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.jboss.errai.workspaces.client.Header.java

License:Apache License

private void createInfoPanel() {

    // ----------- logo panel
    LayoutPanel logoPanel = new LayoutPanel(new BoxLayout());
    logoPanel.setStyleName("bpm-header-left");

    /*// w w  w.  ja va  2  s . c  o  m
     * Image logo = new Image(appContext.getConfig().getLogo()); logo.setHeight("50"); logoPanel.add(logo);
     */

    // ----------- info panel
    HorizontalPanel infoPanel = new HorizontalPanel();
    infoPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_BOTTOM);
    infoPanel.setSpacing(5);
    infoPanel.setStyleName("bpm-header-right");

    // account info
    ErraiImageBundle icons = GWT.create(ErraiImageBundle.class);
    Image img = new Image(icons.user());
    img.addClickHandler(new ClickHandler() {

        public void onClick(ClickEvent clickEvent) {
            String sessionId = Cookies.getCookie("JSESSIONID") != null ? Cookies.getCookie("JSESSIONID") : "";
            AuthenticationContext authContext = Registry.get(SecurityService.class).getAuthenticationContext();
            Set<Role> roleSet = authContext.getRoles();

            StringBuffer roles = new StringBuffer();
            for (Role r : roleSet) {
                roles.append(r.getRoleName()).append(" ");
            }

            StringBuffer sb = new StringBuffer("<h3>User information</h3>");
            sb.append("- User: ").append(authContext.getName()).append("<br/>");
            sb.append("- Logged in since: ").append(loginDate).append("<br/>");
            sb.append("- SID: ").append(sessionId).append("<br/>");
            sb.append("- Roles: ").append(roles.toString()).append("<br/>");

            final LayoutPopupPanel popup = new LayoutPopupPanel(true);
            popup.setPopupPosition(clickEvent.getRelativeElement().getAbsoluteLeft() - 120,
                    clickEvent.getRelativeElement().getAbsoluteTop() + 20);
            popup.setAnimationEnabled(true);
            popup.setSize("240px", "130px");
            HTML html = new HTML(sb.toString());
            html.setStyleName("bpm-user-info-popup");
            popup.add(html);
            popup.show();
        }
    });

    Button btn = new Button("Logout", new ClickHandler() {

        public void onClick(ClickEvent clickEvent) {
            MessageBuilder.createMessage().toSubject("AuthenticationService")
                    .command(SecurityCommands.EndSession).noErrorHandling().sendNowWith(ErraiBus.get());
        }
    });

    infoPanel.add(img);
    infoPanel.add(username);
    infoPanel.add(btn);

    this.add(logoPanel, new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));
    this.add(infoPanel, new BoxLayoutData(177, 50));
}

From source file:org.jbpm.form.builder.ng.model.client.form.items.HorizontalLayoutFormItem.java

License:Apache License

private void populate(HorizontalPanel panel) {
    if (this.borderWidth != null) {
        panel.setBorderWidth(this.borderWidth);
    }//from   ww  w .  j  a v  a2  s .  c  o m
    if (this.getHeight() != null && !"".equals(this.getHeight())) {
        panel.setHeight(this.getHeight());
    }
    if (this.getWidth() != null && !"".equals(this.getWidth())) {
        panel.setWidth(this.getWidth());
    }
    if (this.spacing != null) {
        panel.setSpacing(this.spacing);
    }
    if (this.cssClassName != null) {
        panel.setStyleName(this.cssClassName);
    }
    if (this.horizontalAlignment != null) {
        try {
            Direction d = Direction.valueOf(horizontalAlignment);
            panel.setHorizontalAlignment(HorizontalAlignmentConstant.startOf(d));
        } catch (IllegalArgumentException e) {
        }
    }
    if (this.title != null) {
        panel.setTitle(this.title);
    }
}

From source file:org.jcsadra.tool.statusboard.client.view.StatusListView.java

License:Apache License

/**
 * Get a string representation of the header that includes an image and some
 * text.//from  w w  w  .  j a v  a  2  s.c  o  m
 * 
 * @param text
 *            the header text
 * @param image
 *            the {@link ImageResource} to add next to the header
 * @return the header as a string
 */
