void initTable() { getTable().enableColumnResizing(); QuotaDcStatusColumn dcStatusColumn = new QuotaDcStatusColumn(); dcStatusColumn.setContextMenuTitle(constants.dcStatusQuota()); getTable().addColumn(dcStatusColumn, constants.empty(), "30px"); // $NON-NLS-1$ AbstractTextColumn<Quota> nameColumn = new AbstractTextColumn<Quota>() { @Override public String getValue(Quota object) { return object.getQuotaName() == null ? "" : object.getQuotaName(); // $NON-NLS-1$ } }; nameColumn.makeSortable(); getTable().addColumn(nameColumn, constants.nameQuota(), "400px"); // $NON-NLS-1$ AbstractTextColumn<Quota> descriptionColumn = new AbstractTextColumn<Quota>() { @Override public String getValue(Quota object) { return object.getDescription() == null ? "" : object.getDescription(); // $NON-NLS-1$ } }; descriptionColumn.makeSortable(); getTable().addColumn(descriptionColumn, constants.descriptionQuota(), "400px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.addQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getCreateCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.editQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getEditCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.copyQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getCloneCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<Quota>(constants.removeQuota()) { @Override protected UICommand resolveCommand() { return getDetailModel().getRemoveCommand(); } }); }
void initTable() { getTable().enableColumnResizing(); AbstractTextColumn<RepoImage> fileNameColumn = new AbstractTextColumn<RepoImage>() { @Override public String getValue(RepoImage object) { return object.getRepoImageTitle(); } }; fileNameColumn.makeSortable(); getTable().addColumn(fileNameColumn, constants.fileNameIso(), "500px"); // $NON-NLS-1$ AbstractTextColumn<RepoImage> typeColumn = new AbstractTextColumn<RepoImage>() { @Override public String getValue(RepoImage object) { return object.getFileType().toString(); } }; typeColumn.makeSortable(); getTable().addColumn(typeColumn, constants.typeIso(), "200px"); // $NON-NLS-1$ AbstractTextColumn<RepoImage> sizeColumn = new AbstractDiskSizeColumn<RepoImage>( SizeConverter.SizeUnit.BYTES, DiskSizeRenderer.Format.HUMAN_READABLE) { @Override protected Long getRawValue(RepoImage object) { return object.getSize(); } }; sizeColumn.makeSortable(); getTable().addColumn(sizeColumn, constants.actualSizeTemplate(), "100px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<RepoImage>(constants.importImage()) { @Override protected UICommand resolveCommand() { return getDetailModel().getImportImagesCommand(); } }); getTable().showRefreshButton(); }
void initVmTable() { getTable().enableColumnResizing(); AbstractTextColumn<VM> nameColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return object.getName(); } }; nameColumn.makeSortable(); getTable().addColumn(nameColumn, constants.nameVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> templateColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return vmTemplateNameRenderer.render(object); } }; templateColumn.makeSortable(); getTable().addColumn(templateColumn, constants.templateVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> originColumn = new AbstractEnumColumn<VM, OriginType>() { @Override protected OriginType getRawValue(VM object) { return object.getOrigin(); } }; originColumn.makeSortable(); getTable().addColumn(originColumn, constants.originVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> memoryColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getVmMemSizeMb()) + " MB"; // $NON-NLS-1$ } }; memoryColumn.makeSortable(); getTable().addColumn(memoryColumn, constants.memoryVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> cpuColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getNumOfCpus()); } }; cpuColumn.makeSortable(); getTable().addColumn(cpuColumn, constants.cpusVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> archColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getClusterArch()); } }; archColumn.makeSortable(); getTable().addColumn(archColumn, constants.architectureVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> diskColumn = new AbstractTextColumn<VM>() { @Override public String getValue(VM object) { return String.valueOf(object.getDiskMap().size()); } }; diskColumn.makeSortable(); getTable().addColumn(diskColumn, constants.disksVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> creationDateColumn = new AbstractFullDateTimeColumn<VM>() { @Override protected Date getRawValue(VM object) { return object.getVmCreationDate(); } }; creationDateColumn.makeSortable( new Comparator<VM>() { @Override public int compare(VM vm1, VM vm2) { return vm1.getVmCreationDate().compareTo(vm2.getVmCreationDate()); } }); getTable().addColumn(creationDateColumn, constants.creationDateVm(), "95px"); // $NON-NLS-1$ AbstractTextColumn<VM> exportDateColumn = new AbstractFullDateTimeColumn<VM>() { @Override protected Date getRawValue(VM object) { return object.getExportDate(); } }; exportDateColumn.makeSortable( new Comparator<VM>() { @Override public int compare(VM vm1, VM vm2) { return vm1.getExportDate().compareTo(vm2.getExportDate()); } }); getTable().addColumn(exportDateColumn, constants.exportDateVm(), "95px"); // $NON-NLS-1$ getTable() .addActionButton( new WebAdminButtonDefinition<VM>(constants.restoreVm()) { @Override protected UICommand resolveCommand() { return getDetailModel().getRestoreCommand(); } }); getTable() .addActionButton( new WebAdminButtonDefinition<VM>(constants.removeVm()) { @Override protected UICommand resolveCommand() { return getDetailModel().getRemoveCommand(); } }); getTable().showRefreshButton(); }