IDEMPIERE-724 Zk: Make iDempiere theme more easily customizable. Fixed archive viewer and tree maintenance layout. Fixed load theme preference issue.

This commit is contained in:
Elaine Tan 2013-06-06 18:37:48 +08:00
parent c48da4c201
commit 83e6cc9fa3
5 changed files with 169 additions and 147 deletions

View File

@ -48,6 +48,7 @@ import org.compiere.util.ValueNamePair;
import org.zkoss.image.AImage; import org.zkoss.image.AImage;
import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
@ -222,6 +223,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
btn.setId(btn.getName()); btn.setId(btn.getName());
if (image != null) if (image != null)
{ {
Executions.createComponents(ThemeManager.getPreference(), this, null);
String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size"); String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size");
String suffix = "24.png"; String suffix = "24.png";
if (!Util.isEmpty(size)) if (!Util.isEmpty(size))

View File

@ -37,6 +37,7 @@ import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
@ -384,6 +385,7 @@ public class BreadCrumb extends Div implements EventListener<Event> {
ToolBarButton btn = new ToolBarButton(""); ToolBarButton btn = new ToolBarButton("");
btn.setName(BTNPREFIX+name); btn.setName(BTNPREFIX+name);
btn.setId(name); btn.setId(name);
Executions.createComponents(ThemeManager.getPreference(), this, null);
String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size"); String size = Env.getContext(Env.getCtx(), "#ZK_Toolbar_Button_Size");
String suffix = "24.png"; String suffix = "24.png";
if (!Util.isEmpty(size)) if (!Util.isEmpty(size))

View File

@ -29,10 +29,13 @@ import java.util.logging.Level;
import org.adempiere.util.Callback; import org.adempiere.util.Callback;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Datebox; import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.DatetimeBox; import org.adempiere.webui.component.DatetimeBox;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
@ -61,14 +64,13 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.Util; import org.compiere.util.Util;
import org.zkoss.util.media.AMedia; import org.zkoss.util.media.AMedia;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
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.Cell; import org.zkoss.zul.Cell;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox; import org.zkoss.zul.Hbox;
import org.zkoss.zul.Iframe; import org.zkoss.zul.Iframe;
import org.zkoss.zul.Space;
/** /**
* Archive Viewer * Archive Viewer
@ -131,26 +133,16 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
{ {
log.info(""); log.info("");
form = new CustomForm() { form = new CustomForm();
private static final long serialVersionUID = 7226661630651936293L; try {
dynInit();
jbInit();
}
catch(Exception e)
{
log.log(Level.SEVERE, "init", e);
}
@Override
public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage);
if (newpage != null)
try {
dynInit();
jbInit();
}
catch(Exception e)
{
log.log(Level.SEVERE, "init", e);
}
}
};
m_WindowNo = form.getWindowNo(); m_WindowNo = form.getWindowNo();
} }
@ -237,190 +229,205 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
reportField.setLabel(Msg.translate(Env.getCtx(), "IsReport")); reportField.setLabel(Msg.translate(Env.getCtx(), "IsReport"));
reportField.addEventListener(Events.ON_CHECK, this); reportField.addEventListener(Events.ON_CHECK, this);
Rows rows; if(showQuery)
Row row; {
Div div; Grid gridQuery = GridFactory.newGridLayout();
if(showQuery){
Grid gridQuery = new Grid();
gridQuery.setWidth("500px");
gridQuery.setStyle("margin:0; padding:0;"); gridQuery.setStyle("margin:0; padding:0;");
gridQuery.makeNoStrip(); gridQuery.makeNoStrip();
gridQuery.setOddRowSclass("even"); gridQuery.setOddRowSclass("even");
Columns columns = new Columns();
gridQuery.appendChild(columns);
Column column = new Column();
column.setWidth("35%");
column.setAlign("right");
columns.appendChild(column);
column = new Column();
column.setWidth("40%");
column.setAlign("left");
columns.appendChild(column);
column = new Column();
column.setWidth("25%");
column.setAlign("left");
columns.appendChild(column);
rows = new Rows(); Rows rows = new Rows();
gridQuery.appendChild(rows); gridQuery.appendChild(rows);
row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.setAlign("right"); row.setAlign("right");
row.appendCellChild(reportField, 3); row.appendCellChild(reportField, 2);
row.appendChild(new Space());
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(processLabel);
div.setStyle("text-align: right;"); row.appendChild(processField);
div.appendChild(processLabel); processField.setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(processField, 2);
processField.setWidth("100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(bPartnerLabel);
div.setStyle("text-align: right;"); row.appendChild(bPartnerField.getComponent());
div.appendChild(bPartnerLabel); bPartnerField.getComponent().setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(bPartnerField.getComponent(), 2);
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(tableLabel);
div.setStyle("text-align: right;"); row.appendChild(tableField);
div.appendChild(tableLabel); tableField.setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(tableField, 2);
tableField.setWidth("100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(nameQLabel);
div.setStyle("text-align: right;"); row.appendChild(nameQField);
div.appendChild(nameQLabel); nameQField.setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(nameQField, 2);
nameQField.setWidth("100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(descriptionQLabel);
div.setStyle("text-align: right;"); row.appendChild(descriptionQField);
div.appendChild(descriptionQLabel); descriptionQField.setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(descriptionQField, 2);
descriptionQField.setWidth("100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(helpQLabel);
div.setStyle("text-align: right;"); row.appendChild(helpQField);
div.appendChild(helpQLabel); helpQField.setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(helpQField, 2);
helpQField.setWidth("100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(createdByQLabel);
div.setStyle("text-align: right;"); row.appendChild(createdByQField);
div.appendChild(createdByQLabel); createdByQField.setHflex("1");
row.appendCellChild(div, 1); row.appendChild(new Space());
row.appendCellChild(createdByQField, 2);
createdByQField.setWidth("100%");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(createdQLabel);
div.setStyle("text-align: right;"); Hbox hbox = new Hbox();
div.appendChild(createdQLabel); hbox.appendChild(createdQFrom);
row.appendChild(div); hbox.appendChild(createdQTo);
row.appendChild(createdQFrom); row.appendChild(hbox);
row.appendChild(createdQTo); row.appendChild(new Space());
div = new Div();
div.setStyle("text-align: center;");
div.appendChild(gridQuery);
Tabpanel tabQueryPanel = new Tabpanel(); Tabpanel tabQueryPanel = new Tabpanel();
tabQueryPanel.appendChild(div); tabQueryPanel.appendChild(gridQuery);
Tab tabQuery = new Tab(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ViewerQuery"))); Tab tabQuery = new Tab(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "ViewerQuery")));
tabpanels.appendChild(tabQueryPanel); tabpanels.appendChild(tabQueryPanel);
tabs.appendChild(tabQuery); tabs.appendChild(tabQuery);
} }
Grid gridView = new Grid();
Grid gridView = GridFactory.newGridLayout();
gridView.setStyle("margin:0; padding:0;"); gridView.setStyle("margin:0; padding:0;");
gridView.makeNoStrip(); gridView.makeNoStrip();
gridView.setOddRowSclass("even"); gridView.setOddRowSclass("even");
Columns columns = new Columns();
gridView.appendChild(columns);
Column column = new Column();
column.setHflex("min");
column.setAlign("left");
columns.appendChild(column);
column = new Column();
column.setHflex("1");
column.setAlign("center");
columns.appendChild(column);
column = new Column();
column.setHflex("min");
column.setAlign("right");
columns.appendChild(column);
rows = new Rows(); Rows rows = new Rows();
gridView.appendChild(rows); gridView.appendChild(rows);
row = new Row(); Row row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); row.appendChild(bBack);
div.setStyle("text-align: left;"); row.appendChild(positionInfo);
div.appendChild(bBack); row.appendChild(bNext);
row.appendCellChild(div, 1);
div = new Div();
div.setStyle("text-align: center;");
div.appendChild(positionInfo);
row.appendCellChild(div, 2);
div = new Div();
div.setStyle("text-align: right;");
div.appendChild(bNext);
row.appendCellChild(div, 1);
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(createdByLabel, 4); row.appendCellChild(createdByLabel, 3);
createdByLabel.setWidth("100%"); createdByLabel.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(createdByField, 4); row.appendCellChild(createdByField, 3);
createdByField.setWidth("100%"); createdByField.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); Cell cell = new Cell();
div.setStyle("text-align: right;"); cell.setColspan(3);
div.appendChild(createdField); cell.setRowspan(1);
row.appendCellChild(div, 4); cell.setAlign("right");
cell.appendChild(createdField);
row.appendChild(cell);
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(nameLabel, 4); row.appendCellChild(nameLabel, 3);
nameLabel.setWidth("100%"); nameLabel.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(nameField, 4); row.appendCellChild(nameField, 3);
nameField.setWidth("100%"); nameField.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(descriptionLabel, 4); row.appendCellChild(descriptionLabel, 3);
descriptionLabel.setWidth("100%"); descriptionLabel.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(descriptionField, 4); row.appendCellChild(descriptionField, 3);
descriptionField.setRows(3); descriptionField.setRows(3);
descriptionField.setWidth("100%"); descriptionField.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(helpLabel, 4); row.appendCellChild(helpLabel, 3);
helpLabel.setWidth("100%"); helpLabel.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
row.appendCellChild(helpField, 4); row.appendCellChild(helpField, 3);
helpField.setRows(3); helpField.setRows(3);
helpField.setWidth("100%"); helpField.setHflex("1");
row = new Row(); row = new Row();
rows.appendChild(row); rows.appendChild(row);
div = new Div(); Hbox hbox = new Hbox();
div.setStyle("text-align: right;"); hbox.appendChild(deleteArchive);
div.appendChild(deleteArchive); hbox.appendChild(bRefresh);
div.appendChild(bRefresh); hbox.appendChild(updateArchive);
div.appendChild(updateArchive); cell = new Cell();
row.appendCellChild(div, 4); cell.setColspan(3);
cell.setRowspan(1);
cell.setAlign("right");
cell.appendChild(hbox);
row.appendChild(cell);
createdByField.setReadonly(true); createdByField.setReadonly(true);
createdField.setEnabled(false);
createdField.getDatebox().setReadonly(true); createdField.getDatebox().setReadonly(true);
createdField.getTimebox().setReadonly(true); createdField.getTimebox().setReadonly(true);
@ -430,7 +437,7 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
Hbox boxViewSeparator = new Hbox(); Hbox boxViewSeparator = new Hbox();
boxViewSeparator.setWidth("100%"); boxViewSeparator.setWidth("100%");
boxViewSeparator.setHeight("100%"); boxViewSeparator.setHeight("100%");
Cell cell = new Cell(); cell = new Cell();
cell.setWidth("70%"); cell.setWidth("70%");
cell.appendChild(iframe); cell.appendChild(iframe);
boxViewSeparator.appendChild(cell); boxViewSeparator.appendChild(cell);
@ -508,10 +515,12 @@ public class WArchiveViewer extends Archive implements IFormController, EventLis
// Show // Show
processLabel.setVisible(reports); processLabel.setVisible(reports);
processField.setVisible(reports); processField.setVisible(reports);
processLabel.getParent().setVisible(reports);
// Hide // Hide
bPartnerLabel.setVisible(!reports); bPartnerLabel.setVisible(!reports);
bPartnerField.setVisible(!reports); bPartnerField.setVisible(!reports);
bPartnerLabel.getParent().setVisible(!reports);
} // updateQDisplay } // updateQDisplay
public void cmd_deleteArchive(){ public void cmd_deleteArchive(){

View File

@ -19,7 +19,6 @@ package org.adempiere.webui.apps.form;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.util.Callback; import org.adempiere.util.Callback;
import org.adempiere.webui.apps.BusyDialog;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridFactory; import org.adempiere.webui.component.GridFactory;

View File

@ -44,11 +44,13 @@ import org.zkoss.zk.ui.event.Event;
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.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.East;
import org.zkoss.zul.North;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.DefaultTreeNode; import org.zkoss.zul.DefaultTreeNode;
import org.zkoss.zul.East;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.North;
import org.zkoss.zul.Space; import org.zkoss.zul.Space;
import org.zkoss.zul.Splitter; import org.zkoss.zul.Splitter;
import org.zkoss.zul.Tree; import org.zkoss.zul.Tree;
@ -154,23 +156,31 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController
North north = new North(); North north = new North();
mainLayout.appendChild(north); mainLayout.appendChild(north);
north.appendChild(northPanel); north.appendChild(northPanel);
north.setHeight("28px"); northPanel.setWidth("100%");
// //
northPanel.appendChild (treeLabel); Hbox hbox = new Hbox();
northPanel.appendChild (new Space()); hbox.setStyle("padding: 3px;");
northPanel.appendChild (treeField); hbox.setAlign("center");
northPanel.appendChild (new Space()); hbox.setHflex("1");
northPanel.appendChild (cbAllNodes); northPanel.appendChild(hbox);
northPanel.appendChild (new Space());
northPanel.appendChild (treeInfo); hbox.appendChild (new Space());
northPanel.appendChild (new Space()); hbox.appendChild (treeLabel);
northPanel.appendChild (bAddAll); hbox.appendChild (treeField);
northPanel.appendChild (new Space()); hbox.appendChild (new Space());
northPanel.appendChild (bAdd); hbox.appendChild (cbAllNodes);
northPanel.appendChild (new Space()); hbox.appendChild (new Space());
northPanel.appendChild (bDelete); Cell cell = new Cell();
northPanel.appendChild (new Space()); cell.setColspan(1);
northPanel.appendChild (bDeleteAll); cell.setRowspan(1);
cell.setHflex("1");
cell.appendChild(treeInfo);
hbox.appendChild (cell);
hbox.appendChild (new Space());
hbox.appendChild (bAddAll);
hbox.appendChild (bAdd);
hbox.appendChild (bDelete);
hbox.appendChild (bDeleteAll);
// //
Center center = new Center(); Center center = new Center();
mainLayout.appendChild(center); mainLayout.appendChild(center);