Example usage for com.google.gwt.user.client.ui HorizontalPanel setCellHorizontalAlignment

List of usage examples for com.google.gwt.user.client.ui HorizontalPanel setCellHorizontalAlignment

Introduction

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

Prototype

public void setCellHorizontalAlignment(IsWidget w, HorizontalAlignmentConstant align) 

Source Link

Document

Overloaded version for IsWidget.

Usage

From source file:com.square.composant.tarificateur.square.client.ui.popup.choix.PopupChoixProduit.java

License:Open Source License

/** Chargement de la liste des produits de l'adhrent. */
private void afficherListeProduitsAdherent() {
    // La liste n'est affiche que si le prospect est un adhrent et que ce n'est pas un devis CNP

    if (idPersonne != null) {
        // Chargement de la liste des produits de l'adhrent
        final AsyncCallback<List<ListeProduitsAdherentModel>> callback = new AsyncCallback<List<ListeProduitsAdherentModel>>() {
            public void onFailure(Throwable caught) {
                captionPanelListeProduitsAdherent.setVisible(false);
                ErrorPopup.afficher(new ErrorPopupConfiguration(caught));
            }//from w w  w .  j a va2s  .co m

            public void onSuccess(List<ListeProduitsAdherentModel> listeProduitsContratsAdherentGwt) {
                if (listeProduitsContratsAdherentGwt == null || listeProduitsContratsAdherentGwt.isEmpty()) {
                    captionPanelListeProduitsAdherent.setVisible(false);
                } else {
                    // Produit principal
                    InfosProduitAdherentModel produitPrincipal;

                    // On nettoie le panel
                    captionPanelListeProduitsAdherent.clear();

                    final VerticalPanel panelListeProduitsAdherent = new VerticalPanel();
                    panelListeProduitsAdherent.setWidth(ComposantTarificateurConstants.POURCENT_100);
                    panelListeProduitsAdherent.setSpacing(5);
                    captionPanelListeProduitsAdherent.add(panelListeProduitsAdherent);

                    for (ListeProduitsAdherentModel listeProduitsParcouru : listeProduitsContratsAdherentGwt) {
                        produitPrincipal = listeProduitsParcouru.getProduitPrincipal();
                        int i = 0;

                        // Label de la liste des produits d'un adhrent.
                        final HTML labelListeProduitsAdherent = new HTML();

                        // Bouton de gnration d'une proposition pour un adhrent.
                        final DecoratedButton btnGenererProposition = new DecoratedButton(
                                pageConstants.labelBoutonAjoutProduitAdherent());

                        final HorizontalPanel hpConteneurProduits = new HorizontalPanel();
                        hpConteneurProduits.setWidth(ComposantTarificateurConstants.POURCENT_100);
                        hpConteneurProduits.add(labelListeProduitsAdherent);
                        hpConteneurProduits.add(btnGenererProposition);
                        hpConteneurProduits.setCellHorizontalAlignment(labelListeProduitsAdherent,
                                HasHorizontalAlignment.ALIGN_LEFT);
                        hpConteneurProduits.setCellHorizontalAlignment(btnGenererProposition,
                                HasHorizontalAlignment.ALIGN_RIGHT);
                        hpConteneurProduits.setCellVerticalAlignment(labelListeProduitsAdherent,
                                HasVerticalAlignment.ALIGN_MIDDLE);
                        hpConteneurProduits.setCellVerticalAlignment(btnGenererProposition,
                                HasVerticalAlignment.ALIGN_MIDDLE);
                        hpConteneurProduits.setCellWidth(btnGenererProposition, "160px");
                        panelListeProduitsAdherent.add(hpConteneurProduits);

                        // Ecriture de la liste des produits de l'adhrent
                        final StringBuffer htmlListeProduitsAdherent = new StringBuffer();
                        if (produitPrincipal != null) {
                            // On affiche : libelleProduit ( dateAdhesion -> dateResiliation )
                            htmlListeProduitsAdherent.append("<b>");
                            htmlListeProduitsAdherent.append(produitPrincipal.getLibelle());
                            htmlListeProduitsAdherent.append("</b>");
                            htmlListeProduitsAdherent.append(PageConstants.DU + " "
                                    + produitPrincipal.getDateAdhesion() + " " + PageConstants.AU);
                            htmlListeProduitsAdherent.append(produitPrincipal.getDateResiliation() != null
                                    ? produitPrincipal.getDateResiliation()
                                    : "...");
                            final String garantieAia = produitPrincipal.getGarantieAia();
                            final String produitAia = produitPrincipal.getProduitAia();
                            btnGenererProposition.addClickHandler(new ClickHandler() {
                                @Override
                                public void onClick(ClickEvent event) {
                                    afficherPopupSelectionProduitsAdherent(produitAia, garantieAia);
                                }
                            });
                            i++;
                        }
                        for (InfosProduitAdherentModel infosProduitLieParcouru : listeProduitsParcouru
                                .getListeProduitsLies()) {
                            if (i == 1) {
                                htmlListeProduitsAdherent.append(ComposantTarificateurConstants.SAUT_LIGNE);
                            } else {
                                htmlListeProduitsAdherent.append(PageConstants.VIRGULE);
                            }
                            htmlListeProduitsAdherent.append(infosProduitLieParcouru.getLibelle());
                            i++;
                        }
                        labelListeProduitsAdherent.setHTML(htmlListeProduitsAdherent.toString());
                        // Affichage de la liste
                        captionPanelListeProduitsAdherent.setVisible(true);
                        // si pas de produit principal sant, on cache le bouton gnrerProposition
                        btnGenererProposition.setVisible(listeProduitsParcouru.getProduitPrincipal() != null);
                    }
                }
            }
        };
        // Appel du service
        tarificateurService.getListeProduitsAdherent(idPersonne, callback);
    } else {
        // Liste des produits des adhrents non visible
        captionPanelListeProduitsAdherent.clear();
        captionPanelListeProduitsAdherent.setVisible(false);
    }
}

