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:com.audata.client.search.SearchPanel.java

License:Open Source License

public SearchPanel(AuDoc audoc, ArrayList criteria) {
    this.audoc = audoc;
    if (criteria != null) {
        this.searchTerms = criteria;
    } else {/*from  w  w  w  .j  av  a  2  s  .co  m*/
        if (AuDoc.state.containsKey("Search")) {
            this.searchTerms = (ArrayList) AuDoc.state.getItem("Search");
        } else {
            this.searchTerms = new ArrayList();
        }
    }
    this.setSize("100%", "100%");
    this.setSpacing(4);
    Label title = new Label(LANG.search_Text());
    title.addStyleName("audoc-sectionTitle");
    this.add(title);

    HorizontalPanel hp = new HorizontalPanel();
    hp.setSpacing(4);
    hp.setSize("100%", "100%");

    this.fieldsTree = new Tree();
    this.fieldsTree.addTreeListener(this);
    //this.fieldsTree.setSize("100%", "100%");
    this.fieldsTree.setHeight("90%");
    this.fieldsTree.addStyleName("audoc-fieldTree");
    hp.add(this.fieldsTree);
    this.buildSections();
    this.getUDFs();
    this.addStdFields();

    VerticalPanel form = new VerticalPanel();
    form.addStyleName("audoc-searchForm");
    //form.setSize("100%","100%");
    form.setWidth("250px");
    form.setSpacing(4);
    HorizontalPanel fieldRow = new HorizontalPanel();
    fieldRow.setSpacing(4);
    Label fieldLabel = new Label(LANG.field_Text());
    this.fieldName = new Label();
    this.fieldName.addStyleName("bold");

    fieldRow.add(fieldLabel);
    fieldRow.add(this.fieldName);
    fieldRow.setCellWidth(fieldLabel, "100px");
    fieldRow.setCellHorizontalAlignment(fieldLabel, HasAlignment.ALIGN_LEFT);
    form.add(fieldRow);

    this.valuePanel = new HorizontalPanel();
    this.valuePanel.setSpacing(4);
    Label valueLabel = new Label(LANG.criteria_Text());
    TextBox value = new TextBox();
    this.valuePanel.add(valueLabel);
    this.valuePanel.add(value);
    this.valuePanel.setCellWidth(valueLabel, "100px");
    this.valuePanel.setCellHorizontalAlignment(valueLabel, HasAlignment.ALIGN_LEFT);
    form.add(this.valuePanel);

    HorizontalPanel andOr = new HorizontalPanel();
    andOr.setSpacing(4);
    this.and = new RadioButton("andOr", LANG.and_Text());
    this.and.setChecked(true);
    this.or = new RadioButton("andOr", LANG.or_Text());
    andOr.add(this.and);
    andOr.add(this.or);
    form.add(andOr);

    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setSpacing(4);
    this.add = new Button(LANG.add_Text());
    this.add.addClickListener(this);
    buttons.add(this.add);
    this.clear = new Button(LANG.clear_Text());
    this.clear.addClickListener(this);
    buttons.add(this.clear);

    form.add(buttons);

    this.criteria = new ListBox();
    this.criteria.setVisibleItemCount(10);
    this.criteria.setWidth("100%");
    form.add(this.criteria);

    HorizontalPanel buttons2 = new HorizontalPanel();
    buttons2.setSpacing(4);
    this.search = new Button(LANG.search_Text());
    this.search.addClickListener(this);
    buttons2.add(this.search);
    this.save = new Button(LANG.save_Text());
    this.save.addClickListener(this);
    buttons2.add(this.save);
    form.add(buttons2);

    hp.add(form);

    hp.setCellHeight(this.fieldsTree, "100%");
    this.add(hp);
    this.paintCriteria();
}

From source file:com.audata.client.trays.TrayDialog.java

License:Open Source License

