com.smartgwt.client.widgets.grid.ListGridRecord Java Examples
The following examples show how to use
com.smartgwt.client.widgets.grid.ListGridRecord.
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: CatalogBrowser.java From proarc with GNU General Public License v3.0 | 6 votes |
@Override public void onChanged(ChangedEvent event) { ListGridRecord r = selectCatalog.getSelectedRecord(); String lastFieldSelection = selectField.getValueAsString(); Record[] fields = r.getAttributeAsRecordArray(BibliographicCatalogResourceApi.CATALOG_FIELDS); LinkedHashMap<String, String> fieldMap = new LinkedHashMap<String, String>(); for (Record field : fields) { String fId = field.getAttribute(BibliographicCatalogResourceApi.CATALOG_FIELD_ID); String fTitle = field.getAttribute(BibliographicCatalogResourceApi.CATALOG_FIELD_TITLE); fTitle = fTitle == null || fId.equals(fTitle) ? FIELD_TYPE_TITLES.get(fId) : fTitle; fTitle = fTitle == null ? fId : fTitle; fieldMap.put(fId, fTitle); } if (!fieldMap.containsKey(lastFieldSelection)) { if (fieldMap.isEmpty()) { lastFieldSelection = null; } else { lastFieldSelection = fieldMap.keySet().iterator().next(); } } selectField.setValueMap(fieldMap); selectField.setValue(lastFieldSelection); }
Example #2
Source File: SubscriptionListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
protected ClickHandler createDeleteHandler(final ListGridRecord ruleRecord) { return new ClickHandler() { @Override public void onClick(ClickEvent event) { boolean subscribed = ruleRecord.getAttributeAsBoolean(SUBSCRIBED).booleanValue(); if (subscribed) { SC.say(i18n.deleteOnlyWhenUnsubbscribed()); } else { SC.ask(i18n.deleteSubscriptionQuestion(), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { String role = getLoggedInUserRole(); String uuid = ruleRecord.getAttribute(UUID); getMainEventBus().fireEvent(new DeleteRuleEvent(currentSession(), uuid, role)); removeData(ruleRecord); } } }); } } }; }
Example #3
Source File: CustomIdPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
private void refreshSequences() { SchemeService.Instance.get().loadSequences(new AsyncCallback<GUISequence[]>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUISequence[] data) { List<ListGridRecord> records = new ArrayList<ListGridRecord>(); if (data != null) for (GUISequence cid : data) { ListGridRecord record = new ListGridRecord(); record.setAttribute("template", Util.strip(cid.getTemplate())); record.setAttribute("frequency", I18N.message(cid.getFrequency())); record.setAttribute("year", cid.getYear()); record.setAttribute("month", cid.getMonth()); record.setAttribute("folder", cid.getFolder()); record.setAttribute("id", cid.getId()); record.setAttribute("value", cid.getValue()); records.add(record); } sequences.setData(records.toArray(new ListGridRecord[0])); } }); }
Example #4
Source File: LinksPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void onPreview(ListGridRecord record) { String documentId = record.getAttributeAsString("documentId"); long docId = Long.parseLong(documentId.substring(documentId.lastIndexOf('-') + 1)); DocumentService.Instance.get().getById(docId, new AsyncCallback<GUIDocument>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught.getMessage(), caught); } @Override public void onSuccess(GUIDocument document) { PreviewPopup iv = new PreviewPopup(document); iv.show(); } }); }
Example #5
Source File: Contacts.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
private void onEdit() { final ListGridRecord[] selection = list.getSelectedRecords(); ContactService.Instance.get().load(Long.parseLong(selection[0].getAttribute("id")), new AsyncCallback<GUIContact>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUIContact result) { if (result != null) { ContactDetails dialog = new ContactDetails(result, Contacts.this); dialog.show(); } } }); }
Example #6
Source File: OwnRulesListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
@Override protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { if (record != null) { String fieldName = this.getFieldName(colNum); if (fieldName.equals(EDIT_RULE_FIELD)) { return createEditRuleButton(record); } else if (fieldName.equals(PUBLISHED_RULE_FIELD)) { return createPublishRuleButton(record); } else if (fieldName.equals(DELETE_RULE_FIELD)) { return createDeleteRuleButtonm(record); } else { return null; } } return null; }
Example #7
Source File: DocumentsListGrid.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected String getCellCSSText(ListGridRecord record, int rowNum, int colNum) { if (getFieldName(colNum).equals("filename")) { int immutable = 0; if (record.getAttribute("immutable") != null) immutable = record.getAttributeAsInt("immutable"); if (immutable == 1 || !"yes".equals(record.getAttribute("publishedStatus"))) { return "color: #888888; font-style: italic;"; } else { return super.getCellCSSText(record, rowNum, colNum); } } else { return super.getCellCSSText(record, rowNum, colNum); } }
Example #8
Source File: StoragesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
private void onAddStorage() { for (int i = 1; i < 99; i++) { Record record = list.getRecordList().find("id", Integer.toString(i)); if (record == null) { ListGridRecord newStore = new ListGridRecord(); newStore.setAttribute("id", Integer.toString(i)); newStore.setAttribute("name", "Storage " + i); newStore.setAttribute("type", "fs"); newStore.setAttribute("encrypt", "false"); newStore.setAttribute("write", "blank"); list.getDataSource().addData(newStore); list.redraw(); break; } } }
Example #9
Source File: DocumentsListGrid.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void setDocuments(GUIDocument[] documents) { ListGridRecord[] records = new ListGridRecord[0]; if (documents == null || documents.length == 0) setRecords(records); records = new ListGridRecord[documents.length]; for (int i = 0; i < documents.length; i++) { GUIDocument doc = documents[i]; ListGridRecord record = GridUtil.fromDocument(doc); records[i] = record; } setRecords(records); }
Example #10
Source File: LinksPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void onOpenInFolder(ListGridRecord record) { String documentId = record.getAttributeAsString("documentId"); long docId = Long.parseLong(documentId.substring(documentId.lastIndexOf('-') + 1)); DocumentService.Instance.get().getById(docId, new AsyncCallback<GUIDocument>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught.getMessage(), caught); } @Override public void onSuccess(GUIDocument document) { DocumentsPanel.get().openInFolder(document.getFolder().getId(), document.getId()); } }); }
Example #11
Source File: TemplatePropertiesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void fillAttributesList() { if (attributesList.getRecordList().getLength() > 0) attributesList.getRecordList().removeList(attributesList.getRecords()); if (template == null) return; GUIAttribute[] attributes = template.getAttributesOrderedByPosition(); if (attributes == null) return; for (int i = 0; i < attributes.length; i++) { GUIAttribute att = attributes[i]; ListGridRecord record = new ListGridRecord(); record.setAttribute("name", att.getName()); record.setAttribute("label", att.getLabel()); record.setAttribute("set", att.getSet()); record.setAttribute("setId", att.getSetId()); record.setAttribute("type", att.getType()); record.setAttribute("editor", att.getEditor()); record.setAttribute("mandatory", att.isMandatory()); record.setAttribute("hidden", att.isHidden()); record.setAttribute("multiple", att.isMultiple()); attributesList.getRecordList().add(record); } }
Example #12
Source File: PatchPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
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 #13
Source File: Options.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Removs the selected options */ private void onDelete() { final ListGridRecord[] selection = list.getSelectedRecords(); if (selection == null || selection.length == 0) return; final String[] values = new String[selection.length]; for (int i = 0; i < selection.length; i++) values[i] = selection[i].getAttributeAsString("value"); AttributeSetService.Instance.get().deleteOptions(setId, attribute, values, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void arg0) { list.removeSelectedData(); list.deselectAllRecords(); } }); }
Example #14
Source File: MostUsedTagsPortlet.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
private void refresh() { TagService.Instance.get().getTagCloud(new AsyncCallback<GUITag[]>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUITag[] cloud) { ListGridRecord[] records = new ListGridRecord[cloud.length]; for (int i = 0; i < cloud.length; i++) { records[i] = new ListGridRecord(); records[i].setAttribute("word", cloud[i].getTag()); records[i].setAttribute("count", cloud[i].getCount()); } list.setRecords(records); } }); }
Example #15
Source File: MessageDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Add new users in the recipients grid */ private void addRecipients(ListGridRecord[] newSelection) { if (newSelection == null || newSelection.length < 1) return; for (int i = 0; i < newSelection.length; i++) { ListGridRecord newRec = new ListGridRecord(); newRec.setAttribute("id", newSelection[i].getAttributeAsString("id")); newRec.setAttribute("label", newSelection[i].getAttributeAsString("label")); // Iterate over the current recipients avoiding duplicates boolean duplicate = false; ListGridRecord[] currentRecipients = recipientsGrid.getRecords(); for (int j = 0; j < currentRecipients.length; j++) { ListGridRecord rec = currentRecipients[j]; if (rec.getAttributeAsString("id").equals(newRec.getAttributeAsString("id"))) { duplicate = true; break; } } if (!duplicate) recipientsGrid.addData(newRec); } }
Example #16
Source File: AllRulesListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
@Override protected Canvas createRecordComponent(final ListGridRecord record, Integer colNum) { if (record != null) { String fieldName = getFieldName(colNum); if (fieldName.equals(PUBLISHED_RULE_FIELD)) { return createPublishRuleButton(record); } else if (fieldName.equals(EDIT_RULE_FIELD)) { return createEditRuleButton(record); } else if (fieldName.equals(DELETE_RULE_FIELD)) { return createDeleteRuleButton(record); } else { return null; } } return null; }
Example #17
Source File: AllRulesListGrid.java From SensorWebClient with GNU General Public License v2.0 | 6 votes |
protected Canvas createEditRuleButton(final ListGridRecord ruleRecord) { String userID = getLoggedInUser(); String ruleOwnerID = ruleRecord.getAttribute(OWNERID); if (ruleOwnerID.equals(userID)) { IButton editButton = new IButton(i18n.edit()); editButton.setShowDown(false); editButton.setShowRollOver(false); editButton.setLayoutAlign(Alignment.CENTER); editButton.setPrompt(i18n.editThisRule()); editButton.setHeight(16); editButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { String name = ruleRecord.getAttribute(NAME); EventBus.getMainEventBus().fireEvent(new EditRuleEvent(name)); } }); return editButton; } else { return null; } }
Example #18
Source File: MenuRightsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Create an array of all rights defined * * @return array of rights */ public GUIRight[] getRights() { ListGridRecord[] records = list.getRecords(); GUIRight[] tmp = new GUIRight[records.length]; int i = 0; for (ListGridRecord record : records) { GUIRight right = new GUIRight(); right.setName(record.getAttributeAsString("entity")); right.setEntityId(Long.parseLong(record.getAttribute("entityId"))); tmp[i] = right; i++; } return tmp; }
Example #19
Source File: ExportArchivesList.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void closeArchive(final ListGridRecord record) { ImpexService.Instance.get().setStatus(Long.parseLong(record.getAttributeAsString("id")), GUIArchive.STATUS_CLOSED, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void result) { record.setAttribute("status", "1"); record.setAttribute("statusicon", "lock"); list.refreshRow(list.getRecordIndex(record)); showDetails(Long.parseLong(record.getAttributeAsString("id")), true); } }); }
Example #20
Source File: ExportArchivesList.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
protected void openArchive(final ListGridRecord record) { ImpexService.Instance.get().setStatus(Long.parseLong(record.getAttributeAsString("id")), GUIArchive.STATUS_OPENED, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void result) { record.setAttribute("status", "0"); record.setAttribute("statusicon", "lock_open"); list.refreshRow(list.getRecordIndex(record)); showDetails(Long.parseLong(record.getAttributeAsString("id")), true); } }); }
Example #21
Source File: VersionsPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
protected void onPreview(final GUIDocument document, ListGridRecord record) { GUIVersion version = new GUIVersion(); version.setFolder(document.getFolder()); version.setDocId(document.getId()); version.setId(document.getId()); version.setVersion(record.getAttribute("version")); version.setFileVersion(record.getAttribute("fileVersion")); version.setType(record.getAttribute("type")); version.setFileName(record.getAttribute("filename")); PreviewPopup iv = new PreviewPopup(version); iv.show(); }
Example #22
Source File: Clipboard.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public ListGridRecord[] getRecords() { ListGridRecord[] array = new ListGridRecord[size()]; int i = 0; for (GUIDocument document : this) { array[i] = new ListGridRecord(); array[i].setAttribute("id", Long.toString(document.getId())); array[i].setAttribute("filename", document.getFileName()); array[i].setAttribute("icon", document.getIcon()); i++; } return array; }
Example #23
Source File: AutomationTriggersPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void showContextMenu() { Menu contextMenu = new Menu(); final ListGridRecord record = list.getSelectedRecord(); final long id = Long.parseLong(record.getAttributeAsString("id")); MenuItem delete = new MenuItem(); delete.setTitle(I18N.message("ddelete")); delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() { public void onClick(MenuItemClickEvent event) { LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { AutomationService.Instance.get().deleteTriggers(new long[] { id }, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void result) { list.removeSelectedData(); list.deselectAllRecords(); showTriggerDetails(null); } }); } } }); } }); contextMenu.setItems(delete); contextMenu.showContextMenu(); }
Example #24
Source File: BookmarksPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void onBookmarkSelected() { ListGridRecord record = list.getSelectedRecord(); if (record.getAttributeAsString("type").equals("0")) DocumentsPanel.get().openInFolder(record.getAttributeAsLong("folderId"), record.getAttributeAsLong("targetId")); else DocumentsPanel.get().openInFolder(record.getAttributeAsLong("targetId"), null); }
Example #25
Source File: AutomationRoutinesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void showContextMenu() { Menu contextMenu = new Menu(); final ListGridRecord record = list.getSelectedRecord(); final long id = Long.parseLong(record.getAttributeAsString("id")); MenuItem delete = new MenuItem(); delete.setTitle(I18N.message("ddelete")); delete.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() { public void onClick(MenuItemClickEvent event) { LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { AutomationService.Instance.get().deleteRoutines(new long[] { id }, new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void result) { list.removeSelectedData(); list.deselectAllRecords(); showRoutineDetails(null); } }); } } }); } }); contextMenu.setItems(delete); contextMenu.showContextMenu(); }
Example #26
Source File: MessageTemplatesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void reload() { String lang = langSelector.getValueAsString(); MessageService.Instance.get().loadTemplates(lang, null, new AsyncCallback<GUIMessageTemplate[]>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(GUIMessageTemplate[] templates) { ListGridRecord[] records = new ListGridRecord[templates.length]; int i = 0; for (GUIMessageTemplate pat : templates) { ListGridRecord record = new ListGridRecord(); record.setAttribute("id", pat.getId()); record.setAttribute("name", pat.getName()); record.setAttribute("language", pat.getName()); record.setAttribute("subject", pat.getSubject()); record.setAttribute("body", pat.getBody()); record.setAttribute("type", pat.getType()); records[i++] = record; } list.setData(records); } }); }
Example #27
Source File: StoragesPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void onSave() { final List<GUIParameter> settings = new ArrayList<GUIParameter>(); ListGridRecord[] records = list.getRecords(); for (ListGridRecord rec : records) { String id = rec.getAttributeAsString("id").trim(); settings.add(new GUIParameter("store." + id + ".dir", rec.getAttributeAsString("path").trim())); settings.add(new GUIParameter("store." + id + ".type", rec.getAttributeAsString("type").trim())); if ("database_edit".equals(rec.getAttributeAsString("write"))) { settings.add(new GUIParameter("store.write", id)); } String[] attrs = rec.getAttributes(); if (attrs != null && attrs.length > 0) { for (String attr : attrs) { if (!StoragesPanel.isParameterAttribute(attr)) continue; settings.add(new GUIParameter("store." + id + "." + attr, rec.getAttributeAsString(attr).trim())); } } } SettingService.Instance.get().saveStorageSettings(settings.toArray(new GUIParameter[0]), new AsyncCallback<Void>() { @Override public void onFailure(Throwable caught) { Log.serverError(caught); } @Override public void onSuccess(Void arg) { Log.info(I18N.message("settingssaved"), null); // Replicate the settings in the current session for (GUIParameter setting : settings) Session.get().setConfig(setting.getName(), setting.getValue()); refresh(); } }); }
Example #28
Source File: EventsWindow.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
public void addEvent(GUIEvent event) { ListGridRecord record = new ListGridRecord(); record.setAttribute("date", event.getDate()); record.setAttribute("detail", event.getDetail()); record.setAttribute("severity", event.getSeverity()); record.setAttribute("severityLabel", I18N.message(event.getSeverity())); grid.addData(record); grid.sort("date", SortDirection.DESCENDING); }
Example #29
Source File: FolderSearchDialog.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
protected void search(GUISearchOptions options) { SearchService.Instance.get().search(options, new AsyncCallback<GUIResult>() { @Override public void onFailure(Throwable caught) { ContactingServer.get().hide(); Log.serverError(caught); } @Override public void onSuccess(GUIResult result) { lastResult = new ListGridRecord[result.getHits().length]; for (int i = 0; i < result.getHits().length; i++) { GUIDocument hit = result.getHits()[i]; ListGridRecord record = new ListGridRecord(); lastResult[i] = record; record.setAttribute("id", hit.getId()); record.setAttribute("name", hit.getFileName()); record.setAttribute("description", hit.getSummary()); } if (lastResult.length == 1) { onSelect(lastResult[0].getAttributeAsLong("id"), lastResult[0].getAttribute("name")); } else grid.setData(lastResult); } }); }
Example #30
Source File: FolderSecurityPanel.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
private void onDeleteItem() { ListGridRecord[] selection = list.getSelectedRecords(); if (selection == null || selection.length == 0) return; LD.ask(I18N.message("question"), I18N.message("confirmdelete"), new BooleanCallback() { @Override public void execute(Boolean value) { if (value) { list.removeSelectedData(); } } }); }