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

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

Introduction

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

Prototype

public FlexCellFormatter getFlexCellFormatter() 

Source Link

Document

Explicitly gets the FlexCellFormatter .

Usage

From source file:com.mj.jqplot.sampling.client.utils.Utils.java

License:Open Source License

public static void alignCenter(FlexTable table, int row, int col) {
    table.getFlexCellFormatter().setHorizontalAlignment(row, col, HasAlignment.ALIGN_CENTER);
}

From source file:com.mj.jqplot.sampling.client.utils.Utils.java

License:Open Source License

public static void alignMiddle(FlexTable table, int row, int col) {
    table.getFlexCellFormatter().setVerticalAlignment(row, col, HasAlignment.ALIGN_MIDDLE);
}

From source file:com.mj.jqplot.sampling.client.utils.Utils.java

License:Open Source License

public static void alignTop(FlexTable table, int row, int col) {
    table.getFlexCellFormatter().setVerticalAlignment(row, col, HasAlignment.ALIGN_TOP);
}

From source file:com.mj.jqplot.sampling.client.utils.Utils.java

License:Open Source License

public static void alignBottom(FlexTable table, int row, int col) {
    table.getFlexCellFormatter().setVerticalAlignment(row, col, HasAlignment.ALIGN_BOTTOM);
}

From source file:com.msco.mil.client.com.sencha.gxt.explorer.client.toolbar.AdvancedToolBarExample.java

License:sencha.com license

private ContentPanel createMixed() {
    SamplePanel panel = new SamplePanel();
    panel.setHeadingText("Mix and match icon sizes");

    for (int i = 0; i < 2; i++) {
        ButtonGroup group = new ButtonGroup();
        group.setHeadingText("Clipboard");
        panel.getToolBar().add(group);/*w  ww . j  a va  2s .  co m*/

        FlexTable table = new FlexTable();
        group.add(table);

        TextButton btn = new TextButton("Paste", ExampleImages.INSTANCE.add32());
        btn.setScale(ButtonScale.LARGE);
        btn.setIconAlign(IconAlign.TOP);
        btn.setArrowAlign(ButtonArrowAlign.BOTTOM);

        table.setWidget(0, 0, btn);
        table.getFlexCellFormatter().setRowSpan(0, 0, 3);

        btn = new TextButton("Format", ExampleImages.INSTANCE.add32());
        btn.setScale(ButtonScale.LARGE);
        btn.setIconAlign(IconAlign.TOP);
        btn.setArrowAlign(ButtonArrowAlign.BOTTOM);

        table.setWidget(0, 1, btn);
        table.getFlexCellFormatter().setRowSpan(0, 1, 3);

        btn = new TextButton("Copy", ExampleImages.INSTANCE.add16());
        Menu menu = new Menu();
        menu.add(new MenuItem("Copy me"));
        btn.setMenu(menu);
        table.setWidget(0, 2, btn);

        btn = new TextButton("Cut", ExampleImages.INSTANCE.add16());
        table.setWidget(1, 2, btn);

        btn = new TextButton("Paste", ExampleImages.INSTANCE.add16());
        table.setWidget(2, 2, btn);

        cleanCells(table.getElement());
    }

    return panel;
}

From source file:com.nanosim.client.content.tables.CwFlexTable.java

License:Apache License

/**
 * Initialize this example./*from www .  ja v a 2s .  c  om*/
 */
@NanosimSource
@Override
public Widget onInitialize() {
    // Create a Flex Table
    final FlexTable flexTable = new FlexTable();
    FlexCellFormatter cellFormatter = flexTable.getFlexCellFormatter();
    flexTable.addStyleName("cw-FlexTable");
    flexTable.setWidth("32em");
    flexTable.setCellSpacing(5);
    flexTable.setCellPadding(3);

    // Add some text
    cellFormatter.setHorizontalAlignment(0, 1, HasHorizontalAlignment.ALIGN_LEFT);
    flexTable.setHTML(0, 0, constants.cwFlexTableDetails());
    cellFormatter.setColSpan(0, 0, 2);

    // Add a button that will add more rows to the table
    Button addRowButton = new Button(constants.cwFlexTableAddRow(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            addRow(flexTable);
        }
    });
    addRowButton.addStyleName("sc-FixedWidthButton");

    Button removeRowButton = new Button(constants.cwFlexTableRemoveRow(), new ClickHandler() {
        public void onClick(ClickEvent event) {
            removeRow(flexTable);
        }
    });
    removeRowButton.addStyleName("sc-FixedWidthButton");
    VerticalPanel buttonPanel = new VerticalPanel();
    buttonPanel.setStyleName("cw-FlexTable-buttonPanel");
    buttonPanel.add(addRowButton);
    buttonPanel.add(removeRowButton);
    flexTable.setWidget(0, 1, buttonPanel);
    cellFormatter.setVerticalAlignment(0, 1, HasVerticalAlignment.ALIGN_TOP);

    // Add two rows to start
    addRow(flexTable);
    addRow(flexTable);

    // Return the panel
    flexTable.ensureDebugId("cwFlexTable");
    return flexTable;
}