public TrayDialog(ArrayList records) {
    this.setText(LANG.add_to_tray_Text());
    this.records = records;
    String template = "<span class=\"traylist-title\">#0</span>";
    this.trays = new HTMLButtonList("images/48x48/tray.gif", template, false);
    this.trays.addStyleName("audoc-trays");
    this.addBut = new Button(LANG.add_Text());
    this.addBut.addClickListener(this);
    this.cancel = new Button(LANG.cancel_Text());
    this.cancel.addClickListener(this);
    this.newText = new TextBox();
    this.newBut = new Button(LANG.new_Text());
    this.newBut.addClickListener(this);
    this.getTrays();
    VerticalPanel main = new VerticalPanel();
    main.setSpacing(3);/*  w w  w  . j ava  2  s  .  c  o m*/

    main.add(this.trays);

    HorizontalPanel p = new HorizontalPanel();
    p.add(new Label("New tray:"));
    p.setSpacing(3);
    p.add(this.newText);
    p.add(this.newBut);
    p.setCellHorizontalAlignment(this.addBut, HasAlignment.ALIGN_RIGHT);
    main.add(p);

    HorizontalPanel p2 = new HorizontalPanel();
    p2.setSpacing(3);
    p2.add(this.addBut);
    p2.add(this.cancel);
    main.add(p2);
    main.setCellHorizontalAlignment(p2, HasAlignment.ALIGN_RIGHT);
    this.setWidget(main);
}

From source file:com.audata.client.trays.TrayPanel.java

License:Open Source License

public void addTray(String uuid, String name, String description) {
    HorizontalPanel tp = new HorizontalPanel();
    tp.setSpacing(2);
    tp.setWidth("100%");
    //CaptionButton cp = new CaptionButton("images/16x16/tray.gif", name, CaptionButton.CAPTION_EAST);
    CaptionButton cp = new CaptionButton();
    cp.setImageUrl("images/16x16/tray.gif");
    cp.setCaptionText(name);//from  w  w w . j  av a2s. c  om
    cp.setCaptionStyleName("audoc-trayLabel");
    cp.setTitle(description);
    cp.addClickListener(new TrayClickListener(this.parent, name, uuid));
    Image dButton = new Image("images/16x16/logout.gif");
    dButton.setTitle("delete " + name);
    dButton.addClickListener(new ItemDeleteClickListener(AuDoc.STACK_TRAYS, uuid));
    dButton.addStyleName("hand");

    tp.add(cp);
    tp.add(dButton);
    tp.setCellVerticalAlignment(dButton, HasAlignment.ALIGN_MIDDLE);
    this.trays.add(tp);
    this.show();
}

From source file:com.audata.client.widgets.ClassField.java

License:Open Source License

public ClassField() {
    HorizontalPanel main = new HorizontalPanel();
    main.setSpacing(2);

    this.tb = new ClassTextBox();
    this.tb.setEnabled(false);
    this.select = new Button("...");
    this.select.addClickListener(this);
    main.add(this.tb);
    main.add(this.select);

    this.initWidget(main);
}

From source file:com.audata.client.widgets.KeywordField.java

License:Open Source License

public KeywordField(String hierarchy, String title) {
    this.hierarchy = hierarchy;
    HorizontalPanel main = new HorizontalPanel();
    main.setSpacing(2);

    this.tb = new KeywordTextBox(this.hierarchy, title);
    this.tb.setEnabled(false);
    this.select = new Button("...");
    this.select.addClickListener(this);
    main.add(this.tb);
    main.add(this.select);

    this.initWidget(main);
}

From source file:com.axlight.gbrain.client.MainPane.java

License:Apache License

private void showConfirmDialog(String message, final ClickHandler okHandler) {
    if (GBrain.isIPhone) {
        if (Window.confirm(message)) {
            okHandler.onClick(null);/*from w  w w . j  a v  a  2s  .  c om*/
        }
    } else {
        final DialogBox dialog = new DialogBox();
        dialog.setModal(true);
        dialog.setGlassEnabled(true);
        dialog.setText("Confirm");
        Label label = new Label(message);
        HorizontalPanel buttonPanel = new HorizontalPanel();
        buttonPanel.setSpacing(5);
        Button ok = new Button("OK");
        buttonPanel.add(ok);
        Button cancel = new Button("Cancel");
        buttonPanel.add(cancel);
        VerticalPanel basePanel = new VerticalPanel();
        basePanel.setSpacing(10);
        basePanel.add(label);
        basePanel.add(buttonPanel);
        dialog.add(basePanel);
        ok.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                okHandler.onClick(event);
                dialog.hide();
            }
        });
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialog.hide();
            }
        });
        dialog.center();
    }
}

