Search in sources :

Example 1 with ClusterAdditionalStatusColumn

use of org.ovirt.engine.ui.webadmin.widget.table.column.ClusterAdditionalStatusColumn in project ovirt-engine by oVirt.

the class MainClusterView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    AbstractTextColumn<Cluster> nameColumn = new AbstractLinkColumn<Cluster>(new FieldUpdater<Cluster, String>() {

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

        @Override
        public String getValue(Cluster object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable(ClusterConditionFieldAutoCompleter.NAME);
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameCluster(), "150px");
    ClusterAdditionalStatusColumn additionalStatusColumn = new ClusterAdditionalStatusColumn();
    additionalStatusColumn.setContextMenuTitle(constants.additionalStatusCluster());
    // $NON-NLS-1$
    getTable().addColumn(additionalStatusColumn, constants.empty(), "30px");
    CommentColumn<Cluster> commentColumn = new CommentColumn<>();
    getTable().addColumnWithHtmlHeader(commentColumn, SafeHtmlUtils.fromSafeConstant(constants.commentLabel()), // $NON-NLS-1$
    "75px");
    if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
        AbstractTextColumn<Cluster> dataCenterColumn = new AbstractTextColumn<Cluster>() {

            @Override
            public String getValue(Cluster object) {
                return object.getStoragePoolName();
            }
        };
        // $NON-NLS-1$
        getTable().addColumn(dataCenterColumn, constants.dcCluster(), "150px");
    }
    AbstractTextColumn<Cluster> versionColumn = new AbstractTextColumn<Cluster>() {

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

        @Override
        public String getValue(Cluster object) {
            return object.getDescription();
        }
    };
    descColumn.makeSortable(ClusterConditionFieldAutoCompleter.DESCRIPTION);
    // $NON-NLS-1$
    getTable().addColumn(descColumn, constants.descriptionCluster(), "300px");
    if (ApplicationModeHelper.getUiMode() != ApplicationMode.GlusterOnly) {
        AbstractTextColumn<Cluster> cpuTypeColumn = new AbstractTextColumn<Cluster>() {

            @Override
            public String getValue(Cluster object) {
                return object.getCpuName();
            }
        };
        // $NON-NLS-1$
        getTable().addColumn(cpuTypeColumn, constants.cpuTypeCluster(), "150px");
    }
    AbstractTextColumn<Cluster> hostCountColumn = new AbstractTextColumn<Cluster>() {

        @Override
        public String getValue(Cluster object) {
            if (object.getClusterHostsAndVms() == null) {
                // $NON-NLS-1$
                return "";
            }
            // $NON-NLS-1$
            return object.getClusterHostsAndVms().getHosts() + "";
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(hostCountColumn, constants.hostCount(), "150px");
    AbstractTextColumn<Cluster> vmCountColumn = new AbstractTextColumn<Cluster>() {

        @Override
        public String getValue(Cluster object) {
            if (object.getClusterHostsAndVms() == null) {
                // $NON-NLS-1$
                return "";
            }
            // $NON-NLS-1$
            return object.getClusterHostsAndVms().getVms() + "";
        }
    };
    // $NON-NLS-1$
    getTable().addColumn(vmCountColumn, constants.vmCount(), "150px");
}
Also used : Cluster(org.ovirt.engine.core.common.businessentities.Cluster) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) ClusterAdditionalStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.ClusterAdditionalStatusColumn) 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 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 ClusterAdditionalStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.ClusterAdditionalStatusColumn)1 CommentColumn (org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn)1