private String getHeaderString(String text, ImageResource image) {
    // Add the image and text to a horizontal panel
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setSpacing(0);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    hPanel.add(new Image(image));
    HTML headerText = new HTML(text);
    headerText.setStyleName("cw-StackPanelHeader");
    hPanel.add(headerText);

    // Return the HTML string for the panel
    return hPanel.getElement().getString();
}

From source file:org.kaaproject.avro.ui.sandbox.client.mvp.view.form.FormConstructorViewImpl.java

License:Apache License

public FormConstructorViewImpl() {
    setWidth(FULL_WIDTH);//from ww w . j a  va2  s.  co  m

    int row = 0;

    HorizontalPanel toolbarPanel = new HorizontalPanel();
    CheckBox readOnlyCheckBox = new CheckBox(Utils.constants.read_only());
    readOnlyCheckBox.setWidth(FULL_WIDTH);
    readOnlyCheckBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
        @Override
        public void onValueChange(ValueChangeEvent<Boolean> event) {
            form.setReadOnly(event.getValue());
        }
    });
    toolbarPanel.add(readOnlyCheckBox);
    Button showDisplayStringButton = new Button(Utils.constants.view_display_string());
    showDisplayStringButton.getElement().getStyle().setMarginLeft(10, Unit.PX);
    showDisplayStringButton.addStyleName(Utils.avroUiStyle.buttonSmall());
    showDisplayStringButton.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            RecordField field = form.getValue();
            String displayString = field != null ? field.getDisplayString() : "null";
            Window.alert(Utils.constants.display_string() + ":\n" + displayString);
        }
    });
    toolbarPanel.add(showDisplayStringButton);
    setWidget(row++, 0, toolbarPanel);

    form = new RecordFieldWidget(new AvroWidgetsConfig.Builder().createConfig());

    form.addValueChangeHandler(new ValueChangeHandler<RecordField>() {
        @Override
        public void onValueChange(ValueChangeEvent<RecordField> event) {
            fireFormChanged();
        }
    });

    CaptionPanel formPanel = new CaptionPanel(Utils.constants.avroUiView());
    form.getElement().getStyle().setPropertyPx("minHeight", MIN_PANEL_HEIGHT);
    formPanel.add(form);

    setWidget(row++, 0, formPanel);

    showJsonButton = new Button(Utils.constants.showJson());
    showJsonButton.setEnabled(true);

    loadJsonButton = new Button(Utils.constants.loadJson());
    loadJsonButton.setEnabled(false);

    generateRecordButton = new Button(Utils.constants.generateRecordForm());
    generateRecordButton.getElement().getStyle().setProperty("float", "right");

    generateRecordButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            generateRecordButton.setEnabled(false);
        }
    });

    FlexTable buttonTable = new FlexTable();
    buttonTable.setWidth(FULL_WIDTH);

    HorizontalPanel buttonsPanel1 = new HorizontalPanel();
    buttonsPanel1.setSpacing(15);
    buttonsPanel1.add(showJsonButton);
    buttonsPanel1.add(loadJsonButton);
    HorizontalPanel buttonsPanel2 = new HorizontalPanel();
    buttonsPanel2.setSpacing(15);
    buttonsPanel2.add(generateRecordButton);

    buttonTable.setWidget(0, 0, buttonsPanel1);
    buttonTable.setWidget(0, 1, buttonsPanel2);
    setWidget(row++, 0, buttonTable);

    buttonTable.getFlexCellFormatter().setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    buttonTable.getElement().getParentElement().getStyle().setPaddingTop(0, Unit.PX);

    jsonArea = new SizedTextArea(-1);
    jsonArea.getTextArea().setWidth(JSON_PANEL_WIDTH);
    jsonArea.getTextArea().getElement().getStyle().setPropertyPx("minHeight", 300);
    jsonArea.setVisible(false);
    jsonArea.addInputHandler(new InputEventHandler() {
        @Override
        public void onInputChanged(InputEvent event) {
            fireChanged();
        }
    });

    formJsonPanel = new CaptionPanel(Utils.constants.jsonView());
    formJsonPanel.getElement().getStyle().setMargin(5, Unit.PX);
    VerticalPanel jsonAreaPanel = new VerticalPanel();

    jsonAreaPanel.add(jsonArea);
    jsonAreaPanel.add(uploadForm);
    formJsonPanel.add(jsonAreaPanel);

    formJsonPanel.setVisible(false);

    setWidget(row, 0, formJsonPanel);

    downloadButton.setEnabled(false);

    uploadForm.setEncoding(FormPanel.ENCODING_MULTIPART);
    uploadForm.setMethod(FormPanel.METHOD_POST);
    uploadForm.setAction(GWT.getModuleBaseURL() + UPLOAD_SERVLET_PATH);

    FlexTable fileOpsTable = new FlexTable();
    fileOpsTable.setWidth(JSON_PANEL_WIDTH);
    fileOpsTable.setCellSpacing(8);

    int column = 0;
    uploadForm.setWidget(fileOpsTable);
    fileUpload.setName(Utils.constants.uploadFromFile());
    fileOpsTable.setWidget(0, column++, uploadButton);
    fileOpsTable.setWidget(0, column, fileUpload);
    fileOpsTable.getFlexCellFormatter().setVerticalAlignment(0, column++, HasVerticalAlignment.ALIGN_MIDDLE);

    uploadButton.setEnabled(false);
    uploadButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            if (!"".equals(fileUpload.getFilename())) {
                uploadForm.submit();
            }
        }
    });

    fileUpload.addChangeHandler(new ChangeHandler() {
        @Override
        public void onChange(ChangeEvent changeEvent) {
            if (!"".equals(fileUpload.getFilename())) {
                uploadButton.setEnabled(true);
            } else {
                uploadButton.setEnabled(false);
            }
        }
    });

    fileOpsTable.setWidget(0, column, downloadButton);
    fileOpsTable.getFlexCellFormatter().setHorizontalAlignment(0, column, HasHorizontalAlignment.ALIGN_RIGHT);
}

