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

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

Introduction

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

Prototype

public Hyperlink() 

Source Link

Document

Creates an empty hyperlink.

Usage

From source file:au.com.gworks.gwt.petstore.client.ProductCardView.java

License:Apache License

private void prepareCardBody(ItemRefInfo shelfRefInfo, String lp) {
    if (shelfRefInfo instanceof ItemInfo) {
        ItemInfo si = (ItemInfo) shelfRefInfo;
        descLbl.setText(productInfo.name + " - " + si.description);
        buildBodyFrameIfRequired();/*from w  w  w  .  ja  va  2  s  .c  o  m*/
        productDetails.setText(0, 1, productInfo.description);
        Hyperlink link = (Hyperlink) productDetails.getWidget(1, 1);
        if (link == null) {
            link = new Hyperlink();
            productDetails.setWidget(1, 1, link);
            link.setTitle("click here to link to this product item");
        }
        link.setText(si.id);
        link.setTargetHistoryToken(HistoryUtils.toHistoryToken("shopping", "item-id", si.id));
        //         productDetails.setText(1, 1, si.id);
        productDetails.setText(2, 1, si.stockLevel + "");
        productDetails.setText(3, 1, lp);
    }
}

From source file:cc.alcina.framework.gwt.client.gwittir.widget.BoundHyperlink.java

License:Apache License

/** Creates a new instance of Label */
public BoundHyperlink() {
    base = new Hyperlink() {
        @Override/*from   w w w .  j  av  a2s  .co m*/
        public void onBrowserEvent(Event event) {
            // DON'T use hyperlink history (so events can be cancelled by
            // containers eg)
            superOnBrowserEvent(event);
        }
    };
    super.initWidget(base);
    anchorElem = (Element) getElement().getFirstChild();
}

From source file:com.calclab.emite.hablar.client.pages.roster.RosterItemView.java

License:Open Source License

public RosterItemView(final RosterItem item, final RosterItemViewListener listener) {
    setStyleName("hablar-RosterItemView");
    this.show = new HTML();
    this.jid = new Hyperlink();
    this.menu = new Hyperlink();
    menu.setText("menu");
    add(show);//from  ww w.  jav a2 s.com
    add(jid);
    add(menu);

    jid.addClickHandler(new ClickHandler() {
        public void onClick(final ClickEvent event) {
            listener.onAction(RosterItemView.this);
        }
    });

    setItem(item);
}

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

License:Open Source License

/**
 * Adding document row/*from w ww.  j  a  v  a  2 s. co  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(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  . j  ava2 s.c o m
 * 
 * @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/*from www . ja va2  s. co 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);
}

From source file:com.ikon.frontend.client.widget.filebrowser.ExtendedScrollTable.java

License:Open Source License

/**
 * Sets the document to the row/*from   w  w  w. j a v  a2  s  . c om*/
 * 
 * Update indicates should be updated selected row otherside inserts new
 * 
 * @param doc
 * @param update
 */