From source file:com.axlight.gbrain.client.MainPane.java

License:Apache License

private void showPromptDialog(String message, final PromptHandler promptHandler) {
    if (GBrain.isIPhone) {
        String input = Window.prompt(message, "");
        if (input != null) {
            promptHandler.handleResult(input);
        }/* ww w . ja  v  a2  s .com*/
    } else {
        final DialogBox dialog = new DialogBox();
        dialog.setModal(true);
        dialog.setGlassEnabled(true);
        dialog.setText("Prompt");
        Label label = new Label(message);
        final TextBox textBox = new TextBox();
        HorizontalPanel buttonPanel = new HorizontalPanel();
        buttonPanel.setSpacing(5);
        Button ok = new Button("OK");
        buttonPanel.add(ok);
        Button cancel = new Button("Cancel");
        buttonPanel.add(cancel);
        VerticalPanel basePanel = new VerticalPanel();
        basePanel.setSpacing(10);
        basePanel.add(label);
        basePanel.add(textBox);
        basePanel.add(buttonPanel);
        dialog.add(basePanel);
        ok.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                promptHandler.handleResult(textBox.getText());
                dialog.hide();
            }
        });
        cancel.addClickHandler(new ClickHandler() {
            public void onClick(ClickEvent event) {
                dialog.hide();
            }
        });
        dialog.center();
    }
}

From source file:com.cognitivemedicine.metricsdashboard.client.adminconsole.AdminConsole.java

License:Apache License

public AdminConsole(DashboardController controller) {
    this.controller = controller;
    tabPanel = new TabLayoutPanel(2.5, Unit.EM);
    tabPanel.setAnimationDuration(200);//  w w  w  .  j  a  v a2  s .com
    // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);

    HTML metricGroupText = new HTML("METRIC GROUPS");
    tabPanel.add(new MetricsTab(controller), metricGroupText);

    HTML rolesText = new HTML("ROLES");
    tabPanel.add(new RolesTab(controller), rolesText);

    // Add a tab
    HTML moreInfo = new HTML("CHARTS");
    tabPanel.add(new ChartsTab(controller), moreInfo);

    // Return the content
    tabPanel.selectTab(0);
    // tabPanel.ensureDebugId("cwTabPanel");

    HorizontalPanel buttonPanel = new HorizontalPanel();
    // buttonPanel.setWidth("20%");
    buttonPanel.setSpacing(4);
    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.setSize("24px", "24px");
    PushButton saveButton = new PushButton(image);

    saveButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            AdminConsole.this.hide();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize("24px", "24px");
    PushButton closeButton = new PushButton(image);
    closeButton.setTitle("Cancel");
    closeButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole.this.hide();
        }
    });
    buttonPanel.add(saveButton);
    buttonPanel.add(closeButton);

    VerticalPanel mainPanel = new VerticalPanel();
    // mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.add(tabPanel);
    mainPanel.add(buttonPanel);

    mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER);

    tabPanel.setHeight("400px");
    tabPanel.setWidth("700px");

    this.setHeight("400px");
    this.setWidth("550px");
    this.setText("Admin Console");
    this.setWidget(mainPanel);
    this.setModal(true);
    this.setGlassEnabled(true);

    this.center();
}

From source file:com.cognitivemedicine.metricsdashboard.client.charts.ChartWidget.java

License:Apache License

