Java Code Examples for com.smartgwt.client.widgets.grid.ListGrid#setFields()

The following examples show how to use com.smartgwt.client.widgets.grid.ListGrid#setFields() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UserHistoryPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void onDraw() {
	ListGridField event = new ListGridField("event", I18N.message("event"), 200);
	ListGridField date = new ListGridField("date", I18N.message("date"), 110);
	date.setAlign(Alignment.CENTER);
	date.setType(ListGridFieldType.DATE);
	date.setCellFormatter(new DateCellFormatter(false));
	date.setCanFilter(false);
	ListGridField comment = new ListGridField("comment", I18N.message("comment"));
	ListGridField sid = new ListGridField("sid", I18N.message("sid"), 200);
	ListGridField ip = new ListGridField("ip", I18N.message("ip"), 100);

	ListGrid listGrid = new ListGrid();
	listGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	listGrid.setCanFreezeFields(true);
	listGrid.setAutoFetchData(true);
	listGrid.setDataSource(new UserHistoryDS(userId));
	listGrid.setFields(event, date, ip, sid, comment);
	addMember(listGrid);
}
 
Example 2
Source File: DesaExportAction.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
public ExportResultWidget() {
    i18n = GWT.create(ClientMessages.class);
    VLayout vLayout = new VLayout();
    vLayout.setWidth100();
    vLayout.setHeight100();
    grid = new ListGrid();
    grid.setSelectionType(SelectionStyle.SINGLE);
    grid.setFixedRecordHeights(false);
    grid.setWrapCells(true);
    ListGridField pidField = new ListGridField(ExportResourceApi.RESULT_ERROR_PID,
            i18n.ExportResultWidget_PID_Title());

    ListGridField errorField = new ListGridField(ExportResourceApi.RESULT_ERROR_MESSAGE,
            i18n.ExportResultWidget_Message_Title());
    grid.setFields(pidField, errorField);
    grid.addSelectionUpdatedHandler(new SelectionUpdatedHandler() {

        @Override
        public void onSelectionUpdated(SelectionUpdatedEvent event) {
            logForm.editSelectedData(grid);
        }
    });
    logForm = createLogForm();
    vLayout.setMembers(grid, logForm);
    this.widget = vLayout;
}
 
Example 3
Source File: WorkflowTriggersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void refresh() {
	ListGridField workflow = new ListGridField("workflow", I18N.message("workflow"), 200);
	workflow.setCanFilter(true);

	ListGridField template = new ListGridField("template", I18N.message("template"), 200);
	template.setCanFilter(true);

	ListGridField checkin = new ListGridField("triggerAtCheckin", I18N.message("triggeratcheckin"));
	checkin.setCanFilter(false);
	checkin.setAlign(Alignment.LEFT);
	checkin.setWidth("*");

	list = new ListGrid() {
		@Override
		protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) {
			return super.getCellCSSText(record, rowNum, colNum);
		}
	};
	list.setEmptyMessage(I18N.message("notitemstoshow"));

	list.setShowRecordComponents(true);
	list.setShowRecordComponentsByCell(true);
	list.setCanFreezeFields(true);
	list.setAutoFetchData(true);
	list.setSelectionType(SelectionStyle.SINGLE);
	list.setFilterOnKeypress(true);
	list.setShowFilterEditor(false);
	list.setDataSource(new WorkflowTriggersDS("" + folder.getId()));
	list.setFields(workflow, template, checkin);

	list.addCellContextClickHandler(new CellContextClickHandler() {
		@Override
		public void onCellContextClick(CellContextClickEvent event) {
			showContextMenu();
			event.cancel();
		}
	});

	addMember(list, 0);
}
 
