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.gss_project.gss.web.client.UserAddDialog.java

License:Open Source License

/**
 * The widget's constructor./* w ww .ja va  2 s .  c o m*/
 */
public UserAddDialog() {
    setAnimationEnabled(true);
    setText("Add User");
    VerticalPanel panel = new VerticalPanel();
    setWidget(panel);
    panel.addStyleName("gss-TabPanelBottom");
    userTable.addStyleName("gss-permList");
    userTable.setWidget(0, 0, new Label("Username:"));
    userTable.getFlexCellFormatter().setStyleName(0, 0, "props-toplabels");
    suggestBox.getTextBox().addFocusHandler(new FocusHandler() {

        @Override
        public void onFocus(FocusEvent event) {
            if (selectedUser != null && selectedUser.endsWith("@"))
                updateSuggestions();
        }
    });

    suggestBox.addKeyUpHandler(new KeyUpHandler() {

        @Override
        public void onKeyUp(KeyUpEvent event) {
            // Ignore the arrow keys.
            int keyCode = event.getNativeKeyCode();
            if (keyCode == KeyCodes.KEY_UP || keyCode == KeyCodes.KEY_DOWN || keyCode == KeyCodes.KEY_LEFT
                    || keyCode == KeyCodes.KEY_RIGHT)
                return;
            if (keyCode == KeyCodes.KEY_ESCAPE) {
                suggestBox.hideSuggestionList();
                return;
            }
            String text = suggestBox.getText().trim();
            // Avoid useless queries for keystrokes that do not modify the
            // text.
            if (text.equals(selectedUser))
                return;
            selectedUser = text;
            // Go to the server only if the user typed the @ character.
            if (selectedUser.endsWith("@"))
                updateSuggestions();
        }
    });
    suggestBox.getElement().setId("addUser.textBox");
    userTable.setWidget(0, 1, suggestBox);
    panel.add(userTable);
    HorizontalPanel buttons = new HorizontalPanel();
    Button ok = new Button("OK", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addUser();
            hide();
        }
    });
    ok.getElement().setId("addUser.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.
    Button cancel = new Button("Cancel", new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    cancel.getElement().setId("addUser.button.cancel");
    buttons.add(cancel);
    buttons.setCellHorizontalAlignment(cancel, HasHorizontalAlignment.ALIGN_CENTER);
    buttons.setSpacing(8);
    buttons.addStyleName("gss-TabPanelBottom");
    panel.add(buttons);
    panel.setCellHorizontalAlignment(buttons, HasHorizontalAlignment.ALIGN_CENTER);
    panel.addStyleName("gss-DialogBox");
}

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

License:Open Source License

/**
 * The constructor of the user details panel.
 *//*from  ww  w. j a  v  a  2s  .c o  m*/
public UserDetailsPanel() {
    final HorizontalPanel outer = new HorizontalPanel();
    outer.setSpacing(8);
    userInfoLabel = new HTML(" ");
    outer.add(userInfoLabel);
    outer.setCellHorizontalAlignment(userInfoLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    outer.setStyleName("statusbar-inner");

    initWidget(outer);

    DeferredCommand.addCommand(new IncrementalCommand() {

        @Override
        public boolean execute() {
            return displayUserInfo();
        }
    });
}

From source file:org.gwm.samples.gwmdemo.client.GwmDemo.java

License:Apache License

private Widget buildMenu(String name) {
    HorizontalPanel menuLayout = new HorizontalPanel();
    menuLayout.setSpacing(3);
    menuLayout.add(new Label(name));
    menuLayout.setStyleName("gwmdemo-MenuSection");
    return menuLayout;
}

From source file:org.gwm.samples.gwmdemo.client.GwmDemo.java

License:Apache License

private Widget buildMenuItem(Scenarii scenarii) {
    HorizontalPanel menuItemLayout = new HorizontalPanel();
    menuItemLayout.setSpacing(2);
    menuItemLayout.add(scenarii.getLink());
    menuItemLayout.setStyleName("gwmdemo-MenuItem");
    return menuItemLayout;
}

From source file:org.gwtlib.client.table.ui.PagingBar.java

License:Apache License

protected Widget create() {
    HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(0);
    panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    if (_positionWidget != null)
        panel.add(_positionWidget);//from  w w w  .java2  s  .c  om
    if (_loadingWidget != null)
        panel.add(_loadingWidget);
    if (_browserWidget != null)
        panel.add(_browserWidget);
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    if (_gotoWidget != null)
        panel.add(_gotoWidget);
    if (_pageSizesWidget != null)
        panel.add(_pageSizesWidget);
    return panel;
}

From source file:org.gwtlib.samples.showcase.client.ui.CwMessageBox.java

License:Apache License

public Widget onInit() {
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(10);

    hPanel.add(new Button("Info", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.info("Info", "Permission is allowed", new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //log("Closed message box");
                }/*www . j a va  2 s. c o m*/
            }).show();
        }
    }));
    hPanel.add(new Button("Alert", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.alert("Alert", "This document has not been saved", new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //log("Closed message box");
                }
            }).show();
        }
    }));
    hPanel.add(new Button("Error", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.error("Error", "An error has occurred", new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //log("Closed message box");
                }
            }).show();
        }
    }));
    hPanel.add(new Button("Confirm", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.confirm("Confirm", "Are you sure you want to do that?", new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //log("Closed message box");
                }
            }).show();
        }
    }));
    hPanel.add(new Button("Confirm/Cancel", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.confirm("Confirm", "Are you sure you want to do that?",
                    MessageBox.BTN_YES | MessageBox.BTN_NO | MessageBox.BTN_CANCEL, new MessageBoxListener() {
                        public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                            //log("Closed message box");
                        }
                    }).show();
        }
    }));
    hPanel.add(new Button("Prompt", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.prompt("Prompt", "Please enter your name", new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //Window.alert("You entered: " + sender.getText());
                    //log("Closed message box");
                }
            }).show();
        }
    }));
    hPanel.add(new Button("Multiline Prompt", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.prompt("Prompt", "Please enter your name", true, new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //Window.alert("You entered: " + sender.getText());
                    //log("Closed message box");
                }
            }).show();
        }
    }));
    hPanel.add(new Button("Password", new ClickHandler() {
        public void onClick(ClickEvent event) {
            MessageBox.password("Password", "Please enter your password", new MessageBoxListener() {
                public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                    //Window.alert("You entered: " + sender.getText());
                    //log("Closed message box");
                }
            }).show();
        }
    }));
    hPanel.add(new Button("Widget", new ClickHandler() {
        public void onClick(ClickEvent event) {
            ListBox lb = new ListBox();
            lb.addItem("foo");
            lb.addItem("bar");
            lb.addItem("baz");
            MessageBox.prompt("Any widget", "Please select one of the following items", lb,
                    new MessageBoxListener() {
                        public void onMessageBoxClosed(MessageBox sender, ButtonType buttonClicked) {
                            //Window.alert("You entered: " + sender.getText());
                            //log("Closed message box");
                        }
                    }).show();
        }
    }));

    return hPanel;
}

