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:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayImagesList(List imagesList, final VerticalPanel parent) {
    parent.clear();/* www  .ja  va 2 s  . co m*/
    int nimages = imagesList.size();
    boolean showActions = false;
    if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator().booleanValue()) {
        showActions = true;
    }

    if (nimages > 0) {
        final Grid g = new Grid(nimages + 1, 6);
        g.setStyleName("euca-table");
        g.setCellPadding(6);
        g.setWidget(0, 0, new Label("Id"));
        g.setWidget(0, 1, new Label("Name"));
        g.setWidget(0, 2, new Label("Kernel"));
        g.setWidget(0, 3, new Label("Ramdisk"));
        g.setWidget(0, 4, new Label("State"));
        if (showActions)
            g.setWidget(0, 5, new Label("Actions"));
        g.getRowFormatter().setStyleName(0, "euca-table-heading-row");

        for (int i = 0; i < nimages; i++) {
            ImageInfoWeb img = (ImageInfoWeb) imagesList.get(i);
            int row = i + 1;
            if ((row % 2) == 1) {
                g.getRowFormatter().setStyleName(row, "euca-table-odd-row");
            } else {
                g.getRowFormatter().setStyleName(row, "euca-table-even-row");
            }
            g.setWidget(row, 0, new Label(img.getImageId()));
            g.setWidget(row, 1, new Label(img.getImageLocation()));
            g.setWidget(row, 2, new Label(img.getKernelId()));
            g.setWidget(row, 3, new Label(img.getRamdiskId()));
            g.setWidget(row, 4, new Label(img.getImageState()));
            if (showActions) {
                HorizontalPanel ops = new HorizontalPanel();
                ops.setSpacing(3);
                HTML act_button = imageActionButton("Disable", img);
                if (img.getImageState().equalsIgnoreCase("deregistered")) {
                    act_button = imageActionButton("Enable", img);
                }
                ops.add(act_button);
                // TODO: uncomment when deletion is implemented
                //HTML del_button = imageActionButton ("Delete", img);
                //ops.add(del_button);
                g.setWidget(row, 5, ops);
            }
        }
        parent.add(g);
    } else {
        parent.add(new Label("No images found"));
    }
}

From source file:edu.ucsb.eucalyptus.admin.client.SystemConfigTable.java

License:Open Source License

public SystemConfigTable(String sessionId) {
    this.sessionId = sessionId;
    this.setStyleName("euca-config-component");
    //      this.setSpacing (10);
    this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    //      this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    Label SystemConfigsHeader = new Label("Cloud configuration:");
    SystemConfigsHeader.setStyleName("euca-section-header");
    this.add(SystemConfigsHeader);
    HorizontalPanel c_hpanel = new HorizontalPanel();
    c_hpanel.add(this.c_grid);
    c_hpanel.add(this.c_hint);
    //      c_hint.setWidth ("180");
    this.add(c_hpanel);
    HorizontalPanel c_hpanel2 = new HorizontalPanel();
    c_hpanel2.setSpacing(10);
    c_hpanel2.add(new EucaButton("Save Configuration", new SaveCallback(this)));
    c_hpanel2.add(this.c_status);
    this.c_status.setText("");
    this.c_status.setStyleName("euca-greeting-pending");
    //      this.c_status.setWidth ("250");
    this.add(c_hpanel2);

    Label DNSConfigHeader = new Label("DNS configuration:");
    DNSConfigHeader.setStyleName("euca-section-header");
    this.add(DNSConfigHeader);
    HorizontalPanel dns_hpanel = new HorizontalPanel();
    dns_hpanel.add(this.dns_grid);
    dns_hpanel.add(this.dns_hint);
    //      dns_hint.setWidth ("180");
    this.add(dns_hpanel);
    HorizontalPanel dns_hpanel2 = new HorizontalPanel();
    dns_hpanel2.setSpacing(10);//from   w w w  .j  a v a  2 s  .  c o m
    dns_hpanel2.add(new EucaButton("Save Configuration", new SaveCallback(this)));
    dns_hpanel2.add(this.dns_status);
    this.dns_status.setText("");
    this.dns_status.setStyleName("euca-greeting-pending");
    //      this.dns_status.setWidth ("250");
    this.add(dns_hpanel2);

    this.rebuildTable();
    EucalyptusWebBackend.App.getInstance().getSystemConfig(this.sessionId, new GetCallback(this));
}

