Example usage for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

List of usage examples for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE

Introduction

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

Prototype

VerticalAlignmentConstant ALIGN_MIDDLE

To view the source code for com.google.gwt.user.client.ui HasVerticalAlignment ALIGN_MIDDLE.

Click Source Link

Document

Specifies that the widget's contents should be aligned in the middle.

Usage

From source file:org.jbpm.dashboard.renderer.client.panel.widgets.DisplayerContainerView.java

License:Apache License

@Override
public void showLoading(Displayer displayer) {
    currentDisplayer = null;//from w ww .j  a  v a2  s.c o m
    VerticalPanel centeredPanel = new VerticalPanel();
    centeredPanel.setWidth("100%");
    centeredPanel.setHeight("100%");
    centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    Image loadingIcon = new Image(DataSetClientResources.INSTANCE.images().loadingIcon().getSafeUri());
    loadingIcon.setTitle(DashboardConstants.INSTANCE.loading());
    loadingIcon.setAltText(DashboardConstants.INSTANCE.loading());
    centeredPanel.add(loadingIcon);

    displayerPanel.clear();
    displayerPanel.add(centeredPanel);
}

From source file:org.jbpm.dashboard.renderer.client.panel.widgets.DisplayerContainerView.java

License:Apache License

@Override
public void showEmpty(Displayer displayer) {
    currentDisplayer = null;//from   w  w w .j a v a2s. c om
    VerticalPanel centeredPanel = new VerticalPanel();
    centeredPanel.setWidth("100%");
    centeredPanel.setHeight("100%");
    centeredPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    centeredPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    Label noDataLabel = new Label(DashboardConstants.INSTANCE.noData());
    centeredPanel.add(noDataLabel);

    displayerPanel.clear();
    displayerPanel.add(centeredPanel);
}

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

License:Apache License

public ClientScriptFormItem(List<FBFormEffect> formEffects) {
    super(formEffects);
    Grid border = new Grid(1, 1);
    border.setSize("100px", "20px");
    border.setBorderWidth(1);//from ww w  .java 2s.  co  m
    border.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    border.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    border.setWidget(0, 0, new Image(FormBuilderResources.INSTANCE.clientScriptIcon()));
    border.getElement().insertFirst(this.script);
    add(border);
    setSize("100px", "20px");
}

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

License:Apache License

public HiddenFormItem(List<FBFormEffect> formEffects) {
    super(formEffects);
    Grid border = new Grid(1, 1);
    border.setSize("100px", "20px");
    border.setBorderWidth(1);//from  w  ww . j a va  2  s  .  c o  m
    border.getCellFormatter().setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER);
    border.getCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_MIDDLE);
    border.setWidget(0, 0, new Image(FormBuilderResources.INSTANCE.hiddenFieldIcon()));
    add(border);
    setSize("100px", "20px");
}

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  ww . j  a va2  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.gwt.client.widget.AbstractFieldWidget.java

License:Apache License