public void addRow(GWTDocument doc, boolean update) {
    int col = 0;
    final int row = (update) ? getSelectedRow() : dataTable.getRowCount();
    if (update) {
        data.put(new Integer(dataTable.getText(row, colDataIndex)), doc);
    } else {
        dataTable.insertRow(row);
    }

    // Sets document object
    data.put(new Integer(dataIndexValue), doc);

    if (profileFileBrowser.isStatusVisible()) {
        if (doc.isCheckedOut()) {
            dataTable.setHTML(row, col, Util.imageItemHTML("img/icon/edit.gif"));
        } else if (doc.isLocked()) {
            dataTable.setHTML(row, col, Util.imageItemHTML("img/icon/lock.gif"));
        } else {
            dataTable.setHTML(row, col, "&nbsp;");
        }

        // Subscribed is a special case, must add icon with others
        if (doc.isSubscribed()) {
            dataTable.setHTML(row, col,
                    dataTable.getHTML(row, col) + Util.imageItemHTML("img/icon/subscribed.gif"));
        }
        // Document has notes
        if (doc.isHasNotes()) {
            dataTable.setHTML(row, col, dataTable.getHTML(row, col) + Util.imageItemHTML("img/icon/note.gif"));
        }
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_RIGHT);

    }

    if (profileFileBrowser.isMassiveVisible()) {
        // Checkbox
        final CheckBox checkBox = new CheckBox();
        checkBox.setStyleName("okm-CheckBox");
        checkBox.addClickHandler(new ClickHandler() {
            @Override
            public void onClick(ClickEvent event) {
                oldMassiveSelected = massiveSelected.size();

                if (checkBox.getValue()) {
                    massiveSelected.add(new Integer(dataTable.getText(row, colDataIndex)));
                } else {
                    massiveSelected.remove(new Integer(dataTable.getText(row, colDataIndex)));
                }
            }
        });

        dataTable.setWidget(row, col, checkBox);
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (profileFileBrowser.isIconVisible()) {
        dataTable.setHTML(row, col, Util.mimeImageHTML(doc.getMimeType()));
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (profileFileBrowser.isNameVisible()) {
        dataTable.setHTML(row, col, doc.getName());
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_LEFT);
    }
    if (profileFileBrowser.isSizeVisible()) {
        dataTable.setHTML(row, col, Util.formatSize(doc.getActualVersion().getSize()));
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (profileFileBrowser.isLastModifiedVisible()) {
        DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
        dataTable.setHTML(row, col, dtf.format(doc.getLastModified()));
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (profileFileBrowser.isAuthorVisible()) {
        dataTable.setHTML(row, col, doc.getActualVersion().getUser().getUsername());
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (profileFileBrowser.isVersionVisible()) {
        Hyperlink hLink = new Hyperlink();
        hLink.setText(doc.getActualVersion().getName());
        hLink.setTitle(doc.getActualVersion().getComment());
        dataTable.setWidget(row, col, hLink);
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }
    if (!update) {
        dataTable.setHTML(row, colDataIndex, "" + (dataIndexValue++));
        dataTable.getCellFormatter().setVisible(row, colDataIndex, false);
    }

    for (int i = 0; i < colDataIndex; i++) {
        dataTable.getCellFormatter().addStyleName(row, i, "okm-DisableSelect");
    }
}

From source file:com.ikon.frontend.client.widget.searchresult.ExtendedScrollTable.java

License:Open Source License

/**
 * Adding document row// w  ww  . j  a v a2 s . co  m
 * 
 * @param gwtQueryResult Query result
 * @param score Document score
 */
private void addDocumentRow(GWTQueryResult gwtQueryResult, Score score) {
    int rows = dataTable.getRowCount();
    dataTable.insertRow(rows);

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

    // Sets folder object
    data.put(new Integer(dataIndexValue), gwtQueryResult);

    dataTable.setHTML(rows, 0, score.getHTML());

    if (doc.isAttachment()) {
        dataTable.setHTML(rows, 1, Util.imageItemHTML("img/email_attach.gif"));
    } else {
        dataTable.setHTML(rows, 1, "&nbsp;");
    }

    dataTable.setHTML(rows, 1, dataTable.getHTML(rows, 1) + Util.mimeImageHTML(doc.getMimeType()));
    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(doc.getName());
    hLink.setStyleName("okm-Hyperlink");

    // On attachemt 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());
    }

    dataTable.setWidget(rows, 2, hLink);
    dataTable.setHTML(rows, 3, Util.formatSize(doc.getActualVersion().getSize()));
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    dataTable.setHTML(rows, 4, dtf.format(doc.getLastModified()));
    dataTable.setHTML(rows, 5, doc.getActualVersion().getUser().getUsername());
    dataTable.setHTML(rows, 6, doc.getActualVersion().getName());
    dataTable.setHTML(rows, 7, "" + (dataIndexValue++));

    // Format
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 5, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 6, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setVisible(rows, 7, false);

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

From source file:com.ikon.frontend.client.widget.searchresult.ExtendedScrollTable.java

License:Open Source License

/**
 * Adding folder/*from  w  w  w.j  a  va2s.  c  om*/
 * 
 * @param gwtQueryResult Query result
 * @param score The folder score
 */
private void addFolderRow(GWTQueryResult gwtQueryResult, Score score) {
    int rows = dataTable.getRowCount();
    dataTable.insertRow(rows);

    GWTFolder folder = gwtQueryResult.getFolder();

    // Sets folder object
    data.put(new Integer(dataIndexValue), gwtQueryResult);

    dataTable.setHTML(rows, 0, score.getHTML());

    // Looks if must change icon on parent if now has no childs and properties with user security atention
    if ((folder.getPermissions() & GWTPermission.WRITE) == GWTPermission.WRITE) {
        if (folder.isHasChildren()) {
            dataTable.setHTML(rows, 1, Util.imageItemHTML("img/menuitem_childs.gif"));
        } else {
            dataTable.setHTML(rows, 1, Util.imageItemHTML("img/menuitem_empty.gif"));
        }
    } else {
        if (folder.isHasChildren()) {
            dataTable.setHTML(rows, 1, Util.imageItemHTML("img/menuitem_childs_ro.gif"));
        } else {
            dataTable.setHTML(rows, 1, Util.imageItemHTML("img/menuitem_empty_ro.gif"));
        }
    }

    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(folder.getName());
    hLink.setTitle(folder.getParentPath());
    hLink.setStyleName("okm-Hyperlink");
    dataTable.setWidget(rows, 2, hLink);
    dataTable.setHTML(rows, 3, "&nbsp;");
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    dataTable.setHTML(rows, 4, dtf.format(folder.getCreated()));
    dataTable.setHTML(rows, 5, folder.getUser().getUsername());
    dataTable.setHTML(rows, 6, "&nbsp;");
    dataTable.setHTML(rows, 7, "" + (dataIndexValue++));

    // Format
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 5, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 6, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setVisible(rows, 7, false);

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

From source file:com.ikon.frontend.client.widget.searchresult.ExtendedScrollTable.java

License:Open Source License

/**
 * Adding mail//from  w w w.  j ava2  s . c o m
 * 
 * @param gwtQueryResult Query result
 * @param score The mail score
 */
private void addMailRow(GWTQueryResult gwtQueryResult, Score score) {
    int rows = dataTable.getRowCount();
    dataTable.insertRow(rows);

    GWTMail mail = gwtQueryResult.getMail();

    // Sets folder object
    data.put(new Integer(dataIndexValue), gwtQueryResult);

    dataTable.setHTML(rows, 0, score.getHTML());

    if (mail.getAttachments().size() > 0) {
        dataTable.setHTML(rows, 1, Util.imageItemHTML("img/email_attach.gif"));
    } else {
        dataTable.setHTML(rows, 1, Util.imageItemHTML("img/email.gif"));
    }

    Hyperlink hLink = new Hyperlink();
    hLink.setHTML(mail.getSubject());
    hLink.setTitle(mail.getParentPath());
    hLink.setStyleName("okm-Hyperlink");
    dataTable.setWidget(rows, 2, hLink);
    dataTable.setHTML(rows, 3, Util.formatSize(mail.getSize()));
    DateTimeFormat dtf = DateTimeFormat.getFormat(Main.i18n("general.date.pattern"));
    dataTable.setHTML(rows, 4, dtf.format(mail.getReceivedDate()));
    dataTable.setHTML(rows, 5, mail.getFrom());
    dataTable.setHTML(rows, 6, "&nbsp;");
    dataTable.setHTML(rows, 7, "" + (dataIndexValue++));

    // Format
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 0, HasHorizontalAlignment.ALIGN_LEFT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 1, HasHorizontalAlignment.ALIGN_RIGHT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 2, HasHorizontalAlignment.ALIGN_LEFT);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 3, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 4, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 5, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setHorizontalAlignment(rows, 6, HasHorizontalAlignment.ALIGN_CENTER);
    dataTable.getCellFormatter().setVisible(rows, 7, false);

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