* sync with branches/adempiere341 revision 6526

This commit is contained in:
Heng Sin Low 2008-09-26 08:14:14 +00:00
parent 15e1126852
commit 0256c6f7a9
9 changed files with 53 additions and 16 deletions

View File

@ -69,8 +69,6 @@ public class NumberBox extends Panel
btn = new Button();
btn.setImage("/images/Calculator16.png");
this.setAction("onKeyPress : return calc.validate('" +
decimalBox.getId() + "'," + integral + ", event);");
Popup popup = getCalculatorPopup();
btn.setSclass("editor-button");

View File

@ -141,7 +141,7 @@ public class WDateEditor extends WEditor
@Override
public void setValue(Object value)
{
if (value == null)
if (value == null || value.toString().trim().length() == 0)
{
oldValue = null;
getComponent().setValue(null);
@ -151,10 +151,17 @@ public class WDateEditor extends WEditor
getComponent().setValue((Timestamp)value);
oldValue = (Timestamp)value;
}
else
{
logger.log(Level.SEVERE, "New field value is not of type timestamp");
}
else
{
try
{
getComponent().setText(value.toString());
} catch (Exception e) {}
if (getComponent().getValue() != null)
oldValue = new Timestamp(getComponent().getValue().getTime());
else
oldValue = null;
}
}
@Override

View File

@ -56,7 +56,7 @@ import org.zkoss.zk.ui.event.Events;
*/
public class WSearchEditor extends WEditor implements ContextMenuListener, ValueChangeListener, IZoomableEditor
{
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE, Events.ON_OK};
private Lookup lookup;
private String m_tableName = null;
private String m_keyColumnName = null;
@ -208,12 +208,12 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
public void onEvent(Event e)
{
if ("onChange".equals(e.getName()))
if (Events.ON_CHANGE.equals(e.getName()) || Events.ON_OK.equals(e.getName()))
{
actionText(getComponent().getText());
}
else if ("onClick".equals(e.getName()))
else if (Events.ON_CLICK.equals(e.getName()))
{
actionButton("");
}

View File

@ -130,7 +130,7 @@ public class WStringEditor extends WEditor implements ContextMenuListener
getComponent().setObscureType(obscureType);
popupMenu = new WEditorPopupMenu(false, false, true);
Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.gif");
Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.png");
editor.setAttribute("EVENT", EDITOR_EVENT);
editor.addEventListener(Events.ON_CLICK, popupMenu);
popupMenu.appendChild(editor);

View File

@ -94,6 +94,8 @@ public class WebEditorFactory
else if (displayType == DisplayType.YesNo)
{
editor = new WYesNoEditor(gridField);
if (tableEditor)
((WYesNoEditor)editor).getComponent().setLabel("");
}
/** Text */

View File

@ -49,6 +49,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Vbox;
import org.zkoss.zul.event.ListDataEvent;
/**
* Tab to maintain Order/Sequence
@ -113,10 +114,11 @@ public class ADSortTab extends Panel implements IADTabpanel
int index = Arrays.binarySearch(elements, obj);
if (index < 0)
index = -1 * index - 1;
if (index > elements.length)
if (index >= elements.length)
list.add(obj);
else
list.add(index, obj);
fireEvent(ListDataEvent.INTERVAL_ADDED, index, index);
}
};
SimpleListModel yesModel = new SimpleListModel();
@ -535,11 +537,10 @@ public class ADSortTab extends Panel implements IADTabpanel
if (source == bUp)
{
for (int i = 0; i < length; i++) {
ListItem listItem = (ListItem) selObjects[i];
ListElement selObject = (ListElement)listItem.getValue();
int index = indices[i];
if (index == 0)
break;
ListElement selObject = (ListElement) yesModel.getElementAt(index);
ListElement newObject = (ListElement)yesModel.getElementAt(index - 1);
if (!selObject.isUpdateable() || !newObject.isUpdateable())
break;
@ -553,10 +554,10 @@ public class ADSortTab extends Panel implements IADTabpanel
else if (source == bDown)
{
for (int i = length - 1; i >= 0; i--) {
ListElement selObject = (ListElement)selObjects[i];
int index = indices[i];
if (index >= yesModel.getSize() - 1)
break;
ListElement selObject = (ListElement) yesModel.getElementAt(index);
ListElement newObject = (ListElement)yesModel.getElementAt(index + 1);
if (!selObject.isUpdateable() || !newObject.isUpdateable())
break;

View File

@ -253,6 +253,8 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
confirmPanel.setStyle("border-top: 2px groove #444; padding-top: 4px");
this.setSizable(true);
this.addEventListener(Events.ON_OK, this);
} // init
protected ConfirmPanel confirmPanel;
/** Master (owning) Window */
@ -850,6 +852,11 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
contentPanel.setSelectedIndex(0);
}
}
else if (Events.ON_OK.equals(event.getName()))
{
executeQuery();
renderItems();
}
}
} // onEvent

View File

@ -154,6 +154,8 @@ public class WindowContainer extends AbstractUIPart implements EventListener
Tabpanel panel = (Tabpanel) tabbox.getSelectedPanel();
if (panel.getFirstChild() instanceof Borderlayout) {
LayoutUtils.sendDeferLayoutEvent((Borderlayout) panel.getChildren().get(0), 50);
} else if (panel.getFirstChild() != null){
panel.getFirstChild().invalidate();
}
}

View File

@ -70,10 +70,13 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.ext.AfterCompose;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
@ -86,7 +89,7 @@ import org.zkoss.zul.Vbox;
* @author Sendy Yagambrum
* @date June 27, 2007
*/
public class FindWindow extends Window implements EventListener,ValueChangeListener
public class FindWindow extends Window implements EventListener,ValueChangeListener, AfterCompose
{
private static final long serialVersionUID = 1L;
/** Main Window for the Lookup Panel */
@ -735,6 +738,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
else if (event.getTarget() instanceof Label)
{
Label label = (Label)event.getTarget();
String value = label.getValue();
ListCell listcell = (ListCell)label.getParent();
ListItem row = (ListItem)listcell.getParent();
advancedPanel.setSelectedItem(row);
@ -743,11 +747,13 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
{
Component component = getEditorCompQueryFrom(row);
addRowEditor(component, listcell);
m_editor.setValue(value);
}
else if (listcell.getId().equals("cellQueryTo"+row.getId()))
{
Component component = getEditorCompQueryTo(row);
addRowEditor(component,listcell);
m_editor.setValue(value);
}
}
}
@ -1694,5 +1700,19 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
}
}
/**
* @see AfterCompose#afterCompose()
*/
public void afterCompose() {
if (hasDocNo)
Clients.response(new AuFocus(fieldDocumentNo));
else if (hasValue)
Clients.response(new AuFocus(fieldValue));
else if (hasName)
Clients.response(new AuFocus(fieldName));
else if (m_sEditors.size() > 0 && m_sEditors.get(0) != null)
Clients.response(new AuFocus(m_sEditors.get(0).getComponent()));
}
} // FindPanel