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:cl.uai.client.toolbar.MarkingToolBar.java

License:Open Source License

/**
 * Creates the interface/* www .j  a v  a2  s  . c om*/
 */
public MarkingToolBar() {

    logger.fine("Entering MarkingToolbar");

    grade = new DraftGrade();

    markingButtons = new MarkingButtons();
    markingButtons.setVisible(false);

    examButtons = new ExamButtons(true);
    examButtons.setVisible(true);

    extraButtons = new ExamButtons(false);
    extraButtons.setVisible(true);

    viewButtons = new ViewButtons();
    viewButtons.setVisible(false);

    chatButtons = new ChatButtons();
    chatButtons.setVisible(false);

    helpButtons = new HelpButtons();
    helpButtons.setVisible(false);

    tabButtonsPanel = new TabPanel();
    tabButtonsPanel.addStyleName(Resources.INSTANCE.css().tabbuttons());

    tabButtonsPanel.add(markingButtons, MarkingInterface.messages.Mark().toUpperCase());
    tabButtonsPanel.add(examButtons, MarkingInterface.messages.Exam().toUpperCase());
    tabButtonsPanel.add(viewButtons, MarkingInterface.messages.View().toUpperCase());
    tabButtonsPanel.add(chatButtons, MarkingInterface.messages.Collaboration().toUpperCase());
    tabButtonsPanel.add(helpButtons, MarkingInterface.messages.Help().toUpperCase());

    buttonsPanel = new HorizontalPanel();
    buttonsPanel.setVisible(false);

    buttonsPanel.addStyleName(Resources.INSTANCE.css().buttonspanel());
    buttonsPanel.add(tabButtonsPanel);
    buttonsPanel.setCellHorizontalAlignment(markingButtons, HasHorizontalAlignment.ALIGN_LEFT);
    buttonsPanel.setCellWidth(markingButtons, "50%");

    SubmissionGradeData sdata = MarkingInterface.submissionData;

    if (sdata != null
            && EMarkingConfiguration.getMarkingType() == EMarkingConfiguration.EMARKING_TYPE_MARKER_TRAINING
            && EMarkingConfiguration.isChatEnabled()) {
        buttonsPanel.add(new HTML("Hola, ac habran estadisticas de correccin"));
        buttonsPanel.setCellWidth(markingButtons, "30%");
    }

    buttonsPanel.add(grade);
    buttonsPanel.setCellVerticalAlignment(grade, HasVerticalAlignment.ALIGN_MIDDLE);
    buttonsPanel.setCellHorizontalAlignment(grade, HasHorizontalAlignment.ALIGN_RIGHT);
    buttonsPanel.setCellWidth(grade, "10%");

    extraButtons = new ExamButtons(false);
    extraButtons.getFinishMarkingButton().setVisible(true);
    extraButtons.getSaveAndJumpToNextButton().setVisible(true);
    extraButtons.getSaveChangesButton().setVisible(true);
    buttonsPanel.add(extraButtons);
    buttonsPanel.setCellVerticalAlignment(extraButtons, HasVerticalAlignment.ALIGN_MIDDLE);
    buttonsPanel.setCellHorizontalAlignment(extraButtons, HasHorizontalAlignment.ALIGN_RIGHT);
    buttonsPanel.setCellWidth(extraButtons, "40%");

    this.initWidget(buttonsPanel);
}

From source file:client.template.page.DefaultPage.java

License:Open Source License

/**
 * Creates a default page with title + describing text
 *///w  ww . ja v a2s .c  om
public DefaultPage(final String title, final String text) {
    final FlexTable table = new FlexTable();

    final HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setStyleName("gui-DefaultPage");

    hPanel.add(new Image("phosphoruslogo.png"));

    final VerticalPanel vPanel = new VerticalPanel();

    final Label titleLabel = new Label(title);
    titleLabel.setStyleName("gui-DefaultPage-Title");
    vPanel.add(titleLabel);

    final HTML ruler = new HTML("<hr />");
    ruler.setStyleName("gui-DefaultPage-Ruler");
    vPanel.add(ruler);

    final Label textLabel = new Label(text);
    textLabel.setStyleName("gui-DefaultPage-Text");
    vPanel.add(textLabel);

    hPanel.add(vPanel);

    table.setWidget(0, 0, hPanel);
    table.setWidth("100%");
    table.setHeight("100%");
    table.getCellFormatter().setAlignment(0, 0, HasHorizontalAlignment.ALIGN_CENTER,
            HasVerticalAlignment.ALIGN_MIDDLE);

    this.initWidget(table);
}

