use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable in project ovirt-engine by oVirt.
the class SanStorageLunToTargetList method createLeafNode.
@SuppressWarnings("unchecked")
@Override
protected TreeItem createLeafNode(ListModel leafModel) {
if (hideLeaf) {
return null;
}
EntityModelCellTable<ListModel<LunModel>> table = new EntityModelCellTable<>(false, (Resources) GWT.create(SanStorageListTargetTableResources.class), true);
table.enableColumnResizing();
table.addColumn(new TextColumn<SanTargetModel>() {
@Override
public String getValue(SanTargetModel model) {
return model.getName();
}
}, constants.targetNameSanStorage(), // $NON-NLS-1$
"500px");
table.addColumn(new TextColumn<SanTargetModel>() {
@Override
public String getValue(SanTargetModel model) {
return model.getAddress();
}
}, constants.addressSanStorage(), // $NON-NLS-1$
"100px");
table.addColumn(new TextColumn<SanTargetModel>() {
@Override
public String getValue(SanTargetModel model) {
return model.getPort();
}
}, constants.portSanStorage(), // $NON-NLS-1$
"80px");
List<SanTargetModel> items = (List<SanTargetModel>) leafModel.getItems();
if (items.isEmpty()) {
return null;
}
table.setRowData(items);
Object selectedItem = leafModel.getSelectedItem();
leafModel.setSelectedItem(null);
table.asEditor().edit(leafModel);
leafModel.setSelectedItem(selectedItem);
// $NON-NLS-1$
table.setWidth("100%");
TreeItem item = new TreeItem(table);
addOpenHandlerToTree(tree, item, table);
return item;
}
use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable in project ovirt-engine by oVirt.
the class SanStorageLunToTargetList method createRootNode.
@Override
protected TreeItem createRootNode(LunModel rootModel) {
final EntityModelCellTable<ListModel<LunModel>> table = new EntityModelCellTable<>(multiSelection, (Resources) GWT.create(SanStorageListLunRootResources.class));
// Create table
initRootNodeTable(table);
// Set custom selection column
AbstractLunSelectionColumn lunSelectionColumn = new AbstractLunSelectionColumn(multiSelection) {
@Override
public LunModel getValue(LunModel object) {
return object;
}
};
// $NON-NLS-1$
table.setCustomSelectionColumn(lunSelectionColumn, "20px");
// Add items
List<LunModel> items = new ArrayList<>();
items.add(rootModel);
ListModel<LunModel> listModel = new ListModel<>();
listModel.setItems(items);
// Update table
table.setRowData(items);
table.asEditor().edit(listModel);
// $NON-NLS-1$
table.setWidth("100%");
// This was the height of the header
// $NON-NLS-1$
table.setHeight("26px");
rootModel.getPropertyChangedEvent().removeListener(lunModelSelectedItemListener);
rootModel.getPropertyChangedEvent().addListener(lunModelSelectedItemListener, table);
if (!multiSelection) {
table.getSelectionModel().addSelectionChangeHandler(event -> {
SingleSelectionModel SingleSelectionModel = (SingleSelectionModel) event.getSource();
LunModel selectedLunModel = (LunModel) SingleSelectionModel.getSelectedObject();
if (selectedLunModel != null) {
updateSelectedLunWarning(selectedLunModel);
}
});
} else {
table.getSelectionModel().setSelected(rootModel, rootModel.getIsSelected());
table.getSelectionModel().addSelectionChangeHandler(event -> model.updateLunWarningForDiscardAfterDelete());
}
// Create tree item
HorizontalPanel panel = new HorizontalPanel();
panel.add(table);
// $NON-NLS-1$
panel.setWidth("100%");
panel.getElement().getStyle().setTableLayout(TableLayout.FIXED);
TreeItem item = new TreeItem(table);
// Display LUNs as grayed-out if needed
if (rootModel.getIsGrayedOut()) {
grayOutItem(rootModel.getGrayedOutReasons(), rootModel, table);
}
return item;
}
use of org.ovirt.engine.ui.common.widget.editor.EntityModelCellTable in project ovirt-engine by oVirt.
the class ChangeQuotaView method updateListHeader.
void updateListHeader(ChangeQuotaModel model) {
// $NON-NLS-1$
String width = "100px";
listHeader = new EntityModelCellTable(false, (Resources) GWT.create(PopupSimpleTableResources.class), true);
listHeader.addColumn(new EmptyColumn(), constants.elementName(), width);
listHeader.addColumn(new EmptyColumn(), constants.storageDomainDisk(), width);
listHeader.addColumn(new EmptyColumn(), constants.currentQuota(), width);
listHeader.addColumn(new EmptyColumn(), constants.quotaDisk(), width);
listHeader.setRowData(new ArrayList());
// $NON-NLS-1$
listHeader.setWidth("100%");
listHeaderPanel.setWidget(listHeader);
}
Aggregations