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

The following examples show how to use com.smartgwt.client.widgets.grid.ListGrid#setCanFreezeFields() . 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: 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 3
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 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 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 5
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 6
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;
}