Example 4
Source File: AliasesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void onDraw() {
	ListGridField id = new ListGridField("id", I18N.message("id"), 50);
	id.setHidden(true);
	ListGridField name = new ListGridField("name", I18N.message("name"), 200);
	ListGridField path = new ListGridField("path", I18N.message("path"));

	ListGridField icon = new ListGridField("icon", " ", 20);
	icon.setType(ListGridFieldType.IMAGE);
	icon.setCanSort(false);
	icon.setAlign(Alignment.CENTER);
	icon.setShowDefaultContextMenu(false);
	icon.setImageURLPrefix(Util.imagePrefix());
	icon.setImageURLSuffix(".png");
	icon.setCanFilter(false);

	listGrid = new ListGrid();
	listGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	listGrid.setCanFreezeFields(true);
	listGrid.setAutoFetchData(true);
	dataSource = new FolderAliasesDS(folder.getId());
	listGrid.setDataSource(dataSource);
	listGrid.setFields(id, icon, name, path);
	addMember(listGrid);

	listGrid.addDoubleClickHandler(new DoubleClickHandler() {

		@Override
		public void onDoubleClick(DoubleClickEvent event) {
			FolderNavigator.get().openFolder(listGrid.getSelectedRecord().getAttributeAsLong("id"));
		}
	});
}
 
Example 5
Source File: GUILanguagesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onDraw() {
	ListGridField enabled = new ListGridField("eenabled", " ", 24);
	enabled.setType(ListGridFieldType.IMAGE);
	enabled.setCanSort(false);
	enabled.setAlign(Alignment.CENTER);
	enabled.setShowDefaultContextMenu(false);
	enabled.setImageURLPrefix(Util.imagePrefix());
	enabled.setImageURLSuffix(".gif");
	enabled.setCanFilter(false);

	ListGridField code = new ListGridField("code", I18N.message("code"), 80);
	code.setCanEdit(false);

	ListGridField name = new ListGridField("name", I18N.message("name"));
	name.setCanEdit(false);

	list = new ListGrid();
	list.setEmptyMessage(I18N.message("notitemstoshow"));
	list.setCanEdit(false);
	list.setWidth100();
	list.setHeight100();
	list.setAutoFetchData(true);
	list.setDataSource(new LanguagesDS(true));
	list.setSelectionType(SelectionStyle.SINGLE);
	list.setFields(enabled, code, name);

	addMember(list);

	if (Feature.enabled(Feature.GUI_LANGUAGES))
		list.addCellContextClickHandler(new CellContextClickHandler() {
			@Override
			public void onCellContextClick(CellContextClickEvent event) {
				showContextMenu();
				event.cancel();
			}
		});
}
 
Example 6
Source File: AliasesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void onDraw() {
	ListGridField id = new ListGridField("id", I18N.message("id"), 50);
	id.setHidden(true);

	ListGridField folderId = new ListGridField("folderId", I18N.message("id"), 50);
	folderId.setHidden(true);

	ListGridField filename = new ListGridField("filename", I18N.message("filename"), 200);
	filename.setHidden(true);
	ListGridField path = new ListGridField("path", I18N.message("path"));

	ListGridField icon = new ListGridField("icon", " ", 20);
	icon.setType(ListGridFieldType.IMAGE);
	icon.setCanSort(false);
	icon.setAlign(Alignment.CENTER);
	icon.setShowDefaultContextMenu(false);
	icon.setImageURLPrefix(Util.imagePrefix());
	icon.setImageURLSuffix(".png");
	icon.setCanFilter(false);

	listGrid = new ListGrid();
	listGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	listGrid.setCanFreezeFields(true);
	listGrid.setAutoFetchData(true);
	dataSource = new DocumentAliasesDS(document.getId());
	listGrid.setDataSource(dataSource);
	listGrid.setFields(id, icon, filename, path, folderId);
	addMember(listGrid);

	listGrid.addDoubleClickHandler(new DoubleClickHandler() {

		@Override
		public void onDoubleClick(DoubleClickEvent event) {
			DocumentsPanel.get().openInFolder(listGrid.getSelectedRecord().getAttributeAsLong("folderId"),
					listGrid.getSelectedRecord().getAttributeAsLong("id"));
		}
	});
}
 