public ChartWidget(DashboardController dashboardController, DashboardSettings dashboardSettings,
        ChartSettings chartSettings) {/*from  w  ww  . j av a 2s .c o m*/
    this.controller = dashboardController;
    String id = "chartWidget" + widgetId++;
    this.getElement().setId(id);
    tabPanel = new TabLayoutPanel(28, Unit.PX);
    tabPanel.setAnimationDuration(100);
    // tabPanel.getElement().getStyle().setMarginBottom(10.0, Unit.PX);
    // tabPanel.ensureDebugId("cwTabPanel");

    this.setText("New Chart");

    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(4);
    Image image = new Image(MdConstants.IMG_OK_CHECK);
    image.getElement().setId(id + "OkButtonImage");
    image.setSize("24px", "24px");
    PushButton okButton = new PushButton(image);
    okButton.getElement().setId(this.getElement().getId() + "OkButton");
    okButton.setTitle("Build Chart");
    okButton.addClickHandler(new ClickHandler() {
        public void onClick(ClickEvent event) {
            clickOkButton();
        }
    });

    image = new Image(MdConstants.IMG_CANCEL_X);
    image.setSize("24px", "24px");
    image.getElement().setId(id + "CloseButtonImage");
    PushButton closeButton = new PushButton(image);
    closeButton.getElement().setId(this.getElement().getId() + "CloseButton");
    closeButton.setTitle("Cancel");

    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.getWidgetController().removeWidget(ChartWidget.this);
        }
    });

    buttonPanel.add(okButton);
    buttonPanel.add(closeButton);

    // HTML metricGroupText = new HTML("EDIT");
    chartEditorPanel = new ChartEditorPanel(this, controller, dashboardSettings, chartSettings);
    // When there is a value for chart settings, it means it was loaded form the server.
    // Click Ok button programatically to load chart
    if (chartSettings != null) {
        clickOkButton();
        setText(chartSettings.getTitle());
    }
    Image editImage = new Image(MdConstants.IMG_PENCIL);
    editImage.getElement().setId("editTabImage");
    editImage.setSize("16px", "16px");
    editImage.getElement().setId("editImage");
    tabPanel.add(chartEditorPanel, editImage);

    // HTML rolesText = new HTML("VIEW");
    Image viewImage = new Image(MdConstants.IMG_VIEW_EYE);
    viewImage.getElement().setId("viewTabImage");
    viewImage.setSize("16px", "16px");
    // chartViewerPanel = new ChartViewerPanel(id);
    chartContainer = new VerticalPanel();
    // Initialize this to an empty panel
    chartViewPanel = new EmptyChartPanel();
    // chartViewPanel.setBorderWidth(2);
    chartViewPanel.setSpacing(2);
    chartViewPanel.setWidth("100%");
    // chartContainer.setBorderWidth(2);
    chartContainer.setSpacing(2);
    chartContainer.setWidth("100%");
    chartContainer.setHeight("100%");

    chartContainer.add(chartViewPanel);
    tabPanel.add(chartContainer, viewImage);

    // Return the content
    tabPanel.selectTab(0);
    tabPanel.getElement().setId(id + "TabPanel");
    tabPanel.setHeight("455px");
    tabPanel.setWidth("505px");

    this.setHeight("530");
    this.setWidth("500px");

    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.add(tabPanel);
    mainPanel.add(buttonPanel);
    mainPanel.setCellVerticalAlignment(buttonPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(buttonPanel, HasHorizontalAlignment.ALIGN_CENTER);

    mainPanel.setWidth("100%");
    mainPanel.setHeight("100%");

    this.setWidget(mainPanel);
    this.setModal(false);
}

From source file:com.cognitivemedicine.metricsdashboard.client.dashboard.DashboardMainPanel.java

License:Apache License

