* remove system.err.println and system.out.println
This commit is contained in:
Heng Sin Low 2009-05-21 10:16:30 +00:00
parent 94686ee053
commit ca5fda5868
17 changed files with 299 additions and 258 deletions

View File

@ -200,7 +200,6 @@ public class WZoomAcross implements EventListener
if (count <= 0) if (count <= 0)
return false; return false;
// //
System.err.println("AD_Window_ID=" + AD_Window_ID + " targetTable=" + targetTableName + " Name="+Name + " Count=" + count);
KeyNamePair pp = new KeyNamePair (AD_Window_ID, Name + " (#"+count+")"); KeyNamePair pp = new KeyNamePair (AD_Window_ID, Name + " (#"+count+")");
m_list.add(pp); m_list.add(pp);
Menuitem menuItem = new Menuitem(pp.toString()); Menuitem menuItem = new Menuitem(pp.toString());

View File

@ -421,11 +421,12 @@ public final class AEnv
log.config(sqlRolePermission); log.config(sqlRolePermission);
PreparedStatement prolestmt = null; PreparedStatement prolestmt = null;
ResultSet rs = null;
try try
{ {
prolestmt = DB.prepareStatement (sqlRolePermission, null); prolestmt = DB.prepareStatement (sqlRolePermission, null);
ResultSet rs = prolestmt.executeQuery (); rs = prolestmt.executeQuery ();
rs.next(); rs.next();
@ -437,28 +438,14 @@ public final class AEnv
{ {
return false; return false;
} }
rs.close ();
prolestmt.close ();
prolestmt = null;
}
catch (Exception e)
{
System.out.println(e);
log.log(Level.SEVERE, "(1)", e);
}
try
{
if (prolestmt != null)
{
prolestmt.close ();
}
prolestmt = null;
} }
catch (Exception e) catch (Exception e)
{ {
prolestmt = null; log.log(Level.SEVERE, "(1)", e);
}
finally
{
DB.close(rs, prolestmt);
} }
return result; return result;

View File

@ -54,7 +54,7 @@ public class GridPanel extends Borderlayout implements EventListener
/** /**
* *
*/ */
private static final long serialVersionUID = 6786512082202412891L; private static final long serialVersionUID = -8735897196875342427L;
private static final int MIN_COLUMN_WIDTH = 100; private static final int MIN_COLUMN_WIDTH = 100;
@ -551,11 +551,13 @@ public class GridPanel extends Borderlayout implements EventListener
/** /**
* Handle enter key event * Handle enter key event
*/ */
public void onEnterKey() { public boolean onEnterKey() {
if (!modeless && renderer != null && !renderer.isEditing()) { if (!modeless && renderer != null && !renderer.isEditing()) {
renderer.editCurrentRow(); renderer.editCurrentRow();
renderer.setFocusToEditor(); renderer.setFocusToEditor();
return true;
} }
return false;
} }
public void setFocusToField(String columnName) { public void setFocusToField(String columnName) {

View File

@ -116,7 +116,12 @@ public class WDateEditor extends WEditor
{ {
newValue = new Timestamp(date.getTime()); newValue = new Timestamp(date.getTime());
} }
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent); super.fireValueChange(changeEvent);
oldValue = newValue; oldValue = newValue;

View File

@ -108,7 +108,12 @@ public class WDatetimeEditor extends WEditor
{ {
newValue = new Timestamp(date.getTime()); newValue = new Timestamp(date.getTime());
} }
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent); super.fireValueChange(changeEvent);
oldValue = newValue; oldValue = newValue;

View File

@ -41,6 +41,8 @@ public class WFilenameEditor extends WEditor
private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class); private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class);
private String oldValue;
public WFilenameEditor(GridField gridField) public WFilenameEditor(GridField gridField)
{ {
super(new FilenameBox(), gridField); super(new FilenameBox(), gridField);
@ -59,11 +61,13 @@ public class WFilenameEditor extends WEditor
{ {
if (value == null) if (value == null)
{ {
oldValue = null;
getComponent().setText(""); getComponent().setText("");
} }
else else
{ {
getComponent().setText(String.valueOf(value)); oldValue = String.valueOf(value);
getComponent().setText(oldValue);
} }
} }
@ -93,7 +97,14 @@ public class WFilenameEditor extends WEditor
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()))
{ {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), getComponent().getText(), getComponent().getText()); String newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
fireValueChange(changeEvent); fireValueChange(changeEvent);
} }
else if (Events.ON_CLICK.equals(event.getName())) else if (Events.ON_CLICK.equals(event.getName()))

