com.smartgwt.client.widgets.grid.ListGrid Java Examples

The following examples show how to use com.smartgwt.client.widgets.grid.ListGrid. 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: PatchPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void showContextMenu(ListGrid list) {
	ListGridRecord record = list.getSelectedRecord();
	final GUIPatch patch = new GUIPatch();
	patch.setId(record.getAttribute("id"));
	patch.setName(record.getAttribute("name"));
	patch.setFile(record.getAttribute("file"));
	patch.setDescription(record.getAttribute("description"));
	patch.setSize(record.getAttributeAsLong("size"));
	patch.setDate(record.getAttributeAsDate("date"));
	patch.setInstalled(record.getAttributeAsBoolean("installed"));

	Menu contextMenu = new Menu();

	MenuItem install = new MenuItem();
	install.setTitle(I18N.message("install"));
	install.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			switchDownloadView(patch);
		}
	});
	install.setEnabled(!patch.isInstalled());

	contextMenu.setItems(install);
	contextMenu.showContextMenu();
}
 
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: UsersView.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private ListGrid createUserList(ToolStrip gridEditControls) {
    final ListGrid grid = new ListGrid() {

        @Override
        protected Canvas getExpansionComponent(ListGridRecord record) {
            return getRowProfileEditor(record);
        }

    };
    grid.setDataSource(UserDataSource.getInstance());
    grid.setUseAllDataSourceFields(true);
    grid.setSelectionType(SelectionStyle.SINGLE);
    grid.setCanExpandRecords(true);
    grid.setCanExpandMultipleRecords(false);
    grid.setGridComponents(gridEditControls, ListGridComponent.HEADER, ListGridComponent.BODY);
    // Since SmartGWT 4.0; disable auto-save to post updates of nested forms just on the submit actions.
    grid.setAutoSaveEdits(false);
    grid.setShowClippedValuesOnHover(true);
    ListGridPersistance gridPersistence = new ListGridPersistance("UsersView.userList", grid);
    grid.setViewState(gridPersistence.getViewState());
    return grid;
}
 
Example #4
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 #5
Source File: Actions.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Fixes {@link ListGrid} context menu
 * to update grid selection on right click properly.
 * <p>Bug: right click selects row without firing selection event.
 */
public static void fixListGridContextMenu(final ListGrid grid) {
    grid.addShowContextMenuHandler(new ShowContextMenuHandler() {

        @Override
        public void onShowContextMenu(ShowContextMenuEvent event) {
            int eventRow = grid.getEventRow();
            if (eventRow < 0) {
                return ;
            }
            ListGridRecord[] selectedRecords = grid.getSelectedRecords();

            if (selectedRecords.length <= 1) {
                // ListGrid does not fire selection updated event if right click
                // no select if multi-selection exists
                grid.selectSingleRecord(eventRow);
            }
            Menu contextMenu = grid.getContextMenu();
            contextMenu.showContextMenu();
            event.cancel();
        }
    });

}
 
Example #6
Source File: StationSelector.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private ListGrid createExpandableSelectionGrid() {
    ListGrid listGrid = createListGrid(this);
    listGrid.addSelectionChangedHandler(new SOSSelectionChangedHandler(controller));
    listGrid.addClickHandler(new SOSClickedHandler(controller));
    listGrid.setSelectionType(SelectionStyle.SINGLE);
    listGrid.setCanExpandMultipleRecords(false);
    return listGrid;
}
 
Example #7
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 #8
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 #9
Source File: ComparatorAssociationsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ComparatorAssociationsDialog(final ListGrid srcGrid) {
	this.srcGrid = srcGrid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("associations"));
	setWidth(320);
	setHeight(360);

	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	comparator = ItemFactory.newComparatorSelector();
	comparator.setWidth(290);
	comparator.setRequired(true);
	comparator.setValue(DEFAULT_COMPARATOR);
	comparator.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			refresh();
		}
	});

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);
	form.setItems(comparator);

	addItem(form);

	refresh();
}
 
Example #10
Source File: CalendarEventDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void refreshDocumentsGrid(final ListGrid list) {
	ListGridRecord[] records = new ListGridRecord[calendarEvent.getDocuments().length];
	for (int i = 0; i < calendarEvent.getDocuments().length; i++) {
		records[i] = new ListGridRecord();
		records[i].setAttribute("id", calendarEvent.getDocuments()[i].getId());
		records[i].setAttribute("icon", calendarEvent.getDocuments()[i].getIcon());
		records[i].setAttribute("version", calendarEvent.getDocuments()[i].getVersion());
		records[i].setAttribute("fileVersion", calendarEvent.getDocuments()[i].getFileVersion());
		records[i].setAttribute("filename", calendarEvent.getDocuments()[i].getFileName());
		records[i].setAttribute("lastModified", calendarEvent.getDocuments()[i].getLastModified());
		records[i].setAttribute("docRef", calendarEvent.getDocuments()[i].getDocRef());
	}
	list.setRecords(records);
}
 
Example #11
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 #12
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 #13
Source File: CalendarEventDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void addParticipant(final ListGrid list, String id, String username, String name) {
	// Check if the selected user is already present in the list
	ListGridRecord[] records = list.getRecords();
	for (ListGridRecord test : records) {
		if (test.getAttribute("id").equals(id))
			return;
	}

	// Update the table
	ListGridRecord record = new ListGridRecord();

	record.setAttribute("id", id);
	record.setAttribute("name", name);
	record.setAttribute("username", username);
	list.addData(record);
	
	if (id.startsWith("g-")) {
		GUIGroup group = new GUIGroup();
		group.setId(Long.parseLong(id.substring(2)));
		group.setName(username);
		group.setDescription(name);
		CalendarEventDialog.this.calendarEvent.addParticipant(group);
	} else {
		GUIUser user = new GUIUser();
		user.setId(Long.parseLong(id));
		user.setUsername(username);
		user.setFirstName(name);
		CalendarEventDialog.this.calendarEvent.addParticipant(user);
	}
}
 
