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.hazelcast.monitor.client.PanelUtils.java

License:Open Source License

public static FlexTable createFormattedFlexTable() {
    FlexTable table = new FlexTable();
    table.addStyleName("table");
    table.addStyleName("mapstats");
    table.getRowFormatter().addStyleName(0, "mapstatsHeader");
    return table;
}

From source file:com.howard.lsp.lab8.lab9.stockwatcher.StockWatcher.client.StockWatcher.java

License:Open Source License

@Override
public void onModuleLoad() {
    RootPanel rootPanel = RootPanel.get();

    VerticalPanel mainPanel = new VerticalPanel();
    rootPanel.add(mainPanel, 10, 10);/*from www.j a  va 2  s  . com*/
    mainPanel.setSize("253px", "280px");

    stocksFlexTable = new FlexTable();
    stocksFlexTable.setText(0, 0, "Symbol");
    stocksFlexTable.setText(0, 1, "Price");
    stocksFlexTable.setText(0, 2, "Change");
    stocksFlexTable.setText(0, 3, "Remove");

    mainPanel.add(stocksFlexTable);

    addPanel = new HorizontalPanel();
    mainPanel.add(addPanel);

    newSymbolTextBox = new TextBox();
    newSymbolTextBox.addKeyPressHandler(new KeyPressHandler() {
        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getCharCode() == KeyCodes.KEY_ENTER) {
                addStock();
            }
        }
    });
    addPanel.add(newSymbolTextBox);

    addButton = new Button("Add");
    addButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            addStock();
        }
    });
    addPanel.add(addButton);

    lastUpdatedLabel = new Label("New Label");
    mainPanel.add(lastUpdatedLabel);
}

From source file:com.ikon.extension.frontend.client.widget.dropbox.StatusListenerPopup.java

License:Open Source License

public StatusListenerPopup() {
    // Establishes auto-close when click outside
    super(false, true);

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

    table = new FlexTable();
    table.setCellPadding(2);/*w  ww  . j a v  a2  s .  co  m*/
    table.setCellSpacing(0);
    table.setWidth("100%");

    scrollPanel = new ScrollPanel();
    scrollPanel.setStyleName("gwt-ScrollTable");
    scrollPanel.addStyleName("okm-Input");
    scrollPanel.setSize("600px", "250px");
    scrollPanel.add(table);

    // closeButton
    closeButton = new Button(GeneralComunicator.i18nExtension("button.close"));
    closeButton.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            hide();
        }
    });
    closeButton.setStyleName("okm-YesButton");

    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(scrollPanel);
    vPanel.add(UtilComunicator.vSpace("5"));
    vPanel.add(closeButton);
    vPanel.add(UtilComunicator.vSpace("5"));

    vPanel.setCellHorizontalAlignment(scrollPanel, VerticalPanel.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(closeButton, VerticalPanel.ALIGN_CENTER);

    setWidget(vPanel);
}

From source file:com.ikon.frontend.client.widget.chat.ChatRoomPopup.java

License:Open Source License

/**
 * Chat room popup/*www . j  av a 2  s .  c  o m*/
 */