From source file:org.gwtopenmaps.demo.openlayers.client.examples.vector.OpaqueVectorLayerExample.java

License:Apache License

@Override
public void buildPanel() {
    OpenLayers.setProxyHost("olproxy?targetURL=");
    //create some MapOptions
    MapOptions defaultMapOptions = new MapOptions();
    defaultMapOptions.setDisplayProjection(new Projection("EPSG:4326"));
    defaultMapOptions.setNumZoomLevels(16);

    //Create a MapWidget
    MapWidget mapWidget = new MapWidget("500px", "500px", defaultMapOptions);
    //Create a WMS layer as base layer
    WMSParams wmsParams = new WMSParams();
    wmsParams.setFormat("image/png");
    wmsParams.setLayers("basic");
    wmsParams.setStyles("");

    WMSOptions wmsLayerParams = new WMSOptions();
    wmsLayerParams.setUntiled();//from   w w  w  .j  a v a  2  s .c  o m
    wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);

    String wmsUrl = "http://labs.metacarta.com/wms/vmap0";

    WMS wmsLayer = new WMS("Basic WMS", wmsUrl, wmsParams, wmsLayerParams);

    //Add the WMS to the map
    Map map = mapWidget.getMap();
    map.addLayer(wmsLayer);

    final Vector vectorLayer = new Vector("Vectorlayer");
    map.addLayer(vectorLayer);

    //Define a style for the vectors
    Style style = new Style();
    style.setFillColor("red");
    style.setStrokeColor("green");
    style.setStrokeWidth(2);
    style.setFillOpacity(0.9);
    Style selectedStyle = new Style();
    selectedStyle.setFillColor("yellow");
    selectedStyle.setStrokeColor("yellow");
    selectedStyle.setStrokeWidth(2);
    selectedStyle.setFillOpacity(0.9);

    StyleMap styleMap = new StyleMap(style, selectedStyle, style);
    vectorLayer.setStyleMap(styleMap);

    Point point = new Point(146.7, -41.8);
    VectorFeature pointFeature = new VectorFeature(point);
    vectorLayer.addFeature(pointFeature);

    //Add a line
    Point[] linePoints = { new Point(145, -40), new Point(147, 42) };
    LineString ls = new LineString(linePoints);
    vectorLayer.addFeature(new VectorFeature(ls));

    //Lets add some default controls to the map
    map.addControl(new LayerSwitcher()); //+ sign in the upperright corner to display the layer switcher
    map.addControl(new OverviewMap()); //+ sign in the lowerright to display the overviewmap
    map.addControl(new ScaleLine()); //Display the scaleline

    //Center and zoom to a location
    map.setCenter(new LonLat(146.7, -41.8), 6);

    contentPanel.add(
            new HTML("<p>This example shows how to add a Vector to the map and set its transparency .</p>"));
    contentPanel.add(mapWidget);

    HorizontalPanel panel = new HorizontalPanel();
    panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    panel.setSpacing(16);

    for (String v : opacityValues) {
        final RadioButton radio = new RadioButton("VECTOR_OPACITY", v, HasDirection.Direction.LTR);

        /**
         * I DO THIS FIRST ADDING THE CLICK HANDLER *
         */
        if (v.equals("1f")) {
            radio.setValue(Boolean.TRUE);
        }

        radio.addClickHandler(new ClickHandler() {

            public void onClick(ClickEvent event) {
                vectorLayer.setOpacity(Float.parseFloat(radio.getText()));
                Window.alert("Changing Vector Opacity to value : " + radio.getText());
            }

        });

        panel.add(radio);
    }

    contentPanel.add(panel);

    initWidget(contentPanel);

    mapWidget.getElement().getFirstChildElement().getStyle().setZIndex(0); //force the map to fall behind popups
}