From source file:org.kaaproject.kaa.sandbox.web.client.mvp.view.widget.DemoProjectsView.java

License:Apache License

public void setProjects(List<Project> projects) {
    reset();//from w ww .j  a v a2s.  com
    int row = 0;
    for (final Project project : projects) {
        Label projectTitleLabel = new Label(project.getName());
        projectTitleLabel.addStyleName("b-app-content-title-label");
        if (row > 0) {
            projectTitleLabel.getElement().getStyle().setPaddingTop(10, Unit.PX);
        }
        setWidget(row++, 0, projectTitleLabel);
        Label platformLabel = new Label("Platform: " + project.getPlatform().name());
        platformLabel.getElement().getStyle().setFontWeight(FontWeight.NORMAL);
        setWidget(row++, 0, platformLabel);
        HTML descLabel = new HTML(project.getDescription());
        setWidget(row++, 0, descLabel);
        HorizontalPanel buttonsPanel = new HorizontalPanel();
        buttonsPanel.setSpacing(5);
        setWidget(row++, 0, buttonsPanel);
        Button getSourceCodeButton = new Button("Get source code");
        buttonsPanel.add(getSourceCodeButton);
        Button getBinaryButton = new Button("Get binary");
        buttonsPanel.add(getBinaryButton);

        registrations.add(getSourceCodeButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                String projectId = project.getId();
                ProjectActionEvent action = new ProjectActionEvent(projectId, ProjectAction.GET_SOURCE_CODE);
                fireEvent(action);
            }

        }));

        registrations.add(getBinaryButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                String projectId = project.getId();
                ProjectActionEvent action = new ProjectActionEvent(projectId, ProjectAction.GET_BINARY);
                fireEvent(action);
            }
        }));
    }
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfilesViewImpl.java

License:Apache License

