Use inplace edit mode for grid view.

This commit is contained in:
Heng Sin Low 2012-03-02 15:15:22 +08:00
parent 37b24530e4
commit 6b4c3884ec
2 changed files with 26 additions and 1 deletions

View File

@ -20,10 +20,13 @@ package org.adempiere.webui.editor;
import java.util.List;
import org.adempiere.base.Service;
import org.adempiere.webui.component.EditorBox;
import org.adempiere.webui.component.NumberBox;
import org.adempiere.webui.factory.IEditorFactory;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.util.CLogger;
import org.zkoss.zul.impl.InputElement;
/**
*
@ -60,6 +63,23 @@ public class WebEditorFactory
if (editor != null)
break;
}
if (tableEditor)
{
if (editor.getComponent() instanceof InputElement)
{
((InputElement)editor.getComponent()).setInplace(true);
}
else if (editor.getComponent() instanceof EditorBox)
{
EditorBox box = (EditorBox) editor.getComponent();
box.getTextbox().setInplace(true);
}
else if (editor.getComponent() instanceof NumberBox)
{
NumberBox box = (NumberBox) editor.getComponent();
box.getDecimalbox().setInplace(true);
}
}
return editor;
}
}

View File

@ -78,6 +78,7 @@ import org.zkoss.zul.Separator;
import org.zkoss.zul.DefaultTreeNode;
import org.zkoss.zul.Space;
import org.zkoss.zul.Treeitem;
import org.zkoss.zul.impl.InputElement;
/**
*
@ -471,7 +472,11 @@ DataStatusListener, IADTabpanel, VetoableChangeListener
}
//streach component to fill grid cell
editor.fillHorizontal();
if (editor.getComponent() instanceof InputElement) {
((InputElement)editor.getComponent()).setHflex("1");
} else {
editor.fillHorizontal();
}
//setup editor context menu
WEditorPopupMenu popupMenu = editor.getPopupMenu();