From source file:co.fxl.gui.gwt.GWTHorizontalPanel.java

License:Open Source License

@SuppressWarnings("unchecked")
GWTHorizontalPanel(GWTContainer<?> container) {
    super((GWTContainer<HorizontalPanel>) container);
    widget().setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    widget().setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
}

From source file:com.allen_sauer.gwt.dnd.demo.client.example.duallist.DualListBox.java

License:Apache License

public DualListBox(int visibleItems, String width) {
    HorizontalPanel horizontalPanel = new HorizontalPanel();
    add(horizontalPanel);/* w  w  w.  j a v  a  2 s . c  o  m*/
    horizontalPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    VerticalPanel verticalPanel = new VerticalPanel();
    verticalPanel.addStyleName(CSS_DEMO_DUAL_LIST_EXAMPLE_CENTER);
    verticalPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

    dragController = new ListBoxDragController(this);
    left = new MouseListBox(dragController, LIST_SIZE);
    right = new MouseListBox(dragController, LIST_SIZE);

    left.setWidth(width);
    right.setWidth(width);

    horizontalPanel.add(left);
    horizontalPanel.add(verticalPanel);
    horizontalPanel.add(right);

    oneRight = new Button("&gt;");
    oneLeft = new Button("&lt;");
    allRight = new Button("&gt;&gt;");
    allLeft = new Button("&lt;&lt;");
    verticalPanel.add(oneRight);
    verticalPanel.add(oneLeft);
    verticalPanel.add(new HTML("&nbsp;"));
    verticalPanel.add(allRight);
    verticalPanel.add(allLeft);

    allRight.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            moveItems(left, right, false);
        }
    });

    allLeft.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            moveItems(right, left, false);
        }
    });

    oneRight.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            moveItems(left, right, true);
        }
    });

    oneLeft.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            moveItems(right, left, true);
        }
    });

    ListBoxDropController leftDropController = new ListBoxDropController(left);
    ListBoxDropController rightDropController = new ListBoxDropController(right);
    dragController.registerDropController(leftDropController);
    dragController.registerDropController(rightDropController);
}

From source file:com.anzsoft.client.ui.UserIndicator.java

License:Open Source License