View File

@ -42,7 +42,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_BLUR}; 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;
@ -118,8 +118,7 @@ public class WNumberEditor extends WEditor
*/ */
public void onEvent(Event event) public void onEvent(Event event)
{ {
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()) if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()))
|| Events.ON_BLUR.equalsIgnoreCase(event.getName()))
{ {
BigDecimal newValue = getComponent().getValue(); BigDecimal newValue = getComponent().getValue();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) { if (oldValue != null && newValue != null && oldValue.equals(newValue)) {

View File

@ -123,7 +123,21 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()))
{ {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), getComponent().getText(), getComponent().getText()); String newText = getComponent().getText();
String oldText = null;
if (m_value != null)
{
oldText = m_mPAttribute.getDisplay(m_value);
}
if (oldText != null && newText != null && oldText.equals(newText))
{
return;
}
if (oldText == null && newText == null)
{
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldText, newText);
fireValueChange(changeEvent); fireValueChange(changeEvent);
} }
else if (Events.ON_CLICK.equals(event.getName())) else if (Events.ON_CLICK.equals(event.getName()))

View File

@ -49,7 +49,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE}; private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
private String oldText; private String oldValue;
private WEditorPopupMenu popupMenu; private WEditorPopupMenu popupMenu;
@ -167,10 +167,16 @@ public class WStringEditor extends WEditor implements ContextMenuListener
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()))
{ {
String newText = getComponent().getValue(); String newValue = getComponent().getValue();
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldText, newText); if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent); super.fireValueChange(changeEvent);
oldText = newText; oldValue = newValue;
} }
} }
@ -197,7 +203,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
{ {
getComponent().setValue(""); getComponent().setValue("");
} }
oldText = getComponent().getValue(); oldValue = getComponent().getValue();
} }
protected void setTypePassword(boolean password) protected void setTypePassword(boolean password)
@ -240,9 +246,9 @@ public class WStringEditor extends WEditor implements ContextMenuListener
if (!dialog.isCancelled()) { if (!dialog.isCancelled()) {
getComponent().setText(dialog.getText()); getComponent().setText(dialog.getText());
String newText = getComponent().getValue(); String newText = getComponent().getValue();
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldText, newText); ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newText);
super.fireValueChange(changeEvent); super.fireValueChange(changeEvent);
oldText = newText; oldValue = newText;
} }
} }
} }

View File

@ -100,6 +100,12 @@ public class WTimeEditor extends WEditor
newValue = new Timestamp(date.getTime()); newValue = new Timestamp(date.getTime());
} }
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue); ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
super.fireValueChange(changeEvent); super.fireValueChange(changeEvent);
oldValue = newValue; oldValue = newValue;

View File