private Widget constructNestedWidgetButton(final FormField field,
        List<HandlerRegistration> handlerRegistrations) {
    HorizontalPanel nestedWidget = new HorizontalPanel();
    nestedWidget.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    final String fieldTypeName = field.getFieldType().getName();
    Label label = new Label(Utils.messages.nestedEntry(fieldTypeName));
    Label emptyLabel = new Label(Utils.constants.empty());
    label.setStyleName(style.fieldNotes());
    label.getElement().getStyle().setPaddingRight(10, Unit.PX);
    final boolean isEmptyRecord = field.getFieldType() == FieldType.RECORD && field.isNull();
    final Button openButton = new Button(isEmptyRecord ? Utils.constants.create() : Utils.constants.open());
    openButton.addStyleName(style.buttonSmall());
    final Button deleteButon = new Button(Utils.constants.delete());
    deleteButon.addStyleName(style.buttonSmall());
    deleteButon.getElement().getStyle().setMarginLeft(10, Unit.PX);

    boolean isReadOnly = readOnly || field.isReadOnly();
    boolean showEmptyLabel = isReadOnly && field.isNull();

    if (showEmptyLabel) {
        openButton.setVisible(false);//w w  w. ja va2  s.  com
        deleteButon.setVisible(false);
        emptyLabel.setVisible(true);
    } else {
        openButton.setVisible(true);
        emptyLabel.setVisible(false);
        handlerRegistrations.add(openButton.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                if (field.getFieldType() == FieldType.RECORD && field.isNull()) {
                    ((RecordField) field).create();
                    openButton.setText(Utils.constants.open());
                    deleteButon.setVisible(true);
                    fireChanged();
                }
                navigationContainer.showField(field, new NavigationActionListener() {
                    @Override
                    public void onChanged(FormField field) {
                        fireChanged();
                    }

                    @Override
                    public void onAdded(FormField field) {
                    }
                });
            }
        }));
        handlerRegistrations.add(deleteButon.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                ConfirmListener listener = new ConfirmListener() {
                    @Override
                    public void onNo() {
                    }

                    @Override
                    public void onYes() {
                        ((RecordField) field).setNull();
                        openButton.setText(Utils.constants.create());
                        deleteButon.setVisible(false);
                        fireChanged();
                    }
                };
                ConfirmDialog dialog = new ConfirmDialog(listener, Utils.messages.deleteNestedEntryTitle(),
                        Utils.messages.deleteNestedEntryQuestion(fieldTypeName, field.getDisplayName()));
                dialog.center();
                dialog.show();
            }
        }));
        deleteButon.setVisible(field.getFieldType() == FieldType.RECORD && !field.isNull() && !isReadOnly);
    }

    nestedWidget.add(label);
    nestedWidget.add(emptyLabel);
    nestedWidget.add(openButton);
    nestedWidget.add(deleteButon);
    return nestedWidget;
}

From source file:org.kaaproject.avro.ui.gwt.client.widget.BusyPopup.java

License:Apache License

public BusyPopup() {
    glass = Document.get().createDivElement();
    glass.setClassName(Utils.avroUiStyle.busyGlass());

    glass.getStyle().setPosition(Position.ABSOLUTE);
    glass.getStyle().setLeft(0, Unit.PX);
    glass.getStyle().setTop(0, Unit.PX);
    glass.getStyle().setZIndex(GLASS_Z_INDEX);

    getElement().getStyle().setZIndex(POPUP_Z_INDEX);

    HorizontalPanel panel = new HorizontalPanel();
    panel.setSize("320px", "70px");
    panel.addStyleName(Utils.avroUiStyle.busyPopup());
    Image image = new Image();
    image.setResource(Utils.resources.busyIndicator());
    panel.add(image);//from ww w.  j av  a 2s  . c  o m
    panel.setCellWidth(image, "60px");
    panel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    Label label = new Label();
    label.setText(Utils.constants.busyPopupText());
    label.getElement().getStyle().setPaddingRight(15, Unit.PX);
    panel.add(label);
    panel.setCellHorizontalAlignment(label, HasHorizontalAlignment.ALIGN_CENTER);
    panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_MIDDLE);
    setWidget(panel);

}

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

License:Apache License

