Example usage for com.google.gwt.user.client.ui CheckBox getValue

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

Introduction

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

Prototype

@Override
public Boolean getValue() 

Source Link

Document

Determines whether this check box is currently checked.

Usage

From source file:com.mynotes.client.view.NotesViewImpl.java

License:Open Source License

@Override
public List<Integer> getSelectedRows() {
    List<Integer> selectedRows = new ArrayList<Integer>();

    for (int i = 0; i < notesTable.getRowCount(); ++i) {
        CheckBox checkBox = (CheckBox) notesTable.getWidget(i, 0);

        if (checkBox.getValue()) {
            selectedRows.add(i);// w w  w  .  ja v a 2 s. c  om
        }
    }

    return selectedRows;
}

From source file:com.nitrous.gwt.earth.client.demo.FetchKmlInteractiveCheckboxes.java

License:Apache License

private void toggleKml(String file) {
    GEPlugin ge = earth.getGEPlugin();// www  . j ava  2s  .c  om

    // remove the old KML object if it exists
    KmlObject old = currentKmlObjects.get(file);
    if (old != null) {
        ge.getFeatures().removeChild(old);
        currentKmlObjects.remove(file);
    }

    // if the checkbox is checked, fetch the KML and show it on Earth
    CheckBox checkBox = checkBoxes.get(file);
    if (checkBox != null && Boolean.TRUE.equals(checkBox.getValue())) {
        loadKml(file);
    }
}

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

License:Open Source License

/**
 * Sets the values in specifed row/column
 * Expects a Comparable Object for sorting
 * /*  www.j a v a  2  s  .  co m*/
 * Update indicates should be updated selected row otherside inserts new
 * 
 * @param rows The actual table row
 * @param GWTFolder The folder
 */
public void addRow(GWTFolder folder, boolean update) {
    int col = 0;
    final int row = (update) ? getSelectedRow() : dataTable.getRowCount();
    if (update) {
        data.put(new Integer(dataTable.getText(row, colDataIndex)), folder);
    } else {
        dataTable.insertRow(row);
    }

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

    // Subscribed is a special case, must add icon with others
    if (profileFileBrowser.isStatusVisible()) {
        if (folder.isSubscribed()) {
            dataTable.setHTML(row, col, Util.imageItemHTML("img/icon/subscribed.gif"));
        } else {
            dataTable.setHTML(row, col, "&nbsp;");
        }

        if (folder.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()) {
        // 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(row, col, Util.imageItemHTML("img/menuitem_childs.gif"));
            } else {
                dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_empty.gif"));
            }
        } else {
            if (folder.isHasChildren()) {
                dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_childs_ro.gif"));
            } else {
                dataTable.setHTML(row, col, Util.imageItemHTML("img/menuitem_empty_ro.gif"));
            }
        }

        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (profileFileBrowser.isNameVisible()) {
        dataTable.setHTML(row, col, folder.getName());
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_LEFT);
    }

    if (profileFileBrowser.isSizeVisible()) {
        dataTable.setHTML(row, col, "&nbsp;");
        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(folder.getCreated()));
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (profileFileBrowser.isAuthorVisible()) {
        dataTable.setHTML(row, col, folder.getUser().getUsername());
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (profileFileBrowser.isVersionVisible()) {
        dataTable.setHTML(row, col, "&nbsp;");
        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.openkm.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  .co  m
 * 
 * Update indicates should be updated selected row otherside inserts new
 */
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"));
        }

        // Document encrypted
        if (doc.getCipherName() != null && !doc.getCipherName().equals("")) {
            dataTable.setHTML(row, col,
                    dataTable.getHTML(row, col) + Util.imageItemHTML("img/icon/actions/crypt.png"));
        }

        // Document signed
        if (doc.isSigned()) {
            dataTable.setHTML(row, col,
                    dataTable.getHTML(row, col) + Util.imageItemHTML("img/icon/actions/digital_signature.png"));
        }

        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)));
                }
                evaluateMergePdf(); // Only when document checkbox is changed ( only document can be merged )
            }
        });

        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.openkm.frontend.client.widget.filebrowser.ExtendedScrollTable.java

License:Open Source License

/**
 * Sets the mail to the row/*ww  w  .j  ava 2s . co  m*/
 * 
 * Update indicates should be updated selected row otherside inserts new
 */