From source file:com.square.composants.graphiques.lib.client.composants.BlocSyntheseDepliant.java

License:Open Source License

/**
 * Constructeur.//from  w  ww . java 2 s.  c o m
 * @param listeChamps .
 * @param header .
 * @param contenu .
 * @param nbChampParLigne .
 */
public BlocSyntheseDepliant(List<ChampSynthese> listeChamps, Widget header, Widget contenu,
        final int nbChampParLigne) {
    this.listeChamps = listeChamps;
    this.nbChampParLigne = nbChampParLigne;
    disclosurePanel = new CustomDisclosurePanel();
    disclosurePanel.setAnimationEnabled(true);
    disclosurePanel.addOpenHandler(this);
    disclosurePanel.addCloseHandler(this);
    disclosurePanel.addStyleName(SquareLibResources.INSTANCE.css().blocSyntheseDepliant());
    disclosurePanel.setWidth(ComposantsGraphiquesConstants.POURCENT_100);

    final SimplePanel conteneurContenu = new SimplePanel();
    conteneurContenu.add(contenu);

    icone = new Image(SquareLibResources.INSTANCE.expand());
    icone.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            disclosurePanel.setOpen(!disclosurePanel.isOpen());
        }
    });

    nbLigne = (int) Math.ceil((double) listeChamps.size() / nbChampParLigne);
    resumePanel = new Grid(nbLigne, nbChampParLigne);
    resumePanel.setWidth(ComposantsGraphiquesConstants.POURCENT_100);
    int index = 0;
    for (int row = 0; row < resumePanel.getRowCount(); row++) {
        for (int column = 0; column < resumePanel.getColumnCount() && (index < listeChamps.size()); column++) {
            final ChampSynthese champ = listeChamps.get(index++);
            resumePanel.setWidget(row, column, champ);
            addOpenEventHandler(champ);
            addCloseEventHandler(champ);
        }
    }

    final HorizontalPanel conteneurEntete = new HorizontalPanel();
    conteneurEntete.setSpacing(5);
    conteneurEntete.setWidth(ComposantsGraphiquesConstants.POURCENT_100);
    conteneurEntete.add(resumePanel);
    if (header != null) {
        conteneurEntete.add(header);
        conteneurEntete.setCellHorizontalAlignment(header, HasAlignment.ALIGN_RIGHT);
    }
    conteneurEntete.add(icone);
    conteneurEntete.setCellHorizontalAlignment(icone, HasAlignment.ALIGN_RIGHT);
    conteneurEntete.setCellVerticalAlignment(resumePanel, HasAlignment.ALIGN_MIDDLE);
    conteneurEntete.setCellVerticalAlignment(icone, HasAlignment.ALIGN_MIDDLE);

    conteneurEnteteFocus = new FocusPanel();
    conteneurEnteteFocus.setWidth(ComposantsGraphiquesConstants.POURCENT_100);
    conteneurEnteteFocus.add(conteneurEntete);

    disclosurePanel.setHeader(conteneurEnteteFocus);
    disclosurePanel.setContent(conteneurContenu);

    initWidget(disclosurePanel);
}

