Java Code Examples for com.smartgwt.client.data.Record#getAttributeAsString()

The following examples show how to use com.smartgwt.client.data.Record#getAttributeAsString() . 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: AttributeSetPropertiesPanel.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
protected void onChangeSelectedAttribute(Record record) {
	if (record != null) {
		String selectedAttributeName = record.getAttributeAsString("name");
		GUIAttribute extAttr = attributeSet.getAttribute(selectedAttributeName);
		form2.setValue("attributeName", extAttr.getName());
		form2.setValue("label", extAttr.getLabel());
		form2.setValue("mandatory", extAttr.isMandatory());
		form2.setValue("hidden", extAttr.isHidden());
		form2.setValue("multiple", extAttr.isMultiple());
		form2.setValue("type", extAttr.getType());
		form2.setValue("editor", extAttr.getEditor());
		form2.setValue("group", extAttr.getStringValue());
		updatingAttributeName = selectedAttributeName;
		refreshFieldForm();
	}
}
 
Example 2
Source File: Options.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 * Sends the options in the grid to the server to save them.
 */
private void onSave() {
	Record[] records = list.getRecords();
	String[] values = new String[records.length];
	int i = 0;
	for (Record record : records)
		values[i++] = record.getAttributeAsString("value");

	ContactingServer.get().show();
	AttributeSetService.Instance.get().saveOptions(setId, attribute, values, new AsyncCallback<Void>() {
		@Override
		public void onFailure(Throwable caught) {
			ContactingServer.get().hide();
			Log.serverError(caught);
		}

		@Override
		public void onSuccess(Void arg0) {
			ContactingServer.get().hide();
			SC.say(I18N.message("optionssaved"));
		}
	});
}
 
Example 3
Source File: WorkflowNewJobView.java    From proarc with GNU General Public License v3.0 6 votes vote down vote up
private void fetchModelMenu(Record profile) {
    String jobName = profile.getAttributeAsString("name");

    WorkflowProfileDataSource.getInstance().getModels(false, jobName, (models) -> {
        Menu menu = new Menu();
        for (Record model : models) {
            MenuItem menuItem = new MenuItem(model.getAttribute(WorkflowProfileConsts.MODEL_TITLE));
            menu.addItem(menuItem);
            menuItem.addClickHandler(event -> {
                  fireOnCreateNew(model);
            });
        }
        newJobButton.setMenu(menu);
    });

}
 
Example 4
Source File: GridUtil.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
static public GUIDocument toDocument(Record record) {
	GUIDocument document = null;
	if (record != null) {
		document = new GUIDocument();
		document.setId(record.getAttributeAsLong("id"));
		if (record.getAttribute("docref") != null) {
			document.setDocRef(Long.parseLong(record.getAttribute("docref")));
			document.setDocRefType(record.getAttribute("docrefType"));
		}
		document.setExtResId(record.getAttributeAsString("extResId"));
		document.setCustomId(record.getAttributeAsString("customId"));
		document.setType(record.getAttribute("type"));
		document.setFileName(record.getAttribute("filename"));
		document.setTemplate(record.getAttribute("template"));
		document.setVersion(record.getAttribute("version"));
		document.setFileVersion(record.getAttribute("fileVersion"));
		document.setLanguage(record.getAttribute("language"));

		document.setPublisher(record.getAttributeAsString("publisher"));

		if (record.getAttributeAsFloat("size") != null)
			document.setFileSize(record.getAttributeAsFloat("size"));

		if (record.getAttributeAsInt("indexed") != null)
			document.setIndexed(record.getAttributeAsInt("indexed"));

		if (record.getAttributeAsInt("status") != null)
			document.setStatus(record.getAttributeAsInt("status"));

		if (record.getAttributeAsInt("immutable") != null)
			document.setImmutable(record.getAttributeAsInt("immutable"));

		if (record.getAttributeAsInt("password") != null)
			document.setPasswordProtected(record.getAttributeAsBoolean("password"));

		if (record.getAttributeAsInt("signed") != null)
			document.setSigned(record.getAttributeAsInt("signed"));

		if (record.getAttributeAsInt("stamped") != null)
			document.setStamped(record.getAttributeAsInt("stamped"));

		if (record.getAttributeAsInt("bookmarked") != null)
			document.setBookmarked(record.getAttributeAsBoolean("bookmarked"));

		if (record.getAttribute("lockUserId") != null)
			document.setLockUserId(record.getAttributeAsLong("lockUserId"));

		if (record.getAttribute("lockUser") != null)
			document.setLockUser(record.getAttribute("lockUser"));

		if (record.getAttribute("docref") != null) {
			document.setDocRef(Long.parseLong(record.getAttribute("docref")));
			document.setDocRefType(record.getAttribute("docrefType"));
		}

		if (record.getAttributeAsInt("workflowStatus") != null)
			document.setWorkflowStatus(record.getAttributeAsString("workflowStatus"));

		if (record.getAttributeAsString("workflowStatusDisplay") != null)
			document.setWorkflowStatusDisplay(record.getAttributeAsString("workflowStatusDisplay"));

		document.setIcon(record.getAttribute("icon"));
		if (record.getAttributeAsDate("lastModified") != null)
			document.setLastModified(record.getAttributeAsDate("lastModified"));
		if (record.getAttributeAsDate("published") != null)
			document.setDate(record.getAttributeAsDate("published"));
		if (record.getAttributeAsDate("created") != null)
			document.setCreation(record.getAttributeAsDate("created"));

		GUIFolder folder = new GUIFolder();
		if ("folder".equals(document.getType())) {
			folder.setId(Long.parseLong(record.getAttributeAsString("id")));
		} else if (record.getAttributeAsLong("folderId") != null)
			folder.setId(record.getAttributeAsLong("folderId"));
		else
			folder.setId(Session.get().getCurrentFolder().getId());
		folder.setName(record.getAttribute("filename"));
		folder.setDescription(record.getAttribute("comment"));

		document.setFolder(folder);
	}
	return document;
}