public void addRow(GWTMail mail, boolean update) {
    int col = 0;
    final int row = (update) ? getSelectedRow() : dataTable.getRowCount();

    if (update) {
        data.put(new Integer(dataTable.getText(row, colDataIndex)), mail);
    } else {
        dataTable.insertRow(row);
    }

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

    if (profileFileBrowser.isStatusVisible()) {
        // Mail is never checkout or subscribed ( because can not be changed )
        if (mail.isHasNotes()) {
            dataTable.setHTML(row, col, dataTable.getHTML(row, col) + Util.imageItemHTML("img/icon/note.gif"));
        } else {
            dataTable.setHTML(row, col, "&nbsp;");
        }
        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()) {
        if (mail.getAttachments().size() > 0) {
            dataTable.setHTML(row, col, Util.imageItemHTML("img/email_attach.gif"));
        } else {
            dataTable.setHTML(row, col, Util.imageItemHTML("img/email.gif"));
        }
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (profileFileBrowser.isNameVisible()) {
        dataTable.setHTML(row, col, mail.getSubject());
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_LEFT);
    }

    if (profileFileBrowser.isSizeVisible()) {
        dataTable.setHTML(row, col, Util.formatSize(mail.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(mail.getReceivedDate()));
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (profileFileBrowser.isAuthorVisible()) {
        dataTable.setHTML(row, col, mail.getFrom());
        dataTable.getCellFormatter().setHorizontalAlignment(row, col++, HasHorizontalAlignment.ALIGN_CENTER);
    }

    if (profileFileBrowser.isVersionVisible()) {
        dataTable.setHTML(row, col, "&nbsp;");
        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.openkm.frontend.client.widget.filebrowser.ExtendedScrollTable.java

License:Open Source License

/**
 * getAllSelectedUUIDs/*from   w  ww.  jav a 2 s .  c  om*/
 */
public List<String> getAllSelectedUUIDs() {
    List<String> uuidList = new ArrayList<String>();

    for (int i = 0; dataTable.getRowCount() > i; i++) {
        CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

        if (checkBox.getValue()) {
            Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
            if (obj instanceof GWTDocument) {
                uuidList.add(((GWTDocument) obj).getUuid());
            } else if (obj instanceof GWTFolder) {
                uuidList.add(((GWTFolder) obj).getUuid());
            } else if (obj instanceof GWTMail) {
                uuidList.add(((GWTMail) obj).getUuid());
            }
        }
    }

    return uuidList;
}

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

License:Open Source License

/**
 * getAllSelectedDocumentsUUIDs/* ww w. ja v  a2s .co m*/
 */
public List<String> getAllSelectedDocumentsUUIDs() {
    List<String> uuidList = new ArrayList<String>();

    for (int i = 0; dataTable.getRowCount() > i; i++) {
        CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

        if (checkBox.getValue()) {
            Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
            if (obj instanceof GWTDocument) {
                uuidList.add(((GWTDocument) obj).getUuid());
            }
        }
    }

    return uuidList;
}

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

License:Open Source License

/**
 * getAllSelectedDocumentsPaths//from w w  w  . ja v a 2s.  c o  m
 */
public List<String> getAllSelectedDocumentsPaths() {
    List<String> pathList = new ArrayList<String>();

    for (int i = 0; dataTable.getRowCount() > i; i++) {
        CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

        if (checkBox.getValue()) {
            Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
            if (obj instanceof GWTDocument) {
                pathList.add(((GWTDocument) obj).getPath());
            }
        }
    }

    return pathList;
}

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

License:Open Source License

/**
 * getAllSelectedMailUUIDs//from  w w  w  .  ja  v a  2s  .c o  m
 */
public List<String> getAllSelectedMailUUIDs() {
    List<String> uuidList = new ArrayList<String>();

    for (int i = 0; dataTable.getRowCount() > i; i++) {
        CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);

        if (checkBox.getValue()) {
            Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
            if (obj instanceof GWTMail) {
                uuidList.add(((GWTMail) obj).getUuid());
            }
        }
    }

    return uuidList;
}

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

License:Open Source License

/**
 * getAllSelectedPdfDocuments/*from   ww  w  . ja  v  a  2  s.co  m*/
 * 
 * @return
 */
public List<GWTDocument> getAllSelectedPdfDocuments() {
    List<GWTDocument> docs = new ArrayList<GWTDocument>();
    for (int i = 0; dataTable.getRowCount() > i; i++) {
        CheckBox checkBox = (CheckBox) dataTable.getWidget(i, colMassiveIndex);
        if (checkBox.getValue()) {
            Object obj = data.get(Integer.parseInt(dataTable.getText(i, colDataIndex)));
            if (obj instanceof GWTDocument) {
                GWTDocument doc = (GWTDocument) obj;
                if (doc.getMimeType().equals("application/pdf")) {
                    docs.add(doc);
                }
            }
        }
    }
    return docs;
}