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();
}
}
}
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);
}
}
}
}
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);
}
}
}
}
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();
}
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);
}
}
Aggregations