From source file:edu.ucsb.eucalyptus.admin.client.SystemConfigTable.java

License:Open Source License

private void rebuildTable() {
    this.c_grid.clear();
    this.c_grid.resize(2, 2);
    //      this.c_grid.getColumnFormatter().setWidth(0, "190");
    //      this.c_grid.getColumnFormatter().setWidth(1, "260");
    int i = 0;/*from  www.  ja v a 2 s . c  om*/

    // cloud parameters
    this.c_grid.setWidget(i, 0, new Label("Cloud Host:"));
    this.c_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    cloudHost_box.addChangeListener(new ChangeCallback(this));
    cloudHost_box.setVisibleLength(20);
    cloudHost_box.setText(SystemConfig.getCloudHost());
    cloudHost_box.addFocusListener(new FocusHandler(c_hint,
            "Warning: Changing the Cloud URL will invalidate any existing credentials, and will prevent existing users from accessing the system."));
    this.c_grid.setWidget(i++, 1, cloudHost_box);

    // 2nd row
    this.c_grid.setWidget(i, 0, new Label("Default kernel:"));
    this.c_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel hpanel2 = new HorizontalPanel();
    hpanel2.setSpacing(0);
    this.c_grid.setWidget(i++, 1, hpanel2);

    defaultKernel_box.addChangeListener(new ChangeCallback(this));
    defaultKernel_box.setVisibleLength(10);
    defaultKernel_box.setText(SystemConfig.getDefaultKernelId());
    hpanel2.add(defaultKernel_box);

    hpanel2.add(new HTML("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Default ramdisk: &nbsp;"));
    defaultRamdisk_box.addChangeListener(new ChangeCallback(this));
    defaultRamdisk_box.setVisibleLength(10);
    defaultRamdisk_box.setText(SystemConfig.getDefaultRamdiskId());
    hpanel2.add(defaultRamdisk_box);

    // dns params
    this.dns_grid.clear();
    this.dns_grid.resize(2, 2);
    //      this.dns_grid.getColumnFormatter().setWidth(0, "190");
    //      this.dns_grid.getColumnFormatter().setWidth(1, "260");
    i = 0;

    this.dns_grid.setWidget(i, 0, new Label("Domain name:"));
    this.dns_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    dnsDomain_box.addChangeListener(new ChangeCallback(this));
    dnsDomain_box.setVisibleLength(20);
    dnsDomain_box.setText(SystemConfig.getDnsDomain());
    this.dns_grid.setWidget(i++, 1, dnsDomain_box);

    this.dns_grid.setWidget(i, 0, new Label("Nameserver:"));
    this.dns_grid.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel dns_hpanel2 = new HorizontalPanel();
    dns_hpanel2.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    //dns_hpanel2.add(new Label("Nameserver:"));
    dns_hpanel2.setSpacing(0);
    this.dns_grid.setWidget(i++, 1, dns_hpanel2);

    nameserver_box.addChangeListener(new ChangeCallback(this));
    nameserver_box.setVisibleLength(20);
    nameserver_box.setText(SystemConfig.getNameserver());
    dns_hpanel2.add(nameserver_box);

    dns_hpanel2.add(new HTML("&nbsp;&nbsp;&nbsp; IP:  &nbsp;"));
    nameserverAddress_box.addChangeListener(new ChangeCallback(this));
    nameserverAddress_box.setVisibleLength(20);
    nameserverAddress_box.setText(SystemConfig.getNameserverAddress());
    dns_hpanel2.add(nameserverAddress_box);
}

From source file:edu.ucsb.eucalyptus.admin.client.VmTypeTable.java

License:Open Source License