@ -28,6 +28,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}; private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
private String oldValue;
public WUrlEditor(GridField gridField) public WUrlEditor(GridField gridField)
{ {
@ -41,11 +42,13 @@ public class WUrlEditor extends WEditor
{ {
if (value == null) if (value == null)
{ {
oldValue = null;
getComponent().setText(""); getComponent().setText("");
} }
else else
{ {
getComponent().setText(String.valueOf(value)); oldValue = String.valueOf(value);
getComponent().setText(oldValue);
} }
} }
@ -83,8 +86,16 @@ public class WUrlEditor extends WEditor
{ {
if (Events.ON_CHANGE.equals(event.getName())) if (Events.ON_CHANGE.equals(event.getName()))
{ {
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), getComponent().getText(), getComponent().getText()); String newValue = getComponent().getText();
if (oldValue != null && newValue != null && oldValue.equals(newValue)) {
return;
}
if (oldValue == null && newValue == null) {
return;
}
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldValue, newValue);
fireValueChange(changeEvent); fireValueChange(changeEvent);
oldValue = newValue;
} }
else if (Events.ON_CLICK.equals(event.getName())) else if (Events.ON_CLICK.equals(event.getName()))
{ {

View File

@ -65,10 +65,8 @@ import org.zkoss.zul.event.ListDataEvent;
*/ */
public class ADSortTab extends Panel implements IADTabpanel public class ADSortTab extends Panel implements IADTabpanel
{ {
/**
* private static final long serialVersionUID = 4289328613547509587L;
*/
private static final long serialVersionUID = -3533927024365752586L;
private int m_AD_ColumnSortOrder_ID; private int m_AD_ColumnSortOrder_ID;
/** /**
@ -879,7 +877,8 @@ public class ADSortTab extends Panel implements IADTabpanel
public void afterSave(boolean onSaveEvent) { public void afterSave(boolean onSaveEvent) {
} }
public void onEnterKey() { public boolean onEnterKey() {
return false;
} }
} //ADSortTab } //ADSortTab

View File

@ -94,10 +94,8 @@ import org.zkoss.zul.Treeitem;
public class ADTabpanel extends Div implements Evaluatee, EventListener, public class ADTabpanel extends Div implements Evaluatee, EventListener,
DataStatusListener, IADTabpanel, VetoableChangeListener DataStatusListener, IADTabpanel, VetoableChangeListener
{ {
/**
* private static final long serialVersionUID = 6811039639239312863L;
*/
private static final long serialVersionUID = 7422816988041118839L;
private static final CLogger logger; private static final CLogger logger;
@ -1084,10 +1082,11 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
/** /**
* @see IADTabpanel#onEnterKey() * @see IADTabpanel#onEnterKey()
*/ */
public void onEnterKey() { public boolean onEnterKey() {
if (listPanel.isVisible()) { if (listPanel.isVisible()) {
listPanel.onEnterKey(); return listPanel.onEnterKey();
} }
return false;
} }
/** /**
@ -1111,7 +1110,6 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
if (!FDialog.ask(getWindowNo(), this, "SaveChanges?", gridTab.getCommitWarning())) if (!FDialog.ask(getWindowNo(), this, "SaveChanges?", gridTab.getCommitWarning()))
{ {
m_vetoActive = true; m_vetoActive = true;
System.out.println("throw PropertyVetoException ");
throw new PropertyVetoException ("UserDeniedSave", e); throw new PropertyVetoException ("UserDeniedSave", e);
} }
} }

View File

@ -179,6 +179,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter"); keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter");
keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar); keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar);
keyListener.addEventListener(Events.ON_CTRL_KEY, this); keyListener.addEventListener(Events.ON_CTRL_KEY, this);
keyListener.setAutoBlur(false);
} }
return layout; return layout;
@ -218,10 +219,12 @@ public class ADWindowPanel extends AbstractADWindowPanel
KeyEvent keyEvent = (KeyEvent) event; KeyEvent keyEvent = (KeyEvent) event;
//enter == 13 //enter == 13
if (keyEvent.getKeyCode() == 13 && this.getComponent().getParent().isVisible()) { if (keyEvent.getKeyCode() == 13 && this.getComponent().getParent().isVisible()) {
keyEvent.stopPropagation();
IADTabpanel panel = adTab.getSelectedTabpanel(); IADTabpanel panel = adTab.getSelectedTabpanel();
if (panel != null) if (panel != null) {
panel.onEnterKey(); if (panel.onEnterKey()) {
keyEvent.stopPropagation();
}
}
} }
} else { } else {
super.onEvent(event); super.onEvent(event);

View File

@ -41,9 +41,9 @@ import org.zkoss.zul.Vbox;
public class HeaderPanel extends Panel implements EventListener public class HeaderPanel extends Panel implements EventListener
{ {
private static final long serialVersionUID = -4293371180738797244L; private static final long serialVersionUID = -2351317624519209484L;
private Image image = new Image(); private Image image = new Image();
public HeaderPanel() public HeaderPanel()
{ {
@ -93,7 +93,6 @@ public class HeaderPanel extends Panel implements EventListener
} }
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
System.out.println(event.getTarget());
if (Events.ON_CLICK.equals(event.getName())) { if (Events.ON_CLICK.equals(event.getName())) {
if(event.getTarget() == image) if(event.getTarget() == image)
{ {

View File

@ -98,6 +98,7 @@ public interface IADTabpanel extends Component, Evaluatee {
/** /**
* Enter key event * Enter key event
* @return true if the event is process
*/ */
public void onEnterKey(); public boolean onEnterKey();
} }

View File

@ -74,9 +74,7 @@ import org.zkoss.zul.Vbox;
public final class WAccountDialog extends Window public final class WAccountDialog extends Window
implements EventListener, DataStatusListener, ValueChangeListener implements EventListener, DataStatusListener, ValueChangeListener
{ {
/**
*
*/
private static final long serialVersionUID = 7999516267209766287L; private static final long serialVersionUID = 7999516267209766287L;
/** /**
@ -635,8 +633,6 @@ public final class WAccountDialog extends Window
String info = (String)m_mTab.getValue("Description"); String info = (String)m_mTab.getValue("Description");
if (Executions.getCurrent() != null) if (Executions.getCurrent() != null)
f_Description.setValue (info); f_Description.setValue (info);
else
System.err.println(info);
} // statusChanged } // statusChanged