com.smartgwt.client.types.SelectionStyle Java Examples

The following examples show how to use com.smartgwt.client.types.SelectionStyle. 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: 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 #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: ChannelsPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onDraw() {
	ToolStrip toolStrip = new ToolStrip();
	toolStrip.setHeight(20);
	toolStrip.setWidth100();
	toolStrip.addSpacer(2);
	ToolStripButton refresh = new ToolStripButton();
	refresh.setTitle(I18N.message("refresh"));
	toolStrip.addButton(refresh);
	refresh.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			list.refresh(new ChannelsDS());
		}
	});
	toolStrip.addFill();

	Layout listing = new VLayout();
	setMembers(toolStrip, listing);

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

	ListGridField members = new ListGridField("members", I18N.message("members"));
	members.setCanEdit(false);
	members.setWidth("*");

	list = new RefreshableListGrid();
	list.setEmptyMessage(I18N.message("notitemstoshow"));
	list.setCanEdit(false);
	list.setWidth100();
	list.setHeight100();
	list.setAutoFetchData(true);
	list.setSelectionType(SelectionStyle.SINGLE);
	list.setFields(name, members);
	list.setDataSource(new ChannelsDS());

	listing.addMember(list);
}
 
Example #4
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 #5
Source File: ImportParentChooser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public ImportParentChooser(ClientMessages i18n) {
    this.i18n = i18n;
    this.widget = new VLayout(4);
    widget.setWidth100();
    widget.setHeight100();
    widget.setOverflow(Overflow.AUTO);

    selectionView = createSelectionView(i18n);
    foundView = new DigitalObjectSearchView(i18n, LAST_SELECTED_MODEL_TAG);
    treeView = new DigitalObjectTreeView(i18n);

    foundView.getGrid().setSelectionType(SelectionStyle.SINGLE);
    foundView.getGrid().addSelectionUpdatedHandler(new SelectionUpdatedHandler() {

        @Override
        public void onSelectionUpdated(SelectionUpdatedEvent event) {
            final ListGridRecord selectedRecord = foundView.getGrid().getSelectedRecord();
            if (selectedRecord != null) {
                String pid = selectedRecord.getAttribute(RelationDataSource.FIELD_PID);
                treeView.setRoot(pid);
            }
        }
    });

    widget.addMember(selectionView);
    Canvas foundViewWidget = foundView.asWidget();
    foundViewWidget.setShowResizeBar(true);
    widget.addMember(foundViewWidget);
    widget.addMember(treeView.asWidget());
    createActions();
    initToolbar(foundView.getToolbar(), foundView);
    initToolbar(treeView.getToolbar(), treeView);
    initContextMenu(foundView.getGrid().getContextMenu(), foundView);
    initContextMenu(treeView.getTree().getContextMenu(), treeView);
}
 
Example #6
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 #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: ShareFileTree.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ShareFileTree(boolean export) {
	super();

	setBodyStyleName("normal");
	setShowHeader(false);
	setLeaveScrollbarGap(false);
	setCanReorderRecords(false);
	setCanDragRecordsOut(false);
	setAutoFetchData(true);
	setLoadDataOnDemand(true);
	setDataSource(new ShareFileDS(export));
	setCanSelectAll(false);
	setShowConnectors(true);
	setCanAcceptDrop(false);
	setCanAcceptDroppedRecords(false);
	setShowRoot(false);

	if (export)
		setSelectionType(SelectionStyle.SINGLE);
	else {
		setSelectionType(SelectionStyle.MULTIPLE);
		setSelectionAppearance(SelectionAppearance.CHECKBOX);
	}

	addDataArrivedHandler(new DataArrivedHandler() {
		@Override
		public void onDataArrived(DataArrivedEvent event) {
			TreeNode node = getTree().getChildren(getTree().getRoot())[0];
			getTree().openFolder(node);
		}
	});

}
 
Example #9
Source File: DropboxTree.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public DropboxTree(boolean export) {
	super();

	setBodyStyleName("normal");
	setShowHeader(false);
	setLeaveScrollbarGap(false);
	setCanReorderRecords(false);
	setCanDragRecordsOut(false);
	setAutoFetchData(true);
	setLoadDataOnDemand(true);
	setDataSource(new DropboxDS(null, export));
	setCanSelectAll(false);
	setShowConnectors(true);
	setCanAcceptDrop(false);
	setCanAcceptDroppedRecords(false);
	setShowRoot(false);

	if (export)
		setSelectionType(SelectionStyle.SINGLE);
	else {
		setSelectionType(SelectionStyle.MULTIPLE);
		setSelectionAppearance(SelectionAppearance.CHECKBOX);
	}

	addDataArrivedHandler(new DataArrivedHandler() {
		@Override
		public void onDataArrived(DataArrivedEvent event) {
			TreeNode node = getTree().getChildren(getTree().getRoot())[0];
			getTree().openFolder(node);
		}
	});

}
 