public VmTypeTable(String sessionId) {
    this.sessionId = sessionId;
    this.setStyleName("euca-config-component");
    this.setSpacing(10);
    this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    //      this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    Label VmTypesHeader = new Label("VM Types:");
    VmTypesHeader.setStyleName("euca-section-header");
    this.add(VmTypesHeader);
    this.add(this.grid);
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(5);
    hpanel.add(new EucaButton("Save VmTypes", new SaveCallback(this)));
    hpanel.add(this.statusLabel);
    //      this.statusLabel.setWidth ("250");
    this.statusLabel.setText("");
    this.statusLabel.setStyleName("euca-greeting-pending");
    this.add(hpanel);
    EucalyptusWebBackend.App.getInstance().getVmTypes(this.sessionId, new GetCallback(this));
}

From source file:edu.ucsb.eucalyptus.admin.client.WalrusInfoTable.java

License:Open Source License

public WalrusInfoTable(String sessionId) {
    this.sessionId = sessionId;
    this.setStyleName("euca-config-component");
    this.setSpacing(2);
    this.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    //      this.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    Label walrusesHeader = new Label("Walrus Configuration:");
    walrusesHeader.setStyleName("euca-section-header");
    this.add(walrusesHeader);
    this.noWalrusesLabel.setText("No Walrus hosts registered");
    this.noWalrusesLabel.setStyleName("euca-greeting-disabled");
    HorizontalPanel grid_and_hint = new HorizontalPanel();
    grid_and_hint.add(this.grid);
    grid_and_hint.add(this.hint);
    this.hint.setWidth("100");
    this.add(grid_and_hint);
    HorizontalPanel hpanel = new HorizontalPanel();
    hpanel.setSpacing(2);
    hpanel.add(add_button);//ww w  .ja v a2 s.  c o m
    hpanel.add(new EucaButton("Save Walrus configuration", new SaveCallback(this)));
    hpanel.add(this.statusLabel);
    //      this.statusLabel.setWidth ("250");
    this.statusLabel.setText("");
    this.statusLabel.setStyleName("euca-greeting-pending");
    this.add(hpanel);
    rebuildTable();
    EucalyptusWebBackend.App.getInstance().getWalrusList(this.sessionId, new GetWalrusListCallback(this));
}

From source file:edu.ucsb.eucalyptus.admin.client.WalrusInfoTable.java

License:Open Source License

private Grid addWalrusEntry(int row, WalrusInfoWeb walrusInfo) {
    final ArrayList<String> properties = walrusInfo.getProperties();
    int numProperties = properties.size() / 4;
    Grid g = new Grid(1 + numProperties, 2);
    g.setStyleName("euca-table");
    g.setCellPadding(4);// w ww  .  j a v  a2  s. co m

    int i = 0; // row 1
    g.setWidget(i, 0, new Label("Walrus host:"));
    g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    HorizontalPanel p = new HorizontalPanel();
    p.setSpacing(0);
    g.setWidget(i, 1, p);
    final TextBox walrusHost_box = new TextBox();
    walrusHost_box.addChangeListener(new ChangeCallback(this, row));
    walrusHost_box.setVisibleLength(35);
    walrusHost_box.setText(walrusInfo.getHost());
    p.add(walrusHost_box);
    p.add(new EucaButton("Deregister", new DeleteCallback(this, row)));

    for (int propIdx = 0; propIdx < numProperties; ++propIdx) {
        i++; // next row
        if ("KEYVALUE".equals(properties.get(4 * propIdx))) {
            g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
            g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
            final TextBox propTextBox = new TextBox();
            propTextBox.addChangeListener(new ChangeCallback(this, row));
            propTextBox.setVisibleLength(30);
            propTextBox.setText(properties.get(4 * propIdx + 2));
            propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
            g.setWidget(i, 1, propTextBox);
        } else if ("KEYVALUEHIDDEN".equals(properties.get(4 * propIdx))) {
            g.setWidget(i, 0, new Label(properties.get(4 * propIdx + 1) + ": "));
            g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
            final TextBox propTextBox = new PasswordTextBox();
            propTextBox.addChangeListener(new ChangeCallback(this, row));
            propTextBox.setVisibleLength(30);
            propTextBox.setText(properties.get(4 * propIdx + 2));
            propTextBox.addFocusListener(new FocusHandler(this.hint, this.warningMessage));
            g.setWidget(i, 1, propTextBox);
        } else if ("BOOLEAN".equals(properties.get(4 * propIdx))) {
            final int index = propIdx;
            final CheckBox propCheckbox = new CheckBox();
            g.getCellFormatter().setHorizontalAlignment(i, 0, HasHorizontalAlignment.ALIGN_RIGHT);
            g.setWidget(i, 0, propCheckbox);
            if (Boolean.parseBoolean(properties.get(4 * index + 2))) {
                propCheckbox.setChecked(true);
            } else {
                propCheckbox.setChecked(false);
            }
            propCheckbox.addClickListener(new ClickListener() {
                public void onClick(Widget sender) {
                    if (((CheckBox) sender).isChecked()) {
                        properties.set(4 * index + 2, String.valueOf(true));
                    } else {
                        properties.set(4 * index + 2, String.valueOf(false));
                    }
                }
            });
            g.setWidget(i, 1, new Label(properties.get(propIdx * 4 + 1)));
        }
    }
    return g;
}

