Java Code Examples for org.eclipse.swt.widgets.Table.removeAll()

The following are Jave code examples for showing how to use removeAll() of the org.eclipse.swt.widgets.Table class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: eZooKeeper   File: JmxConnectionModelMainFormPage.java   View Source Code Vote up 6 votes
/**
 * TODO: Comment.
 * 
 */
protected void initPropertiesSectionFromModel() {

    Table table = getPropertiesSectionTable();
    table.removeAll();

    Map<String, String> properties = getZooKeeperConnectionProperties();

    for (String key : properties.keySet()) {
        TableItem item = new TableItem(table, SWT.NONE);
        String value = properties.get(key);
        item.setText(0, key);
        item.setText(1, value);
    }

    packTable(table, PROPERTIES_COLUMN_WIDTHS);

}
 
Example 2
Project: eZooKeeper   File: BaseJmxModelMainFormPage.java   View Source Code Vote up 6 votes
protected void initDescriptorSectionFromModel() {

        Descriptor descriptor = getJmxDescriptor();
        if (descriptor == null) {
            return;
        }

        Table table = getDescriptorTable();
        if (table == null) {
            return;
        }

        table.removeAll();

        for (String fieldName : descriptor.getFieldNames()) {
            TableItem item = new TableItem(table, SWT.NONE);
            Object value = descriptor.getFieldValue(fieldName);
            item.setText(0, fieldName);
            item.setText(1, String.valueOf(value));
        }

        packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS);
    }
 
Example 3
Project: eZooKeeper   File: MBeanAttributeModelMainFormPage.java   View Source Code Vote up 6 votes
@Override
protected void initPrimarySectionFromModel() {

    Table table = getPrimaryTable();

    table.removeAll();

    MBeanAttributeModel model = getModel();
    MBeanAttribute attribute = model.getData();

    String valueString = attribute.getValueAsString();
    String valueError = attribute.getValueRetrievalErrorMessage();

    TableItem item = new TableItem(table, SWT.NONE);
    item.setText(0, attribute.getName());

    if (valueError != null) {
        item.setText(1, valueError);
        item.setForeground(1, table.getDisplay().getSystemColor(SWT.COLOR_RED));
    }
    else {
        item.setText(1, valueString);
    }

    packTable(table, DEFAULT_NAME_VALUE_COLUMN_WIDTHS);
}
 
Example 4
Project: eZooKeeper   File: MBeanFeatureModeMainFormPage.java   View Source Code Vote up 6 votes
@Override
protected void initInfoSectionFromModel() {

    Table table = getInfoTable();
    table.removeAll();

    MBeanFeatureInfo featureInfo = getFeatureInfo();

    TableItem nameItem = new TableItem(table, SWT.NONE);
    nameItem.setText(0, FEATURE_INFO_PROPERTY_NAME_NAME);
    nameItem.setText(1, featureInfo.getName());

    TableItem descriptionItem = new TableItem(table, SWT.NONE);
    descriptionItem.setText(0, FEATURE_INFO_PROPERTY_NAME_DESCRIPTION);
    descriptionItem.setText(1, featureInfo.getDescription());
}
 
Example 5
Project: eZooKeeper   File: ZooKeeperConnectionModelMainFormPage.java   View Source Code Vote up 5 votes
/**
 * TODO: Comment.
 * 
 */
protected void initPropertiesSectionFromModel() {

    Table table = getPropertiesSectionTable();
    table.removeAll();

    Map<String, String> properties = getZooKeeperConnectionProperties();

    for (String key : properties.keySet()) {
        TableItem item = new TableItem(table, SWT.NONE);
        String value = properties.get(key);
        item.setText(0, key);
        item.setText(1, value);

        Color valueTextColor = table.getForeground();
        if (key.equals(ZooKeeperConnectionModelElementType.PROPERTY_NAME_STATE)) {
            if (!States.CONNECTED.name().equals(value)) {
                valueTextColor = table.getDisplay().getSystemColor(SWT.COLOR_RED);
            }
            // else {
            // valueTextColor = table.getDisplay().getSystemColor(SWT.COLOR_GREEN);
            // }
        }
        
        item.setForeground(1, valueTextColor);
    }

    packTable(table, PROPERTIES_COLUMN_WIDTHS);

}
 
Example 6
Project: eZooKeeper   File: ZnodeModelStatFormPage.java   View Source Code Vote up 5 votes
@Override
protected void initTableItemsFromZnode() {

    Table table = getTable();
    table.removeAll();

    ZnodeModel znodeModel = getModel();
    Znode znode = znodeModel.getData();
    Stat stat = znode.getStat();

    DateFormat format = DateFormat.getDateTimeInstance();
    String ctime = format.format(new Date(stat.getCtime()));
    String mtime = format.format(new Date(stat.getMtime()));

    addStatValueTableItem(table, Znode.STAT_NAME_CZXID, String.valueOf(stat.getCzxid()),
            Znode.STAT_DESCRIPTION_CZXID);
    addStatValueTableItem(table, Znode.STAT_NAME_MZXID, String.valueOf(stat.getMzxid()),
            Znode.STAT_DESCRIPTION_MZXID);
    addStatValueTableItem(table, Znode.STAT_NAME_CTIME, ctime, Znode.STAT_DESCRIPTION_CTIME);
    addStatValueTableItem(table, Znode.STAT_NAME_MTIME, mtime, Znode.STAT_DESCRIPTION_MTIME);
    addStatValueTableItem(table, Znode.STAT_NAME_VERSION, String.valueOf(stat.getVersion()),
            Znode.STAT_DESCRIPTION_VERSION);
    addStatValueTableItem(table, Znode.STAT_NAME_CVERSION, String.valueOf(stat.getCversion()),
            Znode.STAT_DESCRIPTION_CVERSION);
    addStatValueTableItem(table, Znode.STAT_NAME_AVERSION, String.valueOf(stat.getAversion()),
            Znode.STAT_DESCRIPTION_AVERSION);
    addStatValueTableItem(table, Znode.STAT_NAME_EPHEMERAL_OWNER, String.valueOf(stat.getEphemeralOwner()),
            Znode.STAT_DESCRIPTION_EPHEMERAL_OWNER);
    addStatValueTableItem(table, Znode.STAT_NAME_DATA_LENGTH, String.valueOf(stat.getDataLength()),
            Znode.STAT_DESCRIPTION_DATA_LENGTH);
    addStatValueTableItem(table, Znode.STAT_NAME_NUM_CHILDREN, String.valueOf(stat.getNumChildren()),
            Znode.STAT_DESCRIPTION_NUM_CHILDREN);

}