Example usage for com.google.gwt.user.client.ui FlexTable FlexTable

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

Introduction

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

Prototype

public FlexTable() 

Source Link

Usage

From source file:com.square.composant.tarificateur.square.client.view.ligne.devis.LigneDevisViewImpl.java

License:Open Source License

/**
 * Cree l'entete du tableau.//  w  w  w.  j av a  2  s  .co m
 */
private void creerTableauLignesDevis() {
    tableauLignesDevis = new FlexTable();
    tableauLignesDevis.addStyleName(ComposantTarificateur.RESOURCES.css().tableauLignesDevis());
    tableauLignesDevis.setWidth(ComposantTarificateurConstants.POURCENT_100);

    final Label lProduits = new Label(viewConstants.titreColonneProduits());
    final Label lNomPrenom = new Label(viewConstants.titreColonneNomPrenom());
    final Label lCriteres = new Label(viewConstants.titreColonneCriteres());
    final Label lDateEffet = new Label(viewConstants.titreColonneDateEffet());
    final Label lTarifs = new Label(viewConstants.titreColonneTarifs());
    final Label lAdhesion = new Label(viewConstants.labelColonneAdhesion());
    lAdhesion.setTitle(viewConstants.titleColonneAdhesion());
    final Label lRefus = new Label(viewConstants.labelColonneRefus());
    lRefus.setTitle(viewConstants.titleColonneRefus());
    final Label lCorbeille = new Label(viewConstants.labelColonneCorbeille());
    lCorbeille.setTitle(viewConstants.titleColonneCorbeille());
    final Label lEnCours = new Label(viewConstants.labelColonneEnCours());
    lEnCours.setTitle(viewConstants.titleColonneEnCours());
    final Label lSelectionImpression = new Label(viewConstants.titreColonneSelectionImpression());
    lSelectionImpression.setTitle(viewConstants.titreCheckboxSelection());

    lProduits.setWordWrap(false);
    lNomPrenom.setWordWrap(false);
    lCriteres.setWordWrap(false);
    lDateEffet.setWordWrap(false);
    lTarifs.setWordWrap(false);
    lAdhesion.setWordWrap(false);
    lRefus.setWordWrap(false);
    lCorbeille.setWordWrap(false);
    lEnCours.setWordWrap(false);
    lSelectionImpression.setWordWrap(false);

    tableauLignesDevis.setWidget(0, 0, lProduits);
    tableauLignesDevis.setWidget(0, 1, lNomPrenom);
    tableauLignesDevis.setWidget(0, 2, lCriteres);
    tableauLignesDevis.setWidget(0, 3, lDateEffet);
    tableauLignesDevis.setWidget(0, 4, lTarifs);
    tableauLignesDevis.setWidget(0, 5, lAdhesion);
    tableauLignesDevis.setWidget(0, 6, lRefus);
    tableauLignesDevis.setWidget(0, 7, lCorbeille);
    tableauLignesDevis.setWidget(0, 8, lEnCours);
    tableauLignesDevis.setWidget(0, 9, lSelectionImpression);

    tableauLignesDevis.getColumnFormatter().setWidth(0, "26%");
    tableauLignesDevis.getColumnFormatter().setWidth(1, "27%");
    tableauLignesDevis.getColumnFormatter().setWidth(2, "27%");
    tableauLignesDevis.getColumnFormatter().setWidth(3, "5%");
    tableauLignesDevis.getColumnFormatter().setWidth(4, "10%");
    tableauLignesDevis.getColumnFormatter().setWidth(5, ComposantTarificateurConstants.POURCENT_1);
    tableauLignesDevis.getColumnFormatter().setWidth(6, ComposantTarificateurConstants.POURCENT_1);
    tableauLignesDevis.getColumnFormatter().setWidth(7, ComposantTarificateurConstants.POURCENT_1);
    tableauLignesDevis.getColumnFormatter().setWidth(8, ComposantTarificateurConstants.POURCENT_1);
    tableauLignesDevis.getColumnFormatter().setWidth(9, ComposantTarificateurConstants.POURCENT_1);

    tableauLignesDevis.getCellFormatter().setHorizontalAlignment(0, 4, HasHorizontalAlignment.ALIGN_CENTER);
    tableauLignesDevis.getCellFormatter().setHorizontalAlignment(0, 5, HasHorizontalAlignment.ALIGN_CENTER);
    tableauLignesDevis.getCellFormatter().setHorizontalAlignment(0, 6, HasHorizontalAlignment.ALIGN_CENTER);
    tableauLignesDevis.getCellFormatter().setHorizontalAlignment(0, 7, HasHorizontalAlignment.ALIGN_CENTER);
    tableauLignesDevis.getCellFormatter().setHorizontalAlignment(0, 8, HasHorizontalAlignment.ALIGN_CENTER);

    for (int i = 0; i < tableauLignesDevis.getCellCount(0); i++) {
        tableauLignesDevis.getCellFormatter().addStyleName(0, i,
                ComposantTarificateur.RESOURCES.css().tableauLignesDevisEntete());
    }
}