From source file:edu.washington.cs.oneswarm.ui.gwt.client.newui.friends.AddFriendDialog.java

License:Open Source License

public AddFriendDialog(FriendListPanel parent) {
    this.parent = parent;
    this.setText("Add friend using public key");

    Label selectLabel = new Label("Enter your friend's nickname and public key into the fields below.");
    selectLabel.addStyleName(CSS_DIALOG_HEADER);
    selectLabel.setWidth(WIDTH + "px");
    mainPanel.add(selectLabel);/*  w w w . j  a v  a  2 s.co m*/

    // nickname
    HorizontalPanel nickPanel = new HorizontalPanel();
    nickPanel.setWidth("100%");
    Label nickLabel = new Label("Nickname: ");
    nickPanel.add(nickLabel);
    nickPanel.add(nickBox);
    nickPanel.setSpacing(3);
    nickBox.setWidth("300px");
    nickPanel.setCellHorizontalAlignment(nickBox, HorizontalPanel.ALIGN_RIGHT);
    nickPanel.setCellVerticalAlignment(nickLabel, VerticalPanel.ALIGN_MIDDLE);
    mainPanel.add(nickPanel);

    // public key
    publicKeyArea.setVisibleLines(7);
    publicKeyArea.setWidth(WIDTH - 20 + "px");
    publicKeyArea.addChangeHandler(this);
    publicKeyArea.addKeyUpHandler(this);
    mainPanel.add(publicKeyArea);
    mainPanel.setCellHorizontalAlignment(publicKeyArea, HorizontalPanel.ALIGN_CENTER);

    // confirm
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(5);
    lengthLabel = new Label("0 / 216");
    // buttonPanel.add(lengthLabel); // skip this for now
    buttonPanel.setCellHorizontalAlignment(lengthLabel, HorizontalPanel.ALIGN_LEFT);
    buttonPanel.setCellVerticalAlignment(lengthLabel, HorizontalPanel.ALIGN_MIDDLE);
    buttonPanel.setWidth("100%");

    // okButton.setEnabled(false);

    HorizontalPanel rhs = new HorizontalPanel();
    rhs.add(okButton);
    okButton.addClickHandler(this);
    rhs.add(cancelButton);
    cancelButton.addClickHandler(this);
    rhs.setSpacing(3);
    buttonPanel.add(rhs);
    buttonPanel.setCellHorizontalAlignment(rhs, HorizontalPanel.ALIGN_RIGHT);

    mainPanel.add(buttonPanel);
    mainPanel.setCellHorizontalAlignment(buttonPanel, VerticalPanel.ALIGN_RIGHT);
    mainPanel.setWidth(WIDTH + "px");
    setWidget(mainPanel);
}

