IDEMPIERE-1012 Missing fields on detail when open for edition.

This commit is contained in:
Heng Sin Low 2013-06-21 17:25:09 +08:00
parent cee1db4c65
commit ac42659cdf
12 changed files with 174 additions and 58 deletions

View File

@ -16,6 +16,7 @@ import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.compiere.util.Util;
import org.zkoss.zk.au.out.AuOuter; import org.zkoss.zk.au.out.AuOuter;
import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.AbstractComponent; import org.zkoss.zk.ui.AbstractComponent;
@ -206,4 +207,18 @@ public final class LayoutUtils {
} }
return true; return true;
} }
public static void removeSclass(String cls, HtmlBasedComponent target) {
String sclass = target.getSclass();
if (Util.isEmpty(sclass))
return;
sclass = " " + sclass + " ";
cls = " " + cls + " ";
if (sclass.indexOf(cls) >= 0) {
sclass.replace(cls, "");
sclass = sclass.trim();
target.setSclass(sclass);
}
}
} }

View File

@ -19,7 +19,6 @@ import org.adempiere.webui.LayoutUtils;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hlayout;
/** /**
* @author Low Heng Sin * @author Low Heng Sin
@ -33,6 +32,7 @@ public class EditorBox extends Div {
this); this);
protected Textbox txt; protected Textbox txt;
protected Button btn; protected Button btn;
// private Hlayout hlayout;
public EditorBox() { public EditorBox() {
initComponents(); initComponents();
@ -54,20 +54,18 @@ public class EditorBox extends Div {
} }
private void initComponents() { private void initComponents() {
Hlayout hlayout = new Hlayout(); // hlayout = new Hlayout();
this.appendChild(hlayout); // hlayout.setHflex("1");
hlayout.setHflex("1");
txt = new Textbox(); txt = new Textbox();
hlayout.appendChild(txt); appendChild(txt);
txt.setHflex("1");
btn = new Button(); btn = new Button();
btn.setTabindex(-1); btn.setTabindex(-1);
btn.setSclass("editor-button");
btn.setHflex("0"); btn.setHflex("0");
hlayout.appendChild(btn); btn.setSclass("editor-button");
appendChild(btn);
LayoutUtils.addSclass("editor-box", this); LayoutUtils.addSclass("editor-box", this);
setTableEditorMode(false);
} }
/** /**
@ -99,10 +97,11 @@ public class EditorBox extends Div {
btn.setEnabled(enabled); btn.setEnabled(enabled);
btn.setVisible(enabled); btn.setVisible(enabled);
if (enabled) { if (enabled) {
btn.setSclass("editor-button"); if (btn.getParent() != txt.getParent())
btn.setParent(this.getFirstChild()); btn.setParent(txt.getParent());
} else { } else {
btn.detach(); if (btn.getParent() != null)
btn.detach();
} }
} }
@ -145,4 +144,19 @@ public class EditorBox extends Div {
public Button getButton() { public Button getButton() {
return btn; return btn;
} }
public void setTableEditorMode(boolean flag) {
if (flag) {
txt.setHflex("0");
setHflex("0");
LayoutUtils.addSclass("grid-editor-input", txt);
LayoutUtils.addSclass("grid-editor-button", btn);
} else {
txt.setHflex("1");
setHflex("1");
LayoutUtils.removeSclass("grid-editor-input", txt);
LayoutUtils.removeSclass("grid-editor-button", btn);
}
}
} }

View File

@ -31,7 +31,6 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Decimalbox; import org.zkoss.zul.Decimalbox;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Popup; import org.zkoss.zul.Popup;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
@ -61,29 +60,30 @@ public class NumberBox extends Div
private Popup popup; private Popup popup;
public NumberBox(boolean integral)
{
this(integral, false);
}
/** /**
* *
* @param integral * @param integral
*/ */
public NumberBox(boolean integral) public NumberBox(boolean integral, boolean tableEditor)
{ {
super(); super();
this.integral = integral; this.integral = integral;
init(); init(tableEditor);
} }
private void init() private void init(boolean tableEditor)
{ {
Hlayout hlayout = new Hlayout();
hlayout.setHflex("1");
appendChild(hlayout);
decimalBox = new Decimalbox(); decimalBox = new Decimalbox();
if (integral) if (integral)
decimalBox.setScale(0); decimalBox.setScale(0);
decimalBox.setStyle("display: inline-block;text-align:right"); decimalBox.setStyle("display: inline-block;text-align:right");
decimalBox.setHflex("1"); decimalBox.setHflex("1");
hlayout.appendChild(decimalBox); appendChild(decimalBox);
btn = new Button(); btn = new Button();
btn.setImage(ThemeManager.getThemeResource("images/Calculator16.png")); btn.setImage(ThemeManager.getThemeResource("images/Calculator16.png"));
@ -93,14 +93,15 @@ public class NumberBox extends Div
"} catch(error) {}"); "} catch(error) {}");
LayoutUtils.addSclass("editor-button", btn); LayoutUtils.addSclass("editor-button", btn);
hlayout.appendChild(btn); appendChild(btn);
popup = getCalculatorPopup(); popup = getCalculatorPopup();
appendChild(popup); appendChild(popup);
btn.setPopup(popup); btn.setPopup(popup);
btn.setStyle("text-align: center;"); btn.setStyle("text-align: center;");
LayoutUtils.addSclass(".number-box", this); LayoutUtils.addSclass("number-box", this);
LayoutUtils.addSclass("editor-box", this);
} }
/** /**
@ -433,4 +434,19 @@ public class NumberBox extends Div
{ {
return btn; return btn;
} }
public void setTableEditorMode(boolean flag) {
if (flag) {
decimalBox.setHflex("0");
setHflex("0");
LayoutUtils.addSclass("grid-editor-input", decimalBox);
LayoutUtils.addSclass("grid-editor-button", btn);
} else {
decimalBox.setHflex("1");
setHflex("1");
LayoutUtils.removeSclass("grid-editor-input", decimalBox);
LayoutUtils.removeSclass("grid-editor-button", btn);
}
}
} }

View File

@ -243,5 +243,10 @@ public class WAccountEditor extends WEditor implements ContextMenuListener
return value == null; return value == null;
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -214,4 +214,9 @@ public class WAssignmentEditor extends WEditor implements ContextMenuListener {
} }
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -181,4 +181,11 @@ public class WFilenameEditor extends WEditor
{ {
return LISTENER_EVENTS; return LISTENER_EVENTS;
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -231,4 +231,12 @@ public class WLocationEditor extends WEditor implements EventListener<Event>, Pr
ValuePreference.start (getComponent(), this.getGridField(), getValue()); ValuePreference.start (getComponent(), this.getGridField(), getValue());
} }
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -514,4 +514,12 @@ public class WLocatorEditor extends WEditor implements EventListener<Event>, Pro
{ {
return LISTENER_EVENTS; return LISTENER_EVENTS;
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -78,7 +78,7 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
*/ */
public WNumberEditor(boolean tableEditor, GridField gridField) public WNumberEditor(boolean tableEditor, GridField gridField)
{ {
super(new NumberBox(gridField.getDisplayType() == DisplayType.Integer), super(new NumberBox(gridField.getDisplayType() == DisplayType.Integer, tableEditor),
gridField); gridField);
this.displayType = gridField.getDisplayType(); this.displayType = gridField.getDisplayType();
this.tableEditor = tableEditor; this.tableEditor = tableEditor;
@ -246,4 +246,11 @@ public class WNumberEditor extends WEditor implements ContextMenuListener
WFieldRecordInfo.start(gridField); WFieldRecordInfo.start(gridField);
} }
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -317,5 +317,9 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
getComponent().getTextbox().setReadonly(true); getComponent().getTextbox().setReadonly(true);
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
} }

