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

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

Introduction

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

Prototype

public void setSpacing(int spacing) 

Source Link

Document

Sets the amount of spacing between this panel's cells.

Usage

From source file:org.geowe.client.local.style.VectorLayerStyleWidget.java

License:Open Source License

@Override
public Widget asWidget() {
    if (panel == null) {
        applyButton = new TextButton(UIMessages.INSTANCE.vlswApplyButtonText());

        HorizontalPanel mainPanel = new HorizontalPanel();
        mainPanel.setSpacing(10);

        VerticalLayoutContainer vlc = new VerticalLayoutContainer();
        vlc.add(createTabPanel(), new VerticalLayoutData(-18, -1));

        HorizontalPanel hp = new HorizontalPanel();
        hp.setSpacing(5);/*w  w  w.ja  v  a 2s  .com*/
        hp.add(applyButton);

        vlc.add(hp, new VerticalLayoutData(1, 1, new Margins(35, 0, 0, 0)));

        panel = new FramedPanel();
        panel.setWidth(500);
        panel.setHeight(275);
        panel.setLayoutData(new MarginData(10));

        mainPanel.add(vlc);
        panel.add(mainPanel);

        panel.setAnimCollapse(true);

        panel.getHeader().setIcon(ImageProvider.INSTANCE.layerIcon());
        panel.getElement().getStyle().setPosition(Position.ABSOLUTE);
        panel.setPosition(300, 185);
        panel.getElement().getStyle().setBorderWidth(1.0, Unit.PX);
        panel.setVisible(false);

        new Draggable(panel, panel.getHeader());

        ToolButton tButton = new ToolButton(ToolButton.CLOSE);
        addCloseSelectHandler(tButton);
        panel.getHeader().addTool(tButton);
        panel.setCollapsible(true);
    }
    return panel;
}

From source file:org.geowe.client.local.style.VertexStyleTab.java

License:Open Source License

@Override
protected void initializePanel() {
    int fieldWidth = 100;

    vertexStyle = new VertexStyleComboBox(fieldWidth + "px");

    basicStyleOption = new RadioButton(RADIO_GROUP);
    basicStyleOption.setText(" " + UIMessages.INSTANCE.vlswBasicVertexStyle());
    basicStyleOption.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override/*  w w  w . j a v  a  2  s  . c o  m*/
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            vertexStyle.setEnabled(event.getValue());
            externalGraphic.setEnabled(!event.getValue());
            graphicWidth.setEnabled(!event.getValue());
            graphicHeight.setEnabled(!event.getValue());
        }
    });

    externalGraphic = new TextField();
    externalGraphic.setWidth(fieldWidth);
    externalGraphic.setEmptyText(UIMessages.INSTANCE.vlswVertexIconEmptyText());

    graphicWidth = new IntegerSpinnerField();
    graphicWidth.setWidth(fieldWidth / 2);

    graphicHeight = new IntegerSpinnerField();
    graphicHeight.setWidth(fieldWidth / 2);

    advancedStyleOption = new RadioButton(RADIO_GROUP);
    advancedStyleOption.setText(" " + UIMessages.INSTANCE.vlswAdvancedVertexStyle());
    advancedStyleOption.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            vertexStyle.setEnabled(!event.getValue());
            externalGraphic.setEnabled(event.getValue());
            graphicWidth.setEnabled(event.getValue());
            graphicHeight.setEnabled(event.getValue());
        }
    });

    HorizontalPanel mainPanel = new HorizontalPanel();
    mainPanel.setSpacing(10);

    VerticalPanel basicStyleContainer = new VerticalPanel();
    basicStyleContainer.setSpacing(5);
    basicStyleContainer.add(basicStyleOption);
    basicStyleContainer.add(new FieldLabel(vertexStyle, UIMessages.INSTANCE.vlswVertexStyle()));

    VerticalPanel advancedStyleContainer = new VerticalPanel();
    advancedStyleContainer.setSpacing(5);
    advancedStyleContainer.addStyleName(ThemeStyles.get().style().borderLeft());
    advancedStyleContainer.add(advancedStyleOption);
    advancedStyleContainer.add(new FieldLabel(externalGraphic, UIMessages.INSTANCE.vlswVertexIcon()));
    advancedStyleContainer.add(new FieldLabel(graphicWidth, UIMessages.INSTANCE.vlswVertexIconWidth()));
    advancedStyleContainer.add(new FieldLabel(graphicHeight, UIMessages.INSTANCE.vlswVertexIconHeight()));

    mainPanel.add(basicStyleContainer);
    mainPanel.add(advancedStyleContainer);

    panel.setSpacing(5);
    panel.add(mainPanel);
}