public EndpointProfilesViewImpl() {
    super(false);

    int column = 0;
    FlexTable flexTable = new FlexTable();
    flexTable.setStyleName(Utils.avroUiStyle.fieldWidget());

    resetButton = new Button(Utils.constants.reset());
    flexTable.setWidget(0, column, resetButton);
    flexTable.getFlexCellFormatter().setVerticalAlignment(0, column++, HasVerticalAlignment.ALIGN_MIDDLE);

    endpointGroupButton = new RadioButton("filter", Utils.constants.endpointGroup());
    listBox = new EndpointGroupsInfoListBox();
    listBox.getElement().getStyle().setPropertyPx("minWidth", 100);
    HorizontalPanel groupPanel = new HorizontalPanel();
    groupPanel.setSpacing(15);
    groupPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    groupPanel.add(endpointGroupButton);
    groupPanel.add(listBox);/*from www.ja  va  2s .c  om*/
    flexTable.setWidget(0, column++, groupPanel);

    HorizontalPanel keyHashPanel = new HorizontalPanel();
    keyHashPanel.setSpacing(15);
    keyHashPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    endpointKeyHashButton = new RadioButton("filter", Utils.constants.endpointKeyHash());
    endpointKeyHash = new TextBox();
    endpointKeyHash.setWidth("100%");
    findButton = new Button(Utils.constants.find());
    findButton.addStyleName(Utils.avroUiStyle.buttonSmall());
    keyHashPanel.add(endpointKeyHashButton);
    keyHashPanel.add(endpointKeyHash);
    keyHashPanel.add(findButton);
    flexTable.setWidget(0, column, keyHashPanel);

    filterPanel.add(flexTable);

    endpointGroupButton.setValue(true);
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.endpoint.EndpointProfileViewImpl.java

License:Apache License

@Override
protected void initDetailsTable() {

    detailsTable.getColumnFormatter().setWidth(0, "200px");
    detailsTable.getColumnFormatter().setWidth(1, "550px");
    detailsTable.getColumnFormatter().setWidth(2, "0px");

    getSaveButtonWidget().removeFromParent();
    getCancelButtonWidget().removeFromParent();
    requiredFieldsNoteLabel.setVisible(false);

    int row = 0;/*from  w  w w.ja  v a2  s  .c om*/
    Label keyHashLabel = new Label(Utils.constants.endpointKeyHash());
    endpointKeyHash = new KaaAdminSizedTextBox(-1, false);
    endpointKeyHash.setWidth("100%");
    detailsTable.setWidget(row, 0, keyHashLabel);
    detailsTable.setWidget(row, 1, endpointKeyHash);

    userInfoList = new ArrayList<>();
    Label userIDLabel = new Label(Utils.constants.userId());
    userID = new KaaAdminSizedTextBox(-1, false);
    userID.setWidth("100%");
    detailsTable.setWidget(++row, 0, userIDLabel);
    detailsTable.setWidget(row, 1, userID);
    userInfoList.add(userIDLabel);
    userInfoList.add(userID);

    Label userExternalIDLabel = new Label(Utils.constants.userExternalId());
    userExternalID = new KaaAdminSizedTextBox(-1, false);
    userExternalID.setWidth("100%");
    detailsTable.setWidget(++row, 0, userExternalIDLabel);
    detailsTable.setWidget(row, 1, userExternalID);
    userInfoList.add(userExternalIDLabel);
    userInfoList.add(userExternalID);

    Label sdkLabel = new Label(Utils.constants.sdkProfile());
    sdkAnchor = new Anchor();
    sdkAnchor.getElement().getStyle().setCursor(Style.Cursor.POINTER);
    sdkAnchor.setWidth("100%");
    detailsTable.getFlexCellFormatter().setHeight(row, 0, "40px");
    detailsTable.setWidget(row, 0, sdkLabel);
    detailsTable.setWidget(row++, 1, sdkAnchor);

    SpanElement span = Document.get().createSpanElement();
    span.appendChild(Document.get().createTextNode(Utils.constants.endpointProfile()));
    span.addClassName("gwt-Label");

    CaptionPanel formPanel = new CaptionPanel(span.getString(), true);
    FlexTable recordTable = new FlexTable();
    recordTable.setWidth("100%");

    Label endpointProfSchemaLabel = new Label(Utils.constants.schemaName());
    endpointProfSchemaName = new Anchor();
    endpointProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER);

    HorizontalPanel schemaNamePanel = new HorizontalPanel();
    schemaNamePanel.setHeight("40px");
    schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    schemaNamePanel.add(endpointProfSchemaLabel);
    schemaNamePanel.add(endpointProfSchemaName);
    schemaNamePanel.setCellWidth(endpointProfSchemaName, "200px");
    endpointProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    HorizontalPanel schemaButtonsPanel = new HorizontalPanel();
    schemaButtonsPanel.setSpacing(6);
    downloadEndpointProfileJsonButton = new ImageTextButton(Utils.resources.download(),
            Utils.constants.downloadJson());
    schemaButtonsPanel.add(downloadEndpointProfileJsonButton);
    schemaNamePanel.add(schemaButtonsPanel);
    schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    recordTable.setWidget(0, 0, schemaNamePanel);

    endpointProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(),
            Utils.constants.profile(), this, true, true);
    endpointProfForm.getRecordWidget().setForceNavigation(true);
    endpointProfForm.setPreferredHeightPx(200);
    recordTable.setWidget(1, 0, endpointProfForm);
    recordTable.getFlexCellFormatter().setColSpan(1, 0, 2);

    formPanel.add(recordTable);

    detailsTable.setWidget(++row, 0, formPanel);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    formPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);

    span = Document.get().createSpanElement();
    span.appendChild(Document.get().createTextNode(Utils.constants.serverProfile()));
    span.addClassName("gwt-Label");

    CaptionPanel serverFormPanel = new CaptionPanel(span.getString(), true);
    FlexTable serverRecordTable = new FlexTable();
    serverRecordTable.setWidth("100%");

    Label serverProfSchemaLabel = new Label(Utils.constants.schemaName());
    serverProfSchemaName = new Anchor();
    serverProfSchemaName.getElement().getStyle().setCursor(Style.Cursor.POINTER);

    schemaNamePanel = new HorizontalPanel();
    schemaNamePanel.setHeight("40px");
    schemaNamePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    schemaNamePanel.add(serverProfSchemaLabel);
    schemaNamePanel.add(serverProfSchemaName);
    schemaNamePanel.setCellWidth(serverProfSchemaName, "200px");
    serverProfSchemaName.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    schemaButtonsPanel = new HorizontalPanel();
    schemaButtonsPanel.setSpacing(6);
    downloadServerProfileJsonButton = new ImageTextButton(Utils.resources.download(),
            Utils.constants.downloadJson());
    schemaButtonsPanel.add(downloadServerProfileJsonButton);
    editServerProfileButton = new Button(Utils.constants.edit());
    schemaButtonsPanel.add(editServerProfileButton);
    schemaNamePanel.add(schemaButtonsPanel);
    schemaButtonsPanel.getElement().getParentElement().getStyle().setPaddingLeft(10, Unit.PX);

    serverRecordTable.setWidget(0, 0, schemaNamePanel);
    serverProfForm = new RecordPanel(new AvroWidgetsConfig.Builder().recordPanelWidth(700).createConfig(),
            Utils.constants.profile(), this, true, true);
    serverProfForm.getRecordWidget().setForceNavigation(true);
    serverProfForm.setPreferredHeightPx(200);
    serverRecordTable.setWidget(1, 0, serverProfForm);
    serverRecordTable.getFlexCellFormatter().setColSpan(1, 0, 2);

    serverFormPanel.add(serverRecordTable);

    detailsTable.setWidget(++row, 0, serverFormPanel);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    serverFormPanel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);

    groupsGrid = new EndpointGroupGrid(true);
    groupsGrid.setSize("100%", "200px");
    Label groupsLabel = new Label(Utils.constants.endpointGroups());
    detailsTable.setWidget(++row, 0, groupsLabel);
    groupsLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
    detailsTable.setWidget(++row, 0, groupsGrid);
    groupsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);

    topicsGrid = new TopicGrid(false, true);
    topicsGrid.setSize("100%", "200px");
    Label topicLabel = new Label(Utils.constants.subscribedOnNfTopics());
    topicLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitleLabel());
    detailsTable.setWidget(++row, 0, topicLabel);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    topicLabel.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
    detailsTable.setWidget(++row, 0, topicsGrid);
    detailsTable.getFlexCellFormatter().setColSpan(row, 0, 2);
    topicsGrid.getElement().getParentElement().getStyle().setPaddingBottom(10, Unit.PX);
}

