Search in sources :

Example 1 with AbstractBooleanColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractBooleanColumn in project ovirt-engine by oVirt.

the class MainDataCenterView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    DcStatusColumn statusIconColumn = new DcStatusColumn();
    statusIconColumn.setContextMenuTitle(constants.statusIconDc());
    // $NON-NLS-1$
    getTable().addColumn(statusIconColumn, constants.empty(), "30px");
    DcAdditionalStatusColumn additionalStatusColumn = new DcAdditionalStatusColumn();
    additionalStatusColumn.setContextMenuTitle(constants.additionalStatusDataCenter());
    // $NON-NLS-1$
    getTable().addColumn(additionalStatusColumn, constants.empty(), "30px");
    AbstractTextColumn<StoragePool> nameColumn = new AbstractLinkColumn<StoragePool>(new FieldUpdater<StoragePool, String>() {

        @Override
        public void update(int index, StoragePool storagePool, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), storagePool.getName());
            // The link was clicked, now fire an event to switch to details.
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.dataCenterStorageSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(StoragePool object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable(StoragePoolFieldAutoCompleter.NAME);
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameDc(), "150px");
    CommentColumn<StoragePool> commentColumn = new CommentColumn<>();
    getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
    "75px");
    AbstractTextColumn<StoragePool> storageTypeColumn = new AbstractBooleanColumn<StoragePool>(constants.storageTypeLocal(), constants.storageTypeShared()) {

        @Override
        protected Boolean getRawValue(StoragePool object) {
            return object.isLocal();
        }
    };
    storageTypeColumn.makeSortable(StoragePoolFieldAutoCompleter.LOCAL);
    // $NON-NLS-1$
    getTable().addColumn(storageTypeColumn, constants.storgeTypeDc(), "150px");
    AbstractTextColumn<StoragePool> statusColumn = new AbstractEnumColumn<StoragePool, StoragePoolStatus>() {

        @Override
        public StoragePoolStatus getRawValue(StoragePool object) {
            return object.getStatus();
        }
    };
    statusColumn.makeSortable(StoragePoolFieldAutoCompleter.STATUS);
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusDc(), "150px");
    AbstractTextColumn<StoragePool> versionColumn = new AbstractTextColumn<StoragePool>() {

        @Override
        public String getValue(StoragePool object) {
            return object.getCompatibilityVersion().getValue();
        }
    };
    versionColumn.makeSortable(StoragePoolFieldAutoCompleter.COMPATIBILITY_VERSION);
    // $NON-NLS-1$
    getTable().addColumn(versionColumn, constants.comptVersDc(), "150px");
    AbstractTextColumn<StoragePool> descColumn = new AbstractTextColumn<StoragePool>() {

        @Override
        public String getValue(StoragePool object) {
            return object.getdescription();
        }
    };
    descColumn.makeSortable(StoragePoolFieldAutoCompleter.DESCRIPTION);
    // $NON-NLS-1$
    getTable().addColumn(descColumn, constants.descriptionDc(), "300px");
}
Also used : DcAdditionalStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.DcAdditionalStatusColumn) StoragePool(org.ovirt.engine.core.common.businessentities.StoragePool) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) AbstractBooleanColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractBooleanColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) DcStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.DcStatusColumn) CommentColumn(org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 Map (java.util.Map)1 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)1 AbstractBooleanColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractBooleanColumn)1 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)1 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 CommentColumn (org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn)1 DcAdditionalStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.DcAdditionalStatusColumn)1 DcStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.DcStatusColumn)1