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

The following examples show how to use com.smartgwt.client.widgets.grid.ListGrid#setSelectionType() . 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: 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 2
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 3
Source File: WorkflowTriggersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void refresh() {
	ListGridField workflow = new ListGridField("workflow", I18N.message("workflow"), 200);
	workflow.setCanFilter(true);

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

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

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

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

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

	addMember(list, 0);
}
 
Example 4
Source File: 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 5
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 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: 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 8
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 9
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 10
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 11
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 12
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 13
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;
}