private void initUi() {
    mainPanel = new VerticalPanel();
    mainPanel.setWidth("300px");
    mainPanel.setSpacing(4);/* w ww.  j  a  va 2s .  c  om*/

    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.setWidth("100%");
    HorizontalPanel logoutPanel = new HorizontalPanel();
    Image logoutImage = new Image(MdConstants.IMG_LOGOUT);
    logoutImage.getElement().getStyle().setCursor(Cursor.POINTER);
    logoutImage.setSize("16px", "16px");
    logoutImage.setTitle("Log Out");
    logoutImage.getElement().getStyle().setProperty("cursor", "hand");
    logoutImage.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    HTML logOutLabel = new HTML("<u><font size=-2>Log Out </font></u>");
    logOutLabel.setHeight("10px");
    // logOutLabel.setStyleName("logoutButton");
    logOutLabel.setStylePrimaryName("logoutButton");
    logOutLabel.getElement().getStyle().setProperty("right", "5px");
    // logOutLabel.getElement().getStyle().setProperty("cursor", "hand");
    logOutLabel.getElement().getStyle().setCursor(Cursor.POINTER);
    logOutLabel.setWidth("100%");
    logOutLabel.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            controller.logOut();
        }
    });

    logoutPanel.add(logOutLabel);
    logoutPanel.add(logoutImage);
    logoutPanel.setSpacing(2);

    logoutPanel.setCellHorizontalAlignment(logoutImage, HasHorizontalAlignment.ALIGN_RIGHT);
    logoutPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);

    titlePanel.getElement().getStyle().setProperty("marginLeft", "50");
    titleLabel = new HTML("<font size=4>&nbsp;</font>");
    titleLabel.getElement().setId("dashboardTitleLabel");

    titlePanel.add(logoutPanel);
    titlePanel.add(titleLabel);

    titlePanel.setCellHorizontalAlignment(logoutPanel, HasHorizontalAlignment.ALIGN_RIGHT);

    DecoratorPanel titleDecor = new DecoratorPanel();
    titleDecor.setWidth("250px");
    titleDecor.setHeight("30px");
    mainPanel.add(titlePanel);

    mainPanel.setCellVerticalAlignment(logOutLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(logOutLabel, HasHorizontalAlignment.ALIGN_RIGHT);
    mainPanel.setCellHorizontalAlignment(titleLabel, HasHorizontalAlignment.ALIGN_LEFT);
    mainPanel.setCellVerticalAlignment(titleLabel, HasVerticalAlignment.ALIGN_MIDDLE);

    Image image = new Image(MdConstants.IMG_TOOLS);
    image.setSize(MdConstants.IMG_SIZE, MdConstants.IMG_SIZE);
    adminConsoleButton = new PushButton(image);
    adminConsoleButton.getElement().setId("adminConsoleButton");
    adminConsoleButton.setSize("50px", MdConstants.IMG_SIZE);
    adminConsoleButton.setTitle("Show Admin Console");
    adminConsoleButton.setEnabled(false);
    adminConsoleButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            AdminConsole console = new AdminConsole(controller);
        }
    });

    editorDecorator = new DecoratorPanel();
    editorDecorator.setTitle("Dashboard Editor");
    editorDecorator.setWidth("315px");

    toolstripPanel = new DashboardToolStripBar(this);

    dashboardListBox = new ListBox(false);
    dashboardListBox.getElement().setId("dashboardListBox");
    dashboardListBox.setWidth("295px");
    dashboardListBox.setVisibleItemCount(10);
    dashboardListBox.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent event) {
            dashboardListChanged();
        }
    });

    notesArea = new TextArea();
    notesArea.setVisibleLines(2);
    notesArea.setWidth("290px");
    notesArea.setHeight("50px");
    notesArea.getElement().setId("notesTextArea");

    VerticalPanel editorVerticalPanel = new VerticalPanel();
    editorVerticalPanel.setSpacing(4);
    editorVerticalPanel.add(toolstripPanel);
    editorVerticalPanel.add(dashboardListBox);
    editorVerticalPanel.add(new HTML("<font size=-1><b>Dashboard Notes:</b></font></br>"));
    editorVerticalPanel.add(notesArea);
    editorVerticalPanel.setCellVerticalAlignment(toolstripPanel, HasVerticalAlignment.ALIGN_MIDDLE);
    editorVerticalPanel.setCellHorizontalAlignment(toolstripPanel, HasHorizontalAlignment.ALIGN_CENTER);
    editorDecorator.setWidget(editorVerticalPanel);

    settingsPanel = new DashboardSettingsPanel(this);

    mainPanel.add(editorDecorator);
    mainPanel.add(settingsPanel);
    // mainPanel.add(adminConsoleButton);

    mainPanel.setCellVerticalAlignment(editorDecorator, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(editorDecorator, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(settingsPanel, HasVerticalAlignment.ALIGN_TOP);
    mainPanel.setCellHorizontalAlignment(settingsPanel, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.setCellVerticalAlignment(adminConsoleButton, HasVerticalAlignment.ALIGN_MIDDLE);
    mainPanel.setCellHorizontalAlignment(adminConsoleButton, HasHorizontalAlignment.ALIGN_CENTER);

    this.add(mainPanel);
}