From source file:com.square.composants.graphiques.lib.client.popups.minimizable.DeskBar.java

License:Open Source License

/**
 * Constructeur.// w w  w .  ja  va2  s  .c  o  m
 * @param maxItem nb d'item max autoris
 * @param eventBus bus d'evenement
 */
public DeskBar(final Integer maxItem, final HandlerManager eventBus) {
    this.eventBus = eventBus;
    this.maxItem = maxItem;

    eventBus.addHandler(MinimizePopupEvent.TYPE, new MinimizePopupEventHandler() {
        @Override
        public void minimizePopup(MinimizePopupEvent event) {
            if (maxItem == null || panel.getWidgetCount() < maxItem.intValue()) {
                addItem(event.getItem());
            }
        }
    });
    eventBus.addHandler(MaximizePopupEvent.TYPE, new MaximizePopupEventHandler() {
        @Override
        public void maximizePopup(MaximizePopupEvent event) {
            removeItem(event.getItem());
        }
    });

    panel = new FlowPanel();

    final HorizontalPanel conteneur = new HorizontalPanel();
    conteneur.setStylePrimaryName(SquareLibResources.INSTANCE.css().deskBar());
    conteneur.add(panel);
    conteneur.setCellHorizontalAlignment(panel, HasHorizontalAlignment.ALIGN_RIGHT);

    initWidget(conteneur);
}

From source file:com.unilorraine.projetdevie.client.ui.TaskAdminViewImpl.java

License:Open Source License

public TaskAdminViewImpl() {

    HorizontalPanel titlePanel = new HorizontalPanel();
    add(titlePanel);/* w  w w . j ava  2  s  .  c o m*/
    titlePanel.setWidth("600px");

    Label activityTitle = new Label("Activit\u00E9");
    titlePanel.add(activityTitle);
    activityTitle.setWidth("76px");

    activityName = new Label("no Name");
    titlePanel.add(activityName);
    titlePanel.setCellHorizontalAlignment(activityName, HasHorizontalAlignment.ALIGN_CENTER);
    activityName.setWidth("261px");

    MenuButton mnbtnAction = new MenuButton("Actions");
    titlePanel.add(mnbtnAction);

    HorizontalPanel taskPanel = new HorizontalPanel();
    add(taskPanel);

    tileGrid = new TileGrid();
    tileGrid.setSize("377px", "220px");
    taskPanel.add(tileGrid);

    transitTaskEditor = new TransitTaskEditor();
    add(transitTaskEditor);

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    add(horizontalPanel);

    saveTaskBtn = new Button("Sauver la t\u00E2che");
    horizontalPanel.add(saveTaskBtn);

}

From source file:de.oose.taskboard.client.view.TaskListView.java

License:Open Source License