From source file:org.kino.client.MainMenu.java

public MainMenu() {
    HorizontalPanel hor = new HorizontalPanel();
    hor.setSpacing(150);
    center.add(hor);/*from  ww w  .j  a  v a2  s.c  o m*/

    final TextButton but_add = new TextButton("?? ??", Resources.INSTANCE.plus());
    final TextButton but_search = new TextButton("", Resources.INSTANCE.search());
    final TextButton but_movie = new TextButton("", Resources.INSTANCE.screen());

    hor.add(but_add);
    hor.add(but_search);
    hor.add(but_movie);

    but_add.setIconAlign(ButtonCell.IconAlign.TOP);
    but_search.setIconAlign(ButtonCell.IconAlign.TOP);
    but_movie.setIconAlign(ButtonCell.IconAlign.TOP);

    SelectEvent.SelectHandler selectHandler = new SelectEvent.SelectHandler() {

        @Override
        public void onSelect(SelectEvent event) {
            int id = -1;
            if (event.getSource() == but_add)
                id = MENU_ADD;
            else if (event.getSource() == but_search)
                id = MENU_SEARCH;
            else if (event.getSource() == but_movie)
                id = MENU_THEATER;
            onMenuClick(id);
        }
    };
    but_add.addSelectHandler(selectHandler);
    but_search.addSelectHandler(selectHandler);
    but_movie.addSelectHandler(selectHandler);

}

