use of org.adempiere.webui.component.Column in project adempiere by adempiere.
the class ADTabPanel method createUI.
/**
* Create UI components if not already created
*/
public void createUI() {
if (uiCreated)
return;
uiCreated = true;
//setup columns
Columns columns = new Columns();
grid.appendChild(columns);
Column col = new Column();
col.setWidth("14%");
columns.appendChild(col);
col = new Column();
col.setWidth("35%");
columns.appendChild(col);
col = new Column();
col.setWidth("14%");
columns.appendChild(col);
col = new Column();
col.setWidth("35%");
columns.appendChild(col);
col = new Column();
col.setWidth("2%");
columns.appendChild(col);
Rows rows = grid.newRows();
GridField[] fields = gridTab.getFields();
org.zkoss.zul.Row row = new Row();
rows.appendChild(row);
String currentFieldGroup = null;
for (int i = 0; i < fields.length; i++) {
GridField field = fields[i];
if (field.isDisplayed()) {
//included tab
if (field.getIncluded_Tab_ID() > 0) {
if (row.getChildren().size() == 2) {
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
} else if (row.getChildren().size() > 0) {
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
}
//end current field group
if (currentGroup != null) {
row = new Groupfoot();
rows.appendChild(row);
currentGroup = null;
currentFieldGroup = null;
}
row = new Row();
row.setSpans("5");
row.appendChild(new Separator());
rows.appendChild(row);
row = new Group();
row.setSpans("2,3");
rows.appendChild(row);
includedTab.put(field.getIncluded_Tab_ID(), (Group) row);
org.zkoss.zul.Div div = new Div();
div.setWidth("100%");
row = new org.adempiere.webui.component.Row();
row.setSpans("5");
row.appendChild(div);
rows.appendChild(row);
horizontalIncludedTab.put(field.getIncluded_Tab_ID(), div);
row = new Groupfoot();
rows.appendChild(row);
includedTabFooter.put(field.getIncluded_Tab_ID(), (Groupfoot) row);
for (EmbeddedPanel ep : includedPanel) {
if (ep.adTabId == field.getIncluded_Tab_ID()) {
ep.group = includedTab.get(ep.adTabId);
createEmbeddedPanelUI(ep);
((ADTabPanel) ep.tabPanel).autoResize();
break;
}
}
//Horizontal
for (HorizontalEmbeddedPanel ep : horizontalIncludedPanel) {
if (ep.adTabId == field.getIncluded_Tab_ID()) {
ep.divComponent = horizontalIncludedTab.get(ep.adTabId);
createHorizontalEmbeddedPanelUI(ep);
((ADTabPanel) ep.tabPanel).autoResize();
break;
}
}
row = new Row();
continue;
}
//normal field
String fieldGroup = field.getFieldGroup();
if (fieldGroup != null && fieldGroup.trim().length() > 0) {
if (!fieldGroup.equals(currentFieldGroup)) {
currentFieldGroup = fieldGroup;
if (row.getChildren().size() == 2) {
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
} else if (row.getChildren().size() > 0) {
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
List<org.zkoss.zul.Row> headerRows = new ArrayList<org.zkoss.zul.Row>();
fieldGroupHeaders.put(fieldGroup, headerRows);
row.setSpans("5");
row.appendChild(new Separator());
rows.appendChild(row);
headerRows.add(row);
rowList = new ArrayList<org.zkoss.zul.Row>();
fieldGroupContents.put(fieldGroup, rowList);
if (X_AD_FieldGroup.FIELDGROUPTYPE_Label.equals(field.getFieldGroupType())) {
row = new Row();
row.setSpans("4");
Label groupLabel = new Label(fieldGroup);
row.appendChild(groupLabel);
row.appendChild(createSpacer());
rows.appendChild(row);
headerRows.add(row);
row = new Row();
row.setSpans("4");
Separator separator = new Separator();
separator.setBar(true);
row.appendChild(separator);
row.appendChild(createSpacer());
rows.appendChild(row);
headerRows.add(row);
} else {
row = new Group(fieldGroup);
if (X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(field.getFieldGroupType()) || field.getIsCollapsedByDefault()) {
((Group) row).setOpen(false);
}
currentGroup = (Group) row;
rows.appendChild(row);
headerRows.add(row);
}
row = new Row();
}
}
if (!field.isSameLine() || field.isLongField()) {
//next line
if (row.getChildren().size() > 0) {
if (row.getChildren().size() == 2) {
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
}
{
row.appendChild(createSpacer());
}
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
} else if (row.getChildren().size() == 4) {
//next line if reach max column ( 4 )
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
WEditor editor = WebEditorFactory.getEditor(gridTab, field, false);
if (// Not heading
editor != null) {
editor.setGridTab(this.getGridTab());
editor.setADTabPanel(this);
field.addPropertyChangeListener(editor);
editors.add(editor);
editorIds.add(editor.getComponent().getUuid());
if (field.isFieldOnly()) {
row.appendChild(createSpacer());
} else {
Div div = new Div();
div.setSclass("field-label");
// Ajust align
div.setAlign("right");
Label label = editor.getLabel();
div.appendChild(label);
if (label.getDecorator() != null)
div.appendChild(label.getDecorator());
row.appendChild(div);
}
row.appendChild(editor.getComponent());
if (field.isLongField()) {
row.setSpans("1,3,1");
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
if (editor instanceof WButtonEditor) {
if (windowPanel != null)
((WButtonEditor) editor).addActionListener(windowPanel);
} else {
editor.addValueChangeListener(dataBinder);
}
//streach component to fill grid cell
editor.fillHorizontal();
//setup editor context menu
WEditorPopupMenu popupMenu = editor.getPopupMenu();
if (popupMenu != null) {
popupMenu.addMenuListener((ContextMenuListener) editor);
this.appendChild(popupMenu);
if (!field.isFieldOnly()) {
Label label = editor.getLabel();
if (popupMenu.isZoomEnabled() && editor instanceof IZoomableEditor) {
label.setStyle("cursor: pointer; text-decoration: underline;");
label.addEventListener(Events.ON_CLICK, new ZoomListener((IZoomableEditor) editor));
}
label.setContext(popupMenu.getId());
}
}
} else if (field.isHeading()) {
//display just a label if we are "heading only"
Label label = new Label(field.getHeader());
Div div = new Div();
div.setAlign("center");
row.appendChild(createSpacer());
div.appendChild(label);
row.appendChild(div);
}
}
}
//last row
if (row.getChildren().size() > 0) {
if (row.getChildren().size() == 2) {
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
}
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
}
//create tree
if (gridTab.isTreeTab() && treePanel != null) {
int AD_Tree_ID = MTree.getDefaultAD_Tree_ID(Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
treePanel.initTree(AD_Tree_ID, windowNo);
}
if (!gridTab.isSingleRow() && !isGridView())
switchRowPresentation();
}
use of org.adempiere.webui.component.Column in project adempiere by adempiere.
the class WBrowserSearch method initComponents.
/**
* Initialize components
*/
@Override
public void initComponents() {
if (mainPanel != null)
return;
//
m_separators = new ArrayList<Label>();
rows = new Rows();
//
mainPanel = new Panel();
centerPanel = GridFactory.newGridLayout();
//setup columns
Columns columns = new Columns();
centerPanel.appendChild(columns);
int colN = getColumns() * 2;
if (colN != 0) {
int percent = 100 / colN;
for (int i = 0; i < colN; i++) {
Column col = new Column();
col.setWidth((i == 0 ? ((int) percent / 2) : percent) + "%");
columns.appendChild(col);
}
}
// Add Rows
centerPanel.appendChild(rows);
mainPanel.appendChild(centerPanel);
mainPanel.setStyle("overflow-y:auto");
}
use of org.adempiere.webui.component.Column in project adempiere by adempiere.
the class InfoPanel method init.
protected void init() {
ThemeUtils.addSclass("ad-infopanel", this);
if (isModal()) {
setAttribute(Window.MODE_KEY, Window.MODE_MODAL);
setBorder("normal");
setClosable(true);
setWidth(p_width + "px");
setHeight(p_height + "px");
setContentStyle("overflow: auto");
setSizable(true);
setMaximizable(true);
ThemeUtils.addSclass("ad-infopanel-modal", this);
} else {
setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
// setBorder("none");
// setWidth("100%");
// setHeight("100%");
// setStyle("position: absolute");
ThemeUtils.addSclass("ad-infopanel-embedded", this);
}
// Elaine 2008/12/16
confirmPanel = new ConfirmPanel(true, true, false, true, true, true);
confirmPanel.addActionListener(Events.ON_CLICK, this);
// Elaine 2008/12/16
confirmPanel.getButton(ConfirmPanel.A_CUSTOMIZE).setVisible(hasCustomize());
confirmPanel.getButton(ConfirmPanel.A_HISTORY).setVisible(hasHistory());
confirmPanel.getButton(ConfirmPanel.A_ZOOM).setVisible(hasZoom());
confirmPanel.getButton(ConfirmPanel.A_OK).setVisible(p_saveResults);
checkAutoQuery.setText(Msg.getMsg(Env.getCtx(), "AutoRefresh"));
checkAutoQuery.setTooltip(Msg.getMsg(Env.getCtx(), "AutoRefresh"));
checkAutoQuery.setName("AutoQuery");
checkAutoQuery.setSelected(MSysConfig.getValue(SYSCONFIG_INFO_AUTO_QUERY, "Y", Env.getAD_Client_ID(Env.getCtx())).equals("Y"));
checkAutoQuery.setAttribute("zk_component_ID", "Lookup_Confirm_checkAutoQuery");
checkAutoQuery.addActionListener(this);
confirmPanel.getButton(ConfirmPanel.A_REFRESH).getParent().insertBefore(checkAutoQuery, confirmPanel.getButton(ConfirmPanel.A_REFRESH));
confirmPanel.getButton(ConfirmPanel.A_REFRESH).getParent().insertBefore(new Separator("vertical"), confirmPanel.getButton(ConfirmPanel.A_REFRESH));
//
statusBar.setEastVisibility(false);
statusBar.setAttribute("zk_component_ID", "info_statusBar");
//
p_southLayout.setVflex("min");
Center center = new Center();
center.appendChild(confirmPanel);
p_southLayout.appendChild(center);
South south = new South();
south.appendChild(statusBar);
p_southLayout.appendChild(south);
//
// Reset button
bReset = confirmPanel.createButton(ConfirmPanel.A_RESET);
bReset.addActionListener(this);
lblReset = new Label();
lblReset.setValue(Util.cleanAmp(Msg.translate(Env.getCtx(), "Reset")));
p_table.setOddRowSclass(null);
p_table.setAttribute("zk_component_ID", "Lookup_Data_SearchResults");
p_table.setVflex(true);
// Sizes
p_centerNorth.setVflex("min");
p_centerCenter.setVflex("1");
p_centerSouth.setHeight("25%");
//
ThemeUtils.addSclass("info-panel-center", p_centerLayout);
// May be empty
p_centerLayout.appendChild(p_centerNorth);
// the table
p_centerLayout.appendChild(p_centerCenter);
// detail tabs or other
p_centerLayout.appendChild(p_centerSouth);
//
// Need to use a container for p_table so we can insert paging if required.
Div div = new Div();
div.appendChild(p_table);
div.setVflex("1");
div.setHflex("1");
p_centerCenter.appendChild(div);
p_centerCenter.setAutoscroll(false);
p_centerCenter.setHflex("1");
//
p_centerSouth.setCollapsible(true);
p_centerSouth.setSplittable(true);
p_centerSouth.setHflex("1");
// Setup the north reset button and criteria grid
West spWest = new West();
spWest.setHflex("min");
ThemeUtils.addSclass("criteria", spWest);
Center spCenter = new Center();
//spCenter.setWidth("100%");
spCenter.setHflex("1");
spCenter.setVflex("min");
ThemeUtils.addSclass("criteria", spCenter);
p_northLayout.setHflex("min");
p_northLayout.setVflex("min");
p_northLayout.appendChild(spWest);
p_northLayout.appendChild(spCenter);
// spWest - the reset button
Grid bGrid = GridFactory.newGridLayout();
bGrid.setSizedByContent(true);
Columns bColumns = new Columns();
Column col = new Column();
col.setHflex("min");
bColumns.appendChild(col);
bGrid.appendChild(bColumns);
Rows bRows = new Rows();
Row bRow = new Row();
bGrid.appendChild(bRows);
bRows.appendChild(bRow);
bRow.appendChild(bReset);
bRow = new Row();
bRows.appendChild(bRow);
bRow.appendChild(lblReset);
spWest.appendChild(bGrid);
// The criteria table
//p_criteriaGrid.setSizedByContent(true);
spCenter.appendChild(p_criteriaGrid);
Borderlayout mainPanel = new Borderlayout();
mainPanel.setWidth("100%");
mainPanel.setHeight("100%");
//
North north = new North();
mainPanel.appendChild(north);
north.appendChild(p_northLayout);
//
center = new Center();
mainPanel.appendChild(center);
center.appendChild(p_centerLayout);
//
south = new South();
mainPanel.appendChild(south);
south.appendChild(p_southLayout);
//
if (!isModal()) {
mainPanel.setStyle("position: absolute");
}
this.appendChild(mainPanel);
this.addEventListener(Events.ON_OK, this);
this.setVisible(true);
}
use of org.adempiere.webui.component.Column in project adempiere by adempiere.
the class ProcessPanel method initComponents.
/**
* Initialize components
*/
@Override
public void initComponents() {
m_separators = new ArrayList<Label>();
rows = new Rows();
//
mainPanel = new Panel();
parameterPanel = GridFactory.newGridLayout();
parameterPanel.setInnerWidth(width);
//setup columns
Columns columns = new Columns();
parameterPanel.appendChild(columns);
int colN = getColumns() * 2;
if (colN != 0) {
int percent = 100 / colN;
for (int i = 0; i < colN; i++) {
Column col = new Column();
col.setWidth((i == 0 ? ((int) percent / 2) : percent) + "%");
columns.appendChild(col);
}
}
// Add Rows
parameterPanel.appendChild(rows);
//
mainLayout = new Borderlayout();
mainLayout.setStyle("border: none; overflow: auto");
// Message Panel
if (isShowDescription()) {
messageDiv = new Div();
message = new Html();
messageDiv.appendChild(message);
messageDiv.setStyle(MESSAGE_DIV_STYLE);
messagePanel = new North();
messagePanel.appendChild(messageDiv);
messagePanel.setAutoscroll(true);
messagePanel.setStyle("border: none;");
mainLayout.appendChild(messagePanel);
}
// Parameter Panel
centerPanel = new Center();
mainLayout.appendChild(centerPanel);
centerPanel.appendChild(parameterPanel);
centerPanel.setFlex(false);
centerPanel.setStyle("border: none");
// Buttons Panel
if (isShowButtons()) {
Grid southRowPanel = GridFactory.newGridLayout();
Rows rows = southRowPanel.newRows();
Row row = rows.newRow();
Hbox hBox = new Hbox();
hBox.appendChild(lSaved);
fSavedName.addEventListener(Events.ON_CHANGE, this);
hBox.appendChild(fSavedName);
bSave.setEnabled(false);
bSave.setImage("/images/Save24.png");
bSave.setSclass("action-button");
bSave.addActionListener(this);
hBox.appendChild(bSave);
bDelete.setEnabled(false);
bDelete.setImage("/images/Delete24.png");
bDelete.setSclass("action-button");
bDelete.addActionListener(this);
hBox.appendChild(bDelete);
row.appendChild(hBox);
Panel confParaPanel = new Panel();
confParaPanel.setAlign("right");
// BR [ 300 ]
try {
// Set Ok
WAppsAction action = new WAppsAction(ConfirmPanel.A_OK, null, ConfirmPanel.A_OK);
bOK = action.getButton();
// Set to Cancel
action = new WAppsAction(ConfirmPanel.A_CANCEL, null, ConfirmPanel.A_CANCEL);
bCancel = action.getButton();
// Add Listener
bOK.addEventListener(Events.ON_CLICK, this);
bCancel.addEventListener(Events.ON_CLICK, this);
// Add to Panel
confParaPanel.appendChild(bCancel);
confParaPanel.appendChild(bOK);
} catch (Exception e) {
log.severe("Error loading Buttons " + e.getLocalizedMessage());
}
//
row.appendChild(confParaPanel);
South south = new South();
south.appendChild(southRowPanel);
// Add to Main panel
mainLayout.appendChild(south);
}
// Set Text
if (isShowDescription()) {
message.setContent(getTextMsg());
}
//
mainPanel.appendChild(mainLayout);
mainPanel.setHeight("100%");
mainPanel.setWidth("100%");
}
Aggregations