View File

@ -893,6 +893,13 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
} }
@Override
public void setTableEditor(boolean b) {
super.setTableEditor(b);
getComponent().setTableEditorMode(b);
}
/** /**
* @param windowNo * @param windowNo
* @return WSearchEditor * @return WSearchEditor

View File

@ -988,54 +988,74 @@ span.z-tree-tee, span.z-tree-last, span.z-tree-firstspacer {
padding: 0px; padding: 0px;
margin: 0px; margin: 0px;
background-color: transparent; background-color: transparent;
width: 100%;
}
.editor-box table {
border: none;
padding: 0px;
margin: 0px;
width: 100%;
border: none;
}
.editor-box tr {
width: 100%;
border: none;
padding: 0px;
margin: 0px;
white-space:nowrap;
}
.editor-box td {
border: none;
padding: 0px;
margin: 0px;
} }
.editor-box .z-textbox { .editor-box .z-textbox {
display: inline; display: inline-block;
width: 99%; border-right-color: transparent;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
} }
.editor-box .z-textbox:focus {
border: 1px solid #0000ff;
}
.editor-button { .editor-button {
padding: 0px 2px; padding: 0px;
margin: 0px; margin: 0px;
border-radius: 2px; display: inline-block;
background-color: transparent;
background-image: none;
width: 19px;
height: 20px;
border: 1px solid #e6e6e6;
border-top-color: #b2b2b2;
border-left-width: 0px;
border-radius: 0 2px 2px 0;
}
.editor-button :hover {
background-color: #ddd;
} }
.editor-button img { .editor-button img {
vertical-align: middle; vertical-align: top;
text-align: center; text-align: left;
width: 16px; width: 16px;
height: 16px; height: 16px;
padding: 2px 1px;
} }
.editor-button-column {
.editor-box .grid-editor-input.z-textbox {
width: 90%;
}
.grid-editor-button {
}
.grid-editor-button img {
} }
.number-box { .number-box {
display: inline-block; white-space:nowrap; display: inline-block;
white-space:nowrap;
}
.number-box .z-decimalbox {
display: inline-block;
border-right-color: transparent;
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}
.number-box .grid-editor-input.z-decimalbox {
width: 80%;
}
.number-box .z-decimalbox:focus {
border: 1px solid #0000ff;
} }
.datetime-box { .datetime-box {