Example usage for com.google.gwt.user.client.ui HorizontalPanel setCellWidth

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellWidth

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui HorizontalPanel setCellWidth.

Prototype

public void setCellWidth(IsWidget w, String width) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:org.pentaho.mantle.client.admin.UserRolesAdminPanel.java

License:Open Source License

private Widget createRolesPanel() {

    HorizontalPanel mainRolesPanel = new HorizontalPanel();
    mainRolesPanel.getElement().setId("admin-roles-panel");
    SimplePanel hSpacer = new SimplePanel();
    hSpacer.setWidth("15px");
    mainRolesPanel.add(hSpacer);/*  w  ww  .j av a  2s . co m*/

    VerticalPanel availablePanel = new VerticalPanel();
    mainRolesPanel.add(availablePanel);
    hSpacer = new SimplePanel();
    hSpacer.setHeight("15px");
    availablePanel.add(hSpacer);

    HorizontalPanel labelAndButtonsPanel = new HorizontalPanel();
    labelAndButtonsPanel.setWidth("100%");
    availablePanel.add(labelAndButtonsPanel);
    Label rolesLabel = new Label(Messages.getString("roles"));
    labelAndButtonsPanel.add(rolesLabel);
    labelAndButtonsPanel.setCellWidth(rolesLabel, "100%");
    hSpacer = new SimplePanel();
    hSpacer.setWidth("100%");
    labelAndButtonsPanel.add(hSpacer);
    labelAndButtonsPanel.setCellWidth(hSpacer, "100%");
    newRoleButton = new ThemeableImageButton(addButtonStyles, null, Messages.getString("new"));
    labelAndButtonsPanel.add(newRoleButton);
    hSpacer = new SimplePanel();
    hSpacer.setWidth("7px");
    labelAndButtonsPanel.add(hSpacer);
    deleteRoleButton = new ThemeableImageButton(removeButtonStyles, null, Messages.getString("delete"));
    labelAndButtonsPanel.add(deleteRoleButton);

    rolesListBox = new ListBoxTitle(true);
    HorizontalScrollWrapper rolesListBoxWrapper = new HorizontalScrollWrapper(rolesListBox);
    availablePanel.add(rolesListBoxWrapper);
    availablePanel.setCellHeight(rolesListBoxWrapper, "100%");
    rolesListBox.setVisibleItemCount(20);
    rolesListBox.addStyleName("users-roles-list");

    hSpacer = new SimplePanel();
    hSpacer.setWidth("24px");
    mainRolesPanel.add(hSpacer);

    VerticalPanel detailsPanel = new VerticalPanel();
    mainRolesPanel.add(detailsPanel);
    mainRolesPanel.setCellWidth(detailsPanel, "100%");

    hSpacer = new SimplePanel();
    hSpacer.setHeight("15px");
    detailsPanel.add(hSpacer);

    //todo check if replacement required
    rolesPermissionsPanel = new PermissionsPanel(rolesListBox);
    detailsPanel.add(rolesPermissionsPanel);

    usersLabelPanel = new VerticalPanel();
    Label usersLabel = new Label(Messages.getString("users"));
    usersLabel.setStyleName("pentaho-fieldgroup-minor");
    hSpacer = new SimplePanel();
    hSpacer.setHeight("15px");
    usersLabelPanel.add(hSpacer);
    usersLabelPanel.add(usersLabel);
    hSpacer = new SimplePanel();
    hSpacer.setHeight("15px");
    usersLabelPanel.add(hSpacer);
    detailsPanel.add(usersLabelPanel);

    usersPanel = new HorizontalPanel();
    usersPanel.getElement().setId("users-panel");
    detailsPanel.add(usersPanel);

    VerticalPanel availableMembersPanel = new VerticalPanel();
    usersPanel.add(availableMembersPanel);

    availableMembersPanel.add(new Label(Messages.getString("available") + ":"));
    availableMembersListBox = new ListBoxTitle(true);
    HorizontalScrollWrapper availableMembersListBoxWrapper = new HorizontalScrollWrapper(
            availableMembersListBox);
    availableMembersPanel.add(availableMembersListBoxWrapper);
    availableMembersListBox.setVisibleItemCount(20);
    availableMembersListBox.addStyleName("users-roles-selection-list");

    VerticalPanel vSpacer = new VerticalPanel();
    vSpacer.setWidth("15px");
    usersPanel.add(vSpacer);

    VerticalPanel arrowsPanel = new VerticalPanel();
    usersPanel.add(arrowsPanel);
    arrowsPanel.setWidth("35px");

    hSpacer = new SimplePanel();
    hSpacer.setHeight("80px");
    arrowsPanel.add(hSpacer);

    addUserButton = new ThemeableImageButton(accumAddButtonStyles, null, null);
    arrowsPanel.add(addUserButton);
    hSpacer = new SimplePanel();
    hSpacer.setHeight("10px");
    arrowsPanel.add(hSpacer);

    removeUserButton = new ThemeableImageButton(accumRemoveButtonStyles, null, null);
    arrowsPanel.add(removeUserButton);
    hSpacer = new SimplePanel();
    hSpacer.setHeight("30px");
    arrowsPanel.add(hSpacer);

    addAllUsersButton = new ThemeableImageButton(accumAddAllButtonStyles, null, null);
    arrowsPanel.add(addAllUsersButton);
    hSpacer = new SimplePanel();
    hSpacer.setHeight("10px");
    arrowsPanel.add(hSpacer);

    removeAllUsersButton = new ThemeableImageButton(accumRemoveAllButtonStyles, null, null);
    arrowsPanel.add(removeAllUsersButton);

    VerticalPanel selectedMembersPanel = new VerticalPanel();
    usersPanel.add(selectedMembersPanel);
    selectedMembersPanel.add(new Label(Messages.getString("selected") + ":"));
    selectedMembersListBox = new ListBoxTitle(true);
    HorizontalScrollWrapper selectedMembersListBoxWrapper = new HorizontalScrollWrapper(selectedMembersListBox);
    selectedMembersPanel.add(selectedMembersListBoxWrapper);
    selectedMembersListBox.setVisibleItemCount(20);
    selectedMembersListBox.addStyleName("users-roles-selection-list");

    return mainRolesPanel;
}