public TaskListView() {
    setSpacing(5);//from ww  w . ja v a2 s  . c  o m
    setSize("800", "600");

    HorizontalPanel horizontalPanel = new HorizontalPanel();
    horizontalPanel.setSpacing(5);
    add(horizontalPanel);
    horizontalPanel.setWidth("100%");
    setCellWidth(horizontalPanel, "100%");

    lblUser = new Label("userlabel");
    horizontalPanel.add(lblUser);
    horizontalPanel.setCellWidth(lblUser, "20%");

    btnLogout = new Button("New button");
    btnLogout.setText("Logout");
    horizontalPanel.add(btnLogout);
    horizontalPanel.setCellWidth(btnLogout, "100%");
    horizontalPanel.setCellHorizontalAlignment(btnLogout, HasHorizontalAlignment.ALIGN_RIGHT);

    taskboard = new Taskboard();
    add(taskboard);

    btnTask = new Button("New button");
    add(btnTask);
    btnTask.setText("New Task");

}

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.common.client.LemmaEditorWidget.java

License:Apache License

/**
 * Create a new {@link LemmaEditorWidget} for the given {@link LemmaDescription}.
 * @param description the {@link LemmaDescription}
 * @param useCase the {@link UseCase} which defines if the widget is used within
 * the 'default' user environment ({@link UseCase#FIELDS_FOR_SIMPLE_EDITOR}) or within
 * the editor environment ({@link UseCase#FIELDS_FOR_ADVANCED_EDITOR}). Other usecases
 * are not supported./*from   ww w.  j  av  a 2s  .  c  o m*/
 * @param vertical Whether or not the fields should be oriented vertically.
 * @param columns The number of columns
 * @param showLanguageHeader Whether or not a language header should be shown
 * @param toggleAntlr The button responsible for displaying the antlr input field. Can be
 * <code>null</code>. If a button is provided, a handler must be set to show/hide
 * the input field. 
 * 
 */
public LemmaEditorWidget(final LemmaDescription description, final UseCase useCase, boolean vertical,
        final int columns, final boolean showLanguageHeader, Button toggleAntlr) {
    this.description = description;
    CellPanel base = null;
    if (vertical) {
        base = new VerticalPanel();
    } else {
        base = new HorizontalPanel();
    }
    base.setWidth("98%");
    base.getElement().getStyle().setMargin(1, Unit.PCT);
    if (toggleAntlr != null) {
        HorizontalPanel panel = new HorizontalPanel();
        panel.getElement().getStyle().setWidth(100, Unit.PCT);
        panel.add(toggleAntlr);
        panel.setCellHorizontalAlignment(toggleAntlr, HorizontalAlignmentConstant.endOf(Direction.LTR));
    }
    setWidget(base);
    final CellPanel finalBase = base;
    LocalizedStrings.afterLoad(new AsyncCallback<TranslationMap>() {

        @Override
        public void onFailure(Throwable caught) {
        }

        @Override
        public void onSuccess(TranslationMap translations) {
            langA = createFields(description, true, useCase, columns, showLanguageHeader, translations);
            langB = createFields(description, false, useCase, columns, showLanguageHeader, translations);
            finalBase.add(langA);
            finalBase.add(langB);
        }
    });

    setStyleName("lemma-editor", true);
}

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.editor.client.entry.list.dataprovider.SimplePagingDataProvider.java

License:Apache License

