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.kaaproject.kaa.sandbox.web.client.mvp.view.project.ProjectBundleViewImpl.java

License:Apache License

@Override
public void setPlatforms(List<Platform> platforms) {
    for (int i = 0; i < platforms.size(); i++) {
        Platform platform = platforms.get(i);
        Image image = new Image(Utils.getPlatformIcon(platform));
        image.setTitle(Utils.getPlatformText(platform));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getPlatformText(platform));
        platformsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        platformsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        platformsPanel.add(image);/*from   w  w w . j av a 2s .  co m*/
        platformsPanel.setCellWidth(image, "32px");
        platformsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        platformsPanel.add(label);
        if (i < platforms.size() - 1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
    }
}

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

License:Apache License

@Override
public void setFeatures(List<Feature> features) {
    for (int i = 0; i < features.size(); i++) {
        Feature feature = features.get(i);
        Image image = new Image(Utils.getFeatureIcon(feature));
        image.setTitle(Utils.getFeatureText(feature));
        image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
        Label label = new Label(Utils.getFeatureText(feature));
        featuresPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
        featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
        featuresPanel.add(image);/*ww  w  . ja v  a  2  s  . c  om*/
        featuresPanel.setCellWidth(image, "32px");
        featuresPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
        featuresPanel.add(label);
        if (i < features.size() - 1) {
            label.getElement().getStyle().setPaddingRight(10, Unit.PX);
        }
        label.getElement().getStyle().setPaddingLeft(8, Unit.PX);

    }
}

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

License:Apache License

@Override
public void setComplexity(Complexity complexity) {
    Image image = new Image(Utils.getFilterComplexityIcon(complexity));
    image.setTitle(Utils.getComplexityText(complexity));
    image.getElement().getStyle().setVerticalAlign(Style.VerticalAlign.MIDDLE);
    Label label = new Label(Utils.getComplexityText(complexity));
    complexityPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    complexityPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    complexityPanel.add(image);//from  www .  java  2  s .  com
    complexityPanel.setCellWidth(image, "32px");
    complexityPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    complexityPanel.add(label);
    label.getElement().getStyle().setPaddingLeft(8, Style.Unit.PX);
}

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

License:Apache License

@Override
protected void initCenterPanel() {

    FlexTable flexTable = new FlexTable();

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

    backButton = new Button();
    backButton.addStyleName(Utils.sandboxStyle.appBackButton());
    backButton.getElement().getStyle().setHeight(180, Unit.PX);
    setBackButton(backButton);//from w w w  . j  a  v a 2s.  com

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

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

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

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

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

    VerticalPanel buttonsPanel = new VerticalPanel();
    buttonsPanel.getElement().getStyle().setPaddingTop(30, Unit.PX);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    buttonsPanel.setWidth("100%");

    getSourceButton = new Button(Utils.constants.getSourceCode());
    getSourceButton.setSize("128px", "32px");
    getSourceButton.getElement().getStyle().setPaddingTop(0, Unit.PX);
    getSourceButton.getElement().getStyle().setPaddingBottom(0, Unit.PX);
    getSourceButton.getElement().getStyle().setFontWeight(FontWeight.BOLD);
    getBinaryButton = new Button(Utils.constants.getBinary());
    getBinaryButton.setSize("128px", "32px");
    getBinaryButton.getElement().getStyle().setPaddingTop(0, Unit.PX);
    getBinaryButton.getElement().getStyle().setPaddingBottom(0, Unit.PX);
    getBinaryButton.getElement().getStyle().setFontWeight(FontWeight.BOLD);

    buttonsPanel.add(getSourceButton);
    SimplePanel spacingPanel = new SimplePanel();
    spacingPanel.setHeight("10px");
    buttonsPanel.add(spacingPanel);
    buttonsPanel.add(getBinaryButton);

    iconAndButtons.add(buttonsPanel);

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

    FlexTable appDetailsPanel = new FlexTable();
    appDetailsPanel.getColumnFormatter().setWidth(0, "120px");
    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 sdkLanguageLabel = new Label(Utils.constants.sdkLanguage());
    sdkLanguageLabel.addStyleName(Utils.sandboxStyle.contentLabel());
    appDetailsPanel.setWidget(++row, 0, sdkLanguageLabel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 0).getStyle().setPaddingTop(15, Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    sdkLanguagePanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, sdkLanguagePanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, 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, Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    platformsPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, platformsPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(15, 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, Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 0, HasVerticalAlignment.ALIGN_MIDDLE);

    featuresPanel = new HorizontalPanel();
    appDetailsPanel.setWidget(row, 1, featuresPanel);
    appDetailsPanel.getFlexCellFormatter().getElement(row, 1).getStyle().setPaddingTop(10, 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, 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, Unit.PX);
    appDetailsPanel.getFlexCellFormatter().setVerticalAlignment(row, 1, HasVerticalAlignment.ALIGN_MIDDLE);

    projectDetailsPanel = new HTML();
    projectDetailsPanel.addStyleName(Utils.sandboxStyle.projectDetails());
    projectDetailsPanel.getElement().getStyle().setPaddingTop(15, Unit.PX);

    appDetailsPanel.setWidget(++row, 0, projectDetailsPanel);
    appDetailsPanel.getFlexCellFormatter().setColSpan(row, 0, 2);

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

    detailsPanel.add(flexTable);
}

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

License:Apache License

@Override
public void setSdkLanguage(SdkLanguage sdkLanguage) {
    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));
    sdkLanguagePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    sdkLanguagePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    sdkLanguagePanel.add(image);/*from w w w.j av a2  s  . c o  m*/
    sdkLanguagePanel.setCellWidth(image, "32px");
    sdkLanguagePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    sdkLanguagePanel.add(label);
    label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
}

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

