* 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)
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+")");
m_list.add(pp);
Menuitem menuItem = new Menuitem(pp.toString());

View File

@ -421,11 +421,12 @@ public final class AEnv
log.config(sqlRolePermission);
PreparedStatement prolestmt = null;
ResultSet rs = null;
try
{
prolestmt = DB.prepareStatement (sqlRolePermission, null);
ResultSet rs = prolestmt.executeQuery ();
rs = prolestmt.executeQuery ();
rs.next();
@ -437,28 +438,14 @@ public final class AEnv
{
return false;
}
rs.close ();
prolestmt.close ();
prolestmt = null;
}
catch (Exception e)
{
System.out.println(e);
log.log(Level.SEVERE, "(1)", e);
}
try
finally
{
if (prolestmt != null)
{
prolestmt.close ();
}
prolestmt = null;
}
catch (Exception e)
{
prolestmt = null;
DB.close(rs, prolestmt);
}
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;
@ -551,11 +551,13 @@ public class GridPanel extends Borderlayout implements EventListener
/**
* Handle enter key event
*/
public void onEnterKey() {
public boolean onEnterKey() {
if (!modeless && renderer != null && !renderer.isEditing()) {
renderer.editCurrentRow();
renderer.setFocusToEditor();
return true;
}
return false;
}
public void setFocusToField(String columnName) {

View File

@ -116,7 +116,12 @@ public class WDateEditor extends WEditor
{
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);
super.fireValueChange(changeEvent);
oldValue = newValue;

View File

@ -108,7 +108,12 @@ public class WDatetimeEditor extends WEditor
{
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);
super.fireValueChange(changeEvent);
oldValue = newValue;

View File

@ -41,6 +41,8 @@ public class WFilenameEditor extends WEditor
private static final CLogger log = CLogger.getCLogger(WFilenameEditor.class);
private String oldValue;
public WFilenameEditor(GridField gridField)
{
super(new FilenameBox(), gridField);
@ -59,11 +61,13 @@ public class WFilenameEditor extends WEditor
{
if (value == null)
{
oldValue = null;
getComponent().setText("");
}
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()))
{
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);
}
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 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;
@ -118,8 +118,7 @@ public class WNumberEditor extends WEditor
*/
public void onEvent(Event event)
{
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName())
|| Events.ON_BLUR.equalsIgnoreCase(event.getName()))
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()))
{
BigDecimal newValue = getComponent().getValue();
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()))
{
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);
}
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 String oldText;
private String oldValue;
private WEditorPopupMenu popupMenu;
@ -167,10 +167,16 @@ public class WStringEditor extends WEditor implements ContextMenuListener
{
if (Events.ON_CHANGE.equals(event.getName()))
{
String newText = getComponent().getValue();
ValueChangeEvent changeEvent = new ValueChangeEvent(this, this.getColumnName(), oldText, newText);
String newValue = getComponent().getValue();
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);
oldText = newText;
oldValue = newValue;
}
}
@ -197,7 +203,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
{
getComponent().setValue("");
}
oldText = getComponent().getValue();
oldValue = getComponent().getValue();
}
protected void setTypePassword(boolean password)
@ -240,9 +246,9 @@ public class WStringEditor extends WEditor implements ContextMenuListener
if (!dialog.isCancelled()) {
getComponent().setText(dialog.getText());
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);
oldText = newText;
oldValue = newText;
}
}
}

View File

@ -100,6 +100,12 @@ public class WTimeEditor extends WEditor
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);
super.fireValueChange(changeEvent);
oldValue = newValue;

View File

@ -28,6 +28,7 @@ import org.zkoss.zk.ui.event.Events;
public class WUrlEditor extends WEditor
{
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
private String oldValue;
public WUrlEditor(GridField gridField)
{
@ -41,11 +42,13 @@ public class WUrlEditor extends WEditor
{
if (value == null)
{
oldValue = null;
getComponent().setText("");
}
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()))
{
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);
oldValue = newValue;
}
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
{
/**
*
*/
private static final long serialVersionUID = -3533927024365752586L;
private static final long serialVersionUID = 4289328613547509587L;
private int m_AD_ColumnSortOrder_ID;
/**
@ -879,7 +877,8 @@ public class ADSortTab extends Panel implements IADTabpanel
public void afterSave(boolean onSaveEvent) {
}
public void onEnterKey() {
public boolean onEnterKey() {
return false;
}
} //ADSortTab

View File

@ -94,10 +94,8 @@ import org.zkoss.zul.Treeitem;
public class ADTabpanel extends Div implements Evaluatee, EventListener,
DataStatusListener, IADTabpanel, VetoableChangeListener
{
/**
*
*/
private static final long serialVersionUID = 7422816988041118839L;
private static final long serialVersionUID = 6811039639239312863L;
private static final CLogger logger;
@ -1084,10 +1082,11 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
/**
* @see IADTabpanel#onEnterKey()
*/
public void onEnterKey() {
public boolean onEnterKey() {
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()))
{
m_vetoActive = true;
System.out.println("throw PropertyVetoException ");
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.addEventListener(Events.ON_CTRL_KEY, toolbar);
keyListener.addEventListener(Events.ON_CTRL_KEY, this);
keyListener.setAutoBlur(false);
}
return layout;
@ -218,10 +219,12 @@ public class ADWindowPanel extends AbstractADWindowPanel
KeyEvent keyEvent = (KeyEvent) event;
//enter == 13
if (keyEvent.getKeyCode() == 13 && this.getComponent().getParent().isVisible()) {
keyEvent.stopPropagation();
IADTabpanel panel = adTab.getSelectedTabpanel();
if (panel != null)
panel.onEnterKey();
if (panel != null) {
if (panel.onEnterKey()) {
keyEvent.stopPropagation();
}
}
}
} else {
super.onEvent(event);

View File

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

View File

@ -98,6 +98,7 @@ public interface IADTabpanel extends Component, Evaluatee {
/**
* 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
implements EventListener, DataStatusListener, ValueChangeListener
{
/**
*
*/
private static final long serialVersionUID = 7999516267209766287L;
/**
@ -635,8 +633,6 @@ public final class WAccountDialog extends Window
String info = (String)m_mTab.getValue("Description");
if (Executions.getCurrent() != null)
f_Description.setValue (info);
else
System.err.println(info);
} // statusChanged