Example 7
Source File: PluginsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onDraw() {
	ListGridField name = new ListGridField("name", I18N.message("name"), 250);
	name.setCanEdit(false);

	ListGridField version = new ListGridField("version", I18N.message("version"));
	version.setCanEdit(false);

	final ListGrid list = new ListGrid();
	list.setEmptyMessage(I18N.message("notitemstoshow"));
	list.setCanEdit(false);
	list.setWidth100();
	list.setHeight100();
	list.setAutoFetchData(true);
	list.setShowFilterEditor(false);
	list.setSelectionType(SelectionStyle.SINGLE);
	list.setFields(name, version);

	addMember(list);

	SystemService.Instance.get().getPlugins(new AsyncCallback<GUIValue[]>() {
		@Override
		public void onFailure(Throwable caught) {
			Log.serverError(caught);
		}

		@Override
		public void onSuccess(GUIValue[] plugins) {
			ListGridRecord[] records = new ListGridRecord[plugins.length];
			for (int i = 0; i < plugins.length; i++) {
				records[i] = new ListGridRecord();
				records[i].setAttribute("name", plugins[i].getCode());
				records[i].setAttribute("version", plugins[i].getValue());
			}
			list.setRecords(records);
		}
	});
}
 
Example 8
Source File: CatalogBrowser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private Canvas createAdvancedOptions() {
        formCatalog = createCatalogForm();

        lgResult = new ListGrid();
        lgResult.setDataSource(BibliographyQueryDataSource.getInstance());
//        lgResult.setUseAllDataSourceFields(true);
        ListGridField preview = new ListGridField(BibliographyQueryDataSource.FIELD_PREVIEW,
                i18n.CatalogBrowser_HeaderPreview_Title());
        ListGridField title = new ListGridField(BibliographyQueryDataSource.FIELD_TITLE,
                i18n.CatalogBrowser_HeaderTitle_Title());
        lgResult.setDetailField(BibliographyQueryDataSource.FIELD_PREVIEW);
        lgResult.setFields(title, preview);
//        lgResult.setAutoFetchData(true);
        lgResult.setHeight100();
        lgResult.setWidth100();
        lgResult.setCanExpandRecords(true);
        lgResult.setCanExpandMultipleRecords(false);
        lgResult.setExpansionMode(ExpansionMode.DETAIL_FIELD);
        lgResult.setSelectionType(SelectionStyle.SINGLE);
//        lgResult.setSelectionAppearance(SelectionAppearance.CHECKBOX);
        lgResult.setAlternateRecordStyles(true);
        lgResult.addDataArrivedHandler(new DataArrivedHandler() {

            @Override
            public void onDataArrived(DataArrivedEvent event) {
                if (event.getStartRow() == 0 && event.getEndRow() > 0) {
                    lgResult.focus();
                    lgResult.selectSingleRecord(0);
                }
            }
        });

        VLayout layout = new VLayout();
        layout.setMembers(formCatalog, lgResult);
        layout.setMargin(4);
        layout.setMembersMargin(4);
        layout.setOverflow(Overflow.AUTO);
        return layout;
    }
 
Example 9
Source File: SearchIndexingPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private Tab fillLanguagesTab() {
	Tab languagesTab = new Tab(I18N.message("languages"));
	Layout languagesTabPanel = new HLayout();
	languagesTabPanel.setWidth100();
	languagesTabPanel.setHeight100();

	ListGridField enabled = new ListGridField("eenabled", " ", 24);
	enabled.setType(ListGridFieldType.IMAGE);
	enabled.setCanSort(false);
	enabled.setAlign(Alignment.CENTER);
	enabled.setShowDefaultContextMenu(false);
	enabled.setImageURLPrefix(Util.imagePrefix());
	enabled.setImageURLSuffix(".gif");
	enabled.setCanFilter(false);

	ListGridField code = new ListGridField("code", I18N.message("code"), 80);
	code.setCanEdit(false);

	ListGridField name = new ListGridField("name", I18N.message("name"));
	name.setCanEdit(false);

	langsList = new ListGrid();
	langsList.setCanEdit(false);
	langsList.setWidth100();
	langsList.setHeight100();
	langsList.setAutoFetchData(true);
	langsList.setDataSource(new LanguagesDS(false));
	langsList.setShowFilterEditor(true);
	langsList.setFilterOnKeypress(true);
	langsList.setSelectionType(SelectionStyle.SINGLE);
	langsList.setFields(enabled, code, name);

	languagesTabPanel.addMember(langsList);
	languagesTab.setPane(languagesTabPanel);

	if (Feature.enabled(Feature.INDEX_LANGUAGES))
		langsList.addCellContextClickHandler(new CellContextClickHandler() {
			@Override
			public void onCellContextClick(CellContextClickEvent event) {
				showLanguagesMenu();
				event.cancel();
			}
		});

	return languagesTab;
}
 