From source file:org.pentaho.mantle.client.dialogs.folderchooser.LeafItemWidget.java

License:Open Source License

public LeafItemWidget(String title, String... styleName) {
    HorizontalPanel widget = new HorizontalPanel();
    initWidget(widget);/*from   w  ww .j a  v a  2s  .  c o  m*/

    leafImage = new Image(
            ScheduleHelper.getFullyQualifiedURL() + "content/common-ui/resources/themes/images/spacer.gif"); //ImageUtil.getThemeableImage( styleName );
    for (String style : styleName) {
        leafImage.addStyleName(style);
    }
    widget.add(leafImage);

    leafLabel = new Label(title);
    leafLabel.removeStyleName("gwt-Label");
    widget.add(leafLabel);
    widget.setCellWidth(leafLabel, "100%");
}

From source file:org.pentaho.mantle.client.solutionbrowser.tree.LeafItemWidget.java

License:Open Source License

public LeafItemWidget(String title, String... styleName) {
    HorizontalPanel widget = new HorizontalPanel();
    initWidget(widget);/*from   ww  w.  j a  v a2  s  . c  o  m*/

    leafImage = ImageUtil.getThemeableImage(styleName);
    widget.add(leafImage);

    leafLabel = new Label(title);
    leafLabel.removeStyleName("gwt-Label");
    widget.add(leafLabel);
    widget.setCellWidth(leafLabel, "100%");
}

From source file:org.pentaho.pac.client.PentahoAdminConsole.java

License:Open Source License

protected HorizontalPanel buildTopPanel() {
    HorizontalPanel topPanel = new HorizontalPanel();
    SimplePanel logo = new SimplePanel();
    logo.setStyleName("logo"); //$NON-NLS-1$
    topPanel.setWidth("100%"); //$NON-NLS-1$
    topPanel.add(logo);/*from   w w  w  . j  a  va2s.c  o  m*/
    topPanel.add(toolbar);
    topPanel.setCellWidth(toolbar, "100%"); //$NON-NLS-1$
    return topPanel;
}

From source file:org.pentaho.pac.client.UsersAndRolesPanel.java

License:Open Source License