From source file:org.geowe.client.local.welcome.Welcome.java

License:Open Source License

private HorizontalPanel getPanel(final HTML data) {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSize("520px", "310px");
    panel.setSpacing(5);
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    Anchor anchor = new AnchorBuilder().setHref("http://www.geowe.org")
            .setImage(new Image(ImageProvider.INSTANCE.geoweSquareLogo())).build();

    panel.add(anchor);/*from   w  ww .j a  v a 2 s. com*/
    panel.add(data);
    return panel;
}

From source file:org.glimpse.client.AggregatorTabOptions.java

License:Open Source License

public AggregatorTabOptions(AggregatorTabPanel tabPanel) {
    this.tabPanel = tabPanel;

    FlowPanel mainPanel = new FlowPanel();
    mainPanel.setWidth("100%");
    SimplePanel closePanel = new SimplePanel();
    closePanel.setStylePrimaryName("taboptions-close");
    mainPanel.add(closePanel);//from  ww  w .  j ava  2s  .c  o m
    FocusPanel closeButton = new FocusPanel();
    closePanel.add(closeButton);
    closeButton.setWidget(new Image(Aggregator.TRANSPARENT_IMAGE));
    closeButton.setStylePrimaryName("taboptions-close-button");
    closeButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            AggregatorTabOptions.this.tabPanel.hideOptions();
        }
    });

    HorizontalPanelExt panel = new HorizontalPanelExt();
    mainPanel.add(panel);
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    HorizontalPanel movePanel = new HorizontalPanel();
    movePanel.setSpacing(0);
    panel.add(movePanel);
    FocusPanel moveLeft = new FocusPanel();
    movePanel.add(moveLeft);
    moveLeft.setWidget(new Image(Aggregator.TRANSPARENT_IMAGE));
    moveLeft.setStylePrimaryName("move-tab-left");
    moveLeft.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            AggregatorTabOptions.this.tabPanel.moveVisibleLeft();
            Aggregator.getInstance().update();
        }
    });
    FocusPanel moveRight = new FocusPanel();
    movePanel.add(moveRight);
    moveRight.setWidget(new Image(Aggregator.TRANSPARENT_IMAGE));
    moveRight.setStylePrimaryName("move-tab-right");
    moveRight.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            AggregatorTabOptions.this.tabPanel.moveVisibleRight();
            Aggregator.getInstance().update();
        }
    });

    FlexTable titleTable = new FlexTable();
    titleTable.setText(0, 0, constants.title());
    titleInput = new TextBox();
    titleTable.setWidget(0, 1, titleInput);
    Button titleButton = new Button(constants.ok());
    titleButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            AggregatorTabOptions.this.tabPanel.setTitle(AggregatorTabOptions.this.tabPanel.getVisibleTab(),
                    titleInput.getValue());
            Aggregator.getInstance().update();
        }
    });
    titleTable.setWidget(0, 2, titleButton);
    panel.add(titleTable);
    panel.setCellVerticalAlignment(titleTable, VerticalPanel.ALIGN_MIDDLE);

    FlexTable columnTable = new FlexTable();
    columnTable.setText(0, 0, constants.numberOfColumns());
    columnList = new ListBox();
    columnList.addItem("1");
    columnList.addItem("2");
    columnList.addItem("3");
    columnList.addItem("4");
    columnList.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            AggregatorTab tab = AggregatorTabOptions.this.tabPanel
                    .getTab(AggregatorTabOptions.this.tabPanel.getVisibleTab());
            int newNumber = Integer.valueOf(columnList.getValue(columnList.getSelectedIndex()));
            List<AggregatorColumn> columns = tab.getColumns();
            boolean confirm = false;
            while (columns.size() < newNumber) {
                columns.add(new AggregatorColumn());
            }
            while (columns.size() > newNumber) {
                AggregatorColumn removed = columns.remove(columns.size() - 1);
                if (removed.getComponentCount() > 0) {
                    confirm = true;
                }
            }
            if (confirm && !Window.confirm(constants.removeColumnWarning())) {
                return;
            }
            tab.setColumns(columns);
            Aggregator.getInstance().update();
        }
    });
    columnTable.setWidget(0, 1, columnList);
    panel.add(columnTable);
    panel.setCellVerticalAlignment(columnTable, VerticalPanel.ALIGN_MIDDLE);

    Button delButton = new Button(constants.deleteTab());
    delButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            if (Window.confirm(constants.deleteTabConfirm())) {
                AggregatorTabOptions.this.tabPanel.remove(AggregatorTabOptions.this.tabPanel.getVisibleTab());
                Aggregator.getInstance().update();
            }
        }
    });
    panel.add(delButton);
    panel.setCellVerticalAlignment(delButton, VerticalPanel.ALIGN_MIDDLE);

    initWidget(mainPanel);
}