public ChatRoomPopup(String user, final String room) {
    // Establishes auto-close when click outside
    super(false, false);
    setText(Main.i18n("chat.room"));
    singleton = this;
    chatRoomActive = true;
    connectedRoom = room;
    usersInRoomText = new HTML("");
    addUserToChatRoom = new Image(OKMBundleResources.INSTANCE.addUserToChatRoom());
    addUserToChatRoom.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            chatService.getUsersInRoom(room, new AsyncCallback<List<String>>() {

                @Override
                public void onSuccess(List<String> result) {
                    Main.get().onlineUsersPopup.setAction(OnlineUsersPopup.ACTION_ADD_USER_TO_ROOM, room);
                    Main.get().onlineUsersPopup.setUsersInChat(result);
                    Main.get().onlineUsersPopup.center();
                    Main.get().onlineUsersPopup.refreshOnlineUsers();
                }

                @Override
                public void onFailure(Throwable caught) {
                    Main.get().showError("Logout", caught);
                }
            });
        }
    });

    close = new Button(Main.i18n("button.close"), new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            chatRoomActive = false;
            chatService.closeRoom(room, new AsyncCallback<Object>() {
                @Override
                public void onSuccess(Object arg0) {
                    Main.get().mainPanel.bottomPanel.userInfo.removeChatRoom(singleton);
                }

                @Override
                public void onFailure(Throwable caught) {
                    Main.get().showError("Logout", caught);
                }
            });

            hide();
        }
    });

    vPanel = new VerticalPanel();
    hPanel = new HorizontalPanel();

    HTML space4 = new HTML("");
    hPanel.add(space4);
    hPanel.add(addUserToChatRoom);
    hPanel.add(usersInRoomText);
    HTML space5 = new HTML("");
    hPanel.add(space5);

    hPanel.setCellHorizontalAlignment(addUserToChatRoom, HasAlignment.ALIGN_LEFT);
    hPanel.setCellHorizontalAlignment(usersInRoomText, HasAlignment.ALIGN_RIGHT);
    hPanel.setCellWidth(space4, "5");
    hPanel.setCellWidth(addUserToChatRoom, "189");
    hPanel.setCellWidth(usersInRoomText, "189");
    hPanel.setCellWidth(space5, "5");
    hPanel.setWidth("100%");

    table = new FlexTable();
    table.setBorderWidth(0);
    table.setCellPadding(2);
    table.setCellSpacing(0);
    table.setWidth("100%");

    scrollPanel = new ScrollPanel(table);
    scrollPanel.setSize("388", "225");

    textArea = new TextArea();
    textArea.setSize("390", "50");
    textArea.addKeyUpHandler(new KeyUpHandler() {
        @Override
        public void onKeyUp(KeyUpEvent event) {
            if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && textArea.getText().length() == 1) {
                // Case only has typewrite a enter character, reset textArea values
                textArea.setText("");
            } else if (KeyCodes.KEY_ENTER == event.getNativeKeyCode() && textArea.getText().length() > 1) {
                textArea.setEnabled(false);
                chatService.addMessageToRoom(room, formatingMessage(textArea.getText()),
                        new AsyncCallback<Object>() {
                            @Override
                            public void onSuccess(Object result) {
                                addMessage("<b>" + Main.get().workspaceUserProperties.getUser().getUsername()
                                        + "</b>: " + formatingMessage(textArea.getText()));
                                textArea.setText("");
                                textArea.setEnabled(true);
                            }

                            @Override
                            public void onFailure(Throwable caught) {
                                textArea.setEnabled(true);
                                Main.get().showError("AddMessageToRoom", caught);
                            }
                        });
            }
        }
    });

    vPanel.add(hPanel);
    HTML space = new HTML();
    vPanel.add(space);
    vPanel.add(scrollPanel);
    HTML space2 = new HTML();
    vPanel.add(space2);
    vPanel.add(textArea);
    HTML space3 = new HTML();
    vPanel.add(space3);
    vPanel.add(close);

    vPanel.setCellHeight(hPanel, "25");
    vPanel.setCellHeight(scrollPanel, "225");
    vPanel.setCellHeight(textArea, "50");
    vPanel.setCellHeight(space, "5");
    vPanel.setCellHeight(space2, "5");
    vPanel.setCellHeight(space3, "5");
    vPanel.setCellHorizontalAlignment(hPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(scrollPanel, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(textArea, HasAlignment.ALIGN_CENTER);
    vPanel.setCellHorizontalAlignment(close, HasAlignment.ALIGN_CENTER);
    vPanel.setCellVerticalAlignment(hPanel, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellVerticalAlignment(scrollPanel, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellVerticalAlignment(textArea, HasAlignment.ALIGN_MIDDLE);
    vPanel.setCellVerticalAlignment(close, HasAlignment.ALIGN_MIDDLE);

    scrollPanel.setStyleName("okm-PanelSelected");
    scrollPanel.addStyleName("okm-Input");
    textArea.setStyleName("okm-TextArea");
    close.setStyleName("okm-NoButton");

    vPanel.setWidth("400px");
    vPanel.setHeight("350px");

    setStyleName("okm-Popup");

    refreshUsersInRoom(room); // Refresh users in room

    super.hide();
    setWidget(vPanel);
}

From source file:com.ikon.frontend.client.widget.dashboard.ControlSearchIn.java

License:Open Source License

public ControlSearchIn() {
    controlPanel = new VerticalPanel();
    table = new FlexTable();
    textResults = new HTML(Main.i18n("search.results"));
    previous = new Image(OKMBundleResources.INSTANCE.previous());
    next = new Image(OKMBundleResources.INSTANCE.next());

    previous.addClickHandler(new ClickHandler() {
        @Override/*from   ww  w  . j  av a  2s. c  om*/
        public void onClick(ClickEvent event) {
            if (previousEnabled) {
                offset -= limit;
                Main.get().mainPanel.dashboard.keyMapDashboard.findPaginated(offset, limit);
            }
        }
    });

    next.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            if (nextEnabled) {
                offset += limit;
                Main.get().mainPanel.dashboard.keyMapDashboard.findPaginated(offset, limit);
            }
        }
    });

    table.setWidget(0, 0, textResults);
    table.setHTML(0, 1, "&nbsp;&nbsp;&nbsp;");
    table.setWidget(0, 2, previous);
    table.setHTML(0, 3, "");
    table.setWidget(0, 4, next);

    controlPanel.add(table);

    controlPanel.setVisible(false); // Initially not shows only when search has been executed
    controlPanel.setStyleName("okm-DisableSelect");
    next.setStyleName("okm-KeyMap-ImageHover");
    previous.setStyleName("okm-KeyMap-ImageHover");

    initWidget(controlPanel);
}

