IDEMPIERE-6113 : Date Range boxes on Info Window are too small (#2320)
* IDEMPIERE-6113 : Date Range boxes on Info Window are too small * Update InfoWindow.java Update class based on the ideas from Zuhri and Heng Sin * - Fix issue getting the number of columns used on a row * - no need for extra column as the parameter grid has already a size of 95% * - getRowSize must also exclude DateRangeButton on Order Info * - increase size as suggested by Zuhri --------- Co-authored-by: Carlos Ruiz <carg67@gmail.com> Co-authored-by: hengsin <hengsin@gmail.com>
This commit is contained in:
parent
ac5f84f48d
commit
67948cbad2
|
@ -164,7 +164,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
/**
|
||||
* generated serial id
|
||||
*/
|
||||
private static final long serialVersionUID = 4004251745919433247L;
|
||||
private static final long serialVersionUID = 615852605072547785L;
|
||||
|
||||
private static final String ON_QUERY_AFTER_CHANGE = "onQueryAfterChange";
|
||||
|
||||
|
@ -1797,13 +1797,16 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
Columns columns = new Columns();
|
||||
parameterGrid.appendChild(columns);
|
||||
noOfParameterColumn = getNoOfParameterColumns();
|
||||
for(int i = 0; i < noOfParameterColumn; i++)
|
||||
columns.appendChild(new Column());
|
||||
|
||||
Column column = new Column();
|
||||
ZKUpdateUtil.setWidth(column, "100px");
|
||||
column.setAlign("right");
|
||||
columns.appendChild(column);
|
||||
String labelWidth = ( 100 / ( 3 * ( getNoOfParameterColumns() / 2 ) ) ) + "%";
|
||||
String fieldWidth = ( 100 * 2 / ( 3 * ( getNoOfParameterColumns() / 2 ) ) ) + "%";
|
||||
for(int i = 0; i < noOfParameterColumn; i++) {
|
||||
Column column = new Column();
|
||||
if (i%2 == 0)
|
||||
column.setWidth(labelWidth);
|
||||
else
|
||||
column.setWidth(fieldWidth);
|
||||
columns.appendChild(column);
|
||||
}
|
||||
|
||||
if (parameterGrid.getRows() != null)
|
||||
parameterGrid.getRows().detach();
|
||||
|
@ -1844,9 +1847,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
|
||||
if (checkAND == null) {
|
||||
if (parameterGrid.getRows() != null && parameterGrid.getRows().getFirstChild() != null) {
|
||||
Row row = (Row) parameterGrid.getRows().getFirstChild();
|
||||
int col = row.getChildren().size();
|
||||
while (col < 6) {
|
||||
Row row = (Row) parameterGrid.getRows().getLastChild();
|
||||
int col = getRowSize(row);
|
||||
if (col == getNoOfParameterColumns()) {
|
||||
row = new Row();
|
||||
parameterGrid.getRows().appendChild(row);
|
||||
col = 0;
|
||||
}
|
||||
while (col < getNoOfParameterColumns()-1) {
|
||||
row.appendChild(new Space());
|
||||
col++;
|
||||
}
|
||||
|
@ -1896,6 +1904,20 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of children from the row except Menupopup
|
||||
* @param row
|
||||
* @return
|
||||
*/
|
||||
private int getRowSize(Row row) {
|
||||
int cnt = 0;
|
||||
for (Component comp : row.getChildren()) {
|
||||
if (! (comp instanceof Menupopup || comp instanceof DateRangeButton) )
|
||||
cnt++;
|
||||
}
|
||||
return cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* evaluate display logic for input parameters
|
||||
*/
|
||||
|
@ -1950,6 +1972,7 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
editor.dynamicDisplay();
|
||||
editor.addValueChangeListener(this);
|
||||
editor.fillHorizontal();
|
||||
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "100%");
|
||||
if (editor instanceof WTableDirEditor)
|
||||
{
|
||||
((WTableDirEditor) editor).setRetainSelectedValueAfterRefresh(false);
|
||||
|
@ -1960,6 +1983,14 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
editor2.dynamicDisplay();
|
||||
editor2.addValueChangeListener(this);
|
||||
editor2.fillHorizontal();
|
||||
if (DisplayType.isDate(mField.getDisplayType())) {
|
||||
// give space for the Date Range button
|
||||
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "44%");
|
||||
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor2.getComponent(), "44%");
|
||||
} else {
|
||||
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor.getComponent(), "50%");
|
||||
ZKUpdateUtil.setWidth((HtmlBasedComponent) editor2.getComponent(), "50%");
|
||||
}
|
||||
}
|
||||
}
|
||||
Label label = editor.getLabel();
|
||||
|
@ -2034,17 +2065,8 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
else
|
||||
{
|
||||
panel = (Row) parameterGrid.getRows().getLastChild();
|
||||
if (panel.getChildren().size() == getNoOfParameterColumns())
|
||||
if (getRowSize(panel) == getNoOfParameterColumns())
|
||||
{
|
||||
if (parameterGrid.getRows().getChildren().size() == 1)
|
||||
{
|
||||
createAndCheckbox();
|
||||
panel.appendChild(checkAND);
|
||||
}
|
||||
else
|
||||
{
|
||||
panel.appendChild(new Space());
|
||||
}
|
||||
panel = new Row();
|
||||
parameterGrid.getRows().appendChild(panel);
|
||||
}
|
||||
|
@ -2067,21 +2089,18 @@ public class InfoWindow extends InfoPanel implements ValueChangeListener, EventL
|
|||
outerParent.setStyle("display: flex;");
|
||||
outerParent.appendChild(fieldEditor);
|
||||
if(fieldEditor2 != null) {
|
||||
Label dash = new Label("-");
|
||||
dash.setStyle("padding-left:3px;padding-right:3px;display:flex;align-items:center;");
|
||||
outerParent.appendChild(dash);
|
||||
outerParent.setStyle("display: flex; flex-wrap: wrap;");
|
||||
outerParent.appendChild(fieldEditor2);
|
||||
if(editor.getGridField() != null && DisplayType.isDate(editor.getGridField().getDisplayType())) {
|
||||
DateRangeButton drb = (new DateRangeButton(editor, editor2));
|
||||
outerParent.appendChild(drb);
|
||||
drb.setDateButtonVisible(false);
|
||||
}
|
||||
if (fieldEditor instanceof InputElement && fieldEditor2 instanceof InputElement) {
|
||||
((InputElement)fieldEditor).setPlaceholder(Msg.getMsg(Env.getCtx(), "From"));
|
||||
((InputElement)fieldEditor2).setPlaceholder(Msg.getMsg(Env.getCtx(), "To"));
|
||||
} else if (fieldEditor instanceof NumberBox && fieldEditor2 instanceof NumberBox) {
|
||||
((NumberBox)fieldEditor).getDecimalbox().setPlaceholder(Msg.getMsg(Env.getCtx(), "From"));
|
||||
((NumberBox)fieldEditor2).getDecimalbox().setPlaceholder(Msg.getMsg(Env.getCtx(), "To"));
|
||||
}
|
||||
if (fieldEditor instanceof InputElement && fieldEditor2 instanceof InputElement) {
|
||||
((InputElement)fieldEditor).setPlaceholder(Msg.getMsg(Env.getCtx(), "From"));
|
||||
((InputElement)fieldEditor2).setPlaceholder(Msg.getMsg(Env.getCtx(), "To"));
|
||||
} else if (fieldEditor instanceof NumberBox && fieldEditor2 instanceof NumberBox) {
|
||||
((NumberBox)fieldEditor).getDecimalbox().setPlaceholder(Msg.getMsg(Env.getCtx(), "From"));
|
||||
((NumberBox)fieldEditor2).getDecimalbox().setPlaceholder(Msg.getMsg(Env.getCtx(), "To"));
|
||||
}
|
||||
}
|
||||
panel.appendChild(outerParent);
|
||||
|
|
Loading…
Reference in New Issue