List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth
public void setCellWidth(IsWidget w, String width)
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 w w w . j ava 2 s. com 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 createTableHeader(String icon, Widget wid) { HorizontalPanel hp = new HorizontalPanel(); //hp.setStyleName("TopHeaderRowContainer"); hp.add(wid);// ww w . j ava 2s . c o m wid.setStyleName("HeaderLabel"); hp.setCellWidth(wid, "100%"); AbsolutePanel ap = new AbsolutePanel(); hp.add(ap); hp.setCellWidth(ap, "16px"); ap.setHeight("18px"); ap.setWidth("16px"); hp.setCellHorizontalAlignment(ap, HasAlignment.ALIGN_RIGHT); hp.setCellHorizontalAlignment(wid, HasAlignment.ALIGN_CENTER); return hp; }
From source file:org.openelis.gwt.widget.ScreenWindow.java
License:Open Source License
public void init(Mode mode, boolean noBorder) { this.mode = mode; setWidget(outer);/* ww w . ja va 2 s . c om*/ setVisible(false); if (browser != null) zIndex = browser.index; if (!noBorder) { tlCorner.addStyleName("WindowTL"); trCorner.addStyleName("WindowTR"); blCorner.addStyleName("WindowBL"); brCorner.addStyleName("WindowBR"); leftSide.addStyleName("WindowLeft"); rightSide.addStyleName("WindowRight"); HorizontalPanel hp = new HorizontalPanel(); hp.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); titleButtonsContainer = new HorizontalPanel(); titleButtonsContainer.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp.setWidth("100%"); titleButtonsContainer.addStyleName("Caption"); titleButtonsContainer.setWidth("100%"); cap.addMouseDownHandler(this); winLabel.setStyleName("ScreenWindowLabel"); cap.add(winLabel); cap.setWidth("100%"); cap.setHeight("100%"); cap.setCellVerticalAlignment(winLabel, HasAlignment.ALIGN_MIDDLE); close.addClickHandler(this); close.setStyleName("CloseButton"); collapse.addClickHandler(this); collapse.setStyleName("MinimizeButton"); hp.add(tlCorner); titleButtonsContainer.add(cap); titleButtonsContainer.setCellWidth(cap, "100%"); hp.add(titleButtonsContainer); hp.setCellWidth(titleButtonsContainer, "100%"); if (mode == Mode.SCREEN || mode == Mode.LOOK_UP) { HorizontalPanel hp2 = new HorizontalPanel(); hp2.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); hp2.add(collapse); hp2.add(close); titleButtonsContainer.add(hp2); titleButtonsContainer.setCellHorizontalAlignment(hp2, HasAlignment.ALIGN_RIGHT); hp.setCellWidth(hp2, "32px"); hp.setCellHorizontalAlignment(hp2, HasAlignment.ALIGN_RIGHT); } hp.add(trCorner); statusImg.addMouseOverHandler(this); statusImg.addMouseOutHandler(this); status.setStyleName("StatusBar"); status.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); status.add(statusImg); status.add(message); status.add(progressBar); progressBar.setVisible(false); status.setWidth("100%"); status.setCellWidth(message, "100%"); message.setStyleName("ScreenWindowLabel"); outer.add(hp); bottomRow.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); bottomRow.setWidth("100%"); bottomRow.setSpacing(0); middleGrid.setCellPadding(0); middleGrid.setCellSpacing(0); middleGrid.getCellFormatter().addStyleName(0, 0, "WindowLeft"); middleGrid.setWidget(0, 1, body); middleGrid.getCellFormatter().addStyleName(0, 2, "WindowRight"); bottomRow.add(blCorner); bottomRow.add(status); bottomRow.add(brCorner); bottomRow.setCellWidth(status, "100%"); body.addStyleName("WindowBody"); outer.add(middleGrid); outer.add(bottomRow); outer.addStyleName("WindowPanel"); outer.sinkEvents(Event.ONCLICK); outer.setWidth("auto"); } else { outer.add(body); outer.addStyleName("WindowPanel"); outer.sinkEvents(Event.ONCLICK); outer.setWidth("auto"); } Window.addResizeHandler(this); if (browser != null) { browser.dragController.makeDraggable(this, cap); return; } if (mode == Mode.LOOK_UP || mode == Mode.DIALOG) { modalGlass = new AbsolutePanel(); modalGlass.setStyleName("GlassPanel"); modalGlass.setHeight(Window.getClientHeight() + "px"); modalGlass.setWidth(Window.getClientWidth() + "px"); RootPanel.get().add(modalGlass); RootPanel.get().setWidgetPosition(modalGlass, 0, 0); modalPanel = new AbsolutePanel(); modalPanel.setStyleName("ModalPanel"); modalPanel.setHeight(Window.getClientHeight() + "px"); modalPanel.setWidth(Window.getClientWidth() + "px"); modalPanel.add(this, position, position); RootPanel.get().add(modalPanel); RootPanel.get().setWidgetPosition(modalPanel, 0, 0); setVisible(true); dragController = new PickupDragController(modalPanel, true); dropController = new AbsolutePositionDropController(modalPanel); dragController.registerDropController(dropController); dragController.makeDraggable(this, cap); dragController.setBehaviorDragProxy(true); } else { RootPanel.get().add(this); RootPanel.get().setWidgetPosition(this, position, position); setVisible(true); dragController = new PickupDragController(RootPanel.get(), true); dropController = new AbsolutePositionDropController(RootPanel.get()); dragController.registerDropController(dropController); dragController.makeDraggable(this, cap); dragController.setBehaviorDragProxy(true); } }
From source file:org.openremote.web.console.widget.ScreenIndicator.java
License:Open Source License
public ScreenIndicator(List<Integer> screenIds) { super(new HorizontalPanel(), CLASS_NAME); HorizontalPanel container = (HorizontalPanel) getWidget(); DOM.setIntStyleAttribute(getElement(), "zIndex", 1000); DOM.setStyleAttribute(getElement(), "overflow", "hidden"); container.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); this.screenIds = screenIds; screenIndicators = new ArrayList<Widget>(); if (screenIds != null) { width = INDICATOR_SIZE * ((screenIds.size() * 2) - 1); setWidth(width + "px"); setHeight(INDICATOR_SIZE + "px"); height = INDICATOR_SIZE;//from w w w. ja v a 2 s . co m // Add a simple div for each screen for (int i = 0; i < screenIds.size(); i++) { int cellWidth = INDICATOR_SIZE; //cellWidth = i != screenIds.size()-1 ? cellWidth + INDICATOR_SPACING : cellWidth; Widget screenIndicator = new SimplePanel(); screenIndicator.setWidth(INDICATOR_SIZE + "px"); screenIndicator.setHeight(INDICATOR_SIZE + "px"); screenIndicator.setStylePrimaryName(ITEM_CLASS_NAME); screenIndicators.add(screenIndicator); container.add(screenIndicator); container.setCellWidth(screenIndicator, cellWidth + "px"); if (i < screenIds.size() - 1) { // Add a spacer Widget spacer = new SimplePanel(); spacer.setWidth(INDICATOR_SIZE + "px"); spacer.setHeight(INDICATOR_SIZE + "px"); spacer.setStylePrimaryName(SPACER_CLASS_NAME); container.add(spacer); container.setCellWidth(spacer, cellWidth + "px"); } } } }
From source file:org.openxdata.designer.client.view.PropertiesView.java
/** * Creates a new instance of the properties view widget. *///from ww w. j a v a 2 s .c o m public PropertiesView() { btnDescTemplate = new DescTemplateWidget(this); btnCalculation = new DescTemplateWidget(this); table.setWidget(0, 0, new Label(designerMessages.text())); table.setWidget(1, 0, new Label(formsConstants.helpText())); table.setWidget(2, 0, new Label(formsConstants.type())); table.setWidget(3, 0, new Label(designerMessages.binding())); table.setWidget(4, 0, new Label(designerMessages.visible())); table.setWidget(5, 0, new Label(formsConstants.enable())); table.setWidget(6, 0, new Label(formsConstants.locked())); table.setWidget(7, 0, new Label(formsConstants.required())); table.setWidget(8, 0, new Label(formsConstants.defaultValue())); table.setWidget(9, 0, new Label(designerMessages.calculation())); lblDescTemplate = new Label(formsConstants.descriptionTemplate()); table.setWidget(10, 0, lblDescTemplate); table.setWidget(11, 0, new Label(designerMessages.formKey())); table.setWidget(0, 1, txtText); table.setWidget(1, 1, txtHelpText); table.setWidget(2, 1, cbDataType); table.setWidget(3, 1, txtBinding); table.setWidget(4, 1, chkVisible); table.setWidget(5, 1, chkEnabled); table.setWidget(6, 1, chkLocked); table.setWidget(7, 1, chkRequired); table.setWidget(8, 1, txtDefaultValue); HorizontalPanel panel = new HorizontalPanel(); panel.add(txtCalculation); panel.add(btnCalculation); panel.setCellWidth(btnCalculation, "20%"); FormUtil.maximizeWidget(txtCalculation); FormUtil.maximizeWidget(panel); table.setWidget(9, 1, panel); panel = new HorizontalPanel(); panel.add(txtDescTemplate); panel.add(btnDescTemplate); panel.setCellWidth(btnDescTemplate, "20%"); FormUtil.maximizeWidget(txtDescTemplate); FormUtil.maximizeWidget(panel); table.setWidget(10, 1, panel); table.setWidget(11, 1, txtFormKey); table.setStyleName("cw-FlexTable"); cbDataType.addItem(designerMessages.qtnTypeText()); cbDataType.addItem(designerMessages.qtnTypeNumber()); cbDataType.addItem(designerMessages.qtnTypeDecimal()); cbDataType.addItem(designerMessages.qtnTypeDate()); cbDataType.addItem(designerMessages.qtnTypeTime()); cbDataType.addItem(designerMessages.qtnTypeDateTime()); cbDataType.addItem(designerMessages.qtnTypeBoolean()); cbDataType.addItem(designerMessages.qtnTypeSingleSelect()); cbDataType.addItem(designerMessages.qtnTypeMultSelect()); cbDataType.addItem(designerMessages.qtnTypeRepeat()); cbDataType.addItem(designerMessages.qtnTypePicture()); cbDataType.addItem(designerMessages.qtnTypeVideo()); cbDataType.addItem(designerMessages.qtnTypeAudio()); cbDataType.addItem(designerMessages.qtnTypeSingleSelectDynamic()); cbDataType.addItem(designerMessages.qtnTypeGPS()); cbDataType.addItem(designerMessages.qtnTypeBarcode()); FlexCellFormatter cellFormatter = table.getFlexCellFormatter(); cellFormatter.setHorizontalAlignment(15, 1, HasHorizontalAlignment.ALIGN_CENTER); table.setWidth("100%"); cellFormatter.setWidth(0, 0, "20%"); txtText.setWidth("100%"); txtHelpText.setWidth("100%"); txtBinding.setWidth("100%"); txtDefaultValue.setWidth("100%"); cbDataType.setWidth("100%"); txtFormKey.setWidth("100%"); VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setSpacing(5); verticalPanel.add(table); DecoratedTabPanel tabs = new DecoratedTabPanel(); tabs.add(skipRulesView, designerMessages.skipLogic()); tabs.add(validationRulesView, designerMessages.validationLogic()); tabs.add(dynamicListsView, designerMessages.dynamicLists()); tabs.add(advancedValidationRulesView, designerMessages.advancedValidationLogic()); tabs.selectTab(0); verticalPanel.add(tabs); FormUtil.maximizeWidget(tabs); FormUtil.maximizeWidget(verticalPanel); initWidget(verticalPanel); setupEventListeners(); cbDataType.setSelectedIndex(-1); enableQuestionOnlyProperties(false); txtText.setEnabled(false); enableDescriptionTemplate(false); txtCalculation.setEnabled(false); btnCalculation.setEnabled(false); txtBinding.setEnabled(false); txtText.setTitle(designerMessages.questionTextDesc()); txtHelpText.setTitle(designerMessages.questionDescDesc()); txtBinding.setTitle(designerMessages.questionIdDesc()); txtDefaultValue.setTitle(designerMessages.defaultValDesc()); cbDataType.setTitle(designerMessages.questionTypeDesc()); DOM.sinkEvents(getElement(), Event.ONKEYDOWN | DOM.getEventsSunk(getElement())); }
From source file:org.optaplanner.workbench.screens.guidedrule.client.widget.BendableConstraintMatchRuleModellerWidget.java
License:Apache License
public BendableConstraintMatchRuleModellerWidget(final RuleModeller mod, final EventBus eventBus, final AbstractActionBendableConstraintMatch actionConstraintMatch, final TranslationService translationService, final Boolean readOnly, final String labelTranslationKey) { super(mod, eventBus, translationService); this.actionConstraintMatch = actionConstraintMatch; constraintMatchInputWidget = new ConstraintMatchInputWidget(actionConstraintMatch); constraintMatchInputWidget/*from w w w. ja va2 s. c om*/ .addConstraintMatchValueChangeHandler(new ConstraintMatchValueChangeHandler(actionConstraintMatch)); HorizontalPanel horizontalPanel = new HorizontalPanel(); HorizontalPanel labelPanel = createLabelPanel(translationService.getTranslation(labelTranslationKey)); horizontalPanel.add(labelPanel); HorizontalPanel selectPanel = createSelectPanel(); horizontalPanel.add(selectPanel); HorizontalPanel constraintMatchPanel = createConstraintMatchPanel(); horizontalPanel.add(constraintMatchPanel); horizontalPanel.setCellWidth(labelPanel, "150px"); horizontalPanel.setCellWidth(selectPanel, "70px"); initWidget(horizontalPanel); }
From source file:org.optaplanner.workbench.screens.guidedrule.client.widget.ConstraintMatchRuleModellerWidget.java
License:Apache License
public ConstraintMatchRuleModellerWidget(final RuleModeller mod, final EventBus eventBus, final AbstractActionConstraintMatch actionConstraintMatch, final TranslationService translationService, final Boolean readOnly, final String labelTranslationKey) { super(mod, eventBus, translationService); HorizontalPanel horizontalPanel = new HorizontalPanel(); HorizontalPanel labelPanel = createLabelPanel(translationService.getTranslation(labelTranslationKey)); horizontalPanel.add(labelPanel);//from w ww . j a v a 2 s . co m HorizontalPanel constraintMatchPanel = createConstraintMatchPanel(actionConstraintMatch); horizontalPanel.add(constraintMatchPanel); horizontalPanel.setCellWidth(labelPanel, "150px"); initWidget(horizontalPanel); }
From source file:org.optaplanner.workbench.screens.guidedrule.client.widget.MultiConstraintBendableMatchRuleModellerWidget.java
License:Apache License
private HorizontalPanel createBendableConstraintMatchRow(final String labelText, final int index, final List<HelpIcon> hardConstraintMatchHelpIcons, final List<ConstraintMatchInputWidget> constraintMatchInputWidgets, final AbstractActionBendableConstraintMatch constraintMatch) { HorizontalPanel horizontalPanel = new HorizontalPanel(); HorizontalPanel labelPanel = new HorizontalPanel(); labelPanel.add(new Label(labelText)); horizontalPanel.add(labelPanel);/*from w w w . j a va2 s . c om*/ HorizontalPanel selectPanel = new HorizontalPanel(); TextBox constraintLevelTextBox = new TextBox(); constraintLevelTextBox.setEnabled(false); constraintLevelTextBox.getElement().getStyle().setWidth(40, Style.Unit.PX); constraintLevelTextBox.setValue(String.valueOf(index)); selectPanel.add(constraintLevelTextBox); HelpIcon constraintLevelSelectHelpIcon = new HelpIcon(); hardConstraintMatchHelpIcons.add(constraintLevelSelectHelpIcon); constraintLevelSelectHelpIcon.setVisible(false); constraintLevelSelectHelpIcon.setHelpContent(translationService .getTranslation(GuidedRuleEditorConstants.RuleModellerActionPlugin_ScoreLevelExceeded)); constraintLevelSelectHelpIcon.getElement().getStyle().setPaddingLeft(5, Style.Unit.PX); selectPanel.add(constraintLevelSelectHelpIcon); horizontalPanel.add(selectPanel); ConstraintMatchInputWidget constraintMatchInputWidget = new ConstraintMatchInputWidget(constraintMatch); constraintMatchInputWidget .addConstraintMatchValueChangeHandler(new ConstraintMatchValueChangeHandler(constraintMatch)); constraintMatchInputWidgets.add(constraintMatchInputWidget); horizontalPanel.add(constraintMatchInputWidget); horizontalPanel.setCellWidth(labelPanel, "150px"); horizontalPanel.setCellWidth(selectPanel, "70px"); horizontalPanel.setStyleName(GuidedRuleEditorResources.INSTANCE.css().multiConstraintMatch()); horizontalPanel.getElement().getStyle().setWidth(100, Style.Unit.PCT); return horizontalPanel; }
From source file:org.optaplanner.workbench.screens.guidedrule.client.widget.MultiConstraintHardMediumSoftMatchRuleModellerWidget.java
License:Apache License
private HorizontalPanel getItemPanel(final String labelText, final IsWidget constraintMatchWidget) { HorizontalPanel horizontalPanel = new HorizontalPanel(); horizontalPanel.setWidth("100%"); HorizontalPanel labelPanel = new HorizontalPanel(); Label label = new Label(labelText); labelPanel.add(label);// w ww .j a v a 2 s .c om horizontalPanel.add(labelPanel); horizontalPanel.add(constraintMatchWidget); horizontalPanel.setCellWidth(labelPanel, "150px"); return horizontalPanel; }
From source file:org.optaplanner.workbench.screens.guidedrule.client.widget.MultiConstraintHardSoftMatchRuleModellerWidget.java
License:Apache License
private HorizontalPanel getItemPanel(final String labelText, final IsWidget constraintWidget) { HorizontalPanel horizontalPanel = new HorizontalPanel(); HorizontalPanel labelPanel = new HorizontalPanel(); Label label = new Label(labelText); labelPanel.add(label);/* ww w.j ava 2 s . co m*/ horizontalPanel.add(labelPanel); horizontalPanel.add(constraintWidget); horizontalPanel.setWidth("100%"); horizontalPanel.setCellWidth(labelPanel, "150px"); return horizontalPanel; }