Search in sources :

Example 1 with HtmlBasedComponent

use of org.zkoss.zk.ui.HtmlBasedComponent in project adempiere by adempiere.

the class ADTabPanel method activate.

/**
     * Activate/deactivate panel
     * @param activate
     */
public void activate(boolean activate) {
    if (getGrid() != null && activate) {
        Grid gridCurrent = getGrid();
        //border-top: 1px solid #fa962f; border-bottom: 1px solid #fa962f; border-right: 1px solid #fa962f;");
        ((HtmlBasedComponent) gridCurrent).setStyle("border-left: 6px solid #fa962f; ");
        gridCurrent.setWidth("99.1%");
    } else if (getGrid() != null && !activate) {
        Grid gridtPrevious = getGrid();
        ((HtmlBasedComponent) gridtPrevious).setStyle("border:none;");
        gridtPrevious.setWidth("100%");
        gridtPrevious.setHeight("100%");
    }
    if (getListPanel() != null && activate) {
        GridPanel gridPanel = getListPanel();
        //gridPanel.setHeight("95%");
        //border-top: 1px solid #fa962f; border-bottom: 1px solid #fa962f; border-right: 1px solid #fa962f;");
        ((HtmlBasedComponent) gridPanel).setStyle("border-left: 6px solid #fa962f; ");
        gridPanel.setWidth("99.1%");
    //gridPanel.setHeight("95%");
    } else if (getListPanel() != null && !activate) {
        GridPanel gridPanel = getListPanel();
        ((HtmlBasedComponent) gridPanel).setStyle("border:none;");
        gridPanel.setWidth("100%");
        gridPanel.setHeight("100%");
    }
    //activate embedded panel
    for (EmbeddedPanel ep : includedPanel) {
        activateChild(activate, ep);
    }
    //Horizontal
    for (HorizontalEmbeddedPanel ep : horizontalIncludedPanel) {
        activateChild(activate, ep);
    }
    active = activate;
    if (listPanel.isVisible()) {
        if (activate)
            listPanel.activate(gridTab);
        else
            listPanel.deactivate();
    } else {
        if (activate) {
            formComponent.setVisible(activate);
            setFocusToField();
        }
    }
}
Also used : Grid(org.adempiere.webui.component.Grid) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent)

Example 2 with HtmlBasedComponent

use of org.zkoss.zk.ui.HtmlBasedComponent in project adempiere by adempiere.

the class WEditor method fillHorizontal.

/**
     * Stretch editor component to fill container
     */
public void fillHorizontal() {
    //streach component to fill grid cell
    if (getComponent() instanceof HtmlBasedComponent) {
        //can't stretch bandbox & datebox
        if (!(getComponent() instanceof Bandbox) && !(getComponent() instanceof Datebox)) {
            String width = "100%";
            if (getComponent() instanceof Button) {
                Button btn = (Button) getComponent();
                String zclass = btn.getZclass();
                if (gridField.getDisplayType() == DisplayType.Image) {
                    if (!zclass.contains("image-button-field ")) {
                        btn.setZclass("image-button-field " + zclass);
                    }
                } else if (!zclass.contains("form-button ")) {
                    btn.setZclass("form-button " + zclass);
                }
            } else if (getComponent() instanceof Image) {
                Image image = (Image) getComponent();
                image.setWidth("48px");
                image.setHeight("48px");
            } else {
                ((HtmlBasedComponent) getComponent()).setWidth(width);
            }
        }
    }
}
Also used : Button(org.adempiere.webui.component.Button) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent) Image(org.zkoss.zul.Image)

Example 3 with HtmlBasedComponent

use of org.zkoss.zk.ui.HtmlBasedComponent in project adempiere by adempiere.

the class WStringEditor method init.

private void init(String obscureType) {
    if (gridField != null) {
        getComponent().setMaxlength(gridField.getFieldLength());
        int displayLength = gridField.getDisplayLength();
        if (displayLength <= 0 || displayLength > MAX_DISPLAY_LENGTH) {
            displayLength = MAX_DISPLAY_LENGTH;
        }
        getComponent().setCols(displayLength);
        if (gridField.getDisplayType() == DisplayType.Text) {
            getComponent().setMultiline(true);
            getComponent().setRows(3);
            ((HtmlBasedComponent) getComponent()).setSclass("field-text");
        } else if (gridField.getDisplayType() == DisplayType.TextLong) {
            getComponent().setMultiline(true);
            getComponent().setRows(5);
            ((HtmlBasedComponent) getComponent()).setSclass("field-textlong");
        } else if (gridField.getDisplayType() == DisplayType.Memo) {
            getComponent().setMultiline(true);
            getComponent().setRows(8);
            ((HtmlBasedComponent) getComponent()).setSclass("field-memo");
        }
        if (getComponent() instanceof org.zkoss.zul.api.Textbox)
            ((StringBox) component).setObscureType(obscureType);
        popupMenu = new WEditorPopupMenu(false, false, true);
        Menuitem editor = new Menuitem(Msg.getMsg(Env.getCtx(), "Editor"), "images/Editor16.png");
        editor.setAttribute("EVENT", EDITOR_EVENT);
        editor.addEventListener(Events.ON_CLICK, popupMenu);
        popupMenu.appendChild(editor);
        if (gridField != null && gridField.getGridTab() != null) {
            WRecordInfo.addMenu(popupMenu);
        }
        getComponent().setContext(popupMenu.getId());
        if (gridField.isAutocomplete()) {
            Combobox combo = (Combobox) getComponent();
            combo.setAutodrop(true);
            combo.setAutocomplete(true);
            combo.setButtonVisible(false);
            List<String> items = gridField.getEntries();
            for (String s : items) {
                combo.appendItem(s);
            }
        }
    }
}
Also used : Menuitem(org.zkoss.zul.Menuitem) Combobox(org.adempiere.webui.component.Combobox) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent)