Example #10
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 #11
Source File: ZohoTree.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
public ZohoTree(boolean export) {
	super();

	setBodyStyleName("normal");
	setShowHeader(false);
	setLeaveScrollbarGap(false);
	setCanReorderRecords(false);
	setCanDragRecordsOut(false);
	setAutoFetchData(true);
	setLoadDataOnDemand(true);
	setDataSource(new ZohoDS(null, export));
	setCanSelectAll(false);
	setShowConnectors(true);
	setCanAcceptDrop(false);
	setCanAcceptDroppedRecords(false);
	setShowRoot(false);

	if (export)
		setSelectionType(SelectionStyle.SINGLE);
	else {
		setSelectionType(SelectionStyle.MULTIPLE);
		setSelectionAppearance(SelectionAppearance.CHECKBOX);
	}

	addDataArrivedHandler(new DataArrivedHandler() {
		@Override
		public void onDataArrived(DataArrivedEvent event) {
			TreeNode node = getTree().getChildren(getTree().getRoot())[0];
			getTree().openFolder(node);
		}
	});

}
 
Example #12
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 #13
Source File: TrashPanel.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void onDraw() {
	ListGridField id = new ListGridField("id");
	id.setHidden(true);

	ListGridField fileName = new ListGridField("filename", I18N.message("name"));
	fileName.setCanFilter(true);
	fileName.setWidth("*");

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

	ListGridField lastModified = new ListGridField("lastModified", I18N.message("lastmodified"), 110);
	lastModified.setAlign(Alignment.CENTER);
	lastModified.setType(ListGridFieldType.DATE);
	lastModified.setCellFormatter(new DateCellFormatter(false));
	lastModified.setCanFilter(false);
	lastModified.setHidden(true);

	ListGridField customId = new ListGridField("customId", I18N.message("customid"), 110);
	customId.setType(ListGridFieldType.TEXT);
	customId.setCanFilter(true);
	customId.setHidden(true);

	list = new RefreshableListGrid();
	list.setEmptyMessage(I18N.message("notitemstoshow"));
	list.setWidth100();
	list.setHeight100();
	list.setAutoFetchData(true);
	list.setFields(icon, fileName, customId, lastModified);
	list.setSelectionType(SelectionStyle.MULTIPLE);
	list.setDataSource(new GarbageDS());
	list.setShowFilterEditor(true);
	list.setFilterOnKeypress(true);
	addMember(list);

	if (Session.get().getCurrentFolder() != null && Session.get().getCurrentFolder().isWrite())
		list.addCellContextClickHandler(new CellContextClickHandler() {
			@Override
			public void onCellContextClick(CellContextClickEvent event) {
				showContextMenu();
				event.cancel();
			}
		});
}
 
Example #14
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 #15
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 #16
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 #17
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 #18
Source File: FolderSearchDialog.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public FolderSearchDialog(FolderSelector selector) {
	this.selector = selector;

	setHeaderControls(HeaderControls.HEADER_LABEL, HeaderControls.CLOSE_BUTTON);
	setTitle(I18N.message("folder"));
	setWidth(450);
	setHeight(600);
	setCanDragResize(true);
	setIsModal(true);
	setShowModalMask(true);
	centerInPage();
	setMembersMargin(0);

	form = new FolderSearchForm() {
		@Override
		protected void search(GUISearchOptions options) {
			FolderSearchDialog.this.search(options);
		}
	};
	form.setWidth100();
	form.setHeight100();
	

	grid.setWidth100();
	grid.setHeight100();
	grid.setMinHeight(220);
	ListGridField name = new ListGridField("name", I18N.message("name"));
	ListGridField description = new ListGridField("description", I18N.message("description"));
	grid.setFields(name, description);
	grid.setSelectionType(SelectionStyle.SINGLE);
	grid.setEmptyMessage(I18N.message("notitemstoshow"));
	grid.setShowRecordComponents(true);
	grid.setShowRecordComponentsByCell(true);
	grid.setAutoFetchData(true);
	grid.setWrapCells(false);
	grid.setData(lastResult);

	grid.addDoubleClickHandler(new DoubleClickHandler() {
		@Override
		public void onDoubleClick(DoubleClickEvent event) {
			ListGridRecord selection = grid.getSelectedRecord();
			onSelect(selection.getAttributeAsLong("id"), selection.getAttribute("name"));
		}
	});

	VLayout formPanel=new VLayout();
	formPanel.setWidth100();
	formPanel.setHeight(300);
	formPanel.setShowResizeBar(true);
	formPanel.addMember(form);
	
	VLayout gridPanel=new VLayout();
	formPanel.setWidth100();
	gridPanel.setHeight("*");
	gridPanel.addMember(grid);
	
	addItem(formPanel);
	addItem(gridPanel);
}
 