public UsersAndRolesPanel() {
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setStyleName("deckToolbar"); //$NON-NLS-1$

    horizontalPanel.add(rolesButton);/*  ww w  .  j av a  2  s . c o  m*/
    horizontalPanel.add(usersButton);
    Label spacer = new Label(""); //$NON-NLS-1$
    horizontalPanel.add(spacer);
    horizontalPanel.setCellWidth(spacer, "100%"); //$NON-NLS-1$
    this.setSpacing(4);
    add(horizontalPanel, DockPanel.NORTH);

    setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);

    usersButton.setTitle(Messages.getString("clickEditUsers")); //$NON-NLS-1$
    rolesButton.setTitle(Messages.getString("clickEditRoles")); //$NON-NLS-1$

    usersButton.setStylePrimaryName("usersToggleBtn"); //$NON-NLS-1$
    rolesButton.setStylePrimaryName("rolesToggleBtn"); //$NON-NLS-1$

    deckPanel.add(rolesPanel);
    deckPanel.add(usersPanel);
    add(deckPanel, DockPanel.CENTER);

    setCellWidth(deckPanel, "100%"); //$NON-NLS-1$
    setCellHeight(deckPanel, "100%"); //$NON-NLS-1$

    deckPanel.setWidth("100%"); //$NON-NLS-1$
    deckPanel.setHeight("100%"); //$NON-NLS-1$

    deckPanel.showWidget(0);
    usersButton.setDown(false);
    rolesButton.setDown(true);
    usersButton.addClickListener(this);
    rolesButton.addClickListener(this);
}

From source file:org.pentaho.pat.client.util.colorpicker.ColorPicker.java

License:Artistic License

public ColorPicker() {
    // UI Drawing
    // ------------------

    hue = 0;/* w w w.j  a  v  a2 s.c om*/
    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);
}

From source file:org.pentaho.ui.xul.gwt.tags.GwtConfirmBox.java

License:Open Source License

@Override
public Panel getButtonPanel() {
    acceptBtn.setText(acceptLabel);/*from   w w w  .  ja  va 2 s  .c o m*/
    cancelBtn.setText(cancelLabel);

    HorizontalPanel hp = new HorizontalPanel();
    hp.add(acceptBtn);
    hp.setCellWidth(acceptBtn, "100%");
    hp.setCellHorizontalAlignment(acceptBtn, hp.ALIGN_RIGHT);
    hp.add(cancelBtn);
    return hp;
}

From source file:org.pentaho.ui.xul.gwt.tags.GwtDialog.java

License:Open Source License

@Override
public Panel getButtonPanel() {
    if (dialogButtons.isEmpty()) {
        return new SimplePanel();
    }//ww w.  ja  v  a 2s.co  m
    // Check for individual button alignment. If the main align properties is set on the Dialog box then all the
    // individual alignment for the button will be ignored
    boolean ignoreIndividualButtonAlign = false;
    String buttonalign = getButtonalign();
    if (!StringUtils.isEmpty(buttonalign)) {
        ignoreIndividualButtonAlign = true;
    }

    // HorizontalPanel buttonPanel = new HorizontalPanel();
    HorizontalPanel buttonPanel = new HorizontalPanel();
    HorizontalPanel leftButtonPanel = new HorizontalPanel();
    HorizontalPanel centerButtonPanel = new HorizontalPanel();
    HorizontalPanel rightButtonPanel = new HorizontalPanel();
    rightButtonPanel.setStylePrimaryName("buttonTable");
    centerButtonPanel.setStylePrimaryName("buttonTable");
    leftButtonPanel.setStylePrimaryName("buttonTable");

    // keep track of the number in the left and right button cells. If they're not the same, add shims to fix the
    // center
    // balance

    for (XulButton btn : dialogButtons) {
        this.removeChild(btn);
        Widget widget = (Widget) btn.getManagedObject();
        if (!ignoreIndividualButtonAlign) {
            String align = btn.getAlign();
            if (!StringUtils.isEmpty(align)) {
                if ("center".equals(align)) { //$NON-NLS-1$
                    centerButtonPanel.add(widget);
                } else if ("left".equals(align)) { //$NON-NLS-1$
                    leftButtonPanel.add(widget);
                } else {
                    // default to right
                    rightButtonPanel.add(widget);
                }
            } else {
                rightButtonPanel.add(widget);
            }
        } else {
            if ("center".equals(buttonalign)) { //$NON-NLS-1$
                centerButtonPanel.add(widget);
            } else if ("left".equals(buttonalign)) { //$NON-NLS-1$
                leftButtonPanel.add(widget);
            } else {
                // default to right
                rightButtonPanel.add(widget);
            }
        }
    }

    buttonPanel.add(leftButtonPanel);
    buttonPanel.setCellHorizontalAlignment(leftButtonPanel, HorizontalPanel.ALIGN_LEFT);
    buttonPanel.setCellWidth(leftButtonPanel, "33%");
    buttonPanel.add(centerButtonPanel);
    buttonPanel.setCellHorizontalAlignment(centerButtonPanel, HorizontalPanel.ALIGN_CENTER);
    buttonPanel.setCellWidth(centerButtonPanel, "33%");
    buttonPanel.add(rightButtonPanel);
    buttonPanel.setCellHorizontalAlignment(rightButtonPanel, HorizontalPanel.ALIGN_RIGHT);
    buttonPanel.setCellWidth(leftButtonPanel, "33%");
    buttonPanel.setWidth("100%");

    return buttonPanel;
}