Example 10
Source File: ComparatorsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void prepareAssociationsGrid() {
	associationsGrid = new ListGrid();
	associationsGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	associationsGrid.setShowFilterEditor(true);
	associationsGrid.setFilterOnKeypress(true);
	associationsGrid.setAutoFetchData(true);
	associationsGrid.setEditByCell(true);
	associationsGrid.setSelectionType(SelectionStyle.SINGLE);
	associationsGrid.setEditEvent(ListGridEditEvent.CLICK);
	associationsGrid.setDataSource(new ComparatorsDS(null));
	associationsGrid.setAllowFilterOperators(true);
	associationsGrid.setShowRecordComponents(true);
	associationsGrid.setShowRecordComponentsByCell(true);

	ListGridField in = new ListGridField("in", I18N.message("ext"), 40);
	ListGridField comparator = new ListGridField("comparator", I18N.message("comparator"));
	comparator.setWidth("*");
	comparator.setCanEdit(!Session.get().isDemo());
	comparator.setCellFormatter(new CellFormatter() {

		@Override
		public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
			String label = getComparatorShortName(value != null ? value.toString() : null);
			boolean enabled = record.getAttributeAsBoolean("eenabled");
			if (!enabled)
				label = "<span style='color:red;'>" + label + "</span>";

			return label;
		}
	});
	comparator.setFilterEditorProperties(ItemFactory.newFormatConverterSelector());

	associationsGrid.setFields(in, comparator);

	associationsGrid.setEditorCustomizer(new ListGridEditorCustomizer() {
		public FormItem getEditor(ListGridEditorContext context) {
			ListGridField field = context.getEditField();

			if (field.getName().equals("comparator")) {
				final ListGridRecord selectedRecord = associationsGrid.getSelectedRecord();
				final SelectItem editorItem = ItemFactory
						.newComparatorSelector(selectedRecord.getAttributeAsString("in"));
				editorItem.setWidth("*");
				return editorItem;
			} else
				return context.getDefaultProperties();
		}
	});

	associationsGrid.addEditCompleteHandler(new EditCompleteHandler() {

		@Override
		public void onEditComplete(EditCompleteEvent event) {
			Record converterRecord = settingsGrid.find(new AdvancedCriteria("id", OperatorId.EQUALS,
					associationsGrid.getSelectedRecord().getAttributeAsString("comparator")));
			if (converterRecord != null)
				associationsGrid.getSelectedRecord().setAttribute("eenabled",
						converterRecord.getAttributeAsBoolean("eenabled"));
		}
	});
}
 