Example #14
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 #15
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 #16
Source File: CustomIdPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void showSchemeContextMenu(final ListGrid schemes) {
	Menu contextMenu = new Menu();

	MenuItem clean = new MenuItem();
	clean.setTitle(I18N.message("clean"));
	clean.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
		public void onClick(MenuItemClickEvent event) {
			LD.ask(I18N.message("question"), I18N.message("confirmclean"), new BooleanCallback() {
				@Override
				public void execute(Boolean value) {
					if (value) {
						final ListGridRecord record = schemes.getSelectedRecord();
						SchemeService.Instance.get().delete(
								Long.parseLong(record.getAttributeAsString("templateId")),
								record.getAttributeAsString("type"), new AsyncCallback<Void>() {

									@Override
									public void onFailure(Throwable caught) {
										Log.serverError(caught);
									}

									@Override
									public void onSuccess(Void ret) {
										schemes.getSelectedRecord().setAttribute("scheme", (String) null);
										schemes.getSelectedRecord().setAttribute("evaluateAtCheckin", false);
										schemes.getSelectedRecord().setAttribute("evaluateAtUpdate", false);
										schemes.refreshRow(schemes.getRecordIndex(record));
									}
								});
					}
				}
			});
		}
	});

	contextMenu.setItems(clean);
	contextMenu.showContextMenu();
}
 
Example #17
Source File: ConverterAssociationsDialog.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ConverterAssociationsDialog(final ListGrid srcGrid) {
	this.srcGrid = srcGrid;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("associations"));
	setWidth(320);
	setHeight(360);
	
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();

	converter = ItemFactory.newFormatConverterSelector();
	converter.setWidth(290);
	converter.setRequired(true);
	converter.setValue(DEFAULT_CONVERTER);
	converter.addChangedHandler(new ChangedHandler() {

		@Override
		public void onChanged(ChangedEvent event) {
			refresh();
		}
	});

	DynamicForm form = new DynamicForm();
	form.setTitleOrientation(TitleOrientation.TOP);
	form.setNumCols(1);
	form.setItems(converter);

	addItem(form);

	refresh();
}
 
Example #18
Source File: DigitalObjectFormValidateAction.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Clears all row errors.
 * @param lg list to clear
 */
public static void clearRowErrors(ListGrid lg) {
    for (int i = lg.getRecords().length - 1; i >= 0; i--) {
        lg.clearRowErrors(i);
    }
}
 
Example #19
Source File: DigitalObjectFormValidateAction.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ValidatableList(ListGrid list) {
    if (list == null) {
        throw new NullPointerException("list");
    }
    this.list = list;
}
 
Example #20
Source File: TasksPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ListGrid getList() {
	return list;
}
 
Example #21
Source File: DesaExportAction.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ListGrid getGrid() {
    return grid;
}
 
Example #22
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;
        }
 
Example #23
Source File: UrnNbnAction.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ListGrid getGrid() {
    return grid;
}
 
Example #24
Source File: SelectionCache.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public static SelectionCache<ListGridRecord> selector(ListGrid lg) {
    return new SelectionCache<>(Optional.of(() -> lg.getSelectedRecords()), r -> lg.getRecordIndex(r));
}
 
Example #25
Source File: SyndicationsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public ListGrid getList() {
	return list;
}
 
Example #26
Source File: WorkflowJobFormView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ListGrid getTasks() {
    return taskView;
}
 
Example #27
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 #28
Source File: WorkflowNewJobView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
private SelectItem createProfileSelector() {
    final SelectItem profile = new SelectItem(WorkflowResourceApi.NEWJOB_PROFILE, i18n.WorkflowJob_NewJobView_Field_Profile_Title());
    profile.setOptionDataSource(WorkflowProfileDataSource.getInstance());
    profile.setValueField(WorkflowProfileDataSource.FIELD_ID);
    profile.setDisplayField(WorkflowProfileDataSource.FIELD_LABEL);
    profile.setOptionCriteria(new Criteria(WorkflowProfileDataSource.FIELD_DISABLED, Boolean.FALSE.toString()));
    profile.setFilterLocally(true);
    profile.setRequired(true);
    profile.setWidth(300);
    profile.setAllowEmptyValue(true);
    ListGrid profilePickListProperties = new ListGrid();
    profilePickListProperties.setCanHover(true);
    profilePickListProperties.setShowHover(true);
    profilePickListProperties.setHoverWidth(300);
    profilePickListProperties.setHoverCustomizer(new HoverCustomizer() {

        @Override
        public String hoverHTML(Object value, ListGridRecord record, int rowNum, int colNum) {
            String hint = record.getAttribute(WorkflowProfileDataSource.FIELD_HINT);
            return hint;
        }
    });
    profile.setPickListProperties(profilePickListProperties);
    profile.addDataArrivedHandler(new DataArrivedHandler() {

        @Override
        public void onDataArrived(DataArrivedEvent event) {
            if (event.getStartRow() == 0) {
                ResultSet data = event.getData();
                int length = data.getLength();
                if (length == 1) {
                    Record r = data.get(0);
                    String profileId = r.getAttribute(WorkflowProfileDataSource.FIELD_ID);
                    profile.setValue(profileId);
                    profile.setDefaultValue(profileId);

                    fetchModelMenu(r); // fill up model menu on init
                }
            }
        }
    });
    return profile;
}
 
Example #29
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;
}
 
Example #30
Source File: DigitalObjectSearchView.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ListGrid getGrid() {
    return foundGrid;
}