From source file:com.nanosim.client.content.tables.CwFlexTable.java

License:Apache License

/**
 * Add a row to the flex table./* w w w  . jav a 2 s. c  o m*/
 */
@NanosimSource
private void addRow(FlexTable flexTable) {
    int numRows = flexTable.getRowCount();
    flexTable.setWidget(numRows, 0, Nanosim.images.logo().createImage());
    flexTable.setWidget(numRows, 1, Nanosim.images.logo().createImage());
    flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows + 1);
}

From source file:com.nanosim.client.content.tables.CwFlexTable.java

License:Apache License

/**
 * Remove a row from the flex table./*w  w w .j  a  v a2s.com*/
 */
@NanosimSource
private void removeRow(FlexTable flexTable) {
    int numRows = flexTable.getRowCount();
    if (numRows > 1) {
        flexTable.removeRow(numRows - 1);
        flexTable.getFlexCellFormatter().setRowSpan(0, 1, numRows - 1);
    }
}

From source file:com.openkm.frontend.client.widget.dashboard.keymap.KeyMapTable.java

License:Open Source License

/**
 * Adding document row//  w w  w  .ja  va 2s.c o  m
 * 
 * @param gwtQueryResult Query result
 * @param score Document score
 */
private void addDocumentRow(GWTQueryResult gwtQueryResult, Score score) {
    Collection<String> selectedKeyList = Main.get().mainPanel.dashboard.keyMapDashboard.getFiltering();
    int rows = table.getRowCount();
    int firstRow = rows;

    firtRowList.add("" + firstRow);
    GWTDocument doc = new GWTDocument();

    if (gwtQueryResult.getDocument() != null) {
        doc = gwtQueryResult.getDocument();
    } else if (gwtQueryResult.getAttachment() != null) {
        doc = gwtQueryResult.getAttachment();
    }

    final String docPath = doc.getPath();
    Image gotoDocument = new Image("img/icon/actions/goto_document.gif");
    gotoDocument.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CommonUI.openPath(Util.getParent(docPath), docPath);
        }

    });
    gotoDocument.setTitle(Main.i18n("dashboard.keyword.goto.document"));
    gotoDocument.setStyleName("okm-KeyMap-ImageHover");
    table.setWidget(rows, 0, gotoDocument);

    if (doc.isAttachment()) {
        SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method
        sp.add(new HTML(Util.imageItemHTML("img/email_attach.gif") + Util.mimeImageHTML(doc.getMimeType())));
        table.setWidget(rows, 1, sp);
    } else {
        SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method
        sp.add(new HTML(Util.mimeImageHTML(doc.getMimeType())));
        table.setWidget(rows, 1, sp);
    }
    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(doc.getName());

    // On attachment case must remove last folder path, because it's internal usage not for visualization
    if (doc.isAttachment()) {
        hLink.setTitle(doc.getParentPath().substring(0, doc.getParentPath().lastIndexOf("/")));
    } else {
        hLink.setTitle(doc.getParentPath());
    }

    table.setWidget(rows, 2, hLink);

    // Format
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    table.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_LEFT);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 2, HasAlignment.ALIGN_MIDDLE);
    table.getFlexCellFormatter().setWidth(rows, 0, "24");
    table.getFlexCellFormatter().setWidth(rows, 1, "47");

    for (int i = 0; i < 2; i++) {
        table.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
    }

    // Writing detail
    rows++; // Next row line
    FlexTable tableDocument = new FlexTable();
    FlexTable tableProperties = new FlexTable();
    FlexTable tableSubscribedUsers = new FlexTable();
    tableDocument.setWidget(0, 0, tableProperties);
    tableDocument.setHTML(0, 1, "");
    tableDocument.setWidget(0, 2, tableSubscribedUsers);
    tableDocument.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    tableDocument.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP);
    tableDocument.getCellFormatter().setWidth(0, 0, "75%");
    tableDocument.getCellFormatter().setWidth(0, 1, "25");
    tableDocument.getCellFormatter().setWidth(0, 2, "25%");

    tableDocument.setWidth("100%");
    table.setWidget(rows, 0, tableDocument);
    table.getFlexCellFormatter().setColSpan(rows, 0, 3);
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);

    tableDocument.setStyleName("okm-DisableSelect");
    tableProperties.setStyleName("okm-DisableSelect");
    tableSubscribedUsers.setStyleName("okm-DisableSelect");

    tableProperties.setHTML(0, 0, "<b>" + Main.i18n("document.folder") + "</b>");
    tableProperties.setHTML(0, 1, doc.getParentPath());
    tableProperties.setHTML(1, 0, "<b>" + Main.i18n("document.size") + "</b>");
    tableProperties.setHTML(1, 1, Util.formatSize(doc.getActualVersion().getSize()));
    tableProperties.setHTML(2, 0, "<b>" + Main.i18n("document.created") + "</b>");
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    tableProperties.setHTML(2, 1,
            dtf.format(doc.getCreated()) + " " + Main.i18n("document.by") + " " + doc.getAuthor());
    tableProperties.setHTML(3, 0, "<b>" + Main.i18n("document.lastmodified") + "</b>");
    tableProperties.setHTML(3, 1, dtf.format(doc.getLastModified()) + " " + Main.i18n("document.by") + " "
            + doc.getActualVersion().getAuthor());
    tableProperties.setHTML(4, 0, "<b>" + Main.i18n("document.mimetype") + "</b>");
    tableProperties.setHTML(4, 1, doc.getMimeType());
    tableProperties.setHTML(5, 0, "<b>" + Main.i18n("document.status") + "</b>");
    if (doc.isCheckedOut()) {
        tableProperties.setHTML(5, 1,
                Main.i18n("document.status.checkout") + " " + doc.getLockInfo().getOwner());
    } else if (doc.isLocked()) {
        tableProperties.setHTML(5, 1, Main.i18n("document.status.locked") + " " + doc.getLockInfo().getOwner());
    } else {
        tableProperties.setHTML(5, 1, Main.i18n("document.status.normal"));
    }
    tableProperties.setHTML(6, 0, "<b>" + Main.i18n("document.subscribed") + "</b>");
    if (doc.isSubscribed()) {
        tableProperties.setHTML(6, 1, Main.i18n("document.subscribed.yes"));
    } else {
        tableProperties.setHTML(6, 1, Main.i18n("document.subscribed.no"));
    }

    // Sets wordWrap for al rows
    for (int i = 0; i < 7; i++) {
        setRowWordWarp(i, 2, false, tableProperties);
    }

    // Setting subscribers
    tableSubscribedUsers.setHTML(0, 0, "<b>" + Main.i18n("document.subscribed.users") + "<b>");
    setRowWordWarp(0, 1, false, tableSubscribedUsers);

    // Sets the folder subscribers
    for (GWTUser subscriptor : doc.getSubscriptors()) {
        tableSubscribedUsers.setHTML(tableSubscribedUsers.getRowCount(), 0, subscriptor.getUsername());
        setRowWordWarp(tableSubscribedUsers.getRowCount() - 1, 1, false, tableSubscribedUsers);
    }

    HorizontalPanel hKeyPanel = addKeywords(table, doc.getKeywords(), selectedKeyList); // Drawing keywords

    // Setting visibility
    switch (visibleStatus) {
    case VISIBLE_SMALL:
        tableDocument.setVisible(false);
        hKeyPanel.setVisible(false);
        table.getCellFormatter().addStyleName(firstRow, 0, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 1, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 2, "okm-Table-BottomBorder");
        break;
    case VISIBLE_MEDIUM:
        tableDocument.setVisible(false);
        hKeyPanel.setVisible(true);
        break;
    case VISIBLE_BIG:
        tableDocument.setVisible(true);
        hKeyPanel.setVisible(true);
        break;
    }

    // Saving object for refreshing language and setting visible ( true / false )
    tableDocumentList.add(tableDocument);
    hKeyPanelList.add(hKeyPanel);
}