Example 11
Source File: MetadataDiff.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public MetadataDiff(final GUIVersion version1, final GUIVersion version2) {
	super();

	setTitle(I18N.message("compare") + " " + version1.getVersion() + " > " + version2.getVersion());
	setWidth(450);
	setHeight(350);
	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.MAXIMIZE_BUTTON, HeaderControls.MINIMIZE_BUTTON,
			HeaderControls.CLOSE_BUTTON);
	setCanDragReposition(true);
	setCanDragResize(true);
	centerInPage();

	// Prepare the records, each one is related to a version's attribute
	ArrayList<DiffRecord> records = new ArrayList<DiffRecord>();
	records.add(new DiffRecord(I18N.message("versiondate"), I18N.message("versiondate"),
			I18N.formatDate(version1.getVersionDate()), I18N.formatDate(version2.getVersionDate()), 0));
	records.add(new DiffRecord(I18N.message("fileversion"), I18N.message("fileversion"), version1.getFileVersion(),
			version2.getFileVersion(), 0));
	records.add(new DiffRecord(I18N.message("filename"), I18N.message("filename"), version1.getFileName(),
			version2.getFileName(), 0));
	records.add(new DiffRecord(I18N.message("username"), I18N.message("username"), version1.getUsername(),
			version2.getUsername(), 0));
	records.add(new DiffRecord(I18N.message("comment"), I18N.message("comment"), version1.getComment(),
			version2.getComment(), 0));
	records.add(new DiffRecord(I18N.message("customid"), I18N.message("customid"), version1.getCustomId(),
			version2.getCustomId(), 0));
	records.add(new DiffRecord(I18N.message("language"), I18N.message("language"), version1.getLanguage(),
			version2.getLanguage(), 0));
	records.add(new DiffRecord(I18N.message("createdon"), I18N.message("createdon"),
			I18N.formatDate(version1.getCreation()), I18N.formatDate(version2.getCreation()), 0));
	records.add(new DiffRecord(I18N.message("creator"), I18N.message("creator"), version1.getCreator(),
			version2.getCreator(), 0));
	records.add(new DiffRecord(I18N.message("publishedon"), I18N.message("publishedon"),
			I18N.formatDate(version1.getDate()), I18N.formatDate(version2.getDate()), 0));
	records.add(new DiffRecord(I18N.message("publisher"), I18N.message("publisher"), version1.getPublisher(),
			version2.getPublisher(), 0));
	records.add(new DiffRecord(I18N.message("size"), I18N.message("size"),
			Util.formatSizeBytes((double) version1.getFileSize()),
			Util.formatSizeBytes((double) version2.getFileSize()), 0));
	records.add(new DiffRecord(I18N.message("folder"), I18N.message("folder"),
			version1.getFolder().getId() == Constants.DOCUMENTS_FOLDERID ? "/" : version1.getFolder().getName(),
			version2.getFolder().getId() == Constants.DOCUMENTS_FOLDERID ? "/" : version2.getFolder().getName(),
			0));

	records.add(new DiffRecord(I18N.message("tags"), I18N.message("tags"), version1.getTagsString(),
			version2.getTagsString(), 0));

	records.add(new DiffRecord(I18N.message("published"), I18N.message("published"),
			version1.getPublished() == 1 ? I18N.message("yes") : I18N.message("no"),
			version2.getPublished() == 1 ? I18N.message("yes") : I18N.message("no"), 0));

	records.add(new DiffRecord(I18N.message("startpublishing"), I18N.message("startpublishing"),
			version1.getStartPublishing() != null ? I18N.formatDate(version1.getStartPublishing()) : null,
			version2.getStartPublishing() != null ? I18N.formatDate(version2.getStartPublishing()) : null, 0));

	records.add(new DiffRecord(I18N.message("stoppublishing"), I18N.message("stoppublishing"),
			version1.getStopPublishing() != null ? I18N.formatDate(version1.getStopPublishing()) : null,
			version2.getStopPublishing() != null ? I18N.formatDate(version2.getStopPublishing()) : null, 0));

	records.add(new DiffRecord(I18N.message("template"), I18N.message("template"), version1.getTemplate(),
			version2.getTemplate(), 0));
	printExtendedAttributes(records, version1, version2);

	ListGridField label = new ListGridField("label", " ");
	ListGridField val1 = new ListGridField("val1", version1.getVersion());
	ListGridField val2 = new ListGridField("val2", version2.getVersion());

	ListGrid listGrid = new ListGrid();
	listGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	listGrid.setCanFreezeFields(false);
	listGrid.setCanGroupBy(false);
	listGrid.setAutoFetchData(true);
	listGrid.setCanReorderFields(false);
	listGrid.setCanSort(false);
	listGrid.setData(records.toArray(new ListGridRecord[0]));
	listGrid.setFields(label, val1, val2);
	addItem(listGrid);

	IButton compareContent = new IButton(I18N.message("comparecontent"));
	compareContent.setWidth100();
	compareContent.addClickHandler(new ClickHandler() {

		@Override
		public void onClick(ClickEvent event) {
			ComparisonWindow diff = new ComparisonWindow(version1, version2);
			diff.show();
		}
	});
	if (Feature.visible(Feature.COMPARISON)) {
		addItem(compareContent);
		compareContent.setDisabled(!Feature.enabled(Feature.COMPARISON));
	}
}
 