From source file:org.gss_project.gss.admin.client.ui.ConfirmationDialog.java

License:Open Source License

/**
 * The widget's constructor./*from  www . j  av a  2 s.  c  o  m*/
 *
 * @param message the message to display
 * @param buttonLabel the label of the confirmation button
 */
public ConfirmationDialog(String message, String buttonLabel) {
    // Set the dialog's caption.
    setText("Confirmation");
    setAnimationEnabled(true);
    // Create a VerticalPanel to contain the label and the buttons.
    VerticalPanel outer = new VerticalPanel();
    HorizontalPanel buttons = new HorizontalPanel();

    HTML text = new HTML("<table><tr><td rowspan='2'>" +
    //AbstractImagePrototype.create(MessagePanel.images.warn()).getHTML() +

            "</td><td>" + message + "</td></tr></table>");
    text.setStyleName("gss-warnMessage");
    outer.add(text);

    // Create the 'Update' button, along with a listener that hides the dialog
    // when the button is clicked and renames the file.
    Button ok = new Button(buttonLabel, new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            confirm();
            hide();
        }
    });
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog when the button is clicked.
    Button cancel = new Button("Cancel", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            hide();
            cancel();
        }
    });
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.setStyleName("gss-warnMessage");
    outer.setStyleName("gss-warnMessage");
    outer.add(buttons);
    outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(outer);
}

From source file:org.gss_project.gss.web.client.ConfirmationDialog.java

License:Open Source License

/**
 * The widget's constructor./*from  w w w . jav a 2  s .c  o  m*/
 *
 * @param message the message to display
 * @param buttonLabel the label of the confirmation button
 */
public ConfirmationDialog(String message, String buttonLabel) {
    // Set the dialog's caption.
    setText("Confirmation");
    setAnimationEnabled(true);
    // Create a VerticalPanel to contain the label and the buttons.
    VerticalPanel outer = new VerticalPanel();
    HorizontalPanel buttons = new HorizontalPanel();

    HTML text = new HTML(
            "<table><tr><td rowspan='2'> " + AbstractImagePrototype.create(MessagePanel.images.warn()).getHTML()
                    + "</td><td>" + message + "</td></tr></table>");
    text.setStyleName("gss-warnMessage");
    outer.add(text);

    // Create the 'Update' button, along with a listener that hides the
    // dialog when the button is clicked and renames the file.
    Button ok = new Button(buttonLabel, new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            confirm();
            hide();
        }
    });
    ok.getElement().setId("confirmation.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog when the button is clicked.
    Button cancel = new Button("Cancel", new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            hide();
            cancel();
        }
    });
    cancel.getElement().setId("confirmation.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.setStyleName("gss-warnMessage");
    outer.setStyleName("gss-warnMessage");
    outer.add(buttons);
    outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(outer);
}

From source file:org.gss_project.gss.web.client.DeleteFileDialog.java

License:Open Source License

/**
 * The widget's constructor.//from  w  w  w. j ava2s  .c  o  m
 *
 * @param images the supplied images
 */
