Java Code Examples for com.smartgwt.client.widgets.grid.ListGridRecord#getAttribute()

The following examples show how to use com.smartgwt.client.widgets.grid.ListGridRecord#getAttribute() . 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: LinksPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void onDownloadPackage() {
	if (document.getFolder().isDownload()) {
		String url = GWT.getHostPageBaseURL() + "zip-export?folderId=" + document.getFolder().getId();
		url += "&docId=" + document.getId();

		treeGrid.getRecords();

		for (ListGridRecord record : treeGrid.getRecords()) {
			if (record.getAttributeAsBoolean("password")) {
				SC.warn(I18N.message("somedocsprotected"));
				break;
			}

			String docId = record.getAttribute("documentId");
			docId = docId.substring(docId.indexOf('-') + 1);
			url += "&docId=" + docId;
		}
		WindowUtils.openUrl(url);
	}
}
 
Example 2
Source File: EmailDialog.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void addEmptyRow() {
	ListGridRecord[] records = recipientsGrid.getRecords();
	// Search for an empty record
	for (ListGridRecord rec : records) {
		if (rec.getAttribute("email") == null || rec.getAttribute("email").trim().equals(""))
			return;
	}

	ListGridRecord[] newRecords = new ListGridRecord[records.length + 1];
	for (int i = 0; i < records.length; i++)
		newRecords[i] = records[i];
	newRecords[records.length] = new ListGridRecord();
	newRecords[records.length].setAttribute("type", "to");
	newRecords[records.length].setAttribute("email", "");
	recipientsGrid.setRecords(newRecords);
}
 
Example 3
Source File: DocumentsListGrid.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
@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 4
Source File: SubscriptionListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
protected ChangedHandler createActivateChangedHandler(final ListGridRecord ruleRecord) {
    return new ChangedHandler() {
        @Override
        public void onChanged(ChangedEvent event) {
            CheckboxItem checkbox = (CheckboxItem) event.getSource();
            boolean checked = checkbox.getValueAsBoolean().booleanValue();
            String uuid = ruleRecord.getAttribute(UUID);
            String medium = ruleRecord.getAttribute(MEDIUM);
            String format = ruleRecord.getAttribute(FORMAT);
            ruleRecord.setAttribute(SUBSCRIBED, checked);
            if(checked) {
                getMainEventBus().fireEvent(new SubscribeEvent(currentSession(), uuid, medium, format));
            } else {
                getMainEventBus().fireEvent(new UnsubscribeEvent(currentSession(), uuid, medium, format));
            }
        }
    };
}
 
Example 5
Source File: AllRulesListGrid.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
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 6
Source File: EmailAccountFiltersPanel.java    From document-management-software with GNU Lesser General Public License v3.0 5 votes vote down vote up
boolean validate() {
	if (list == null)
		return true;

	ListGridRecord[] records = list.getRecords();
	List<GUIEmailRule> rules = new ArrayList<GUIEmailRule>();
	for (ListGridRecord record : records) {
		if (record.getAttribute("expression") == null)
			continue;
		GUIEmailRule rule = new GUIEmailRule();
		GUIFolder target = new GUIFolder();

		if (record.getAttributeAsLong("targetId") != null)
			target.setId(record.getAttributeAsLong("targetId"));
		else
			target.setId(0L);

		target.setName(record.getAttribute("targetName"));
		rule.setTarget(target);
		rule.setField(Integer.parseInt(record.getAttribute("field")));
		rule.setPolicy(Integer.parseInt(record.getAttribute("condition")));
		rule.setExpression(record.getAttribute("expression"));
		rules.add(rule);
	}

	account.setRules(rules.toArray(new GUIEmailRule[0]));
	return true;
}
 
Example 7
Source File: CatalogBrowser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
/**
     * Gets the selected metadata or {@code null}.
     */
    public String getMods() {
        ListGridRecord r = lgResult.getSelectedRecord();
        String mods = (r == null) ? null : r.getAttribute(BibliographyQueryDataSource.FIELD_MODS);
//        ClientUtils.info(LOG, "getMods: %s", mods);
        return mods;
    }
 
Example 8
Source File: ImportSourceChooser.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
private void updateOnSelection() {
    ListGridRecord selectedRecord = treeGrid.getSelectedRecord();
    String label = (selectedRecord == null)
            ? i18n.ImportSourceChooser_NothingSelected_Title()
            : selectedRecord.getAttribute(ImportTreeDataSource.FIELD_PATH);
    lblCurrSelection.setContents(label);
    ImportRecord importRecord = selectedRecord == null ? null : new ImportRecord(selectedRecord);
    loadButton.setDisabled(importRecord == null || !importRecord.isNew());
}
 
Example 9
Source File: UserRuleLayout.java    From SensorWebClient with GNU General Public License v2.0 5 votes vote down vote up
private static void warnForLongSmsMessages(ListGridRecord record) {
    if (DataControlsSes.warnUserLongNotification) {
        if (record.getAttribute(MEDIUM).contains("SMS")) {
            String format = record.getAttribute(FORMAT);
            if (format.contains("XML") || format.contains("EML")) {
                SC.say(i18n.longNotificationMessage());
                return;
            }
        }
    }
}
 
Example 10
Source File: CatalogBrowser.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public String getCatalogId() {
    ListGridRecord r = lgResult.getSelectedRecord();
    String val = (r == null) ? null : r.getAttribute(BibliographicCatalogResourceApi.CATALOG_ID);
    return val;
}
 
Example 11
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;
}