Example 12
Source File: FormatConvertersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private void prepareAssociationsGrid() {
	associationsGrid = new ListGrid();
	associationsGrid.setEmptyMessage(I18N.message("notitemstoshow"));
	associationsGrid.setShowFilterEditor(true);
	associationsGrid.setFilterOnKeypress(true);
	associationsGrid.setAutoFetchData(true);
	associationsGrid.setEditByCell(true);
	associationsGrid.setSelectionType(SelectionStyle.SINGLE);
	associationsGrid.setEditEvent(ListGridEditEvent.CLICK);
	associationsGrid.setDataSource(new FormatConvertersDS(null, null));
	associationsGrid.setAllowFilterOperators(true);
	associationsGrid.setShowRecordComponents(true);
	associationsGrid.setShowRecordComponentsByCell(true);

	ListGridField in = new ListGridField("in", I18N.message("in"), 40);
	ListGridField out = new ListGridField("out", I18N.message("out"), 40);
	ListGridField converter = new ListGridField("converter", I18N.message("converter"));
	converter.setWidth("*");
	converter.setCanEdit(!Session.get().isDemo());
	converter.setCellFormatter(new CellFormatter() {

		@Override
		public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
			String label = getConverterShortName(value != null ? value.toString() : null);
			boolean enabled = record.getAttributeAsBoolean("eenabled");
			if (!enabled)
				label = "<span style='color:red;'>" + label + "</span>";

			return label;
		}
	});
	converter.setFilterEditorProperties(ItemFactory.newFormatConverterSelector());

	associationsGrid.setFields(in, out, converter);

	associationsGrid.setEditorCustomizer(new ListGridEditorCustomizer() {
		public FormItem getEditor(ListGridEditorContext context) {
			ListGridField field = context.getEditField();

			if (field.getName().equals("converter")) {
				final ListGridRecord selectedRecord = associationsGrid.getSelectedRecord();
				final SelectItem editorItem = ItemFactory.newFormatConverterSelector(
						selectedRecord.getAttributeAsString("in"), selectedRecord.getAttributeAsString("out"));
				editorItem.setWidth("*");
				return editorItem;
			} else
				return context.getDefaultProperties();
		}
	});

	associationsGrid.addEditCompleteHandler(new EditCompleteHandler() {

		@Override
		public void onEditComplete(EditCompleteEvent event) {
			Record converterRecord = settingsGrid.find(new AdvancedCriteria("id", OperatorId.EQUALS,
					associationsGrid.getSelectedRecord().getAttributeAsString("converter")));
			if (converterRecord != null)
				associationsGrid.getSelectedRecord().setAttribute("eenabled",
						converterRecord.getAttributeAsBoolean("eenabled"));
		}
	});
}
 