public DeleteFileDialog(Images images) {
    // Set the dialog's caption.
    setText("Confirmation");
    setAnimationEnabled(true);
    Object selection = GSS.get().getCurrentSelection();
    // Create a VerticalPanel to contain the label and the buttons.
    VerticalPanel outer = new VerticalPanel();
    HorizontalPanel buttons = new HorizontalPanel();

    HTML text;
    if (selection instanceof FileResource)
        text = new HTML("<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>"
                + "Are you sure you want to <b>permanently</b> delete file '"
                + ((FileResource) selection).getName() + "'?</td></tr></table>");
    else
        text = new HTML("<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>"
                + "Are you sure you want to <b>permanently</b> delete the selected files?</td></tr></table>");
    text.setStyleName("gss-warnMessage");
    outer.add(text);

    // Create the 'Delete' button, along with a listener that hides the dialog
    // when the button is clicked and deletes the file.
    Button ok = new Button("Delete", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            deleteFile();
            hide();
        }
    });
    ok.getElement().setId("confirmation.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog when the button is clicked.
    Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    cancel.getElement().setId("confirmation.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.setStyleName("gss-warnMessage");
    outer.setStyleName("gss-warnMessage");
    outer.add(buttons);
    outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(outer);
}

From source file:org.gss_project.gss.web.client.DeleteFolderDialog.java

License:Open Source License

/**
 * The widget's constructor.//from ww w  .j  ava 2 s.  c  o m
 * @param images the supplied images
 */
public DeleteFolderDialog(Images images) {
    // Set the dialog's caption.
    setText("Confirmation");
    setAnimationEnabled(true);
    FolderResource folder = ((RestResourceWrapper) GSS.get().getTreeView().getSelection()).getResource();
    // Create a VerticalPanel to contain the HTML label and the buttons.
    VerticalPanel outer = new VerticalPanel();
    HorizontalPanel buttons = new HorizontalPanel();

    HTML text = new HTML("<table><tr><td rowspan='2'>" + AbstractImagePrototype.create(images.warn()).getHTML()
            + "</td><td>" + "Are you sure you want to <b>permanently</b> delete folder '" + folder.getName()
            + "'?</td></tr></table>");
    text.setStyleName("gss-warnMessage");
    outer.add(text);

    // Create the 'Delete' button, along with a listener that hides the dialog
    // when the button is clicked and deletes the folder.
    Button ok = new Button("Delete", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            deleteFolder();
            hide();
        }
    });
    ok.getElement().setId("confirmation.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog when the button is clicked.
    Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    cancel.getElement().setId("confirmation.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.setStyleName("gss-warnMessage");
    outer.setStyleName("gss-warnMessage");
    outer.add(buttons);
    outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(outer);
}

From source file:org.gss_project.gss.web.client.DeleteGroupDialog.java

License:Open Source License

/**
 * The widget's constructor./*from  w ww .j a va2  s.co m*/
 * @param images the supplied images
 */
public DeleteGroupDialog(final Images images) {
    // Use this opportunity to set the dialog's caption.
    setText("Delete group");
    setAnimationEnabled(true);
    final GroupResource group = (GroupResource) GSS.get().getCurrentSelection();
    // Create a VerticalPanel to contain the 'about' label and the 'OK'
    // button.
    final VerticalPanel outer = new VerticalPanel();
    final HorizontalPanel buttons = new HorizontalPanel();

    // Create the 'about' text and set a style name so we can style it with
    // CSS.
    final HTML text = new HTML(
            "<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>"
                    + "Are you sure you want to delete group '" + group.getName() + "'?</td></tr></table>");
    text.setStyleName("gss-warnMessage");
    outer.add(text);

    // Create the 'Quit' button, along with a listener that hides the dialog
    // when the button is clicked and quits the application.
    final Button ok = new Button("OK", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            deleteGroup();
            hide();
        }
    });
    ok.getElement().setId("deleteGroup.button.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog
    // when the button is clicked.
    final Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    cancel.getElement().setId("deleteGroup.button.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.setStyleName("gss-warnMessage");
    outer.setStyleName("gss-warnMessage");
    outer.add(buttons);
    outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(outer);
}

From source file:org.gss_project.gss.web.client.DeleteUserDialog.java

License:Open Source License

/**
 * The widget's constructor./*  w  ww .jav  a2s  .c o m*/
 * @param images the supplied images
 */
public DeleteUserDialog(final Images images) {
    // Use this opportunity to set the dialog's caption.
    setText("Delete user");
    setAnimationEnabled(true);
    final GroupUserResource group = (GroupUserResource) GSS.get().getCurrentSelection();
    // Create a VerticalPanel to contain the 'about' label and the 'OK'
    // button.
    final VerticalPanel outer = new VerticalPanel();
    final HorizontalPanel buttons = new HorizontalPanel();

    // Create the 'about' text and set a style name so we can style it with
    // CSS.
    final HTML text = new HTML(
            "<table><tr><td>" + AbstractImagePrototype.create(images.warn()).getHTML() + "</td><td>"
                    + "Are you sure you want to remove user '" + group.getName() + "'?</td></tr></table>");
    text.setStyleName("gss-warnMessage");
    outer.add(text);

    // Create the 'Quit' button, along with a listener that hides the dialog
    // when the button is clicked and quits the application.
    final Button ok = new Button("OK", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            deleteUser();
            hide();
        }
    });
    ok.getElement().setId("deleteUser.button.ok");
    buttons.add(ok);
    buttons.setCellHorizontalAlignment(ok, HasHorizontalAlignment.ALIGN_CENTER);
    // Create the 'Cancel' button, along with a listener that hides the
    // dialog
    // when the button is clicked.
    final Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    cancel.getElement().setId("confirmation.button.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.setStyleName("gss-warnMessage");
    outer.setStyleName("gss-warnMessage");
    outer.add(buttons);
    outer.setCellHorizontalAlignment(text, HasHorizontalAlignment.ALIGN_CENTER);
    outer.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    setWidget(outer);
}