Improve management of the server push update info thread.
Improve dynamic display handling for table editor.
This commit is contained in:
parent
07f062f826
commit
d136ea9057
|
@ -181,6 +181,8 @@ public class AdempiereWebUI extends Window implements EventListener, IWebClient
|
||||||
mSession.logout();
|
mSession.logout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appDesktop.logout();
|
||||||
|
|
||||||
SessionManager.clearSession();
|
SessionManager.clearSession();
|
||||||
super.getChildren().clear();
|
super.getChildren().clear();
|
||||||
Page page = this.getPage();
|
Page page = this.getPage();
|
||||||
|
|
|
@ -63,7 +63,6 @@ import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
import org.compiere.util.WebDoc;
|
import org.compiere.util.WebDoc;
|
||||||
import org.zkoss.lang.Threads;
|
|
||||||
import org.zkoss.util.media.AMedia;
|
import org.zkoss.util.media.AMedia;
|
||||||
import org.zkoss.zhtml.Button;
|
import org.zkoss.zhtml.Button;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
|
@ -114,6 +113,10 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
private MGoal[] m_goals = null;
|
private MGoal[] m_goals = null;
|
||||||
|
|
||||||
private List<MQuery> queryZoom = null;
|
private List<MQuery> queryZoom = null;
|
||||||
|
|
||||||
|
private Thread updateInfoThread;
|
||||||
|
|
||||||
|
private UpdateInfoRunnable updateInfoRunnable;
|
||||||
|
|
||||||
private static final String key = "queryZoom";
|
private static final String key = "queryZoom";
|
||||||
|
|
||||||
|
@ -355,9 +358,10 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
|
|
||||||
updateInfo();
|
updateInfo();
|
||||||
|
|
||||||
Thread infoThread = new Thread(new UpdateInfoRunnable(layout.getDesktop()), "UpdateInfo");
|
updateInfoRunnable = new UpdateInfoRunnable(layout.getDesktop());
|
||||||
infoThread.setDaemon(true);
|
updateInfoThread = new Thread(updateInfoRunnable, "UpdateInfo");
|
||||||
infoThread.start();
|
updateInfoThread.setDaemon(true);
|
||||||
|
updateInfoThread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String goalsDetail(int AD_Table_ID, Panelchildren panel)
|
private String goalsDetail(int AD_Table_ID, Panelchildren panel)
|
||||||
|
@ -474,27 +478,35 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
|
|
||||||
private class UpdateInfoRunnable implements Runnable {
|
private class UpdateInfoRunnable implements Runnable {
|
||||||
private org.zkoss.zk.ui.Desktop desktop;
|
private org.zkoss.zk.ui.Desktop desktop;
|
||||||
|
private boolean stop = false;
|
||||||
UpdateInfoRunnable(org.zkoss.zk.ui.Desktop desktop) {
|
UpdateInfoRunnable(org.zkoss.zk.ui.Desktop desktop) {
|
||||||
this.desktop = desktop;
|
this.desktop = desktop;
|
||||||
}
|
}
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
while(true) {
|
while(!stop) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(60000); // Update every one minutes
|
||||||
|
} catch (InterruptedException e1) {
|
||||||
|
if (stop) break;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// get full control of desktop
|
// get full control of desktop
|
||||||
Executions.activate(desktop);
|
Executions.activate(desktop);
|
||||||
try {
|
try {
|
||||||
updateInfo();
|
updateInfo();
|
||||||
Threads.sleep(5000);// Update each 5 seconds
|
|
||||||
} catch (Error ex) {
|
} catch (Error ex) {
|
||||||
throw ex;
|
logger.log(Level.SEVERE, "UpdateInfo Thread error="+ex.getLocalizedMessage(), ex);
|
||||||
|
break;
|
||||||
} finally {
|
} finally {
|
||||||
// release full control of desktop
|
// release full control of desktop
|
||||||
Executions.deactivate(desktop);
|
Executions.deactivate(desktop);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Throwable e) {
|
||||||
logger.log(Level.WARNING, "Failed to run UpdateInfo", e);
|
logger.log(Level.SEVERE, "UpdateInfo Thread error="+e.getLocalizedMessage(), e);
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -984,4 +996,11 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
||||||
public Component getComponent() {
|
public Component getComponent() {
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void logout() {
|
||||||
|
if (updateInfoThread != null && updateInfoThread.isAlive()) {
|
||||||
|
updateInfoRunnable.stop = true;
|
||||||
|
updateInfoThread.interrupt();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,13 @@ package org.adempiere.webui.component;
|
||||||
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
|
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
|
import org.adempiere.webui.editor.WEditor;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.GridTable;
|
import org.compiere.model.GridTable;
|
||||||
|
@ -298,4 +300,35 @@ public class GridPanel extends Borderlayout implements EventListener
|
||||||
public Listbox getListbox() {
|
public Listbox getListbox() {
|
||||||
return listbox;
|
return listbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dynamicDisplay(int col) {
|
||||||
|
if (!gridTab.isOpen())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Selective
|
||||||
|
if (col > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
boolean noData = gridTab.getRowCount() == 0;
|
||||||
|
List<WEditor> list = renderer.getEditors();
|
||||||
|
for (WEditor comp : list)
|
||||||
|
{
|
||||||
|
GridField mField = comp.getGridField();
|
||||||
|
if (mField != null && mField.getIncluded_Tab_ID() <= 0)
|
||||||
|
{
|
||||||
|
if (noData)
|
||||||
|
{
|
||||||
|
comp.setReadWrite(false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
comp.dynamicDisplay();
|
||||||
|
boolean rw = mField.isEditable(true); // r/w - check Context
|
||||||
|
comp.setReadWrite(rw);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} // all components
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,9 @@ package org.adempiere.webui.component;
|
||||||
|
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
@ -116,6 +118,9 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
|
||||||
if (editor != null) {
|
if (editor != null) {
|
||||||
editor.addValueChangeListener(dataBinder);
|
editor.addValueChangeListener(dataBinder);
|
||||||
cell.appendChild(editor.getComponent());
|
cell.appendChild(editor.getComponent());
|
||||||
|
if (editor.getComponent() instanceof Checkbox) {
|
||||||
|
cell.setStyle("text-align:center");
|
||||||
|
}
|
||||||
gridField.addPropertyChangeListener(editor);
|
gridField.addPropertyChangeListener(editor);
|
||||||
editor.setValue(gridField.getValue());
|
editor.setValue(gridField.getValue());
|
||||||
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
||||||
|
@ -255,4 +260,16 @@ public class GridTabListItemRenderer implements ListitemRenderer, ListitemRender
|
||||||
public boolean isInitialize() {
|
public boolean isInitialize() {
|
||||||
return !editors.isEmpty();
|
return !editors.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return active editor list
|
||||||
|
*/
|
||||||
|
public List<WEditor> getEditors() {
|
||||||
|
List<WEditor> editorList = new ArrayList<WEditor>();
|
||||||
|
if (!editors.isEmpty())
|
||||||
|
editorList.addAll(editors.values());
|
||||||
|
|
||||||
|
return editorList;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WAccountEditor extends WEditor
|
public class WAccountEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
||||||
|
|
||||||
private MAccountLookup m_mAccount;
|
private MAccountLookup m_mAccount;
|
||||||
|
|
||||||
|
@ -173,10 +173,6 @@ public class WAccountEditor extends WEditor
|
||||||
{
|
{
|
||||||
cmd_button();
|
cmd_button();
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getEvents()
|
public String[] getEvents()
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class WAssignmentEditor extends WEditor {
|
||||||
|
|
||||||
private final static CLogger log = CLogger.getCLogger(WAssignmentEditor.class);
|
private final static CLogger log = CLogger.getCLogger(WAssignmentEditor.class);
|
||||||
|
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private boolean m_readWrite;
|
private boolean m_readWrite;
|
||||||
private Object m_value;
|
private Object m_value;
|
||||||
|
@ -153,10 +153,6 @@ public class WAssignmentEditor extends WEditor {
|
||||||
fireValueChange(vce);
|
fireValueChange(vce);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WBinaryEditor extends WEditor
|
public class WBinaryEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(WBinaryEditor.class);
|
private static CLogger log = CLogger.getCLogger(WBinaryEditor.class);
|
||||||
|
@ -127,9 +127,5 @@ public class WBinaryEditor extends WEditor
|
||||||
if (!dialog.isCancel() && dialog.isChange())
|
if (!dialog.isCancel() && dialog.isChange())
|
||||||
m_data = dialog.getData();
|
m_data = dialog.getData();
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WButtonEditor extends WEditor
|
public class WButtonEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
|
@ -274,9 +274,5 @@ public class WButtonEditor extends WEditor
|
||||||
evtListener.actionPerformed(actionEvent);
|
evtListener.actionPerformed(actionEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WDateEditor extends WEditor
|
public class WDateEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -119,10 +119,6 @@ public class WDateEditor extends WEditor
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WDatetimeEditor extends WEditor
|
public class WDatetimeEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -112,10 +112,6 @@ public class WDatetimeEditor extends WEditor
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -35,7 +35,7 @@ import org.zkoss.zul.Fileupload;
|
||||||
*/
|
*/
|
||||||
public class WFilenameEditor extends WEditor
|
public class WFilenameEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
||||||
|
|
||||||
private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class);
|
private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class);
|
||||||
|
|
||||||
|
@ -98,10 +98,6 @@ public class WFilenameEditor extends WEditor
|
||||||
{
|
{
|
||||||
cmd_file();
|
cmd_file();
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -33,7 +33,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WImageEditor extends WEditor
|
public class WImageEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
|
@ -150,9 +150,5 @@ public class WImageEditor extends WEditor
|
||||||
ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), oldValue, newValue);
|
ValueChangeEvent vce = new ValueChangeEvent(this, gridField.getColumnName(), oldValue, newValue);
|
||||||
fireValueChange(vce);
|
fireValueChange(vce);
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
**/
|
**/
|
||||||
public class WLocationEditor extends WEditor implements EventListener, PropertyChangeListener
|
public class WLocationEditor extends WEditor implements EventListener, PropertyChangeListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(WLocationEditor.class);
|
private static CLogger log = CLogger.getCLogger(WLocationEditor.class);
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -163,10 +163,6 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
}
|
}
|
||||||
setValue(ii);
|
setValue(ii);
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
|
|
||||||
public class WLocatorEditor extends WEditor implements EventListener, PropertyChangeListener
|
public class WLocatorEditor extends WEditor implements EventListener, PropertyChangeListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private String m_columnName;
|
private String m_columnName;
|
||||||
private MLocatorLookup m_mLocator;
|
private MLocatorLookup m_mLocator;
|
||||||
|
@ -216,10 +216,6 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
return;
|
return;
|
||||||
setValue (ld.getValue(), true);
|
setValue (ld.getValue(), true);
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WNumberEditor extends WEditor
|
public class WNumberEditor extends WEditor
|
||||||
{
|
{
|
||||||
public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_FOCUS};
|
public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
|
|
||||||
public static final int MAX_DISPLAY_LENGTH = 20;
|
public static final int MAX_DISPLAY_LENGTH = 20;
|
||||||
|
|
||||||
|
@ -112,10 +112,6 @@ public class WNumberEditor extends WEditor
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -38,7 +38,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
||||||
|
|
||||||
private static final CLogger log = CLogger.getCLogger(WPAttributeEditor.class);
|
private static final CLogger log = CLogger.getCLogger(WPAttributeEditor.class);
|
||||||
|
|
||||||
|
@ -130,10 +130,6 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
cmd_dialog();
|
cmd_dialog();
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,7 +56,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WSearchEditor extends WEditor implements ContextMenuListener, ValueChangeListener, IZoomableEditor
|
public class WSearchEditor extends WEditor implements ContextMenuListener, ValueChangeListener, IZoomableEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
|
||||||
private Lookup lookup;
|
private Lookup lookup;
|
||||||
private String m_tableName = null;
|
private String m_tableName = null;
|
||||||
private String m_keyColumnName = null;
|
private String m_keyColumnName = null;
|
||||||
|
@ -223,11 +223,6 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
}
|
}
|
||||||
actionButton("");
|
actionButton("");
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(e.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String EDITOR_EVENT = "EDITOR";
|
private static final String EDITOR_EVENT = "EDITOR";
|
||||||
|
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
|
|
||||||
private String oldText;
|
private String oldText;
|
||||||
|
|
||||||
|
@ -157,10 +157,6 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldText = newText;
|
oldText = newText;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,7 +50,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
public class WTableDirEditor extends WEditor implements ListDataListener,
|
public class WTableDirEditor extends WEditor implements ListDataListener,
|
||||||
ContextMenuListener, IZoomableEditor
|
ContextMenuListener, IZoomableEditor
|
||||||
{
|
{
|
||||||
public final static String[] LISTENER_EVENTS = {Events.ON_SELECT, Events.ON_FOCUS};
|
public final static String[] LISTENER_EVENTS = {Events.ON_SELECT};
|
||||||
|
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
|
@ -266,10 +266,6 @@ ContextMenuListener, IZoomableEditor
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getEvents()
|
public String[] getEvents()
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.zkoss.zul.Timebox;
|
||||||
*/
|
*/
|
||||||
public class WTimeEditor extends WEditor
|
public class WTimeEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -104,10 +104,6 @@ public class WTimeEditor extends WEditor
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -29,7 +29,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
|
|
||||||
public class WUrlEditor extends WEditor
|
public class WUrlEditor extends WEditor
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_FOCUS};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
||||||
|
|
||||||
public WUrlEditor(GridField gridField)
|
public WUrlEditor(GridField gridField)
|
||||||
{
|
{
|
||||||
|
@ -108,10 +108,6 @@ public class WUrlEditor extends WEditor
|
||||||
FDialog.warn(0, this.getComponent(), "URLnotValid", message);
|
FDialog.warn(0, this.getComponent(), "URLnotValid", message);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] getEvents()
|
public String[] getEvents()
|
||||||
|
|
|
@ -37,7 +37,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*/
|
*/
|
||||||
public class WYesNoEditor extends WEditor
|
public class WYesNoEditor extends WEditor
|
||||||
{
|
{
|
||||||
public static final String[] LISTENER_EVENTS = {Events.ON_CHECK, Events.ON_FOCUS};
|
public static final String[] LISTENER_EVENTS = {Events.ON_CHECK};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -69,10 +69,6 @@ public class WYesNoEditor extends WEditor
|
||||||
super.fireValueChange(changeEvent);
|
super.fireValueChange(changeEvent);
|
||||||
oldValue = newValue;
|
oldValue = newValue;
|
||||||
}
|
}
|
||||||
else if (Events.ON_FOCUS.equalsIgnoreCase(event.getName()) && gridField != null)
|
|
||||||
{
|
|
||||||
this.setReadWrite(gridField.isEditable(true));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void propertyChange(PropertyChangeEvent evt)
|
public void propertyChange(PropertyChangeEvent evt)
|
||||||
|
|
|
@ -493,31 +493,7 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
// Selective
|
// Selective
|
||||||
if (col > 0)
|
if (col > 0)
|
||||||
{
|
return;
|
||||||
GridField changedField = gridTab.getField(col);
|
|
||||||
String columnName = changedField.getColumnName();
|
|
||||||
ArrayList<GridField> dependants = gridTab.getDependantFields(columnName);
|
|
||||||
logger.config("(" + gridTab.toString() + ") "
|
|
||||||
+ columnName + " - Dependents=" + dependants.size());
|
|
||||||
if (dependants.size() == 0 && changedField.getCallout().length() > 0)
|
|
||||||
{
|
|
||||||
for (WEditor comp : editors)
|
|
||||||
{
|
|
||||||
if (columnName.equals(comp.getColumnName()))
|
|
||||||
{
|
|
||||||
boolean manMissing = false;
|
|
||||||
boolean noValue = changedField.getValue() == null || changedField.getValue().toString().length() == 0;
|
|
||||||
if (noValue && changedField.isEditable(true) && changedField.isMandatory(true))
|
|
||||||
{
|
|
||||||
manMissing = true;
|
|
||||||
}
|
|
||||||
comp.setBackground(manMissing || changedField.isError());
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean noData = gridTab.getRowCount() == 0;
|
boolean noData = gridTab.getRowCount() == 0;
|
||||||
logger.config(gridTab.toString() + " - Rows=" + gridTab.getRowCount());
|
logger.config(gridTab.toString() + " - Rows=" + gridTab.getRowCount());
|
||||||
|
@ -802,6 +778,7 @@ DataStatusListener, IADTabpanel
|
||||||
|
|
||||||
if (listPanel.isVisible()) {
|
if (listPanel.isVisible()) {
|
||||||
listPanel.updateListIndex();
|
listPanel.updateListIndex();
|
||||||
|
listPanel.dynamicDisplay(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!includedPanel.isEmpty()) {
|
if (!includedPanel.isEmpty()) {
|
||||||
|
|
|
@ -230,6 +230,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
for (int tab = 0; tab < tabSize; tab++)
|
for (int tab = 0; tab < tabSize; tab++)
|
||||||
{
|
{
|
||||||
initTab(query, tab);
|
initTab(query, tab);
|
||||||
|
if (tab == 0 && curTab == null && m_findCancelled)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
|
Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
|
||||||
}
|
}
|
||||||
|
@ -238,7 +240,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
initEmbeddedTab(query, embeddedTabindex);
|
initEmbeddedTab(query, embeddedTabindex);
|
||||||
}
|
}
|
||||||
|
|
||||||
curTab.getTableModel().setChanged(false);
|
if (curTab != null)
|
||||||
|
curTab.getTableModel().setChanged(false);
|
||||||
|
|
||||||
if (embeddedTabindex < 0)
|
if (embeddedTabindex < 0)
|
||||||
{
|
{
|
||||||
curTabIndex = 0;
|
curTabIndex = 0;
|
||||||
|
|
Loading…
Reference in New Issue