Example #19
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 #20
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 #21
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public ImportSourceChooser(ClientMessages i18n) {
    this.i18n = i18n;
    VLayout layout = this;
    setWidth100();
    setHeight100();
    VLayout innerLayout = new VLayout();
    innerLayout.setLayoutMargin(4);

    lblCurrSelection = new Label(i18n.ImportSourceChooser_NothingSelected_Title());
    lblCurrSelection.setWidth100();
    lblCurrSelection.setAutoFit(true);
    lblCurrSelection.setMargin(4);
    lblCurrSelection.setCanSelectText(true);

    treeGrid = new TreeGrid();
    treeGrid.setHeight100();
    treeGrid.setDataSource(dataSource);
    TreeGridField stateField = new TreeGridField(
            ImportTreeDataSource.FIELD_STATE,
            i18n.ImportSourceChooser_TreeHeaderImportState_Title());
    stateField.setWidth(100);
    treeGrid.setFields(
            new TreeGridField(ImportTreeDataSource.FIELD_NAME, i18n.ImportSourceChooser_TreeHeaderFolderName_Title()),
            stateField);
    treeGrid.setShowConnectors(true);
    treeGrid.setEmptyMessage(i18n.ImportSourceChooser_NoDataOnServer_Title());
    treeGrid.setAlternateRecordStyles(true);
    treeGrid.setSelectionType(SelectionStyle.SINGLE);
    ListGridPersistance treeGridPersistence = new ListGridPersistance("ImportSourceChooser.directoryList", treeGrid);
    treeGrid.setViewState(treeGridPersistence.getViewState());

    treeGrid.addFolderClickHandler(new FolderClickHandler() {

        @Override
        public void onFolderClick(FolderClickEvent event) {
            updateOnSelection();
            // issue 41: open node on single click
            TreeNode folder = event.getFolder();
            event.getViewer().getTree().openFolder(folder);
        }
    });

    ToolStrip toolbar = createToolbar();

    optionsForm = createOptionsForm();

    innerLayout.setMembers(optionsForm, lblCurrSelection, treeGrid);
    layout.setMembers(toolbar, innerLayout);
}
 
Example #22
Source File: SearchHitsGrid.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public SearchHitsGrid() {
	super(null);
	setShowRecordComponents(true);
	setShowRecordComponentsByCell(true);
	setSelectionType(Session.get().isAdmin() ? SelectionStyle.MULTIPLE : SelectionStyle.SINGLE);
	setShowRowNumbers(true);

	fieldsMap.get("type").setHidden(true);
	fieldsMap.get("customId").setHidden(true);

	fields.add(fieldsMap.get("id"));
	fields.add(fieldsMap.get("thumbnail"));
	fields.add(fieldsMap.get("statusIcons"));
	fields.add(fieldsMap.get("icon"));

	String[] cols = Session.get().getInfo().getConfig("gui.search.columns").split(",");
	for (String col : cols) {
		ListGridField field = fieldsMap.get(col);
		if (field != null) {
			field.setHidden(false);
			fields.add(field);
		}
	}

	if (!fields.contains(fieldsMap.get("filename")))
		fields.add(fieldsMap.get("filename"));
	if (!fields.contains(fieldsMap.get("score")))
		fields.add(fieldsMap.get("score"));
	if (!fields.contains(fieldsMap.get("lastModified")))
		fields.add(fieldsMap.get("lastModified"));
	if (!fields.contains(fieldsMap.get("type")))
		fields.add(fieldsMap.get("type"));
	if (!fields.contains(fieldsMap.get("size")))
		fields.add(fieldsMap.get("size"));
	if (!fields.contains(fieldsMap.get("fileVersion")))
		fields.add(fieldsMap.get("fileVersion"));
	if (!fields.contains(fieldsMap.get("version")))
		fields.add(fieldsMap.get("version"));
	if (!fields.contains(fieldsMap.get("publisher")))
		fields.add(fieldsMap.get("publisher"));
	if (!fields.contains(fieldsMap.get("published")))
		fields.add(fieldsMap.get("published"));
	if (!fields.contains(fieldsMap.get("creator")))
		fields.add(fieldsMap.get("creator"));
	if (!fields.contains(fieldsMap.get("created")))
		fields.add(fieldsMap.get("created"));
	if (!fields.contains(fieldsMap.get("customId")))
		fields.add(fieldsMap.get("customId"));
	if (!fields.contains(fieldsMap.get("folder")))
		fields.add(fieldsMap.get("folder"));
	if (!fields.contains(fieldsMap.get("rating")))
		fields.add(fieldsMap.get("rating"));
	if (!fields.contains(fieldsMap.get("rating")))
		fields.add(fieldsMap.get("rating"));
	if (!fields.contains(fieldsMap.get("comment")))
		fields.add(fieldsMap.get("comment"));
	if (!fields.contains(fieldsMap.get("workflowStatus")))
		fields.add(fieldsMap.get("workflowStatus"));
	if (!fields.contains(fieldsMap.get("workflowStatusDisp")))
		fields.add(fieldsMap.get("workflowStatusDisp"));
	if (!fields.contains(fieldsMap.get("startPublishing")))
		fields.add(fieldsMap.get("startPublishing"));
	if (!fields.contains(fieldsMap.get("stopPublishing")))
		fields.add(fieldsMap.get("stopPublishing"));
	if (!fields.contains(fieldsMap.get("template")))
		fields.add(fieldsMap.get("template"));
	if (!fields.contains(fieldsMap.get("language")))
		fields.add(fieldsMap.get("language"));

	setFields(fields.toArray(new ListGridField[0]));

	loadGridLayout(null);
}