Java Code Examples for com.smartgwt.client.widgets.grid.ListGridField#setCanEdit()
The following examples show how to use
com.smartgwt.client.widgets.grid.ListGridField#setCanEdit() .
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: GUILanguagesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
@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 2
Source File: ChannelsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
@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 3
Source File: PluginsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
@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 4
Source File: SearchIndexingPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
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 5
Source File: ComparatorsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
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 6
Source File: FormatConvertersPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
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 7
Source File: RunLevelPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
private SectionStack prepareAspectsTable() { ListGridField id = new ListGridField("id", I18N.message("aspect"), 300); id.setCanEdit(false); id.setCanSort(false); id.setAutoFitWidth(true); id.setCellFormatter(new CellFormatter() { @Override public String format(Object value, ListGridRecord record, int rowNum, int colNum) { return I18N.message("aspect." + record.getAttributeAsString("id")); } }); ListGridField _default = new ListGridField("default", I18N.message("default"), 60); _default.setType(ListGridFieldType.BOOLEAN); _default.setCanEdit(true); _default.setAutoFitWidth(true); _default.setCanSort(false); ListGridField bulkload = new ListGridField("bulkload", I18N.message("bulkload"), 60); bulkload.setType(ListGridFieldType.BOOLEAN); bulkload.setCanEdit(true); bulkload.setAutoFitWidth(true); bulkload.setCanSort(false); ListGridField slave = new ListGridField("slave", I18N.message("slave"), 60); slave.setType(ListGridFieldType.BOOLEAN); slave.setCanEdit(true); slave.setAutoFitWidth(true); slave.setCanSort(false); ListGridField devel = new ListGridField("devel", I18N.message("devel"), 60); devel.setType(ListGridFieldType.BOOLEAN); devel.setCanEdit(true); devel.setAutoFitWidth(true); devel.setCanSort(false); ListGridField demo = new ListGridField("demo", I18N.message("demo"), 60); demo.setType(ListGridFieldType.BOOLEAN); demo.setCanEdit(true); demo.setAutoFitWidth(true); demo.setCanSort(false); aspects = new ListGrid(); aspects.setEmptyMessage(I18N.message("notitemstoshow")); aspects.setCanFreezeFields(true); aspects.setAutoFetchData(true); aspects.setDataSource(new AspectsDS()); aspects.setFields(id, _default, bulkload, slave, devel, demo); aspects.setHeaderHeight(44); aspects.setHeaderSpans(new HeaderSpan(I18N.message("runlevels"), new String[] { "default", "bulkload", "slave", "devel", "demo" })); SectionStack stack = new SectionStack(); stack.setWidth100(); stack.setHeight100(); SectionStackSection section = new SectionStackSection(I18N.message("aspects")); section.setCanCollapse(false); section.setExpanded(true); section.setItems(aspects); stack.setSections(section); return stack; }