From source file:org.mobicents.servlet.management.client.router.RequestColumnsContainer.java

License:Open Source License

private Widget buildTitles() {
    HorizontalPanel titles = new HorizontalPanel();
    titles.setStyleName(CSS_TITLE);
    titles.setSpacing(SPACING);
    Label spacerLabel = new Label("");
    spacerLabel.setPixelSize(14, 7);//from   w w  w .  j a  v  a  2 s . c  o m
    titles.add(spacerLabel);

    for (int col = 0; col < COLUMNS.length; col++) {
        titles.add(makeTitle(COLUMNS[col]));
    }

    return titles;
}

From source file:org.mobicents.servlet.management.client.router.RequestColumnsContainer.java

License:Open Source License

private void populateRouterNodes(DARRoute[] routes) {
    AbsolutePanel boundaryPanel = this;
    boundaryPanel.add(buildTitles());//from   w  ww  . j a  v a2 s.c om
    boundaryPanel.setSize(UserInterface.WIDTH, UserInterface.HEIGHT);
    addStyleName(CSS_SSM);
    routeColumns = new VerticalPanel[COLUMNS.length];
    PickupDragController columnDragController = new PickupDragController(boundaryPanel, false);
    columnDragController.setBehaviorMultipleSelection(false);

    final PickupDragController widgetDragController = new PickupDragController(boundaryPanel, false);
    widgetDragController.setBehaviorMultipleSelection(false);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.addStyleName(CSS_CONTAINER);
    horizontalPanel.setSpacing(SPACING);
    boundaryPanel.add(horizontalPanel);

    IndexedDropController columnDropController = new IndexedDropController(horizontalPanel);
    columnDragController.registerDropController(columnDropController);

    for (int col = 0; col < COLUMNS.length; col++) {

        VerticalPanel columnCompositePanel = new VerticalPanel();
        columnCompositePanel.addStyleName(CSS_SSM_COLUMN_COMPOSITE);

        final VerticalPanel verticalPanel = new VerticalPanel();
        routeColumns[col] = verticalPanel;
        verticalPanel.addStyleName(CSS_CONTAINER);
        verticalPanel.setSpacing(SPACING);
        horizontalPanel.add(columnCompositePanel);

        NoInsertAtEndIndexedDropController widgetDropController = new NoInsertAtEndIndexedDropController(
                verticalPanel);
        widgetDragController.registerDropController(widgetDropController);

        HTML groupDragHandle = new HTML("<div class='group-drag-handle'/>");
        columnCompositePanel.add(groupDragHandle);
        columnCompositePanel.add(verticalPanel);

        columnDragController.makeDraggable(columnCompositePanel, groupDragHandle);

        for (int q = 0; q < routes.length; q++) {
            if (COLUMNS[col].equals(routes[q].getRequest())) {
                for (int w = 0; w < routes[q].getNodes().length; w++) {
                    ApplicationRouteNodeEditor widget = new ApplicationRouteNodeEditor(routes[q].getNodes()[w]);
                    verticalPanel.add(widget);
                    widgetDragController.makeDraggable(widget, widget.getDragHandle());
                }
            }
        }

        Label spacerLabel = new Label("");
        spacerLabel.setPixelSize(199, 50);
        verticalPanel.add(spacerLabel);
        Button addApplicationButton = new Button("Add application", new ButtonListenerAdapter() {
            public void onClick(Button button, EventObject e) {
                ApplicationRouteNodeEditor widget = new ApplicationRouteNodeEditor();
                verticalPanel.insert(widget, verticalPanel.getWidgetCount() - 1);
                widgetDragController.makeDraggable(widget, widget.getDragHandle());
            }

        });
        addApplicationButton.setWidth("100%");
        columnCompositePanel.add(addApplicationButton);
    }

}