From source file:org.jboss.bpm.console.client.process.HistoryInstanceListView.java

License:Open Source License

public void initialize() {
    if (!isInitialized) {
        instanceList = new VerticalPanel();

        // create history list box elements
        listBoxHistory = createHistoryListBox();
        // create list of activities executed for currently selected history process instance
        this.listBoxInstanceActivity = createHistoryActivitiesListBox();

        // toolbar
        final HorizontalPanel toolBox = new HorizontalPanel();

        toolBox.setSpacing(5);

        final MenuBar toolBar = new MenuBar();
        toolBar.addItem("Refresh", new Command() {

            public void execute() {

                controller.handleEvent(new Event(UpdateHistoryDefinitionAction.ID, getCurrentDefinition()));
            }/* w w w  .  ja  va  2s .c  o m*/
        });

        diagramBtn = new MenuItem("Diagram", new Command() {
            public void execute() {
                String diagramUrl = currentDefinition.getDiagramUrl();
                if (currentDefinition != null && executedActivities != null) {
                    HistoryActivityDiagramEvent eventData = new HistoryActivityDiagramEvent(currentDefinition,
                            executedActivities);
                    if (diagramUrl != null && !diagramUrl.equals("")) {
                        createDiagramWindow();
                        controller.handleEvent(new Event(LoadHistoryDiagramAction.ID, eventData));

                    } else {
                        Window.alert("Incomplete deployment, No diagram associated with process");
                    }
                }
            }
        });

        // terminate works on any BPM Engine
        toolBar.addItem(diagramBtn);
        diagramBtn.setEnabled(false);

        toolBox.add(toolBar);

        instanceList.add(toolBox);
        instanceList.add(listBoxHistory);

        pagingPanel = new

        PagingPanel(new PagingCallback() {
            public void rev() {
                renderUpdate();
            }

            public void ffw() {
                renderUpdate();
            }
        });
        instanceList.add(pagingPanel);
        instanceList.add(listBoxInstanceActivity);

        // cached data?
        if (this.cachedInstances != null) {
            bindData(this.cachedInstances);
        }

        // layout
        SimplePanel layout = new SimplePanel();
        layout.add(instanceList);

        panel.add(layout);

        isInitialized = true;

        this.executedActivities = new ArrayList<String>();

    }
}