From source file:org.pentaho.ui.xul.gwt.tags.GwtMessageBox.java

License:Open Source License

@Override
public Panel getButtonPanel() {
    HorizontalPanel hp = new HorizontalPanel();
    acceptBtn.setText(this.acceptLabel);
    hp.add(acceptBtn);//  w  w  w  .ja va 2s .  co m
    hp.setCellWidth(acceptBtn, "100%");
    hp.setCellHorizontalAlignment(acceptBtn, hp.ALIGN_CENTER);
    return hp;
}

From source file:org.pentaho.ui.xul.gwt.util.GenericDialog.java

License:Open Source License

public void show() {
    // Instantiation if delayed to prevent errors with the underlying GWT's not being able to calculate available
    // size//from  w w  w.java 2s .com
    // in the case that the GWT app has been loaded into an iframe that's not visible.
    if (dialog == null) {
        createDialog();
    }
    dialog.setText(title);

    contents.clear();

    // implement the buttons
    VerticalPanel panel = new VerticalPanel();

    Panel p = getDialogContents();
    p.setSize("100%", "100%");

    p.setStyleName("dialog-content"); //$NON-NLS-1$

    panel.add(p);
    panel.setCellHeight(p, "100%");
    panel.setStyleName("dialog"); //$NON-NLS-1$
    panel.setWidth("100%"); //$NON-NLS-1$
    panel.setSpacing(0);
    panel.setHeight("100%"); //$NON-NLS-1$
    contents.add(panel);
    contents.setCellHeight(panel, "100%");

    if (getBgcolor() != null) {
        p.getElement().getStyle().setProperty("backgroundColor", getBgcolor());
    }

    p = this.getButtonPanel();
    p.setWidth("100%");
    HorizontalPanel buttonPanelWrapper = new HorizontalPanel();
    buttonPanelWrapper.setStyleName("button-panel"); //$NON-NLS-1$
    buttonPanelWrapper.add(p);
    buttonPanelWrapper.setWidth("100%"); //$NON-NLS-1$
    buttonPanelWrapper.setCellWidth(p, "100%");
    contents.add(buttonPanelWrapper);

    contents.setWidth("100%"); //$NON-NLS-1$
    contents.setHeight("100%"); //$NON-NLS-1$

    if (getWidth() > 0) {
        contents.setWidth(getWidth() + "px"); //$NON-NLS-1$
    }
    if (getHeight() > 0) {
        int offsetHeight = getHeight() - HEADER_HEIGHT;
        contents.setHeight(offsetHeight + "px"); //$NON-NLS-1$
    }
    dialog.center();
    dialog.show();

    // Show glasspane element
    RootPanel.get().add(glasspane);

    // Notify GlassPane listeners
    GlassPane.getInstance().show();

    glasspane.getElement().getStyle().setProperty("zIndex", "" + (GenericDialog.dialogPos)); //$NON-NLS-1$
    dialog.getElement().getStyle().setProperty("zIndex", "" + (++GenericDialog.dialogPos)); //$NON-NLS-1$

}