From source file:com.square.composant.tarificateur.square.client.view.popup.ajout.assure.PopupAjoutAssureViewImpl.java

License:Open Source License

private FlexTable construireFormulaire() {
    final Label lCivilite = new Label(viewConstants.civilite());
    final Label lNom = new Label(viewConstants.nom());
    final Label lPrenom = new Label(viewConstants.prenom());
    final Label lDateNaissance = new Label(viewConstants.dateNaissance());
    final Label lNumSS = new Label(viewConstants.numSS());
    final Label lCleSS = new Label(viewConstants.cleSS());
    final Label lRegime = new Label(viewConstants.regime());
    final Label lCaisse = new Label(viewConstants.caisse());

    final SuggestListBoxSingleProperties<IdentifiantLibelleGwt> properties = new SuggestListBoxSingleProperties<IdentifiantLibelleGwt>() {
        @Override//from   w w w.  j  av a 2s  . c o  m
        public String getSelectSuggestRenderer(IdentifiantLibelleGwt row) {
            return row == null ? "" : row.getLibelle();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(IdentifiantLibelleGwt row) {
            return new String[] { row == null ? "" : row.getLibelle() };
        }
    };
    final SuggestListBoxSingleProperties<CaisseSimpleModel> propertiesCaisse = new SuggestListBoxSingleProperties<CaisseSimpleModel>() {
        @Override
        public String getSelectSuggestRenderer(CaisseSimpleModel row) {
            return row == null ? "" : row.getCode() + "." + row.getCentre() + "." + row.getNom();
        }

        @Override
        public String[] getResultColumnsRenderer() {
            return new String[] {};
        }

        @Override
        public String[] getResultRowsRenderer(CaisseSimpleModel row) {
            return new String[] {
                    row == null ? "" : row.getCode() + "." + row.getCentre() + "." + row.getNom() };
        }
    };

    slbCivilite = new DecoratedSuggestListBoxSingle<IdentifiantLibelleGwt>(properties);
    slbCaisse = new DecoratedSuggestListBoxSingle<CaisseSimpleModel>(propertiesCaisse);
    slbRegime = new DecoratedSuggestListBoxSingle<IdentifiantLibelleGwt>(properties);
    tbNom = new DecoratedTextBox();
    tbPrenom = new DecoratedTextBox();
    tbNumSS = new DecoratedTextBox();
    tbCleSS = new DecoratedTextBox();
    cdbDateNaissance = new DecoratedCalendrierDateBox(true);

    tbNumSS.setMaxLength(InfosAdhesionViewImplConstants.LONGUEUR_NUM_SECURITE_SOCIALE);
    tbCleSS.setMaxLength(InfosAdhesionViewImplConstants.LONGUEUR_CLE_SECURITE_SOCIALE);
    tbCleSS.setWidth(InfosAdhesionViewImplConstants.LARGEUR_TB_CLE_SS);

    final FlexTable formulaire = new FlexTable();
    formulaire.setWidth(ComposantTarificateurConstants.POURCENT_100);
    formulaire.setWidget(0, 0, lCivilite);
    formulaire.setWidget(0, 1, construireBlocIcone(slbCivilite, "PersonneDto.eidCivilite"));
    formulaire.setWidget(0, 2, lDateNaissance);
    formulaire.setWidget(0, 3, construireBlocIcone(cdbDateNaissance, "PersonneDto.dateNaissance"));
    formulaire.setWidget(1, 0, lNom);
    formulaire.setWidget(1, 1, construireBlocIcone(tbNom, "PersonneDto.nom"));
    formulaire.setWidget(1, 2, lPrenom);
    formulaire.setWidget(1, 3, construireBlocIcone(tbPrenom, "PersonneDto.prenom"));
    formulaire.setWidget(2, 0, lNumSS);
    formulaire.setWidget(2, 1, tbNumSS);
    formulaire.setWidget(2, 2, lCleSS);
    formulaire.setWidget(2, 3, construireBlocIcone(tbCleSS, "PersonneDto.infoSante.numSecuriteSocial"));
    formulaire.setWidget(3, 0, lRegime);
    formulaire.setWidget(3, 1, construireBlocIcone(slbRegime, "PersonneDto.infoSante.eidRegime"));
    formulaire.setWidget(3, 2, lCaisse);
    formulaire.setWidget(3, 3, construireBlocIcone(slbCaisse, "PersonneDto.infoSante.eidCaisse"));
    return formulaire;
}

From source file:com.sun.labs.aura.dbbrowser.client.query.AttnPanel.java

License:Open Source License

public AttnPanel(AttnDesc[] attns, final TabbedQueryUI parent) {
    this.attns = attns;
    this.parent = parent;
    results = new FlexTable();
    setStylePrimaryName("db-ResultsPanel");
    setSpacing(5);/*from  ww  w  .j  a v a 2  s. c o  m*/
    //
    // Put in the headers
    results.setText(0, TYPE_COL, "Type");
    results.setText(0, SRC_COL, "Source Key");
    results.setText(0, TRG_COL, "Target Key");
    results.setText(0, TIME_COL, "Timestamp");
    results.setText(0, STRVAL_COL, "String Val");
    results.setText(0, LONGVAL_COL, "Long Val");
    RowFormatter rf = results.getRowFormatter();
    rf.setStylePrimaryName(0, "db-TableHeader");
    fillAttns();
    center.add(results);
    add(center, CENTER);
    Button close = new Button("Close");
    close.addClickListener(new ClickListener() {
        public void onClick(Widget arg0) {
            parent.removeAttnTab(arg0.getParent());
        }
    });
    timeStamp = new Label();
    add(timeStamp, SOUTH);
    AttnDesc info = attns[0];
    setQueryInfo(info.getQueryTime(), attns.length - 1, info.getNumTotal());
    add(close, SOUTH);

    service = GWTMainEntryPoint.getDBService();
}

From source file:com.sun.labs.aura.dbbrowser.client.query.ResultsPanel.java

License:Open Source License

public ResultsPanel(ItemDesc[] items, final TabbedQueryUI parent) {
    this.items = items;
    this.parent = parent;
    results = new FlexTable();
    setStylePrimaryName("db-ResultsPanel");
    setSpacing(5);/*w  ww  .j  a v  a  2s . c  o m*/
    //
    // Put in the headers
    results.setText(0, NAME_COL, "Item Name");
    results.setText(0, KEY_COL, "Item Key");
    results.setText(0, TYPE_COL, "Type");
    results.setText(0, SRC_ATTN_COL, "Attn For Source");
    results.setText(0, TRG_ATTN_COL, "Attn for Target");
    results.setText(0, DELETE_COL, "Delete?");
    RowFormatter rf = results.getRowFormatter();
    rf.setStylePrimaryName(0, "db-TableHeader");
    fillItems();
    center.add(results);
    add(center, CENTER);
    ItemDesc time = items[0];
    add(new Label("Query took: " + time.getQueryTime() + "ms"), SOUTH);
    Button close = new Button("Close");
    close.addClickListener(new ClickListener() {
        public void onClick(Widget arg0) {
            parent.removeTab(arg0.getParent());
        }
    });
    add(close, SOUTH);

    itemInfo = new DialogBox(true);

    service = GWTMainEntryPoint.getDBService();
}

From source file:com.sun.labs.aura.dbbrowser.client.query.ResultsPanel.java

License:Open Source License

protected void displayItemInfo(HashMap results) {
    if (results == null) {
        itemInfo.setWidget(new Label("No info"));
        return;/*from  w  ww .j a v a  2 s  .  c  o  m*/
    }
    FlexTable contents = new FlexTable();
    RowFormatter rf = contents.getRowFormatter();
    Set names = results.keySet();
    Iterator nit = names.iterator();
    int row = 0;
    boolean lightRow = true;
    while (nit.hasNext()) {
        String name = (String) nit.next();
        contents.setText(row, 0, name);
        String val = (String) results.get(name);
        Widget valWidget = null;
        if (val.startsWith("http")) {
            valWidget = new Hyperlink(val, val);
            if (val.endsWith(".jpg") || val.endsWith(".gif") || val.endsWith(".png")) {
                FlowPanel both = new FlowPanel();
                both.add(valWidget);
                both.add(new Image(val));
                valWidget = both;
            }
        } else {
            valWidget = new Label(val);
        }
        if (lightRow) {
            rf.addStyleName(row, "db-lightRow");
        } else {
            rf.addStyleName(row, "db-darkRow");
        }
        lightRow = !lightRow;
        contents.setWidget(row++, 1, valWidget);
    }
    itemInfo.setWidget(contents);
}

From source file:com.sun.labs.aura.dbbrowser.client.viz.Util.java

License:Open Source License

public static DisclosurePanel getTypeStatsPanel(Map typeToCount) {
    DisclosurePanel typeStats = new DisclosurePanel(new StyleLabel("Item Type Stats", "viz-typeStatsLabel"));
    FlexTable typeTable = new FlexTable();
    CellFormatter cf = typeTable.getCellFormatter();
    Set types = typeToCount.keySet();
    int row = 0;/*from  w w  w .  j  a  v  a  2s. co  m*/
    for (Iterator typeIt = types.iterator(); typeIt.hasNext();) {
        String type = (String) typeIt.next();
        Long count = (Long) typeToCount.get(type);
        if (count.longValue() != 0L) {
            typeTable.setWidget(row, 0, new StyleLabel(type + ":", "viz-statLabel"));
            typeTable.setWidget(row, 1, new StyleLabel(count.toString(), "viz-statLabel"));
            cf.setStylePrimaryName(row, 0, "viz-typeStatsTypeCol");
            cf.setStylePrimaryName(row++, 1, "viz-typeStatsCountCol");
        }
    }
    typeStats.add(typeTable);
    typeStats.setStylePrimaryName("viz-typeStatsPanel");
    return typeStats;
}

From source file:com.tasktop.c2c.server.common.web.client.widgets.DynamicFormPanel.java

License:Open Source License

public DynamicFormPanel() {
    flexTable = new FlexTable();
    flexTable.addStyleName("taskDetailLayout");
    initWidget(flexTable);
}

From source file:com.toedter.gwt.demo.contacts.client.ui.ContactDetailsView2.java

License:Open Source License

public ContactDetailsView2() {
    resources = GWT.create(Resources.class);
    colSpan = 2;/* w w w. j  a  v a2s .  co m*/
    flexTable = new FlexTable();
    // flexTable.setStyleName("greyBackground");
    flexTable.setWidget(1, 4, new Image(resources.fiveXfive()));
    flexTable.getFlexCellFormatter().setWidth(1, 4, "5px");
    flexTable.setWidget(1, 6, new Image(resources.fiveXfive()));
    flexTable.getFlexCellFormatter().setWidth(1, 6, "5px");

    image = new Image(resources.dummyContact());

    flexTable.setWidget(1, 5, image);
    flexTable.getFlexCellFormatter().setRowSpan(1, 5, 4);
    flexTable.getFlexCellFormatter().setVerticalAlignment(1, 5, HasVerticalAlignment.ALIGN_TOP);

    createSeparator("General");
    titleText = createTextBox("Title:");
    nameText = createTextBox("Name:");
    companyText = createTextBox("Company:");
    jobTitleText = createTextBox("Job Title:");

    colSpan = 4;
    createSeparator("Business Address");
    streetText = createTextBox("Street:");
    cityText = createTextBox("City:");
    zipText = createTextBox("Zip:");
    countryText = createTextBox("Country:");

    createSeparator("Business Internet");
    emailText = createTextBox("Email:");
    webText = createTextBox("Web:");

}

From source file:com.totsp.gwittir.example.client.ContactEdit.java

License:Open Source License

/** Creates a new instance of ContactEdit */
public ContactEdit() {
    super();/*  ww w. ja v  a 2s .c  om*/
    super.initWidget(p);

    FlexTable base = new FlexTable();
    base.setWidth("100%");
    base.setStyleName("example-ContactEdit");
    base.setWidget(0, 0, new Label("First Name:"));
    base.setWidget(0, 1, firstName);
    base.setWidget(1, 0, new Label("LastName:"));
    base.setWidget(1, 1, lastName);
    base.setWidget(2, 0, new Label("Notes:"));
    base.getFlexCellFormatter().setColSpan(2, 0, 2);
    base.setWidget(3, 0, notes);
    base.getFlexCellFormatter().setColSpan(3, 0, 2);
    p.add(base);
    p.add(new Label("Addresses:"));
    addressCols[0] = new Field("type", "Type");
    addressCols[1] = new Field("address1", "Address");
    addressCols[2] = new Field("address2", "");
    addressCols[3] = new Field("city", "City");
    addressCols[4] = new Field("state", "State");
    addressCols[5] = new Field("zip", "Zip");

    factory.add(StateLookup.class, new BoundWidgetProvider() {
        public BoundWidget get() {
            Label label = new Label();
            label.setRenderer(new Renderer() {
                public Object render(Object o) {
                    return (o == null) ? "" : ((StateLookup) o).code;
                }
            });

            return label;
        }
    });

    factory.add(TypeLookup.class, new BoundWidgetProvider() {
        public BoundWidget get() {
            TextBox label = new TextBox();
            label.setRenderer(new Renderer() {
                public Object render(Object o) {
                    return (o == null) ? "" : ((TypeLookup) o).name;
                }
            });

            return label;
        }
    });
    factory.add(String.class, BoundWidgetTypeFactory.LABEL_PROVIDER);
    factory.add(Address.class, new BoundWidgetProvider() {
        public BoundWidget get() {
            AddressEdit e = new AddressEdit();
            e.setAction(new AddressEditAction());

            return e;
        }
    });

    addresses = new BoundTable(BoundTable.HEADER_MASK + BoundTable.SORT_MASK + BoundTable.NO_SELECT_CELL_MASK
            + BoundTable.NO_SELECT_COL_MASK//+ BoundTable.MULTIROWSELECT_MASK
            + BoundTable.INSERT_WIDGET_MASK, factory);
    addresses.setColumns(addressCols);

    addresses.setWidth("500px");
    p.add(addresses);
    p.add(this.newAddress);
    p.add(new Label("Phone Numbers: "));

    phoneCols[0] = new Field("type", "Type");
    phoneCols[1] = new Field("number", "Number");

    BoundWidgetTypeFactory phoneFactory = new BoundWidgetTypeFactory(true);
    phoneFactory.add(TypeLookup.class, TypeSelectorProvider.INSTANCE);

    this.phoneNumbers = new BoundTable(BoundTable.HEADER_MASK + BoundTable.SORT_MASK
            + BoundTable.NO_SELECT_CELL_MASK + BoundTable.NO_SELECT_COL_MASK, phoneFactory);
    phoneNumbers.setColumns(phoneCols);
    p.add(this.phoneNumbers);
    p.add(this.newPhone);
}

From source file:com.vaadin.addon.timeline.gwt.client.VTimelineDisplay.java

/**
 * Plots a marker to a gived position/*from  w ww.j a  va  2 s  .c o m*/
 * 
 * @param caption
 *            The short caption to be displayed in the graph
 * @param description
 *            The tooltip
 * @param x
 *            The x-coordinate
 * @param y
 *            The y-coordinate
 */
private void plotMarker(String markString, float x, float y) {

    HTML lbl;
    FlexTable tooltip;

    // Check if marker exists on display
    if (markerMap.get(markString) != null) {
        lbl = markerMap.get(markString);
        tooltip = markerTooltipMap.get(markString);
    } else {
        String m[] = markString.split("_");
        Long time = Long.parseLong(m[0]);
        String caption = m[1];
        String description = m[2];

        lbl = new HTML("<span class=\"" + CLASSNAME_MARKER + "-text\">" + caption + "</span>");
        lbl.setStyleName(CLASSNAME_MARKER);
        lbl.addStyleName(CLASSNAME_MARKER + "-" + caption);

        displayComponentPanel.add(lbl);
        displayComponentPanel.setWidgetPosition(lbl, (int) x - lbl.getOffsetWidth() / 2,
                (int) y - lbl.getOffsetHeight());

        markerMap.put(markString, lbl);

        DateTimeFormat formatter = DateTimeFormat.getFormat("MMM d, ''yy");

        tooltip = new FlexTable();
        tooltip.setVisible(true);
        tooltip.setStyleName(CLASSNAME_MARKERTOOLTIP);
        tooltip.setBorderWidth(0);
        tooltip.setCellSpacing(0);
        tooltip.setCellPadding(0);

        tooltip.getRowFormatter().setStyleName(0, "top");
        tooltip.getCellFormatter().setStyleName(0, 0, "topLeft");
        tooltip.getCellFormatter().setStyleName(0, 1, "topMiddle");
        tooltip.getCellFormatter().setStyleName(0, 2, "topRight");

        tooltip.getRowFormatter().setStyleName(1, "middle");
        tooltip.getCellFormatter().setStyleName(1, 0, "middleLeft");
        tooltip.getCellFormatter().setStyleName(1, 1, "content");
        tooltip.getCellFormatter().setStyleName(1, 2, "middleRight");

        tooltip.getRowFormatter().setStyleName(2, "bottom");
        tooltip.getCellFormatter().setStyleName(2, 0, "bottomLeft");
        tooltip.getCellFormatter().setStyleName(2, 1, "bottomMiddle");
        tooltip.getCellFormatter().setStyleName(2, 2, "bottomRight");

        HTML content = new HTML("<span class=date>" + formatter.format(new Date(time)) + "</span> <br/>"
                + "<span class=text>" + description + "</span>");

        tooltip.setWidget(1, 1, content);

        displayComponentPanel.add(tooltip);
        markerTooltipMap.put(markString, tooltip);
    }

    int markerX = (int) (x - Util.getRequiredWidth(lbl) / 2.0);
    int markerY = (int) (y - Util.getRequiredHeight(lbl));

    displayComponentPanel.setWidgetPosition(lbl, markerX, markerY);

    // Show tooltip for measurement
    tooltip.setVisible(true);
    displayComponentPanel.setWidgetPosition(tooltip, 0, 0);

    markerY -= Util.getRequiredHeight(tooltip);

    // Check if right border is reached, if so, the move the tooltip
    // left
    if (markerX + Util.getRequiredWidth(tooltip) > Util.getRequiredWidth(displayComponentPanel)) {
        markerX -= Util.getRequiredWidth(tooltip);
    }

    displayComponentPanel.setWidgetPosition(tooltip, markerX, markerY);
    tooltip.setVisible(false);
}