Search in sources :

Example 1 with NetworkClusterStatusColumn

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

the class SubTabNetworkClusterView method initTable.

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

        @Override
        public void update(int index, PairQueryable<Cluster, NetworkCluster> cluster, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), cluster.getFirst().getName());
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.clusterGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getName();
        }
    };
    nameColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameCluster(), "400px");
    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> versionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {

        @Override
        public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getCompatibilityVersion().getValue();
        }
    };
    versionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(versionColumn, constants.comptVersCluster(), "130px");
    AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> attachedColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {

        @Override
        public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getSecond() != null;
        }

        @Override
        protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
            return false;
        }
    };
    attachedColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(attachedColumn, constants.attachedNetworkCluster(), "120px");
    NetworkClusterStatusColumn statusColumn = new NetworkClusterStatusColumn();
    statusColumn.makeSortable(new SimpleStatusColumnComparator<>(statusColumn));
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.networkStatus(), "120px");
    AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>> netRequiredColumn = new AbstractCheckboxColumn<PairQueryable<Cluster, NetworkCluster>>(true) {

        @Override
        public Boolean getValue(PairQueryable<Cluster, NetworkCluster> object) {
            if (object.getSecond() != null) {
                return object.getSecond().isRequired();
            }
            return false;
        }

        @Override
        protected boolean canEdit(PairQueryable<Cluster, NetworkCluster> object) {
            return false;
        }
    };
    netRequiredColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(netRequiredColumn, constants.requiredNetCluster(), "120px");
    AbstractSafeHtmlColumn<PairQueryable<Cluster, NetworkCluster>> netRoleColumn = createNetRoleColumn();
    netRoleColumn.makeSortable(new NetRoleColumnComparator());
    // $NON-NLS-1$
    getTable().addColumn(netRoleColumn, constants.roleNetCluster(), "120px");
    AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>> descriptionColumn = new AbstractTextColumn<PairQueryable<Cluster, NetworkCluster>>() {

        @Override
        public String getValue(PairQueryable<Cluster, NetworkCluster> object) {
            return object.getFirst().getDescription();
        }
    };
    descriptionColumn.makeSortable();
    // $NON-NLS-1$
    getTable().addColumn(descriptionColumn, constants.descriptionCluster(), "400px");
}
Also used : PairQueryable(org.ovirt.engine.core.common.utils.PairQueryable) Cluster(org.ovirt.engine.core.common.businessentities.Cluster) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) AbstractCheckboxColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) NetworkClusterStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.NetworkClusterStatusColumn) AbstractTextColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn) NetworkCluster(org.ovirt.engine.core.common.businessentities.network.NetworkCluster) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)1 NetworkCluster (org.ovirt.engine.core.common.businessentities.network.NetworkCluster)1 PairQueryable (org.ovirt.engine.core.common.utils.PairQueryable)1 AbstractCheckboxColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractCheckboxColumn)1 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)1 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)1 NetworkClusterStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.NetworkClusterStatusColumn)1