Search in sources :

Example 26 with AbstractEnumColumn

use of org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn 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

AbstractEnumColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractEnumColumn)26 AbstractTextColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractTextColumn)23 HashMap (java.util.HashMap)13 Map (java.util.Map)13 AbstractLinkColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractLinkColumn)13 VM (org.ovirt.engine.core.common.businessentities.VM)6 AbstractUptimeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.AbstractUptimeColumn)6 VmTypeColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmTypeColumn)6 EntityModel (org.ovirt.engine.ui.uicommonweb.models.EntityModel)5 NoSelectionModel (com.google.gwt.view.client.NoSelectionModel)4 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)4 AbstractDiskSizeColumn (org.ovirt.engine.ui.common.widget.table.column.AbstractDiskSizeColumn)4 VmStatusColumn (org.ovirt.engine.ui.webadmin.widget.table.column.VmStatusColumn)4 HasCell (com.google.gwt.cell.client.HasCell)3 ImageResource (com.google.gwt.resources.client.ImageResource)3 SafeHtml (com.google.gwt.safehtml.shared.SafeHtml)3 ScrollPanel (com.google.gwt.user.client.ui.ScrollPanel)3 ArrayList (java.util.ArrayList)3 List (java.util.List)3 VDS (org.ovirt.engine.core.common.businessentities.VDS)3