Search in sources :

Example 1 with Column

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();
}
Also used : Label(org.adempiere.webui.component.Label) org.zkoss.zul(org.zkoss.zul) Row(org.zkoss.zul.Row) Column(org.adempiere.webui.component.Column) Rows(org.adempiere.webui.component.Rows) Columns(org.adempiere.webui.component.Columns) org.adempiere.webui.component(org.adempiere.webui.component) Row(org.zkoss.zul.Row)

Example 2 with Column

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");
}
Also used : Panel(org.adempiere.webui.component.Panel) Column(org.adempiere.webui.component.Column) Label(org.adempiere.webui.component.Label) Columns(org.adempiere.webui.component.Columns) Rows(org.adempiere.webui.component.Rows)

Example 3 with Column

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);
}
Also used : Center(org.zkoss.zul.Center) West(org.zkoss.zul.West) Grid(org.adempiere.webui.component.Grid) South(org.zkoss.zul.South) Label(org.adempiere.webui.component.Label) Columns(org.adempiere.webui.component.Columns) Borderlayout(org.zkoss.zul.Borderlayout) Div(org.zkoss.zul.Div) ConfirmPanel(org.adempiere.webui.component.ConfirmPanel) IDColumn(org.compiere.minigrid.IDColumn) Column(org.adempiere.webui.component.Column) North(org.zkoss.zul.North) Row(org.adempiere.webui.component.Row) Separator(org.zkoss.zul.Separator) Rows(org.adempiere.webui.component.Rows)

Example 4 with Column

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%");
}
Also used : Hbox(org.zkoss.zul.Hbox) Center(org.zkoss.zkex.zul.Center) Grid(org.adempiere.webui.component.Grid) Label(org.adempiere.webui.component.Label) South(org.zkoss.zkex.zul.South) Columns(org.adempiere.webui.component.Columns) Html(org.zkoss.zul.Html) Borderlayout(org.adempiere.webui.component.Borderlayout) WAppsAction(org.adempiere.webui.component.WAppsAction) Div(org.zkoss.zul.Div) Panel(org.adempiere.webui.component.Panel) ConfirmPanel(org.adempiere.webui.component.ConfirmPanel) Column(org.adempiere.webui.component.Column) North(org.zkoss.zkex.zul.North) Row(org.adempiere.webui.component.Row) Rows(org.adempiere.webui.component.Rows)

Aggregations

Column (org.adempiere.webui.component.Column)4 Columns (org.adempiere.webui.component.Columns)4 Label (org.adempiere.webui.component.Label)4 Rows (org.adempiere.webui.component.Rows)4 ConfirmPanel (org.adempiere.webui.component.ConfirmPanel)2 Grid (org.adempiere.webui.component.Grid)2 Panel (org.adempiere.webui.component.Panel)2 Row (org.adempiere.webui.component.Row)2 Div (org.zkoss.zul.Div)2 org.adempiere.webui.component (org.adempiere.webui.component)1 Borderlayout (org.adempiere.webui.component.Borderlayout)1 WAppsAction (org.adempiere.webui.component.WAppsAction)1 IDColumn (org.compiere.minigrid.IDColumn)1 Center (org.zkoss.zkex.zul.Center)1 North (org.zkoss.zkex.zul.North)1 South (org.zkoss.zkex.zul.South)1 org.zkoss.zul (org.zkoss.zul)1 Borderlayout (org.zkoss.zul.Borderlayout)1 Center (org.zkoss.zul.Center)1 Hbox (org.zkoss.zul.Hbox)1