public SimplePagingDataProvider(final PagingDataGrid<LexEntry> table, final HorizontalPanel pagination,
        final ListFilter filterOptions, final Label resultSummary) {
    this.table = table;
    this.service = GWT.create(EditorService.class);
    pagination.getElement().getStyle().setMarginBottom(10, Unit.PX);
    final HorizontalPanel sizePanel = new HorizontalPanel();
    table.setIncrementSize(10);/*w  w w .j  a v a 2  s  .  c  o  m*/
    searchOptions.setPageSize(10);
    searchOptions.setVerification(Verification.UNVERIFIED);

    // Callback responsible for updating the list
    callback = new AsyncCallback<LexEntryList>() {

        @Override
        public void onFailure(Throwable caught) {
            pagination.clear();
            Dialog.showError(constants.failedToUpdateEntryList(), caught);
        }

        @Override
        public void onSuccess(LexEntryList result) {
            if (result.getOverallCount() == 0) {
                resultSummary.setText(constants.noEntriesMached());
            } else {
                resultSummary.setText(messages.displayingEntries((searchOptions.getCurrent() + 1),
                        (searchOptions.getCurrent() + result.entries().size()), result.getOverallCount()));
            }
            setList(result.entries());
            updatePagination(result.getOverallCount());
            MultiSelectionModel<?> selectionModel = (MultiSelectionModel<?>) table.getSelectionModel();
            selectionModel.clear();
            table.redraw();
            lastQuery = searchOptions.getCopy();
        }

        private void updatePagination(final int overall) {
            int currentPage = searchOptions.getCurrent() / searchOptions.getPageSize();
            int start = Math.max(0, currentPage - 3);
            final int end = Math.min(currentPage + 4,
                    (overall + searchOptions.getPageSize() - 1) / searchOptions.getPageSize());
            pagination.clear();
            pagination.add(sizePanel);
            pagination.setCellHorizontalAlignment(sizePanel,
                    HorizontalAlignmentConstant.startOf(Direction.LTR));
            ButtonGroup pagingButtons = new ButtonGroup();
            pagingButtons.getElement().getStyle().setFloat(Float.RIGHT);
            pagination.setCellHorizontalAlignment(pagingButtons,
                    HorizontalAlignmentConstant.endOf(Direction.LTR));
            Button first = new Button(constants.first(), IconType.FAST_BACKWARD);
            first.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    searchOptions.setCurrent(0);
                    doUpdate();
                }
            });
            pagingButtons.add(first);
            for (int i = start; i < end; i++) {
                final int page = i;
                Button button = new Button((i + 1) + "");
                button.setToggle(true);
                if (i == currentPage) {
                    button.setStyleName("active", true);
                } else {
                    button.addClickHandler(new ClickHandler() {

                        @Override
                        public void onClick(ClickEvent event) {
                            searchOptions.setCurrent(page * searchOptions.getPageSize());
                            doUpdate();
                        }
                    });
                }
                pagingButtons.add(button);
            }
            Button last = new Button(constants.last(), IconType.FAST_FORWARD);
            last.addClickHandler(new ClickHandler() {

                @Override
                public void onClick(ClickEvent event) {
                    int lastPage = (overall + searchOptions.getPageSize() - 1) / searchOptions.getPageSize()
                            - 1;
                    searchOptions.setCurrent(lastPage * searchOptions.getPageSize());
                    doUpdate();
                }
            });
            pagingButtons.add(last);
            pagination.add(pagingButtons);
        }

    };
    addDataDisplay(table);
    // Enable sorting columns 
    table.addColumnSortHandler(new Handler() {

        @Override
        public void onColumnSort(ColumnSortEvent event) {
            Column<?, ?> column = event.getColumn();
            // Update sort properties and start a new query
            searchOptions.setOrder(column.getDataStoreName(), event.getColumnSortList().get(0).isAscending());
            searchOptions.setCurrent(0);
            refreshQuery();
        }
    });
}

From source file:edu.ucsb.eucalyptus.admin.client.EucalyptusWebInterface.java

License:Open Source License