public UserIndicator(final String nick) {
    createStatusMenu();//from w  ww. j  av a 2s  .c om
    setWidth("100%");
    setCellPadding(0);
    setCellSpacing(0);
    setStyleName("indicator");
    FlexCellFormatter formatter = getFlexCellFormatter();

    // Setup the links cell
    /*
    linksPanel = new HorizontalPanel();
    setWidget(0, 0, linksPanel);
    formatter.setStyleName(0, 0, "indicator-links");
    formatter.setHorizontalAlignment(0, 0, HasHorizontalAlignment.ALIGN_RIGHT);
    formatter.setColSpan(0, 0, 2);
    */

    // Setup the title cell
    setTitleWidget(null);
    formatter.setStyleName(0, 0, "indicator-title");

    getRowFormatter().setVerticalAlign(0, HasVerticalAlignment.ALIGN_TOP);
    getRowFormatter().setVerticalAlign(1, HasVerticalAlignment.ALIGN_TOP);

    final ChatIcons icons = ChatIcons.App.getInstance();
    statusImg = new Image();
    statusImg.setWidth("16px");
    statusImg.setHeight("16px");
    icons.online().applyTo(statusImg);

    avatarImg = new Image("images/default_avatar.png");
    avatarImg.setWidth("32px");
    avatarImg.setHeight("32px");
    avatarImg.setStyleName("handler");
    avatarImg.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            JabberApp.instance().showInfoSelf();
        }

    });

    nickName = new Label(nick);
    nickName.setDirection(Direction.LTR);
    nickName.setWidth("100%");

    statusLabel = new Label();
    statusLabel.setStyleName("status_label");
    statusLabel.setWidth("100%");

    statusEditor = new TextBox();
    statusEditor.setVisible(false);
    statusEditor.setWidth("100%");

    statusButton = new Button();
    statusButton.setMenu(statusMenu);
    statusButton.setStyleName("Status-Menu-Button");

    //statusMenuLabel = new Label();
    //statusMenuLabel.setStyleName("status_menu_label");

    //addLink(new HTML("<a href=\"http://samespace.anzsoft.com\">SameSpace</a>"));
    // Add the title and some images to the title bar
    HorizontalPanel titlePanel = new HorizontalPanel();
    titlePanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
    titlePanel.setWidth("100%");
    titlePanel.setSpacing(3);

    VerticalPanel statusPanel = new VerticalPanel();
    statusPanel.setWidth("100%");
    statusPanel.add(nickName);

    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.setWidth("100%");
    hPanel.setSpacing(2);
    hPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_TOP);
    hPanel.add(statusLabel);
    hPanel.add(statusEditor);
    hPanel.add(statusButton);

    statusPanel.add(hPanel);

    titlePanel.add(statusImg);
    titlePanel.add(statusPanel);
    titlePanel.add(avatarImg);

    titlePanel.setCellWidth(statusImg, "20px");
    titlePanel.setCellWidth(statusPanel, "100%");
    titlePanel.setCellWidth(avatarImg, "32px");
    setTitleWidget(titlePanel);

    JabberApp.instance().getSession().getUser().addUserListener(new XmppUserListener() {
        public void onPresenceChanged(XmppPresence presence) {
            String show = new String("");
            PresenceShow presenceShow = presence.getShow();
            if (presenceShow != null)
                show = presenceShow.toString();
            String statusString = presence.getStatus();
            int priority = presence.getPriority();
            boolean avaiable = true;
            String type = presence.getType();
            if (type != null && !type.isEmpty()) {
                if (type.equalsIgnoreCase("unavailable"))
                    avaiable = false;
            }
            status = new XmppContactStatus(show, statusString, priority, avaiable);
            statusLabel.setText(status.status());
            iconFromStatus(status).applyTo(statusImg);
        }
    });

    statusLabel.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            statusLabel.setVisible(false);
            statusEditor.setVisible(true);
            statusEditor.setText(statusLabel.getText());
        }

    });

    statusEditor.addKeyboardListener(new KeyboardListener() {

        public void onKeyDown(Widget sender, char keyCode, int modifiers) {

        }

        public void onKeyPress(Widget sender, char keyCode, int modifiers) {

        }

        public void onKeyUp(Widget sender, char keyCode, int modifiers) {
            if (keyCode == 13)
                doneChangeStatusString();
        }

    });

    statusEditor.addFocusListener(new FocusListener() {
        public void onFocus(Widget sender) {
        }

        public void onLostFocus(Widget sender) {
            doneChangeStatusString();
        }

    });

    XmppVCardFactory.instance().addVCardListener(new VCardListener() {
        public void onVCard(XmppID jid, XmppVCard vcard) {
            if (jid.toStringNoResource().equalsIgnoreCase(JabberApp.instance().getJid().toStringNoResource())) {
                if (!vcard.nickName().isEmpty())
                    nickName.setText(vcard.fullName());
                else if (!vcard.fullName().isEmpty())
                    nickName.setText(vcard.fullName());
                String photoData = vcard.photo();
                if (!photoData.isEmpty() && !GXT.isIE) {
                    ImageElement imgEl = avatarImg.getElement().cast();
                    imgEl.removeAttribute("src");
                    imgEl.setSrc("data:image;base64," + photoData);
                }

            }
        }

    });
}

From source file:com.audata.client.HomePanel.java

License:Open Source License

/**
 * Public contructor. Builds the HomePanel
 *//*from w  w w. java2s .c  om*/