License:Apache License

@Override
public void setComplexity(Complexity complexity) {
    Image image = new Image(Utils.getFilterComplexityIcon(complexity));
    image.setTitle(Utils.getComplexityText(complexity));
    image.getElement().getStyle().setVerticalAlign(VerticalAlign.MIDDLE);
    Label label = new Label(Utils.getComplexityText(complexity));
    complexityPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    complexityPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    complexityPanel.add(image);/*from  w  ww  .  j a v  a 2 s .  co  m*/
    complexityPanel.setCellWidth(image, "32px");
    complexityPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    complexityPanel.add(label);
    label.getElement().getStyle().setPaddingLeft(8, Unit.PX);
}

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

License:Apache License

public DemoProjectWidget() {
    super();//from w  w w  .  ja va2 s .  com

    addStyleName(Utils.sandboxStyle.demoProjectWidget());
    setVisible(false);
    projectWidgetAnimation = new ProjectWidgetAnimation(this, 230, 10.0);

    SimplePanel backPanel = new SimplePanel();
    backPanel.addStyleName(Utils.sandboxStyle.projectCard());
    add(backPanel, 20, 20);
    backPanel = new SimplePanel();
    backPanel.addStyleName(Utils.sandboxStyle.projectCard());
    add(backPanel, 10, 10);
    backPanel = new SimplePanel();
    backPanel.addStyleName(Utils.sandboxStyle.projectCard());
    add(backPanel, 0, 0);

    getWidget(0).setVisible(false);
    getWidget(1).setVisible(false);

    VerticalPanel rootPanel = new VerticalPanel();
    rootPanel.setHeight("100%");
    backPanel.add(rootPanel);

    detailsPanel = new VerticalPanel();
    detailsPanel.addStyleName(Utils.sandboxStyle.details());
    detailsPanel.sinkEvents(Event.ONCLICK);

    detailsPanel.setWidth("100%");

    AbsolutePanel layoutPanel = new AbsolutePanel();

    VerticalPanel platformImagePanel = new VerticalPanel();
    platformImagePanel.addStyleName(Utils.sandboxStyle.detailsInnerTop());
    platformImagePanel.setWidth("100%");
    applicationImage = new Image();
    complexityImage = new Image();
    applicationImage.getElement().getStyle().setHeight(128, Unit.PX);
    platformImagePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    platformImagePanel.add(applicationImage);

    layoutPanel.add(platformImagePanel);
    layoutPanel.add(complexityImage, 3, 3);
    SimplePanel platformImageHoverPanel = new SimplePanel();
    platformImageHoverPanel.addStyleName(Utils.sandboxStyle.platformImageHover());
    layoutPanel.add(platformImageHoverPanel);
    platformImageHoverPanel.setSize("100%", "100%");
    layoutPanel.setSize("100%", "100%");

    detailsPanel.add(layoutPanel);
    VerticalPanel titlePanel = new VerticalPanel();
    titlePanel.addStyleName(Utils.sandboxStyle.detailsInnerCenter());
    titlePanel.addStyleName(Utils.sandboxStyle.titlePanel());
    projectTitle = new Anchor();
    projectTitle.addStyleName(Utils.sandboxStyle.title());
    titlePanel.add(projectTitle);
    titlePanel.setCellVerticalAlignment(projectTitle, HasVerticalAlignment.ALIGN_MIDDLE);

    detailsPanel.add(titlePanel);

    rootPanel.add(detailsPanel);

    bottomPanel = new VerticalPanel();
    bottomPanel.setWidth("100%");

    HorizontalPanel iconsPanel = new HorizontalPanel();
    iconsPanel.setWidth("100%");
    iconsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    iconsPanel.addStyleName(Utils.sandboxStyle.detailsInnerCenter());
    iconsPanel.getElement().getStyle().setPaddingTop(10, Unit.PX);
    platformPanel = new HorizontalPanel();
    platformPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    iconsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    iconsPanel.add(platformPanel);

    featuresPanel = new HorizontalPanel();
    featuresPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    iconsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    iconsPanel.add(featuresPanel);

    bottomPanel.add(iconsPanel);

    rootPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    rootPanel.add(bottomPanel);
    rootPanel.setCellHeight(bottomPanel, "100%");
}

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