From source file:org.jboss.bpm.console.client.process.InstanceListView.java

License:Open Source License

private void createSignalWindow() {
    signalTextBoxes = new ArrayList<TextBox>();

    VerticalPanel layout = new VerticalPanel();
    layout.setStyleName("bpm-window-layout");

    // toolbar/*  w  w  w  .ja va 2 s  .  co  m*/
    final HorizontalPanel toolBox = new HorizontalPanel();

    toolBox.setSpacing(5);

    final MenuBar toolBar = new MenuBar();
    toolBar.addItem("Signal", new Command() {

        public void execute() {
            int selectedToken = listBoxTokens.getSelectedIndex();
            int selectedSignal = listBoxTokenSignals.getSelectedIndex();
            if (selectedToken != -1 && selectedSignal != -1) {

                controller.handleEvent(new Event(SignalExecutionAction.ID,
                        new SignalInstanceEvent(getCurrentDefinition(), getSelection(),
                                listBoxTokens.getItem(selectedToken),
                                listBoxTokenSignals.getItem(selectedSignal), selectedToken)));

            } else {
                Window.alert("Incomplete selection. Please select both token and signal name");
            }

        }
    });

    toolBar.addItem("Cancel", new Command() {
        public void execute() {

            signalWindowPanel.close();
        }
    });

    Label header = new Label("Available tokens to signal: ");
    header.setStyleName("bpm-label-header");
    layout.add(header);

    toolBox.add(toolBar);

    layout.add(toolBox);

    listBoxTokens = new CustomizableListBox<TokenReference>(
            new CustomizableListBox.ItemFormatter<TokenReference>() {
                public String format(TokenReference tokenReference) {
                    String result = "";

                    result += tokenReference.getId();

                    result += " ";

                    result += tokenReference.getName() == null ? tokenReference.getCurrentNodeName()
                            : tokenReference.getName();

                    return result;
                }
            });

    listBoxTokens.setFirstLine("Id, Name");

    listBoxTokens.addChangeHandler(new ChangeHandler() {
        public void onChange(ChangeEvent event) {
            int index = listBoxTokens.getSelectedIndex();
            if (index != -1) {
                TokenReference item = listBoxTokens.getItem(index);
                renderAvailableSignals(item);
            }
        }
    });

    renderSignalListBox(-1);
    layout.add(listBoxTokens);

    Label headerSignals = new Label("Available signal names");
    headerSignals.setStyleName("bpm-label-header");
    layout.add(headerSignals);

    listBoxTokenSignals = new CustomizableListBox<String>(new CustomizableListBox.ItemFormatter<String>() {
        public String format(String item) {
            return item;
        }
    });

    listBoxTokenSignals.setFirstLine("Signal name");

    layout.add(listBoxTokenSignals);

    signalWindowPanel = new WidgetWindowPanel("Signal process from wait state", layout, true);

}

From source file:org.jboss.errai.cdi.demo.mvp.client.local.view.ContactsView.java

License:Apache License

public ContactsView() {
    DecoratorPanel contentTableDecorator = new DecoratorPanel();
    initWidget(contentTableDecorator);//from   ww  w.j  av  a2s.  com
    contentTableDecorator.setWidth("100%");
    contentTableDecorator.setWidth("18em");

    contentTable = new FlexTable();
    contentTable.setWidth("100%");
    contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListContainer");
    contentTable.getCellFormatter().setWidth(0, 0, "100%");
    contentTable.getFlexCellFormatter().setVerticalAlignment(0, 0, DockPanel.ALIGN_TOP);

    // Create the menu
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setBorderWidth(0);
    hPanel.setSpacing(0);
    hPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
    addButton = new Button("Add Contact");
    hPanel.add(addButton);
    deleteButton = new Button("Delete Contact");
    hPanel.add(deleteButton);
    contentTable.getCellFormatter().addStyleName(0, 0, "contacts-ListMenu");
    contentTable.setWidget(0, 0, hPanel);

    // Create the contacts list
    contactsTable = new FlexTable();
    contactsTable.setCellSpacing(0);
    contactsTable.setCellPadding(0);
    contactsTable.setWidth("100%");
    contactsTable.addStyleName("contacts-ListContents");
    contactsTable.getColumnFormatter().setWidth(0, "15px");
    contentTable.setWidget(1, 0, contactsTable);

    contentTableDecorator.add(contentTable);
}