public HomePanel() {

    final VerticalPanel verticalPanel = new VerticalPanel();
    initWidget(verticalPanel);
    verticalPanel.setSize("100%", "100%");

    final Image image = new Image();
    verticalPanel.add(image);
    verticalPanel.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    verticalPanel.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_CENTER);
    image.setUrl("images/title/welcome.jpg");

    final HTML html = new HTML(LANG.homepage_Text());
    html.setWidth("100%");
    verticalPanel.add(html);
    html.setStyleName("audoc-welcomeText");
    setSize("100%", "100%");
    verticalPanel.setCellVerticalAlignment(html, HasVerticalAlignment.ALIGN_BOTTOM);
}

From source file:com.audata.client.record.RecordListPanel.java

License:Open Source License

private Panel buildMenu() {
    HorizontalPanel menuContainer = new HorizontalPanel();
    menuContainer.addStyleName("audoc-commandPanel");
    menuContainer.setWidth("100%");
    HorizontalPanel menu = new HorizontalPanel();
    menuContainer.add(menu);//from  w  ww  .  j  a  va2s.  co  m
    menu.setSpacing(4);
    //menu.addStyleName("audoc-commandPanel");
    //menu.setWidth("100%");
    menu.setHorizontalAlignment(HasAlignment.ALIGN_LEFT);

    //add Refresh button
    //CaptionButton refreshButton = new CaptionButton("images/16x16/refresh.gif", "Refresh", CaptionButton.CAPTION_EAST);
    CaptionButton refreshButton = new CaptionButton();
    refreshButton.setCaptionText(LANG.refresh_Text());
    refreshButton.setImageUrl("images/16x16/refresh.gif");
    refreshButton.addClickListener(new CommandClickListener(this, CommandClickListener.COMMAND_REFRESH));
    refreshButton.setTitle(LANG.refresh_title_Text());
    menu.add(refreshButton);

    //add print button
    //CaptionButton printButton = new CaptionButton("images/16x16/print.gif", "Print", CaptionButton.CAPTION_EAST);
    CaptionButton printButton = new CaptionButton();
    printButton.setCaptionText(LANG.print_Text());
    printButton.setImageUrl("images/16x16/print.gif");
    printButton.addClickListener(new CommandClickListener(this, CommandClickListener.COMMAND_PRINT));
    printButton.setTitle(LANG.print_title_Text());
    menu.add(printButton);

    Label pagesLabel = new Label(LANG.page_Text() + ": ");
    pagesLabel.addStyleName("audoc-label");
    menu.add(pagesLabel);
    menu.setCellVerticalAlignment(pagesLabel, HasVerticalAlignment.ALIGN_MIDDLE);
    this.pages = new ListBox();
    this.pages.addChangeListener(this);
    menu.add(this.pages);
    menu.setCellVerticalAlignment(this.pages, HasVerticalAlignment.ALIGN_MIDDLE);
    return menuContainer;
}

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

License:Open Source License

public CaptionButton() {
    main = new DockPanel();
    initWidget(main);/*  w  w w . j a  va  2s  .  com*/
    main.setSpacing(4);
    main.setStyleName("captionButton");

    image = new Image();
    main.add(image, DockPanel.WEST);
    main.setCellHorizontalAlignment(image, HasHorizontalAlignment.ALIGN_LEFT);
    main.setCellVerticalAlignment(image, HasVerticalAlignment.ALIGN_MIDDLE);
    image.setStyleName("captionButton-Icon");
    image.setUrl("images/48x48/admin.gif");

    caption = new HTML("New Label");
    main.add(caption, DockPanel.EAST);
    main.setCellHorizontalAlignment(caption, HasHorizontalAlignment.ALIGN_LEFT);
    main.setCellVerticalAlignment(caption, HasVerticalAlignment.ALIGN_MIDDLE);
    caption.setStyleName("captionButton-caption");
    //setWidth("100%");
}

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

License:Open Source License