License:Apache License

public HeaderMenuItems() {
    addStyleName(Utils.sandboxStyle.buttons());
    setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    setSize("100%", "100%");

    collapsedMenu = new ActionsLabel("", true);
    collapsedMenu.addStyleName(Utils.sandboxStyle.button());
    collapsedMenu.addStyleName(Utils.sandboxStyle.buttonLast());
    collapsedMenu.addStyleName(Utils.sandboxStyle.toggle());
    collapsedMenu.setVisible(false);/* ww  w  .  ja va2s  .c o m*/
    add(collapsedMenu);
}

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

License:Apache License

public LeftPanelWidget(Unit unit) {
    super(unit);/*ww w  . ja  v  a 2s.  c  o  m*/
    addStyleName(Utils.sandboxStyle.leftPanel());
    HorizontalPanel titlePanel = new HorizontalPanel();
    titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    titlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    titleLabel = new Label();
    titleLabel.addStyleName(Utils.sandboxStyle.title());
    titlePanel.add(titleLabel);
    titlePanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    anchor = new Anchor();
    anchor.addStyleName(Utils.sandboxStyle.toggle());
    titlePanel.add(anchor);
    titlePanel.setSize("100%", "100%");
    addNorth(titlePanel, 40);

    contentScroll = new ScrollPanel() {
        @Override
        public void onResize() {
            super.onResize();
            int scrollHeight = this.getScrollableElement().getClientHeight();
            int elementHeight = this.getContainerElement().getClientHeight();
            boolean isScroll = elementHeight > scrollHeight;
            if (isScroll && !(LeftPanelWidget.this.isOpen && LeftPanelWidget.this.isActive)) {
                LeftPanelWidget.this.addStyleName(Utils.sandboxStyle.isScroll());
            } else {
                LeftPanelWidget.this.removeStyleName(Utils.sandboxStyle.isScroll());
            }
        }
    };
    contentScroll.setHeight("100%");
    add(contentScroll);

    addStyleName(Utils.sandboxStyle.isOpen());

    anchor.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (isActive) {
                setOpen(!isOpen, false);
            }
        }
    });
}

From source file:org.kaaproject.kaa.server.admin.client.mvp.view.base.BaseDetailsViewImpl.java

License:Apache License

protected void constructTopPanel() {
    FlowPanel panel = new FlowPanel();
    panel.setSize("100%", "100%");
    topPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    topPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    topPanel.add(panel);//from  www . j  a va2s  .  co  m
    topPanel.setCellHeight(panel, "100%");
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setHeight("100%");
    panel.add(horizontalPanel);

    HorizontalPanel backButtonPanel = new HorizontalPanel();
    backButtonPanel.setHeight("100%");
    backButtonPanel.addStyleName(Utils.kaaAdminStyle.bAppPaddedPanel());
    backButtonPanel.setVisible(false);
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(backButtonPanel);
    horizontalPanel.setCellHeight(backButtonPanel, "100%");

    backButtonPanelWidget = backButtonPanel;

    Button backButton = new Button();
    backButton.addStyleName(Utils.kaaAdminStyle.bAppBackButton());
    backButtonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    backButtonPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    backButtonPanel.add(backButton);
    backButtonPanel.setCellHeight(backButton, "100%");

    backButtonWidget = backButton;

    Label titleLabel = new Label();
    titleLabel.addStyleName(Utils.kaaAdminStyle.bAppContentTitle());
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(titleLabel);
    horizontalPanel.setCellHeight(titleLabel, "100%");

    titleLabelWidget = titleLabel;

    HorizontalPanel buttonsPanel = new HorizontalPanel();
    buttonsPanel.setHeight("100%");
    buttonsPanel.addStyleName(Utils.avroUiStyle.buttonsPanel());
    horizontalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    horizontalPanel.add(buttonsPanel);
    horizontalPanel.setCellHeight(buttonsPanel, "100%");

    Button saveButton = new Button();
    buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    buttonsPanel.add(saveButton);
    buttonsPanel.setCellHeight(saveButton, "100%");

    saveButtonWidget = saveButton;

    Button cancelButton = new Button();
    cancelButton.setVisible(false);
    buttonsPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    buttonsPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    buttonsPanel.add(cancelButton);
    buttonsPanel.setCellHeight(cancelButton, "100%");

    cancelButtonWidget = cancelButton;
}