From source file:com.openkm.frontend.client.widget.dashboard.keymap.KeyMapTable.java

License:Open Source License

/**
 * Adding mail/*from ww w .j  a v  a  2  s .c o  m*/
 * 
 * @param gwtQueryResult Query result
 * @param score The mail score
 */
private void addMailRow(GWTQueryResult gwtQueryResult, Score score) {
    Collection<String> selectedKeyList = Main.get().mainPanel.dashboard.keyMapDashboard.getFiltering();
    int rows = table.getRowCount();
    int firstRow = rows;

    firtRowList.add("" + firstRow);

    GWTMail mail = gwtQueryResult.getMail();
    ;
    final String mailPath = mail.getPath();

    Image gotoMail = new Image("img/icon/actions/goto_document.gif");
    gotoMail.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CommonUI.openPath(Util.getParent(mailPath), mailPath);
        }

    });
    gotoMail.setTitle(Main.i18n("dashboard.keyword.goto.mail"));
    gotoMail.setStyleName("okm-KeyMap-ImageHover");
    table.setWidget(rows, 0, gotoMail);

    SimplePanel sp = new SimplePanel(); // Solves some middle alignament problem derived from mimeImageHTML method
    if (mail.getAttachments().size() > 0) {
        sp.add(new HTML(Util.imageItemHTML("img/email_attach.gif")));
    } else {
        sp.add(new HTML(Util.imageItemHTML("img/email.gif")));
    }
    table.setWidget(rows, 1, sp);
    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(mail.getSubject());
    // On attachemt case must remove last folder path, because it's internal usage not for visualization
    hLink.setTitle(mail.getSubject());

    table.setWidget(rows, 2, hLink);

    // Format
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasAlignment.ALIGN_CENTER);
    table.getCellFormatter().setHorizontalAlignment(rows, 1, HasAlignment.ALIGN_RIGHT);
    table.getCellFormatter().setHorizontalAlignment(rows, 2, HasAlignment.ALIGN_LEFT);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 0, HasAlignment.ALIGN_MIDDLE);
    table.getCellFormatter().setVerticalAlignment(rows, 2, HasAlignment.ALIGN_MIDDLE);
    table.getFlexCellFormatter().setWidth(rows, 0, "24");
    table.getFlexCellFormatter().setWidth(rows, 1, "47");

    for (int i = 0; i < 2; i++) {
        table.getCellFormatter().addStyleName(rows, i, "okm-DisableSelect");
    }

    // Writing detail
    rows++; // Next row line
    FlexTable tableMail = new FlexTable();
    FlexTable tableProperties = new FlexTable();
    FlexTable tableSubscribedUsers = new FlexTable();
    tableMail.setWidget(0, 0, tableProperties);
    tableMail.setHTML(0, 1, "");
    tableMail.setWidget(0, 2, tableSubscribedUsers);
    tableMail.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    tableMail.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP);
    tableMail.getCellFormatter().setWidth(0, 0, "75%");
    tableMail.getCellFormatter().setWidth(0, 1, "25");
    tableMail.getCellFormatter().setWidth(0, 2, "25%");

    tableMail.setWidth("100%");
    table.setWidget(rows, 0, tableMail);
    table.getFlexCellFormatter().setColSpan(rows, 0, 3);
    table.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);

    tableMail.setStyleName("okm-DisableSelect");
    tableProperties.setStyleName("okm-DisableSelect");
    tableSubscribedUsers.setStyleName("okm-DisableSelect");

    tableProperties.setHTML(0, 0, "<b>" + Main.i18n("mail.folder") + "</b>");
    tableProperties.setHTML(0, 1, mail.getParentPath());
    tableProperties.setHTML(1, 0, "<b>" + Main.i18n("mail.size") + "</b>");
    tableProperties.setHTML(1, 1, Util.formatSize(mail.getSize()));
    tableProperties.setHTML(2, 0, "<b>" + Main.i18n("mail.created") + "</b>");
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    tableProperties.setHTML(2, 1,
            dtf.format(mail.getCreated()) + " " + Main.i18n("mail.by") + " " + mail.getAuthor());
    tableProperties.setHTML(3, 0, "<b>" + Main.i18n("mail.mimetype") + "</b>");
    tableProperties.setHTML(3, 1, mail.getMimeType());

    // Sets wordWrap for al rows
    for (int i = 0; i < 4; i++) {
        setRowWordWarp(i, 2, false, tableProperties);
    }

    HorizontalPanel hKeyPanel = addKeywords(table, mail.getKeywords(), selectedKeyList); // Drawing keywords

    // Setting visibility
    switch (visibleStatus) {
    case VISIBLE_SMALL:
        tableMail.setVisible(false);
        hKeyPanel.setVisible(false);
        table.getCellFormatter().addStyleName(firstRow, 0, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 1, "okm-Table-BottomBorder");
        table.getCellFormatter().addStyleName(firstRow, 2, "okm-Table-BottomBorder");
        break;
    case VISIBLE_MEDIUM:
        tableMail.setVisible(false);
        hKeyPanel.setVisible(true);
        break;
    case VISIBLE_BIG:
        tableMail.setVisible(true);
        hKeyPanel.setVisible(true);
        break;
    }

    tableMailList.add(tableMail);
    hKeyPanelList.add(hKeyPanel);
}