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

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

Introduction

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

Prototype

public void setHTML(String html) 

Source Link

Usage

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

License:Open Source License

/**
 * Adding document row/*from   ww  w. j  av a  2 s  .  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(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/*ww w  . j a va 2  s.com*/
 * 
 * @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// www. 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);
}

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

License:Open Source License

/**
 * Adding document row/* www .j a v  a 2  s  .c o  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// w  w w  .  j ava2s.c  o m
 * 
 * @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/*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) {
    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");
    }
}

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

License:Open Source License

/**
 * Adding document row/* ww w .j  a va 2 s . c om*/
 * 
 * @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//ww  w  .  jav 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);
}

From source file:org.curriki.gwt.client.widgets.metadata.MetadataEdit.java

License:Open Source License

private void addCRS(Document doc, Panel panel, boolean isPrivate) {
    String role = Main.getProperty("role");
    XObject crsObj = doc.getObject(Constants.CURRIKI_REVIEW_STATUS_CLASS);
    Integer reviewpending = (crsObj == null) ? null
            : (Integer) crsObj.get(Constants.CURRIKI_REVIEW_STATUS_REVIEWPENDING);
    String status = (crsObj == null) ? null : (String) crsObj.get(Constants.CURRIKI_REVIEW_STATUS_STATUS);
    currentCRSStatus = status;/*from  w  w  w  . ja v a 2  s .  com*/
    String lastReviewDate = (crsObj == null) ? ""
            : crsObj.getViewProperty(Constants.CURRIKI_REVIEW_STATUS_LASTTREVIEWDATE);
    FlowPanel crsPanel = new FlowPanel();
    crsPanel.setStyleName("crs_review");
    HTMLPanel crsPanelTitle = new HTMLPanel(Main.getTranslation("curriki.crs.currikireview"));
    crsPanelTitle.setStyleName("crs_reviewtitle");
    crsPanel.add(crsPanelTitle);
    String txt = Main.getTranslation("curriki.crs.review.tooltip");
    Image image = new Image(Constants.ICON_PATH + "exclamation.png");
    PopupPanel popup = new PopupPanel(true);
    popup.setStyleName("metadata-tooltip-popup");
    // popup.setWidth("300px");
    popup.add(new HTML(txt));
    image.addMouseListener(new TooltipMouseListener(popup));
    crsPanel.add(image);
    FlowPanel crsRatingPanel = new FlowPanel();
    crsRatingPanel.setStyleName("crs_reviewrating");
    if ((status == null) || (status.equals("100")) || (status.equals(""))) {
        crsRatingPanel.setStyleName("crs_reviewnorating");
        HTMLPanel crsRatingTextPanel = new HTMLPanel(Main.getTranslation("curriki.crs.unrated"));
        crsRatingTextPanel.setStyleName("crs_reviewratingtext");
        crsRatingPanel.add(crsRatingTextPanel);
    } else {
        HTMLPanel crsRatingTextPanel = new HTMLPanel(Main.getTranslation("curriki.crs.rating" + status));
        crsRatingTextPanel.setStyleName("crs_reviewratingtext");
        crsRatingPanel.add(crsRatingTextPanel);
        if ((lastReviewDate != null) && (!lastReviewDate.equals(""))) {
            String sreviewDate = (lastReviewDate.length() >= 8) ? lastReviewDate.substring(0, 8)
                    : lastReviewDate;
            HTMLPanel crsRatingDatePanel = new HTMLPanel(
                    Main.getTranslation("curriki.crs.asof") + " " + sreviewDate);
            crsRatingDatePanel.setStyleName("crs_reviewratingdate");
            crsRatingPanel.add(crsRatingDatePanel);
        }
        Image crsRatingImage = new Image(Constants.SKIN_PATH + "crs" + status + ".gif");
        crsRatingImage.addClickListener(new ClickListener() {
            public void onClick(Widget widget) {
                ComponentsPage.getSingleton().switchPage("comment");
            }
        });
        crsRatingImage.setStyleName("crs_reviewratingtext");
        crsRatingPanel.add(crsRatingImage);
    }
    crsPanel.add(crsRatingPanel);
    if (!"200".equals(status) && !isPrivate) {
        if ((reviewpending != null) && reviewpending.intValue() == 1) {
            HTMLPanel crsReviewPendingPanel = new HTMLPanel(Main.getTranslation("curriki.crs.reviewpending"));
            crsReviewPendingPanel.setStyleName("crs_reviewpending");
            crsPanel.add(crsReviewPendingPanel);
        } else {
            Hyperlink crsReviewNominateLink = new Hyperlink();
            crsReviewNominateLink.setHTML(Main.getTranslation("curriki.crs.reviewnominate"));
            crsReviewNominateLink.setStyleName("crs_reviewnominate");
            crsReviewNominateLink.addClickListener(new ClickListener() {
                public void onClick(Widget widget) {
                    Document currentAsset = Main.getSingleton().getEditor().getCurrentAsset();
                    new NominateDialog(currentAsset, new AsyncCallback() {
                        public void onFailure(Throwable throwable) {
                            // nothing to do this was a cancel
                        }

                        public void onSuccess(Object object) {
                            // Refresh the page
                            Editor editor = Main.getSingleton().getEditor();
                            editor.setCurrentAssetInvalid(true);
                            editor.refreshState();
                        }
                    });

                    // String url = Main.getTranslation("params.crs.nominateurl") + "?fromgwt=1&page=" + currentAsset.getFullName();
                    // Window.open(url, "_blank", "");
                }
            });
            crsPanel.add(crsReviewNominateLink);
        }

        // if the reviewer mode is set to one then we show the review link
        if (("reviewer".equals(role)) || ("admin".equals(role))) {
            Hyperlink crsReviewReviewLink = new Hyperlink();
            crsReviewReviewLink.setHTML(Main.getTranslation("curriki.crs.review"));
            crsReviewReviewLink.setStyleName("crs_reviewreview");
            crsReviewReviewLink.addClickListener(new ClickListener() {
                public void onClick(Widget widget) {
                    Document currentAsset = Main.getSingleton().getEditor().getCurrentAsset();
                    String url = Main.getTranslation("params.crs.reviewurl") + "?page="
                            + currentAsset.getFullName();
                    Window.open(url, "_blank", "");
                }
            });
            crsPanel.add(crsReviewReviewLink);
        }
    }

    /*
    // We are not putting the set to partner button anymore in the CB
    // see CURRIKI-2781
    if ("admin".equals(role)) {
    final CheckBox setToPCheckBox = new CheckBox(Main.getTranslation("curriki.crs.settopartner"));
    setToPCheckBox.setChecked("200".equals(currentCRSStatus));
    setToPCheckBox.addClickListener(new ClickListener() {
        public void onClick(Widget widget) {
            String questionText;
            String titleText;
            if ("200".equals(currentCRSStatus)) {
                questionText = Main.getTranslation("curriki.crs.confirmunsettopartner");
                titleText = "curriki.crs.unsettopartner";
            } else {
                questionText = Main.getTranslation("curriki.crs.confirmsettopartner");
                titleText = "curriki.crs.settopartner";
            }
            ncDialog = new NextCancelDialog(titleText, questionText, "crsconfirmsettopartner", new AsyncCallback() {
                public void onFailure(Throwable throwable) {
                    setToPCheckBox.setChecked("200".equals(currentCRSStatus));
                    ncDialog.hide();
                }
                public void onSuccess(Object object) {
                    Document currentAsset = Main.getSingleton().getEditor().getCurrentAsset();
                    final String newCRSStatus =  "200".equals(currentCRSStatus) ? "100" : "200";
                    ncDialog.hide();
                    CurrikiService.App.getInstance().updateProperty(currentAsset.getFullName(), Constants.CURRIKI_REVIEW_STATUS_CLASS, "status", newCRSStatus, new CurrikiAsyncCallback() {
                        public void onFailure(Throwable caught) {
                            super.onFailure(caught);
                            setToPCheckBox.setChecked("200".equals(currentCRSStatus));
                        }
            
                        public void onSuccess(Object result) {
                            super.onSuccess(result);
                            setToPCheckBox.setChecked("200".equals(newCRSStatus));
                            currentCRSStatus = newCRSStatus;
                        }
                    });
                }
            });
            
        }
    });
    crsPanel.add(setToPCheckBox);
    }
    */
    panel.add(crsPanel);

}

From source file:org.sonar.plugins.core.clouds.client.widget.ClassCloudsWidget.java

License:Open Source License

private void createClouds(List<CloudElement> cloudElements, Metric colorMetric) {
    for (CloudElement tag : cloudElements) {
        HTML className = new HTML("<span style=\"font-size:"
                + Integer.toString(sizeCalculator.getFontSizePercent(tag.getFontSize())) + "%; color:"
                + colorCalculator.getFontColor(tag.getFontColor()) + "\" >" + tag.getResource().getName()
                + "</span>\n");
        className.setStyleName("inline");

        Hyperlink link = createLink(tag, colorMetric);
        link.setHTML(className.getHTML());
        main.add(link);// w ww .ja va  2  s . c  o  m
    }
}