public void displayBarAndTabs(String message) {
    /* top bar */
    displayStatusPage("Drawing the tabs...");

    HorizontalPanel top_bar = new HorizontalPanel();
    top_bar.getElement().setClassName("euca-top-bar");

    HorizontalPanel name_panel = new HorizontalPanel();
    name_panel.getElement().setClassName("euca-top-bar-left");
    name_panel.setSpacing(5);/*from w  w w.ja v  a2 s .  com*/
    name_panel.add(new HTML(Theme.draw_header()));
    top_bar.add(name_panel);

    top_bar.setCellHorizontalAlignment(name_panel, HorizontalPanel.ALIGN_LEFT);
    top_bar.setCellVerticalAlignment(name_panel, HorizontalPanel.ALIGN_TOP); // michael left this as MIDDLE

    HorizontalPanel upanel = new HorizontalPanel();
    upanel.getElement().setClassName("euca-top-bar-right");
    Label user_name = new HTML(
            "Logged in as <b>" + loggedInUser.getUserName() + "</b>&nbsp;&nbsp;|&nbsp;&nbsp;");
    Hyperlink logout_button = new Hyperlink("Logout", "logout");
    logout_button.addClickListener(LogoutButtonListener);
    upanel.add(user_name);
    upanel.add(logout_button);
    top_bar.add(upanel);
    top_bar.setCellHorizontalAlignment(upanel, HorizontalPanel.ALIGN_RIGHT);
    top_bar.setCellVerticalAlignment(upanel, HorizontalPanel.ALIGN_TOP);

    final HorizontalPanel messageBox = new HorizontalPanel();
    messageBox.setStyleName("euca-message-bar");
    messageBox.setSpacing(3);
    messageBox.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT);
    messageBox.add(statusMessage);
    statusMessage.setStyleName("euca-small-text");

    final VerticalPanel wrapper = new VerticalPanel();
    wrapper.setStyleName("euca-tab-contents");
    //        wrapper.setSize("100%", "80%");
    //        wrapper.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
    //        wrapper.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);

    // set up tab layout so that *TabIndex variables are set in the beginning
    int nTabs = 0;
    allTabs = new TabBar();

    allTabs.addTab("Credentials");
    credsTabIndex = nTabs++;
    allTabs.addTab("Images");
    imgTabIndex = nTabs++;
    /////allTabs.addTab ("Instances"); instTabIndex = nTabs++;
    if (loggedInUser.isAdministrator() != null && loggedInUser.isAdministrator().booleanValue()) {
        allTabs.addTab("Users");
        usrTabIndex = nTabs++;
        allTabs.addTab("Configuration");
        confTabIndex = nTabs++;
        allTabs.addTab("Extras");
        downTabIndex = nTabs++;
        if (extensions != null && extensions.contains("store")) {
            allTabs.addTab("Store");
            storeTabIndex = nTabs++;
        }
    }
    // can happen if admin user re-logs in as regular without reloading
    if (currentTabIndex > (nTabs - 1)) {
        currentTabIndex = 0;
    }
    allTabs.addTabListener(new TabListener() {
        public void onTabSelected(SourcesTabEvents sender, int tabIndex) {
            String error = "This tab is not implemented yet, sorry!";
            statusMessage.setText("");
            wrapper.clear();
            currentTabIndex = tabIndex;
            if (tabIndex == credsTabIndex) {
                displayCredentialsTab(wrapper);
            } else if (tabIndex == imgTabIndex) {
                displayImagesTab(wrapper);
            } else if (tabIndex == usrTabIndex) {
                displayUsersTab(wrapper);
            } else if (tabIndex == confTabIndex) {
                displayConfTab(wrapper);
            } else if (tabIndex == downTabIndex) {
                displayDownloadsTab(wrapper);
            } else if (tabIndex == storeTabIndex) {
                displayStoreTab(wrapper);
            } else {
                displayErrorPage("Invalid tab!");
            }
        }

        public boolean onBeforeTabSelected(SourcesTabEvents sender, int tabIndex) {
            return true; /* here we could do checking for clicks on disabled tabs */
        }
    });

    RootPanel.get().clear();
    RootPanel.get().add(top_bar);
    RootPanel.get().add(allTabs);
    RootPanel.get().add(messageBox);
    RootPanel.get().add(wrapper);
    allTabs.selectTab(currentTabIndex);
}

From source file:edu.washington.cs.oneswarm.ui.gwt.client.newui.friends.AddFriendDialog.java

License:Open Source License