Example 4 with HtmlBasedComponent

use of org.zkoss.zk.ui.HtmlBasedComponent in project adempiere by adempiere.

the class WEditor method init.

private void init() {
    label = new Label("");
    label.setValue(strLabel);
    label.setTooltiptext(description);
    this.setMandatory(mandatory);
    if (readOnly || !updateable) {
        this.setReadWrite(false);
    } else {
        this.setReadWrite(true);
    }
    ((HtmlBasedComponent) component).setTooltiptext(description);
    if (gridField != null)
        label.setTooltiptext(description + "\n\n" + gridField.getHelp());
    else
        label.setTooltiptext(description);
    //init listeners
    for (String event : this.getEvents()) {
        component.addEventListener(event, this);
    }
    component.addEventListener(Events.ON_FOCUS, new EventListener() {

        public void onEvent(Event event) throws Exception {
            hasFocus = true;
            if (gridTab != null) {
                CWindowToolbar toolbar = tabPanel.getGlobalToolbar();
                if (toolbar != null) {
                    if (tabPanel.getGlobalToolbar().getCurrentPanel() != toolbar.getCurrentPanel()) {
                        tabPanel.getGlobalToolbar().getCurrentPanel().setUnselected(toolbar.getCurrentPanel());
                        tabPanel.getGlobalToolbar().getCurrentPanel().setSelected(tabPanel);
                    }
                }
            }
        }
    });
    component.addEventListener(Events.ON_BLUR, new EventListener() {

        public void onEvent(Event event) throws Exception {
            hasFocus = false;
        }
    });
    repaintComponent();
}
Also used : Label(org.adempiere.webui.component.Label) ValueChangeEvent(org.adempiere.exceptions.ValueChangeEvent) Event(org.zkoss.zk.ui.event.Event) PropertyChangeEvent(java.beans.PropertyChangeEvent) EventListener(org.zkoss.zk.ui.event.EventListener) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent)

Example 5 with HtmlBasedComponent

use of org.zkoss.zk.ui.HtmlBasedComponent in project adempiere by adempiere.

the class WPAttributeDialog method cmd_newEdit.

//	cmd_select
/**
	 * 	Instance New/Edit
	 */
private void cmd_newEdit() {
    boolean rw = cbNewEdit.isChecked();
    log.config("R/W=" + rw + " " + m_masi);
    //
    fieldLotString.setReadonly(!(rw && m_masi.getM_Lot_ID() == 0));
    if (fieldLot != null)
        fieldLot.setEnabled(rw);
    bLot.setEnabled(rw);
    fieldSerNo.setReadonly(!rw);
    bSerNo.setEnabled(rw);
    fieldGuaranteeDate.setReadonly(!rw);
    //
    for (int i = 0; i < m_editors.size(); i++) {
        HtmlBasedComponent editor = m_editors.get(i);
        if (editor instanceof InputElement)
            ((InputElement) editor).setReadonly(!rw);
        else if (editor instanceof Listbox)
            ((Listbox) editor).setEnabled(rw);
        else if (editor instanceof NumberBox)
            ((NumberBox) editor).setEnabled(rw);
    }
}
Also used : InputElement(org.zkoss.zul.impl.InputElement) NumberBox(org.adempiere.webui.component.NumberBox) HtmlBasedComponent(org.zkoss.zk.ui.HtmlBasedComponent) Listbox(org.adempiere.webui.component.Listbox)

Aggregations

HtmlBasedComponent (org.zkoss.zk.ui.HtmlBasedComponent)6 Label (org.adempiere.webui.component.Label)2 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 ValueChangeEvent (org.adempiere.exceptions.ValueChangeEvent)1 Button (org.adempiere.webui.component.Button)1 Checkbox (org.adempiere.webui.component.Checkbox)1 Combobox (org.adempiere.webui.component.Combobox)1 Grid (org.adempiere.webui.component.Grid)1 Listbox (org.adempiere.webui.component.Listbox)1 NumberBox (org.adempiere.webui.component.NumberBox)1 Event (org.zkoss.zk.ui.event.Event)1 EventListener (org.zkoss.zk.ui.event.EventListener)1 Decimalbox (org.zkoss.zul.Decimalbox)1 Hbox (org.zkoss.zul.Hbox)1 Image (org.zkoss.zul.Image)1 Menuitem (org.zkoss.zul.Menuitem)1 Radio (org.zkoss.zul.Radio)1 Radiogroup (org.zkoss.zul.Radiogroup)1 InputElement (org.zkoss.zul.impl.InputElement)1