Search in sources :

Example 16 with AbstractLinkColumn

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

the class SubTabClusterVmView method initTable.

void initTable() {
    getTable().enableColumnResizing();
    VmStatusColumn<VM> statusIconColumn = new VmStatusColumn<>();
    statusIconColumn.setContextMenuTitle(constants.statusIconVm());
    statusIconColumn.makeSortable(VmConditionFieldAutoCompleter.STATUS);
    // $NON-NLS-1$
    getTable().addColumn(statusIconColumn, constants.empty(), "30px");
    AbstractTextColumn<VM> nameColumn = new AbstractLinkColumn<VM>(new FieldUpdater<VM, String>() {

        @Override
        public void update(int index, VM vm, String value) {
            Map<String, String> parameters = new HashMap<>();
            parameters.put(FragmentParams.NAME.getName(), vm.getName());
            getPlaceTransitionHandler().handlePlaceTransition(WebAdminApplicationPlaces.virtualMachineGeneralSubTabPlace, parameters);
        }
    }) {

        @Override
        public String getValue(VM object) {
            return object.getName();
        }
    };
    nameColumn.makeSortable(VmConditionFieldAutoCompleter.NAME);
    // $NON-NLS-1$
    getTable().addColumn(nameColumn, constants.nameVm(), "220px");
    VmTypeColumn typeColumn = new VmTypeColumn();
    typeColumn.setContextMenuTitle(constants.typeVm());
    typeColumn.makeSortable(VmConditionFieldAutoCompleter.TYPE);
    // $NON-NLS-1$
    getTable().addColumn(typeColumn, constants.empty(), "60px");
    AbstractTextColumn<VM> statusColumn = new AbstractEnumColumn<VM, VMStatus>() {

        @Override
        protected VMStatus getRawValue(VM object) {
            return object.getStatus();
        }
    };
    statusColumn.makeSortable(VmConditionFieldAutoCompleter.STATUS);
    // $NON-NLS-1$
    getTable().addColumn(statusColumn, constants.statusVm(), "220px");
    AbstractTextColumn<VM> uptimeColumn = new AbstractUptimeColumn<VM>() {

        @Override
        protected Double getRawValue(VM object) {
            return object.getElapsedTime();
        }
    };
    uptimeColumn.makeSortable(VmConditionFieldAutoCompleter.UPTIME);
    // $NON-NLS-1$
    getTable().addColumn(uptimeColumn, constants.uptimeVm(), "220px");
}
Also used : VmStatusColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn) AbstractUptimeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn) AbstractEnumColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn) AbstractLinkColumn(org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn) VM(org.ovirt.engine.core.common.businessentities.VM) VmTypeColumn(org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

HashMap (java.util.HashMap)16 Map (java.util.Map)16 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)16 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)14 AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)13 VM (org.ovirt.engine.core.common.businessentities.VM)5 AbstractUptimeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn)5 VmStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn)5 VmTypeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn)5 CommentColumn (org.ovirt.engine.ui.webadmin.widget.table.column.CommentColumn)4 HasCell (com.google.gwt.cell.client.HasCell)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3 LinkedHashMap (java.util.LinkedHashMap)2 Cluster (org.ovirt.engine.core.common.businessentities.Cluster)2 StatusCompositeCell (org.ovirt.engine.ui.common.widget.table.cell.StatusCompositeCell)2 AbstractColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractColumn)2 HostStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.HostStatusColumn)2