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

The following examples show how to use com.smartgwt.client.widgets.grid.ListGrid#setCanGroupBy() . 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: 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 2
Source File: WorkflowJobView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private ListGrid createSubjobList() {
    ListGrid g = new ListGrid();
    subjobGrid = g;
    subjobsPersistance = new ListGridPersistance("WorkflowJobView.subjobList", g);

    CanvasSizePersistence sizePersistence = new CanvasSizePersistence("WorkflowJobView.subjobList", g);
    g.setHeight(sizePersistence.getHeight());

    g.setSelectionType(SelectionStyle.SINGLE);
    g.setCanGroupBy(false);
    g.setDataFetchMode(FetchMode.BASIC);
    g.setDataSource(WorkflowJobDataSource.getInstance(),
            new ListGridField(WorkflowJobDataSource.FIELD_LABEL),
            new ListGridField(WorkflowJobDataSource.FIELD_ID, 30),
            new ListGridField(WorkflowJobDataSource.FIELD_STATE, 50),
            new ListGridField(WorkflowJobDataSource.FIELD_PROFILE_ID, 80),
            new ListGridField(WorkflowJobDataSource.FIELD_OWNER, 50),
            new ListGridField(WorkflowJobDataSource.FIELD_PRIORITY, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_CREATED, 100),
            new ListGridField(WorkflowJobDataSource.FIELD_MODIFIED, 100),
            new ListGridField(WorkflowJobDataSource.FIELD_FINANCED, 100),
            new ListGridField(WorkflowJobDataSource.FIELD_MBARCODE, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_MDETAIL, 100),
            new ListGridField(WorkflowJobDataSource.FIELD_MFIELD001, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_MISSUE, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_MSIGLA, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_MSIGNATURE, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_MVOLUME, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_MYEAR, 60),
            new ListGridField(WorkflowJobDataSource.FIELD_NOTE)
            );
    g.setSortField(WorkflowJobDataSource.FIELD_CREATED);
    g.setSortDirection(SortDirection.ASCENDING);

    SelectItem profileFilter = new SelectItem();
    profileFilter.setOptionDataSource(WorkflowProfileDataSource.getInstance());
    profileFilter.setValueField(WorkflowProfileDataSource.FIELD_ID);
    profileFilter.setDisplayField(WorkflowProfileDataSource.FIELD_LABEL);
    g.getField(WorkflowJobDataSource.FIELD_PROFILE_ID).setFilterEditorProperties(profileFilter);

    SelectItem owner = new SelectItem();
    owner.setOptionDataSource(UserDataSource.getInstance());
    owner.setValueField(UserDataSource.FIELD_ID);
    owner.setDisplayField(UserDataSource.FIELD_USERNAME);
    g.getField(WorkflowJobDataSource.FIELD_OWNER).setFilterEditorProperties(owner);

    g.addSelectionUpdatedHandler((SelectionUpdatedEvent event) -> {
        if (!ignoreSubjobSelection) {
            editSubjobSelection();
        }
        ignoreSubjobSelection = false;
    });
    return g;
}
 
Example 3
Source File: WorkflowMaterialView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private Widget createMaterialList() {
    materialGrid = new ListGrid() {

        @Override
        protected Canvas getExpansionComponent(final ListGridRecord record) {
            String type = record.getAttribute(WorkflowMaterialDataSource.FIELD_TYPE);
            DynamicForm form = null;
            if (MaterialType.FOLDER.name().equals(type)) {
                form = createFolderForm();
            } else if (MaterialType.PHYSICAL_DOCUMENT.name().equals(type)) {
                form = createPhysicalDocumentForm();
            } else if (MaterialType.DIGITAL_OBJECT.name().equals(type)) {
                form = createDigitalDocumentForm();
            }
            if (form != null) {
                return bindExpansinonForm(form, record);
            } else {
                return super.getExpansionComponent(record);
            }
        }

    };
    materialGrid.setSelectionType(SelectionStyle.SINGLE);
    materialGrid.setExpansionMode(ExpansionMode.DETAIL_FIELD);
    materialGrid.setCanExpandRecords(true);
    materialGrid.setCanExpandMultipleRecords(false);
    materialGrid.setAutoSaveEdits(false);
    materialGrid.setCanSort(false);
    materialGrid.setCanGroupBy(false);
    materialGrid.setWrapCells(true);

    CanvasSizePersistence persistence = new CanvasSizePersistence(parentName + ".WorkflowMaterialView.materialList", materialGrid);
    materialGrid.setHeight(persistence.getHeight());

    materialGrid.setDataSource(WorkflowMaterialDataSource.getInstance(),
            new ListGridField(WorkflowMaterialDataSource.FIELD_PROFILENAME),
            new ListGridField(WorkflowMaterialDataSource.FIELD_VALUE),
            new ListGridField(WorkflowMaterialDataSource.FIELD_WAY),
            new ListGridField(WorkflowMaterialDataSource.FIELD_NOTE),
            new ListGridField(WorkflowMaterialDataSource.FIELD_ID)
    );
    materialGrid.getField(WorkflowMaterialDataSource.FIELD_WAY).setHidden(jobMaterial);
    String dbPrefix = jobMaterial ? "WorkflowJobFormView.WorkflowMaterialView"
            : "WorkflowTaskFormView.WorkflowMaterialView";
    ListGridPersistance listGridPersistance = new ListGridPersistance(
            dbPrefix, materialGrid);
    materialGrid.setViewState(listGridPersistance.getViewState());
    return materialGrid;
}