From source file:es.deusto.weblab.client.experiments.gpib.ui.GpibExperiment.java

License:Open Source License

private void showResults() {
    final PopupPanel popup = new PopupPanel(false, true);

    popup.setStyleName("results-popup");

    final VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setWidth("100%");
    mainPanel.setSpacing(10);//  ww w. j  a v  a  2  s .c  o m

    final Label title = new Label("Your experiment's results");
    title.setStyleName("results-title");
    mainPanel.add(title);
    mainPanel.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_CENTER);

    final TextArea textAreaFileResult = new TextArea();
    textAreaFileResult.setText(this.resultFileContent);
    textAreaFileResult.setVisibleLines(15);
    textAreaFileResult.setWidth("100%");
    mainPanel.add(textAreaFileResult);

    final VerticalPanel stdoutPanel = new VerticalPanel();
    final Label stdoutLabel = new Label("stdout:");
    stdoutLabel.setStyleName("results-label");
    stdoutPanel.add(stdoutLabel);
    final TextArea textAreaStdout = new TextArea();
    textAreaStdout.setVisibleLines(8);
    textAreaStdout.setText(this.resultStdout);
    textAreaStdout.setSize("100%", "100%");
    stdoutPanel.add(textAreaStdout);
    stdoutPanel.setWidth("100%");
    mainPanel.add(stdoutPanel);

    final VerticalPanel stderrPanel = new VerticalPanel();
    final Label stderrLabel = new Label("stderr:");
    stderrLabel.setStyleName("results-label");
    stderrPanel.add(stderrLabel);
    final TextArea textAreaStderr = new TextArea();
    textAreaStderr.setVisibleLines(4);
    textAreaStderr.setText(this.resultStderr);
    textAreaStderr.setSize("100%", "100%");
    stderrPanel.add(textAreaStderr);
    stderrPanel.setWidth("100%");
    mainPanel.add(stderrPanel);

    final HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(10);
    buttonPanel.setSize("100%", "100%");

    final Button button = new Button("Close");
    button.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    });
    buttonPanel.add(button);
    buttonPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.add(buttonPanel);
    popup.setWidget(mainPanel);
    popup.show();
}

From source file:es.udc.pfc.gameweb.client.StatusWidget.java

License:Open Source License

@Inject
public StatusWidget(final XmppSession session) {
    this.session = session;

    final HorizontalPanel panel = new HorizontalPanel();
    panel.setSpacing(10);
    panel.add(image);//  ww w.  j  ava  2 s .c om
    panel.add(status);

    session.addSessionStatusChangedHandler(this, true);

    initWidget(panel);
}

From source file:es.upm.fi.dia.oeg.map4rdf.client.view.FiltersView.java

License:Open Source License

private void addFilter(FlowPanel filters, DateFilter dateFilter) {
    if (dateFilters.contains(dateFilter)) {
        widgetFactory.getDialogBox().showError(messages.existsOtherDateFilterEqual());
    } else {// w  w  w  .  ja va2s  . c  om
        HorizontalPanel dateFilterPanel = new HorizontalPanel();
        dateFilterPanel.setSpacing(5);
        dateFilterPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        dateFilterPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        dateFilterPanel.setStyleName(resources.css().dateFilterBox());
        String message = getDateFilterTypeMessage(dateFilter.getFilter());
        if (message != null) {
            dateFilters.add(dateFilter);
            dateFilterPanel.add(new Label(message));
            dateFilterPanel.add(new Label(dateTimeFormater(dateFilter.getDate())));
            Image removeImage = new Image(resources.eraserIcon());
            removeImage.getElement().getStyle().setCursor(Cursor.POINTER);
            dateFilterPanel.add(removeImage);
            addRemoveFilterEvent(removeImage, filters, dateFilterPanel, dateFilter);
            filters.add(dateFilterPanel);
            fireDateFilterChangeEvent();
        } else {
            widgetFactory.getDialogBox().showError(messages.errorFilterType());
        }
    }
}