public AddFriendDialog(FriendListPanel parent) {
    this.parent = parent;
    this.setText("Add friend using public key");

    Label selectLabel = new Label("Enter your friend's nickname and public key into the fields below.");
    selectLabel.addStyleName(CSS_DIALOG_HEADER);
    selectLabel.setWidth(WIDTH + "px");
    mainPanel.add(selectLabel);//from w  ww  .j a  v  a2 s.  co  m

    // nickname
    HorizontalPanel nickPanel = new HorizontalPanel();
    nickPanel.setWidth("100%");
    Label nickLabel = new Label("Nickname: ");
    nickPanel.add(nickLabel);
    nickPanel.add(nickBox);
    nickPanel.setSpacing(3);
    nickBox.setWidth("300px");
    nickPanel.setCellHorizontalAlignment(nickBox, HorizontalPanel.ALIGN_RIGHT);
    nickPanel.setCellVerticalAlignment(nickLabel, VerticalPanel.ALIGN_MIDDLE);
    mainPanel.add(nickPanel);

    // public key
    publicKeyArea.setVisibleLines(7);
    publicKeyArea.setWidth(WIDTH - 20 + "px");
    publicKeyArea.addChangeHandler(this);
    publicKeyArea.addKeyUpHandler(this);
    mainPanel.add(publicKeyArea);
    mainPanel.setCellHorizontalAlignment(publicKeyArea, HorizontalPanel.ALIGN_CENTER);

    // confirm
    HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(5);
    lengthLabel = new Label("0 / 216");
    // buttonPanel.add(lengthLabel); // skip this for now
    buttonPanel.setCellHorizontalAlignment(lengthLabel, HorizontalPanel.ALIGN_LEFT);
    buttonPanel.setCellVerticalAlignment(lengthLabel, HorizontalPanel.ALIGN_MIDDLE);
    buttonPanel.setWidth("100%");

    // okButton.setEnabled(false);

    HorizontalPanel rhs = new HorizontalPanel();
    rhs.add(okButton);
    okButton.addClickHandler(this);
    rhs.add(cancelButton);
    cancelButton.addClickHandler(this);
    rhs.setSpacing(3);
    buttonPanel.add(rhs);
    buttonPanel.setCellHorizontalAlignment(rhs, HorizontalPanel.ALIGN_RIGHT);

    mainPanel.add(buttonPanel);
    mainPanel.setCellHorizontalAlignment(buttonPanel, VerticalPanel.ALIGN_RIGHT);
    mainPanel.setWidth(WIDTH + "px");
    setWidget(mainPanel);
}

From source file:es.deusto.weblab.client.experiments.gpib.ui.GpibExperiment.java

License:Open Source License

private void showResults() {
    final PopupPanel popup = new PopupPanel(false, true);

    popup.setStyleName("results-popup");

    final VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setWidth("100%");
    mainPanel.setSpacing(10);/*from   w ww .  j av a  2  s . c  om*/

    final Label title = new Label("Your experiment's results");
    title.setStyleName("results-title");
    mainPanel.add(title);
    mainPanel.setCellHorizontalAlignment(title, HasHorizontalAlignment.ALIGN_CENTER);

    final TextArea textAreaFileResult = new TextArea();
    textAreaFileResult.setText(this.resultFileContent);
    textAreaFileResult.setVisibleLines(15);
    textAreaFileResult.setWidth("100%");
    mainPanel.add(textAreaFileResult);

    final VerticalPanel stdoutPanel = new VerticalPanel();
    final Label stdoutLabel = new Label("stdout:");
    stdoutLabel.setStyleName("results-label");
    stdoutPanel.add(stdoutLabel);
    final TextArea textAreaStdout = new TextArea();
    textAreaStdout.setVisibleLines(8);
    textAreaStdout.setText(this.resultStdout);
    textAreaStdout.setSize("100%", "100%");
    stdoutPanel.add(textAreaStdout);
    stdoutPanel.setWidth("100%");
    mainPanel.add(stdoutPanel);

    final VerticalPanel stderrPanel = new VerticalPanel();
    final Label stderrLabel = new Label("stderr:");
    stderrLabel.setStyleName("results-label");
    stderrPanel.add(stderrLabel);
    final TextArea textAreaStderr = new TextArea();
    textAreaStderr.setVisibleLines(4);
    textAreaStderr.setText(this.resultStderr);
    textAreaStderr.setSize("100%", "100%");
    stderrPanel.add(textAreaStderr);
    stderrPanel.setWidth("100%");
    mainPanel.add(stderrPanel);

    final HorizontalPanel buttonPanel = new HorizontalPanel();
    buttonPanel.setSpacing(10);
    buttonPanel.setSize("100%", "100%");

    final Button button = new Button("Close");
    button.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            popup.hide();
        }
    });
    buttonPanel.add(button);
    buttonPanel.setCellHorizontalAlignment(button, HasHorizontalAlignment.ALIGN_CENTER);
    mainPanel.add(buttonPanel);
    popup.setWidget(mainPanel);
    popup.show();
}