public void setOrientation(DockLayoutConstant layout) {
    DockLayoutConstant capPos = layout;/*w  ww.  j  a v a 2s. com*/
    DockLayoutConstant imgPos = DockPanel.WEST;
    HorizontalAlignmentConstant capHorizAlign = HasHorizontalAlignment.ALIGN_CENTER;
    VerticalAlignmentConstant capVertAlign = HasVerticalAlignment.ALIGN_MIDDLE;
    HorizontalAlignmentConstant imgHorizAlign = HasHorizontalAlignment.ALIGN_CENTER;
    VerticalAlignmentConstant imgVertAlign = HasVerticalAlignment.ALIGN_MIDDLE;
    if (layout == DockPanel.EAST) {
        imgPos = DockPanel.WEST;
        capHorizAlign = HasHorizontalAlignment.ALIGN_LEFT;
        imgHorizAlign = HasHorizontalAlignment.ALIGN_LEFT;
    }
    if (layout == DockPanel.NORTH) {
        imgPos = DockPanel.SOUTH;
        capVertAlign = HasVerticalAlignment.ALIGN_BOTTOM;
        imgVertAlign = HasVerticalAlignment.ALIGN_BOTTOM;
    }
    if (layout == DockPanel.WEST) {
        imgPos = DockPanel.EAST;
        capHorizAlign = HasHorizontalAlignment.ALIGN_LEFT;
        imgHorizAlign = HasHorizontalAlignment.ALIGN_LEFT;
    }
    if (layout == DockPanel.SOUTH) {
        imgPos = DockPanel.NORTH;
        capVertAlign = HasVerticalAlignment.ALIGN_BOTTOM;
        imgVertAlign = HasVerticalAlignment.ALIGN_BOTTOM;
    }
    main.clear();
    main.add(caption, capPos);
    main.setCellHorizontalAlignment(caption, capHorizAlign);
    main.setCellVerticalAlignment(caption, capVertAlign);
    main.add(image, imgPos);
    main.setCellHorizontalAlignment(image, imgHorizAlign);
    main.setCellVerticalAlignment(image, imgVertAlign);
}

From source file:com.badlogic.gdx.backends.gwt.GwtApplication.java

License:Apache License

@Override
public void onModuleLoad() {
    GwtApplication.agentInfo = computeAgentInfo();
    this.listener = createApplicationListener();
    this.config = getConfig();
    this.log = config.log;

    addEventListeners();//w w w .  j  av  a2  s. co m

    if (config.rootPanel != null) {
        this.root = config.rootPanel;
    } else {
        Element element = Document.get().getElementById("embed-" + GWT.getModuleName());
        if (element == null) {
            VerticalPanel panel = new VerticalPanel();
            panel.setWidth("" + config.width + "px");
            panel.setHeight("" + config.height + "px");
            panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            RootPanel.get().add(panel);
            RootPanel.get().setWidth("" + config.width + "px");
            RootPanel.get().setHeight("" + config.height + "px");
            this.root = panel;
        } else {
            VerticalPanel panel = new VerticalPanel();
            panel.setWidth("" + config.width + "px");
            panel.setHeight("" + config.height + "px");
            panel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
            panel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);
            element.appendChild(panel.getElement());
            root = panel;
        }
    }

    // initialize SoundManager2
    SoundManager.init(GWT.getModuleBaseURL(), 9, config.preferFlash, new SoundManager.SoundManagerCallback() {

        @Override
        public void onready() {
            final PreloaderCallback callback = getPreloaderCallback();
            preloader = createPreloader();
            preloader.preload("assets.txt", new PreloaderCallback() {
                @Override
                public void error(String file) {
                    callback.error(file);
                }

                @Override
                public void update(PreloaderState state) {
                    callback.update(state);
                    if (state.hasEnded()) {
                        getRootPanel().clear();
                        if (loadingListener != null)
                            loadingListener.beforeSetup();
                        setupLoop();
                        if (loadingListener != null)
                            loadingListener.afterSetup();
                    }
                }
            });
        }

        @Override
        public void ontimeout(String status, String errorType) {
            error("SoundManager", status + " " + errorType);
        }

    });
}