From source file:com.ikon.frontend.client.widget.dashboard.DashboardWidget.java

License:Open Source License

/**
 * DashboardWidget/*from   w  w w . ja  v  a 2  s .  c om*/
 */
public DashboardWidget(String source, String headerTextKey, String iconUrl, boolean zoom, String feedUrl) {
    status = new Status();
    status.setStyleName("okm-StatusPopup");

    spTop = new SimplePanel();
    spLeft = new SimplePanel();
    spRight = new SimplePanel();
    panelData = new SimplePanel();
    table = new FlexTable();
    vCenterPanel = new VerticalPanel();
    hPanel = new HorizontalPanel();
    header = new Header(iconUrl, zoom);
    vPanel = new VerticalPanel();
    this.source = source;
    this.headerTextKey = headerTextKey;
    this.feedUrl = feedUrl;

    // Sets or unsets visible table
    table.setVisible(zoom);

    header.setHeaderText(Main.i18n(headerTextKey));

    panelData.add(table);

    vCenterPanel.add(header);
    vCenterPanel.add(panelData);

    hPanel.add(spLeft);
    hPanel.add(vCenterPanel);
    hPanel.add(spRight);

    vPanel.add(spTop);
    vPanel.add(hPanel);

    spTop.setHeight("" + SEPARATOR_HEIGHT);
    spLeft.setWidth("" + SEPARATOR_WIDTH);
    spRight.setWidth("" + SEPARATOR_WIDTH);

    vPanel.setStyleName("okm-DashboardWidget ");
    panelData.setStyleName("data");
    table.setStyleName("okm-NoWrap");

    panelData.setWidth("99.6%");
    header.setWidth("100%");

    table.setCellPadding(0);
    table.setCellSpacing(0);

    vPanel.addStyleName("okm-DisableSelect");

    initWidget(vPanel);
}

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

License:Open Source License

/**
 * KeyMapTable/*from w  w w.j  a v a 2  s. c  o  m*/
 */