public FormConstructorViewImpl() {
    setWidth(FULL_WIDTH);/*w  w  w . j a  v  a  2  s . c o 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.project.ProjectBundleViewImpl.java

License:Apache License

@Override
protected void initCenterPanel() {

    FlexTable flexTable = new FlexTable();
    flexTable.addStyleName(sandboxStyle.contentPanel());

    flexTable.getColumnFormatter().setWidth(0, "60px");
    flexTable.getColumnFormatter().setWidth(1, "160px");
    flexTable.getColumnFormatter().setWidth(2, "700px");

    backButton.addStyleName(Utils.sandboxStyle.appBackButton());
    backButton.getElement().getStyle().setHeight(180, Unit.PX);
    setBackButton(backButton);//from   ww  w.jav  a  2  s.  c o m

    flexTable.setWidget(0, 0, backButton);
    flexTable.getFlexCellFormatter().setRowSpan(0, 0, 2);
    flexTable.getFlexCellFormatter().setVerticalAlignment(0, 0, HasVerticalAlignment.ALIGN_TOP);

    bundleTitleLabel = new Label();
    bundleTitleLabel.addStyleName(Utils.sandboxStyle.contentTitleLabel());
    bundleTitleLabel.getElement().getStyle().setPaddingBottom(15, Unit.PX);

    flexTable.setWidget(0, 1, bundleTitleLabel);
    flexTable.getFlexCellFormatter().setColSpan(0, 1, 2);
    flexTable.getFlexCellFormatter().setHeight(0, 1, "51px");

    VerticalPanel iconAndButtons = new VerticalPanel();
    iconAndButtons.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);

    bundleImage = new Image();
    iconAndButtons.add(bundleImage);

    flexTable.setWidget(1, 0, iconAndButtons);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);

    FlexTable appDetailsPanel = new FlexTable();
    appDetailsPanel.getColumnFormatter().setWidth(0, "130px");
    appDetailsPanel.getColumnFormatter().setWidth(1, "610px");

    int row = -1;

    descriptionLabel = new Label();
    descriptionLabel.addStyleName(Utils.sandboxStyle.descriptionLabel());
    appDetailsPanel.setWidget(++row, 0, descriptionLabel);
    appDetailsPanel.getFlexCellFormatter().setColSpan(row, 0, 2);

    Label sdkLanguagesLabel = new Label(Utils.constants.sdkLanguages());
    sdkLanguagesLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(++row, 0, sdkLanguagesLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP);

    sdkLanguagesPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, sdkLanguagesPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    Label platformsLabel = new Label(Utils.constants.platforms());
    platformsLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(++row, 0, platformsLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP);

    platformsPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, platformsPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    Label featuresLabel = new Label(Utils.constants.features());
    featuresLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(++row, 0, featuresLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(10, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_TOP);

    featuresPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, featuresPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    Label complexityLabel = new Label(Utils.constants.complexity());
    complexityLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(++row, 0, complexityLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(10, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    complexityPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, complexityPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, Style.Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    flexTable.setWidget(1, 1, appDetailsPanel);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 1, HasVerticalAlignment.ALIGN_TOP);

    projectDetailsPanel = new HTML();
    projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails());
    projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Style.Unit.PX);
    projectDetailsPanel.getElement().getStyle().setPaddingBottom(15, Style.Unit.PX);
    flexTable.setWidget(2, 1, projectDetailsPanel);
    flexTable.getFlexCellFormatter().setColSpan(2, 1, 2);

    carousel = new CarouselWidget();
    HorizontalPanel carouselPanel = new HorizontalPanel();
    carouselPanel.addStyleName(sandboxStyle.bundleProjectsPanel());
    carouselPanel.getElement().getStyle().setPadding(15, Unit.PX);
    carouselPanel.setHeight("330px");
    carouselPanel.setWidth("100%");
    carouselPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    carouselPanel.add(carousel);

    VerticalPanel content = new VerticalPanel();
    content.add(flexTable);
    content.add(carouselPanel);
    content.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    content.getElement().getStyle().setOverflowX(Overflow.AUTO);

    DockLayoutPanel dockPanel = new DockLayoutPanel(Unit.PX);
    dockPanel.add(new ScrollPanel(content));

    centerPanel.add(dockPanel);
    centerPanel.getWidgetContainerElement(dockPanel).getStyle().setOverflowY(Overflow.AUTO);
}

From source file:org.kaaproject.kaa.sandbox.web.client.mvp.view.project.ProjectBundleViewImpl.java

License:Apache License

@Override
public void setSdkLanguages(List<SdkLanguage> sdkLanguages) {
    for (int i = 0; i < sdkLanguages.size(); i++) {
        SdkLanguage sdkLanguage = sdkLanguages.get(i);
        Image image = new Image(Utils.getSdkLanguageIcon(sdkLanguage));
        image.setTitle(Utils.getSdkLanguageText(sdkLanguage));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getSdkLanguageText(sdkLanguage));
        sdkLanguagesPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        sdkLanguagesPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        sdkLanguagesPanel.add(image);/*from   ww w.  j  ava  2 s.com*/
        sdkLanguagesPanel.setCellWidth(image, "32px");
        sdkLanguagesPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        sdkLanguagesPanel.add(label);
        if (i < sdkLanguages.size() - 1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
    }
}