List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellHeight
public void setCellHeight(IsWidget w, String height)
From source file:org.kaaproject.kaa.server.admin.client.mvp.view.ctl.CtlSchemaViewImpl.java
License:Apache License
@Override protected void constructTopPanel() { FlexTable flexTable = new FlexTable(); flexTable.setCellSpacing(0);/* ww w . j ava2 s .c o m*/ flexTable.setCellPadding(0); flexTable.setHeight("100%"); topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); topPanel.add(flexTable); topPanel.setCellHeight(flexTable, "100%"); HorizontalPanel backButtonPanel = new HorizontalPanel(); backButtonPanel.setHeight("100%"); backButtonPanel.addStyleName(Utils.kaaAdminStyle.bAppPaddedPanel()); backButtonPanel.setVisible(false); flexTable.setWidget(0, 0, backButtonPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE); backButtonPanelWidget = backButtonPanel; Button backButton = new Button(); backButton.addStyleName(Utils.kaaAdminStyle.bAppBackButton()); backButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); backButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); backButtonPanel.add(backButton); backButtonPanel.setCellHeight(backButton, "100%"); backButtonWidget = backButton; VerticalPanel verticalPanel = new VerticalPanel(); verticalPanel.setHeight("100%"); flexTable.setWidget(0, 1, verticalPanel); flexTable.getFlexCellFormatter().setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_MIDDLE); HorizontalPanel firstRowPanel = new HorizontalPanel(); firstRowPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); firstRowPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); verticalPanel.add(firstRowPanel); HorizontalPanel secondRowPanel = new HorizontalPanel(); secondRowPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT); secondRowPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); if (!create) { backButton.getElement().getStyle().setPaddingTop(25, Unit.PX); backButton.getElement().getStyle().setPaddingBottom(25, Unit.PX); firstRowPanel.setHeight("45px"); firstRowPanel.getElement().getStyle().setPaddingBottom(5, Unit.PX); secondRowPanel.setHeight("45px"); topPanel.setHeight("105px"); topPanel.getElement().getStyle().setPaddingTop(10, Unit.PX); updateNorthSize(185); } else { firstRowPanel.setHeight("70px"); secondRowPanel.setHeight("100%"); topPanel.setHeight("80px"); updateNorthSize(175); } verticalPanel.add(secondRowPanel); Label titleLabel = new Label(); titleLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle()); firstRowPanel.add(titleLabel); firstRowPanel.setCellHeight(titleLabel, "100%"); titleLabelWidget = titleLabel; int horizontalMargin = 15; scope = new Label(); scope.getElement().getStyle().setFontSize(16, Unit.PX); scope.getElement().getStyle().setFontWeight(FontWeight.NORMAL); scope.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); firstRowPanel.add(scope); firstRowPanel.setCellHeight(scope, "100%"); updateSchemaScopeButton = new Button(Utils.constants.promote()); updateSchemaScopeButton.setVisible(!create && editable); updateSchemaScopeButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (hasUpdateScopeOption()) { firstRowPanel.add(updateSchemaScopeButton); firstRowPanel.setCellHeight(updateSchemaScopeButton, "100%"); } Label versionLabel = new Label(Utils.constants.version()); versionLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle()); versionLabel.getElement().getStyle().setFontSize(16, Unit.PX); versionLabel.getElement().getStyle().setFontWeight(FontWeight.NORMAL); version = new IntegerListBox(); version.getElement().getStyle().setPadding(5, Unit.PX); version.getElement().getStyle().setMarginLeft(10, Unit.PX); HorizontalPanel versionPanel = new HorizontalPanel(); versionPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE); versionPanel.add(versionLabel); versionPanel.add(version); versionPanel.setVisible(!create); secondRowPanel.add(versionPanel); secondRowPanel.setCellHeight(versionPanel, "100%"); createNewSchemaVersionButton = new Button(Utils.constants.createNewVersion()); createNewSchemaVersionButton.setVisible(!create && editable); createNewSchemaVersionButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (!create && editable) { secondRowPanel.add(createNewSchemaVersionButton); secondRowPanel.setCellHeight(createNewSchemaVersionButton, "100%"); } exportActionsButton = new ActionsButton(Utils.resources.export(), Utils.constants.export()); exportActionsButton.setVisible(!create); exportActionsButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (!create) { secondRowPanel.add(exportActionsButton); secondRowPanel.setCellHeight(exportActionsButton, "100%"); } Button saveButton = new Button(); saveButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (create) { firstRowPanel.add(saveButton); firstRowPanel.setCellHeight(saveButton, "100%"); } saveButtonWidget = saveButton; Button cancelButton = new Button(); cancelButton.setVisible(false); cancelButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (create) { firstRowPanel.add(cancelButton); firstRowPanel.setCellHeight(cancelButton, "100%"); } cancelButtonWidget = cancelButton; deleteSchemaVersionButton = new Button(Utils.constants.delete()); deleteSchemaVersionButton.addStyleName(Utils.kaaAdminStyle.deleteButton()); deleteSchemaVersionButton.setVisible(!create && editable); deleteSchemaVersionButton.getElement().getStyle().setMarginLeft(horizontalMargin, Unit.PX); if (!create && editable) { secondRowPanel.add(deleteSchemaVersionButton); secondRowPanel.setCellHeight(deleteSchemaVersionButton, "100%"); } }
From source file:org.opencms.gwt.client.ui.input.colorpicker.CmsColorSelector.java
License:Open Source License
/** * Constructor to create an CmsColorPicker. <p> *//*from w w w. jav a2s . co m*/ public CmsColorSelector() { m_hue = 0; m_saturation = 100; m_brightness = 100; m_red = 255; m_green = 0; m_blue = 0; HorizontalPanel panel = new HorizontalPanel(); panel.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().colorSelectorWidget()); FlexTable table = new FlexTable(); // Add the slider map m_slidermap = new CmsSliderMap(this); panel.add(m_slidermap); panel.setCellWidth(m_slidermap, "258px"); panel.setCellHeight(m_slidermap, "258px"); // Add the slider bar m_sliderbar = new CmsSliderBar(this); panel.add(m_sliderbar); panel.setCellWidth(m_sliderbar, "40px"); panel.setCellHeight(m_sliderbar, "258px"); m_colorpreview = new HTML(""); m_colorpreview.setWidth("auto"); m_colorpreview.setHeight("50px"); m_colorpreview.getElement().getStyle().setBorderColor("black"); m_colorpreview.getElement().getStyle().setBorderStyle(BorderStyle.SOLID); m_colorpreview.getElement().getStyle().setBorderWidth(1, Unit.PX); // Radio buttons m_rbHue = new CmsRadioButton("H:", "H:"); m_rbHue.setGroup(m_radioButtonGroup); m_rbHue.addClickHandler(this); m_rbSaturation = new CmsRadioButton("S:", "S:"); m_rbSaturation.setGroup(m_radioButtonGroup); m_rbSaturation.addClickHandler(this); m_rbBrightness = new CmsRadioButton("V:", "V:"); m_rbBrightness.setGroup(m_radioButtonGroup); m_rbBrightness.addClickHandler(this); m_rbRed = new CmsRadioButton("R:", "R:"); m_rbRed.setGroup(m_radioButtonGroup); m_rbRed.addClickHandler(this); m_rbGreen = new CmsRadioButton("G:", "G:"); m_rbGreen.setGroup(m_radioButtonGroup); m_rbGreen.addClickHandler(this); m_rbBlue = new CmsRadioButton("B:", "B:"); m_rbBlue.setGroup(m_radioButtonGroup); m_rbBlue.addClickHandler(this); // Textboxes m_tbHue = new TextBox(); m_tbHue.setText(new Integer(m_hue).toString()); m_tbHue.setMaxLength(3); m_tbHue.setVisibleLength(6); m_tbHue.addKeyPressHandler(this); m_tbHue.addChangeHandler(this); m_tbHue.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); m_tbSaturation = new TextBox(); m_tbSaturation.setText(new Integer(m_saturation).toString()); m_tbSaturation.setMaxLength(3); m_tbSaturation.setVisibleLength(6); m_tbSaturation.addKeyPressHandler(this); m_tbSaturation.addChangeHandler(this); m_tbSaturation.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); m_tbBrightness = new TextBox(); m_tbBrightness.setText(new Integer(m_brightness).toString()); m_tbBrightness.setMaxLength(3); m_tbBrightness.setVisibleLength(6); m_tbBrightness.addKeyPressHandler(this); m_tbBrightness.addChangeHandler(this); m_tbBrightness.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); m_tbRed = new TextBox(); m_tbRed.setText(new Integer(m_red).toString()); m_tbRed.setMaxLength(3); m_tbRed.setVisibleLength(6); m_tbRed.addKeyPressHandler(this); m_tbRed.addChangeHandler(this); m_tbRed.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); m_tbGreen = new TextBox(); m_tbGreen.setText(new Integer(m_green).toString()); m_tbGreen.setMaxLength(3); m_tbGreen.setVisibleLength(6); m_tbGreen.addKeyPressHandler(this); m_tbGreen.addChangeHandler(this); m_tbGreen.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); m_tbBlue = new TextBox(); m_tbBlue.setText(new Integer(m_blue).toString()); m_tbBlue.setMaxLength(3); m_tbBlue.setVisibleLength(6); m_tbBlue.addKeyPressHandler(this); m_tbBlue.addChangeHandler(this); m_tbBlue.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); m_tbHexColor = new TextBox(); m_tbHexColor.setText(m_stcolor); m_tbHexColor.setMaxLength(6); m_tbHexColor.setVisibleLength(6); m_tbHexColor.addKeyPressHandler(this); m_tbHexColor.addChangeHandler(this); m_tbHexColor.addStyleName(I_CmsLayoutBundle.INSTANCE.colorSelectorCss().tableField()); // Put together the FlexTable table.setWidget(0, 1, m_colorpreview); table.setWidget(1, 0, m_rbHue); table.setWidget(1, 1, m_tbHue); table.setWidget(1, 2, new HTML("°")); table.setWidget(2, 0, m_rbSaturation); table.setWidget(2, 1, m_tbSaturation); table.setText(2, 2, "%"); table.setWidget(3, 0, m_rbBrightness); table.setWidget(3, 1, m_tbBrightness); table.setText(3, 2, "%"); table.setWidget(4, 0, m_rbRed); table.setWidget(4, 1, m_tbRed); table.setWidget(5, 0, m_rbGreen); table.setWidget(5, 1, m_tbGreen); table.setWidget(6, 0, m_rbBlue); table.setWidget(6, 1, m_tbBlue); table.setText(7, 0, "Web:"); table.setWidget(7, 1, m_tbHexColor); table.setCellSpacing(3); // Final setup panel.add(table); m_radioButtonGroup.selectButton(m_rbRed); setPreview(m_stcolor); m_colorpreview.getElement().getStyle().setCursor(Cursor.DEFAULT); // First event onClick(m_radioButtonGroup.getSelectedButton()); initWidget(panel); }
From source file:org.pentaho.gwt.widgets.client.colorpicker.ColorPicker.java
License:Artistic License
public ColorPicker() { // UI Drawing // ------------------ hue = 0;/*from ww w .j a v a 2 s .c o m*/ saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; HorizontalPanel panel = new HorizontalPanel(); FlexTable table = new FlexTable(); // Add the large slider map slidermap = new SliderMap(this); panel.add(slidermap); panel.setCellWidth(slidermap, "258px"); //$NON-NLS-1$ panel.setCellHeight(slidermap, "258px"); //$NON-NLS-1$ // Add the small slider bar sliderbar = new SliderBar(this); panel.add(sliderbar); panel.setCellWidth(sliderbar, "40px"); //$NON-NLS-1$ panel.setCellHeight(sliderbar, "258px"); //$NON-NLS-1$ // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); //$NON-NLS-1$ colorpreview.setWidth("50px"); //$NON-NLS-1$ colorpreview.setHeight("50px"); //$NON-NLS-1$ DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); //$NON-NLS-1$ //$NON-NLS-2$ // Radio buttons rbHue = new RadioButton("color", "H:"); //$NON-NLS-1$ //$NON-NLS-2$ rbHue.addClickListener(this); rbSaturation = new RadioButton("color", "S:"); //$NON-NLS-1$ //$NON-NLS-2$ rbSaturation.addClickListener(this); rbBrightness = new RadioButton("color", "V:"); //$NON-NLS-1$ //$NON-NLS-2$ rbBrightness.addClickListener(this); rbRed = new RadioButton("color", "R:"); //$NON-NLS-1$ //$NON-NLS-2$ rbRed.addClickListener(this); rbGreen = new RadioButton("color", "G:"); //$NON-NLS-1$ //$NON-NLS-2$ rbGreen.addClickListener(this); rbBlue = new RadioButton("color", "B:"); //$NON-NLS-1$ //$NON-NLS-2$ rbBlue.addClickListener(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyboardListener(this); tbHue.addChangeListener(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbSaturation.addKeyboardListener(this); tbSaturation.addChangeListener(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbBrightness.addKeyboardListener(this); tbBrightness.addChangeListener(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbRed.addKeyboardListener(this); tbRed.addChangeListener(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbGreen.addKeyboardListener(this); tbGreen.addChangeListener(this); tbBlue = new TextBox(); tbBlue.setText(new Integer(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbBlue.addKeyboardListener(this); tbBlue.addChangeListener(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); //$NON-NLS-1$ tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHexColor.addKeyboardListener(this); tbHexColor.addChangeListener(this); // Put together the FlexTable table.setWidget(0, 0, colorpreview); table.getFlexCellFormatter().setColSpan(0, 0, 3); table.setWidget(1, 0, rbHue); table.setWidget(1, 1, tbHue); table.setWidget(1, 2, new HTML("°")); //$NON-NLS-1$ table.setWidget(2, 0, rbSaturation); table.setWidget(2, 1, tbSaturation); table.setText(2, 2, "%"); //$NON-NLS-1$ table.setWidget(3, 0, rbBrightness); table.setWidget(3, 1, tbBrightness); table.setText(3, 2, "%"); //$NON-NLS-1$ table.setWidget(4, 0, rbRed); table.setWidget(4, 1, tbRed); table.setWidget(5, 0, rbGreen); table.setWidget(5, 1, tbGreen); table.setWidget(6, 0, rbBlue); table.setWidget(6, 1, tbBlue); table.setText(7, 0, "#:"); //$NON-NLS-1$ table.setWidget(7, 1, tbHexColor); table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup panel.add(table); rbSaturation.setChecked(true); setPreview("ff0000"); //$NON-NLS-1$ DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); //$NON-NLS-1$ //$NON-NLS-2$ // First event onClick(rbSaturation); initWidget(panel); }
From source file:org.pentaho.pat.client.util.colorpicker.ColorPicker.java
License:Artistic License
public ColorPicker() { // UI Drawing // ------------------ hue = 0;/* w ww . j av a 2 s .com*/ saturation = 100; brightness = 100; red = 255; green = 0; blue = 0; HorizontalPanel panel = new HorizontalPanel(); FlexTable table = new FlexTable(); // Add the large slider map slidermap = new SliderMap(this); panel.add(slidermap); panel.setCellWidth(slidermap, "258px"); //$NON-NLS-1$ panel.setCellHeight(slidermap, "258px"); //$NON-NLS-1$ // Add the small slider bar sliderbar = new SliderBar(this); panel.add(sliderbar); panel.setCellWidth(sliderbar, "40px"); //$NON-NLS-1$ panel.setCellHeight(sliderbar, "258px"); //$NON-NLS-1$ // Define the Flextable's content // Color preview at the top colorpreview = new HTML(""); //$NON-NLS-1$ colorpreview.setWidth("50px"); //$NON-NLS-1$ colorpreview.setHeight("50px"); //$NON-NLS-1$ DOM.setStyleAttribute(colorpreview.getElement(), "border", "1px solid black"); //$NON-NLS-1$ //$NON-NLS-2$ // Radio buttons rbHue = new RadioButton("color", "H:"); //$NON-NLS-1$ //$NON-NLS-2$ rbHue.addClickHandler(this); rbSaturation = new RadioButton("color", "S:"); //$NON-NLS-1$ //$NON-NLS-2$ rbSaturation.addClickHandler(this); rbBrightness = new RadioButton("color", "V:"); //$NON-NLS-1$ //$NON-NLS-2$ rbBrightness.addClickHandler(this); rbRed = new RadioButton("color", "R:"); //$NON-NLS-1$ //$NON-NLS-2$ rbRed.addClickHandler(this); rbGreen = new RadioButton("color", "G:"); //$NON-NLS-1$ //$NON-NLS-2$ rbGreen.addClickHandler(this); rbBlue = new RadioButton("color", "B:"); //$NON-NLS-1$ //$NON-NLS-2$ rbBlue.addClickHandler(this); // Textboxes tbHue = new TextBox(); tbHue.setText(new Integer(hue).toString()); tbHue.setMaxLength(3); tbHue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbHue.addChangeHandler(this); tbSaturation = new TextBox(); tbSaturation.setText(new Integer(saturation).toString()); tbSaturation.setMaxLength(3); tbSaturation.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbSaturation.addChangeHandler(this); tbBrightness = new TextBox(); tbBrightness.setText(new Integer(brightness).toString()); tbBrightness.setMaxLength(3); tbBrightness.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbBrightness.addChangeHandler(this); tbRed = new TextBox(); tbRed.setText(new Integer(red).toString()); tbRed.setMaxLength(3); tbRed.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbRed.addChangeHandler(this); tbGreen = new TextBox(); tbGreen.setText(new Integer(green).toString()); tbGreen.setMaxLength(3); tbGreen.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbGreen.addChangeHandler(this); tbBlue = new TextBox(); tbBlue.setText(Integer.valueOf(blue).toString()); tbBlue.setMaxLength(3); tbBlue.setVisibleLength(4); tbHue.addKeyPressHandler(this); tbBlue.addChangeHandler(this); tbHexColor = new TextBox(); tbHexColor.setText("ff0000"); //$NON-NLS-1$ tbHexColor.setMaxLength(6); tbHexColor.setVisibleLength(6); tbHue.addKeyPressHandler(this); tbHexColor.addChangeHandler(this); // Put together the FlexTable table.setWidget(0, 0, colorpreview); table.getFlexCellFormatter().setColSpan(0, 0, 3); table.setWidget(1, 0, rbHue); table.setWidget(1, 1, tbHue); table.setWidget(1, 2, new HTML("°")); //$NON-NLS-1$ table.setWidget(2, 0, rbSaturation); table.setWidget(2, 1, tbSaturation); table.setText(2, 2, "%"); //$NON-NLS-1$ table.setWidget(3, 0, rbBrightness); table.setWidget(3, 1, tbBrightness); table.setText(3, 2, "%"); //$NON-NLS-1$ table.setWidget(4, 0, rbRed); table.setWidget(4, 1, tbRed); table.setWidget(5, 0, rbGreen); table.setWidget(5, 1, tbGreen); table.setWidget(6, 0, rbBlue); table.setWidget(6, 1, tbBlue); table.setText(7, 0, "#:"); //$NON-NLS-1$ table.setWidget(7, 1, tbHexColor); table.getFlexCellFormatter().setColSpan(7, 1, 2); // Final setup panel.add(table); rbSaturation.setValue(true); setPreview("ff0000"); //$NON-NLS-1$ DOM.setStyleAttribute(colorpreview.getElement(), "cursor", "default"); //$NON-NLS-1$ //$NON-NLS-2$ // First event onClick2(rbSaturation); initWidget(panel); }