public KeyMapTable() {
    status = new Status();
    status.setStyleName("okm-StatusPopup");

    table = new FlexTable();
    tableDocumentList = new ArrayList<FlexTable>();
    tableFolderList = new ArrayList<FlexTable>();
    tableMailList = new ArrayList<FlexTable>();
    hKeyPanelList = new ArrayList<HorizontalPanel>();
    firtRowList = new ArrayList<String>();
    visibleStatus = VISIBLE_MEDIUM;

    table.setWidth("100%");

    table.setCellSpacing(0);
    table.setCellPadding(2);

    initWidget(table);
}

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

License:Open Source License

/**
 * Adding document row//w  w  w  . j a va  2s .  com
 * 
 * @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(docPath.substring(0, docPath.lastIndexOf("/")), 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.ikon.frontend.client.widget.dashboard.keymap.KeyMapTable.java

License:Open Source License

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

    firtRowList.add("" + firstRow);

    GWTFolder folder = new GWTFolder();
    if (gwtQueryResult.getFolder() != null) {
        folder = gwtQueryResult.getFolder();
    }
    final String fldPath = folder.getPath();

    Image gotoFolder = new Image("img/icon/actions/goto_folder.gif");
    gotoFolder.addClickHandler(new ClickHandler() {
        @Override
        public void onClick(ClickEvent event) {
            CommonUI.openPath(fldPath, null);
        }

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

    // Solves some middle alignament problem derived from mimeImageHTML method
    SimplePanel sp = new SimplePanel();

    if (folder.isHasChildren()) {
        sp.add(new HTML(Util.imageItemHTML("img/menuitem_childs.gif")));
    } else {
        sp.add(new HTML(Util.imageItemHTML("img/menuitem_empty.gif")));
    }

    table.setWidget(rows, 1, sp);
    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(folder.getName());
    hLink.setTitle(folder.getPath());
    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 tableFolder = new FlexTable();
    FlexTable tableProperties = new FlexTable();
    FlexTable tableSubscribedUsers = new FlexTable();
    tableFolder.setWidget(0, 0, tableProperties);
    tableFolder.setHTML(0, 1, "");
    tableFolder.setWidget(0, 2, tableSubscribedUsers);
    tableFolder.getFlexCellFormatter().setVerticalAlignment(0, 0, HasAlignment.ALIGN_TOP);
    tableFolder.getFlexCellFormatter().setVerticalAlignment(0, 2, HasAlignment.ALIGN_TOP);
    tableFolder.getCellFormatter().setWidth(0, 0, "75%");
    tableFolder.getCellFormatter().setWidth(0, 1, "25");
    tableFolder.getCellFormatter().setWidth(0, 2, "25%");

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

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

    tableProperties.setHTML(0, 0, "<b>" + Main.i18n("folder.name") + "</b>");
    tableProperties.setHTML(0, 1, folder.getName());
    tableProperties.setHTML(1, 0, "<b>" + Main.i18n("folder.parent") + "</b>");
    tableProperties.setHTML(1, 1, folder.getParentPath());
    tableProperties.setHTML(2, 0, "<b>" + Main.i18n("folder.created") + "</b>");
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    tableProperties.setHTML(2, 1,
            dtf.format(folder.getCreated()) + " " + Main.i18n("folder.by") + " " + folder.getAuthor());
    tableProperties.setHTML(3, 0, "<b>" + Main.i18n("document.subscribed") + "</b>");
    if (folder.isSubscribed()) {
        tableProperties.setHTML(3, 1, Main.i18n("document.subscribed.yes"));
    } else {
        tableProperties.setHTML(3, 1, Main.i18n("document.subscribed.no"));
    }

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

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

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

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

    // Setting visibility
    switch (visibleStatus) {
    case VISIBLE_SMALL:
        tableFolder.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:
        tableFolder.setVisible(false);
        hKeyPanel.setVisible(true);
        break;
    case VISIBLE_BIG:
        tableFolder.setVisible(true);
        hKeyPanel.setVisible(true);
        break;
    }

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

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

License:Open Source License

/**
 * Adding mail// w  w  w  . j av  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(mailPath.substring(0, mailPath.lastIndexOf("/")), 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);
}