List of usage examples for com.google.gwt.user.client.ui Widget addStyleName
public void addStyleName(String style)
From source file:org.opencms.gwt.client.ui.CmsAvailabilityDialog.java
License:Open Source License
/** * Creates a flowpanel with a widget and a checkbox in front of it.<p> * /* w w w. ja va 2 s . com*/ * @param checkbox the checkbox for the date box * @param w the widget behind the checkbox * * @return the flowpanel with a widget and a checkbox */ private FlowPanel createInputCombinationPanel(CmsCheckBox checkbox, Widget w) { FlowPanel inputCombination = new FlowPanel(); inputCombination.addStyleName(I_CmsLayoutBundle.INSTANCE.availabilityCss().inputCombination()); checkbox.addStyleName(I_CmsLayoutBundle.INSTANCE.availabilityCss().checkBox()); w.addStyleName(I_CmsLayoutBundle.INSTANCE.availabilityCss().dateBox()); inputCombination.add(checkbox); inputCombination.add(w); return inputCombination; }
From source file:org.opencms.gwt.client.ui.CmsAvailabilityDialog.java
License:Open Source License
/** * Creates a two column row used for a field set.<p> * /* w w w . j ava 2 s .com*/ * @param labelText the label for this row * @param w the input widget for this row * * @return a flow panel that contains the label and the input widget */ private Widget createTwoColumnRow(String labelText, Widget w) { FlowPanel result = new FlowPanel(); result.addStyleName(I_CmsLayoutBundle.INSTANCE.availabilityCss().inlineBlock()); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(labelText) && (w != null)) { CmsLabel inputLabel = new CmsLabel(labelText); inputLabel.addStyleName(I_CmsLayoutBundle.INSTANCE.availabilityCss().labelColumn()); result.add(inputLabel); w.addStyleName(I_CmsLayoutBundle.INSTANCE.availabilityCss().inputCombination()); result.add(w); } else if (w != null) { result.add(w); } return result; }
From source file:org.opencms.gwt.client.ui.CmsPopup.java
License:Open Source License
/** * Wraps the given Widget with a cornered border, padding and margin.<p> * /* w w w . ja va 2 s.co m*/ * @param w the widget to wrap * * @return a new widget that wraps the given one */ public static Widget wrapWithBorderPadding(Widget w) { w.addStyleName(I_CmsLayoutBundle.INSTANCE.dialogCss().borderPadding()); w.addStyleName(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll()); SimplePanel panel = new SimplePanel(); panel.add(w); return panel; }
From source file:org.opencms.gwt.client.ui.input.form.A_CmsFormFieldPanel.java
License:Open Source License
/** * Helper method for adding a border to a widget.<p> * //from ww w .j a va 2 s . com * @param widget the widget which a border should be added to */ protected void setBorder(Widget widget) { String cornerAll = org.opencms.gwt.client.ui.css.I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll(); String border = org.opencms.gwt.client.ui.css.I_CmsLayoutBundle.INSTANCE.generalCss().border(); widget.addStyleName(border); widget.addStyleName(cornerAll); widget.getElement().getStyle().setPadding(6, Unit.PX); }
From source file:org.opencms.gwt.client.ui.input.form.CmsFormRow.java
License:Open Source License
/** * The default constructor. //w ww. j ava 2s .co m */ public CmsFormRow() { Widget main = uiBinder.createAndBindUi(this); initWidget(main); main.addStyleName(I_CmsInputLayoutBundle.INSTANCE.inputCss().highTextBoxes()); }
From source file:org.opencms.gwt.client.ui.replace.CmsReplaceDialog.java
License:Open Source License
/** * Checks if the file suffix of the selected file matches the suffix of the resource to replace.<p> */// ww w . j av a 2s . c o m private void checkFileType() { if ((m_fileInput != null) && (m_replaceInfo != null) && (m_fileWidget != null)) { CmsFileInfo file = m_fileInput.getFiles()[0]; if (!m_replaceInfo.getSitepath().endsWith(file.getFileSuffix())) { Widget warningImage = FontOpenCms.WARNING.getWidget(20, I_CmsConstantsBundle.INSTANCE.css().colorWarning()); warningImage.setTitle(Messages.get().key(Messages.GUI_REPLACE_WRONG_FILE_EXTENSION_0)); warningImage.addStyleName(org.opencms.gwt.client.ui.css.I_CmsLayoutBundle.INSTANCE .listItemWidgetCss().permaVisible()); m_fileWidget.addButton(warningImage); } } }
From source file:org.openelis.gwt.widget.MenuItem.java
License:Open Source License
public Widget create(String icon, Widget wid, String descriptionText) { FlexTable table = new FlexTable(); table.setStyleName("TopMenuRowContainer"); iconPanel.setStyleName(icon);//from ww w .jav a2 s .c om HorizontalPanel hp = new HorizontalPanel(); hp.add(wid); hp.setCellWidth(wid, "100%"); hp.add(openIcon); hp.setWidth("100%"); VerticalPanel textPanel = new VerticalPanel(); //Label label = new Label(labelText); wid.setStyleName("topMenuItemTitle"); wid.addStyleName("locked"); Label description; if ("EXCEPTION".equals(descriptionText)) description = new Label(); else description = new Label(descriptionText); description.setStyleName("topMenuItemDesc"); table.setWidget(0, 0, iconPanel); textPanel.add(hp); textPanel.setCellWidth(hp, "100%"); textPanel.add(description); textPanel.setWidth("100%"); table.setWidget(0, 1, textPanel); table.getFlexCellFormatter().setStyleName(0, 0, "topMenuIcon"); table.getFlexCellFormatter().setStyleName(0, 1, "topMenuItemMiddle"); return table; }
From source file:org.openelis.gwt.widget.MenuItem.java
License:Open Source License
public static Widget createDefault(String icon, Widget wid, String descriptionText) { FlexTable table = new FlexTable(); table.setStyleName("TopMenuRowContainer"); AbsolutePanel iconPanel = new AbsolutePanel(); iconPanel.setStyleName(icon);//from w ww .j av a 2s. co m VerticalPanel textPanel = new VerticalPanel(); //Label label = new Label(labelText); wid.setStyleName("topMenuItemTitle"); wid.addStyleName("locked"); Label description; if ("EXCEPTION".equals(descriptionText)) description = new Label(); else description = new Label(descriptionText); description.setStyleName("topMenuItemDesc"); table.setWidget(0, 0, iconPanel); textPanel.add(wid); textPanel.add(description); table.setWidget(0, 1, textPanel); table.getFlexCellFormatter().setStyleName(0, 0, "topMenuIcon"); table.getFlexCellFormatter().setStyleName(0, 1, "topMenuItemMiddle"); return table; }
From source file:org.openelis.gwt.widget.table.TableColumn.java
License:Open Source License
public Widget getDisplayWidget(TableDataRow row) { TableDataCell cell = new TableDataCell(null); if (columnIndex < row.cells.size()) cell = row.cells.get(columnIndex); Widget wid = null; Object val = null; if (colWidget instanceof CheckBox) { wid = new CheckBoxContainer(); IconContainer icon = new IconContainer(); if (CheckBox.CHECKED.equals(cell.getValue())) icon.setStyleName(CheckBox.CHECKED_STYLE); else if (controller.queryMode && cell.getValue() == null) icon.setStyleName(CheckBox.UNKNOWN_STYLE); else/*from w w w. j ava 2s .c om*/ icon.setStyleName(CheckBox.UNCHECKED_STYLE); setAlign(HasHorizontalAlignment.ALIGN_CENTER); ((AbsolutePanel) wid).add(icon); DOM.setStyleAttribute(wid.getElement(), "align", "center"); wid.setWidth((currentWidth) + "px"); } else if (colWidget instanceof PercentBar) { PercentBar newBar = new PercentBar(); newBar.setColors(((PercentBar) colWidget).getColors()); newBar.setWidth(currentWidth + "px"); newBar.setBarWidth(((PercentBar) colWidget).getBarWidth()); newBar.setPercent((Double) cell.getValue()); return newBar; } else if (colWidget instanceof TableImage) { if (controller.queryMode) return new Label(""); TableImage newImg = new TableImage(); newImg.setStyleName((String) cell.getValue()); setAlign(HasHorizontalAlignment.ALIGN_CENTER); return newImg; } else { if (colWidget instanceof AutoComplete) { if (controller.queryMode) { val = cell.getValue(); if (val == null) val = ""; } else { TableDataRow vrow = (TableDataRow) cell.getValue(); if (vrow != null) ((AutoComplete) colWidget).setSelection(vrow); else ((AutoComplete) colWidget).setSelection(null, ""); val = ((AutoComplete) colWidget).getTextBoxDisplay(); } } else if (colWidget instanceof Dropdown) { if (cell.getValue() instanceof ArrayList) ((Dropdown) colWidget).setSelectionKeys((ArrayList<Object>) cell.getValue()); else ((Dropdown) colWidget).setSelection(cell.getValue()); val = ((Dropdown) colWidget).getTextBoxDisplay(); } else if (colWidget instanceof CalendarLookUp && ((CalendarLookUp) colWidget).getField().queryMode) { val = ((HasField) colWidget).getField().queryString; } else { if (cell.getValue() instanceof ArrayList) { if (((ArrayList) cell.getValue()).size() > 0) ((HasField) colWidget).setFieldValue(((ArrayList) cell.getValue()).get(0).toString()); else ((HasField) colWidget).setFieldValue(""); } else ((HasField) colWidget).setFieldValue(cell.getValue()); } if (val == null) { if (((HasField) colWidget).getField().queryMode) val = ((HasField) colWidget).getField().queryString; else val = ((HasField) colWidget).getFieldValue(); } Label label = new Label(""); label.setStyleName("ScreenLabel"); if (colWidget instanceof Label) label.setStyleName(colWidget.getStyleName()); if (val != null) { if (colWidget instanceof CalendarLookUp) { if (((HasField) colWidget).getField().queryMode) label.setText(((HasField) colWidget).getField().queryString); else label.setText((((CalendarLookUp) colWidget).getField().format())); } else if (colWidget instanceof AutoComplete && controller.queryMode) { label.setText((String) val); } else if (colWidget instanceof DropdownWidget) { label.setText(((DropdownWidget) colWidget).getTextBoxDisplay()); } else if (colWidget instanceof TextBoxBase) { if (((HasField) colWidget).getField().queryMode) label.setText(((HasField) colWidget).getField().queryString); else label.setText(((TextBoxBase) colWidget).getText()); } else if (colWidget instanceof Label) label.setText(((Label) colWidget).getText()); } label.setWordWrap(false); wid = label; wid.setWidth((currentWidth) + "px"); } setExceptions(wid, cell.exceptions); wid.addStyleName("TableWidget"); return wid; }
From source file:org.openelis.gwt.widget.table.TableColumn.java
License:Open Source License
public Widget getWidgetEditor(TableDataRow row) { TableDataCell cell = new TableDataCell(null); if (columnIndex < row.cells.size()) cell = row.cells.get(columnIndex); Widget editor = colWidget; if (colWidget instanceof CheckBox) { CheckBoxContainer ap = new CheckBoxContainer(); ((CheckBox) editor).setValue((String) cell.getValue()); ap.setWidth((currentWidth) + "px"); ap.add(editor);// w w w . jav a 2 s .c o m return ap; } if (colWidget instanceof PercentBar) { if (controller.queryMode) return new Label(""); PercentBar newBar = (PercentBar) colWidget; newBar.setWidth(currentWidth + "px"); newBar.setPercent((Double) cell.getValue()); HTML html = new HTML(DOM.getInnerHTML(newBar.getElement())); html.setWidth(currentWidth + "px"); return html; } if (colWidget instanceof TableImage) { if (controller.queryMode) return new Label(""); TableImage newImg = new TableImage(); newImg.setStyleName((String) cell.getValue()); return newImg; } editor = colWidget; editor.setWidth((currentWidth) + "px"); if (colWidget instanceof AutoComplete) { if (controller.queryMode) { ((AutoComplete) colWidget).textbox.setText((String) cell.getValue()); } else { TableDataRow vrow = (TableDataRow) cell.getValue(); if (vrow != null) ((AutoComplete) colWidget).setSelection(vrow); else ((AutoComplete) colWidget).setSelection(null, ""); } } else if (colWidget instanceof Dropdown) { if (cell.getValue() instanceof ArrayList) ((Dropdown) colWidget).setSelectionKeys((ArrayList<Object>) cell.getValue()); else ((Dropdown) colWidget).setSelection(cell.getValue()); } else if (colWidget instanceof CalendarLookUp && ((CalendarLookUp) colWidget).getField().queryMode) { // do nothing; } else ((HasField) editor).setFieldValue(cell.getValue()); ((HasField) editor).clearExceptions(); setExceptions(editor, cell.exceptions); editor.addStyleName("TableWidget"); return editor; }