Example 13
Source File: RunLevelPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
private SectionStack prepareAspectsTable() {
	ListGridField id = new ListGridField("id", I18N.message("aspect"), 300);
	id.setCanEdit(false);
	id.setCanSort(false);
	id.setAutoFitWidth(true);
	id.setCellFormatter(new CellFormatter() {

		@Override
		public String format(Object value, ListGridRecord record, int rowNum, int colNum) {
			return I18N.message("aspect." + record.getAttributeAsString("id"));
		}
	});

	ListGridField _default = new ListGridField("default", I18N.message("default"), 60);
	_default.setType(ListGridFieldType.BOOLEAN);
	_default.setCanEdit(true);
	_default.setAutoFitWidth(true);
	_default.setCanSort(false);
	
	ListGridField bulkload = new ListGridField("bulkload", I18N.message("bulkload"), 60);
	bulkload.setType(ListGridFieldType.BOOLEAN);
	bulkload.setCanEdit(true);
	bulkload.setAutoFitWidth(true);
	bulkload.setCanSort(false);

	ListGridField slave = new ListGridField("slave", I18N.message("slave"), 60);
	slave.setType(ListGridFieldType.BOOLEAN);
	slave.setCanEdit(true);
	slave.setAutoFitWidth(true);
	slave.setCanSort(false);
	
	ListGridField devel = new ListGridField("devel", I18N.message("devel"), 60);
	devel.setType(ListGridFieldType.BOOLEAN);
	devel.setCanEdit(true);
	devel.setAutoFitWidth(true);
	devel.setCanSort(false);

	ListGridField demo = new ListGridField("demo", I18N.message("demo"), 60);
	demo.setType(ListGridFieldType.BOOLEAN);
	demo.setCanEdit(true);
	demo.setAutoFitWidth(true);
	demo.setCanSort(false);

	aspects = new ListGrid();
	aspects.setEmptyMessage(I18N.message("notitemstoshow"));
	aspects.setCanFreezeFields(true);
	aspects.setAutoFetchData(true);
	aspects.setDataSource(new AspectsDS());
	aspects.setFields(id, _default, bulkload, slave, devel, demo);
	aspects.setHeaderHeight(44);
	aspects.setHeaderSpans(new HeaderSpan(I18N.message("runlevels"), new String[] { "default", "bulkload", "slave", "devel",
			"demo" }));

	SectionStack stack = new SectionStack();
	stack.setWidth100();
	stack.setHeight100();

	SectionStackSection section = new SectionStackSection(I18N.message("aspects"));
	section.setCanCollapse(false);
	section.setExpanded(true);

	section.setItems(aspects);
	stack.setSections(section);
	return stack;
}
 
Example 14
Source File: UrnNbnAction.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ExportResultWidget() {
            i18n = GWT.create(ClientMessages.class);
            VLayout vLayout = new VLayout();
            vLayout.setWidth100();
            vLayout.setHeight100();
            grid = new ListGrid();
            grid.setSelectionType(SelectionStyle.SINGLE);
            grid.setFixedRecordHeights(false);
            grid.setWrapCells(true);
            grid.setShowClippedValuesOnHover(true);
            ListGridField pidField = new ListGridField(DigitalObjectResourceApi.DIGITALOBJECT_PID,
                    i18n.ExportResultWidget_PID_Title());

//            ListGridField errorField = new ListGridField(DigitalObjectResourceApi.URNNBN_ITEM_MESSAGE,
//                    i18n.ExportResultWidget_Message_Title());
            ListGridField urnNbnField = new ListGridField(DigitalObjectResourceApi.URNNBN_ITEM_URNNBN,
                    i18n.UrnNbnAction_Result_UrnNbn_Title());
            ListGridField labelField = new ListGridField(DigitalObjectResourceApi.MEMBERS_ITEM_LABEL,
                    i18n.UrnNbnAction_Result_Label_Title());
            ListGridField modelField = new ListGridField(DigitalObjectResourceApi.DIGITALOBJECT_MODEL,
                    i18n.UrnNbnAction_Result_Model_Title());
            ListGridField statusField = new ListGridField(DigitalObjectResourceApi.URNNBN_ITEM_STATUSTYPE,
                    i18n.UrnNbnAction_Result_Error_Title());
            ListGridField warningField = new ListGridField(DigitalObjectResourceApi.URNNBN_ITEM_WARNING,
                    i18n.UrnNbnAction_Result_Status_Title(), 50);
            warningField.setCellAlign(Alignment.CENTER);
            warningField.setEmptyCellValue(":-)");
            HashMap<String, String> statusValues = new HashMap<String, String>();
            statusValues.put("true", ":-|");
            statusValues.put("false", ":-(");
            warningField.setValueMap(statusValues);

            grid.setFields(labelField, modelField, statusField, urnNbnField, warningField, pidField);

            grid.addSelectionUpdatedHandler(new SelectionUpdatedHandler() {

                @Override
                public void onSelectionUpdated(SelectionUpdatedEvent event) {
                    logForm.editSelectedData(grid);
                }
            });
            logForm = createLogForm();
            vLayout.setMembers(grid, logForm);
            this.widget = vLayout;
        }