Java Code Examples for com.smartgwt.client.data.fields.DataSourceIntegerField#setPrimaryKey()

The following examples show how to use com.smartgwt.client.data.fields.DataSourceIntegerField#setPrimaryKey() . 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: UserDataSource.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public UserDataSource() {

        DataSourceIntegerField id = new DataSourceIntegerField("parameterId", "ID");
        id.setPrimaryKey(true);
        id.setHidden(true);

        DataSourceTextField userName = new DataSourceTextField("userName", i18n.userName());
        DataSourceTextField name = new DataSourceTextField("name", i18n.name());
        DataSourceTextField password = new DataSourceTextField("password", i18n.password());
        DataSourceTextField eMail = new DataSourceTextField("eMail", i18n.emailAddress());
        DataSourceTextField handy = new DataSourceTextField("handy", i18n.handyNumber());
        DataSourceTextField role = new DataSourceTextField("role", i18n.role());

        setFields(id, userName, name, password, eMail, handy, role);

        setClientOnly(true);
    }
 
Example 2
Source File: SOSDataSource.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
public SOSDataSource(String id) {
	setID(id);
	setRecordXPath("/instances/instance");
	DataSourceIntegerField pkField = new DataSourceIntegerField("itemID");
       pkField.setPrimaryKey(true);  
	pkField.setHidden(true);

	DataSourceTextField sosURLField = new DataSourceTextField("url");
	DataSourceTextField sosVersionField = new DataSourceTextField("version");
	DataSourceBooleanField cachedField = new DataSourceBooleanField("cached");
	DataSourceTextField sosItemNameField = new DataSourceTextField("itemName");
	DataSourceBooleanField waterMLField = new DataSourceBooleanField("waterML");
	DataSourceFloatField llEastingField = new DataSourceFloatField("llEasting");
	DataSourceFloatField urEastingField = new DataSourceFloatField("urEasting");
	DataSourceFloatField llNorthingField = new DataSourceFloatField("llNorthing");
	DataSourceFloatField urNorthingField = new DataSourceFloatField("urNorthing");
	DataSourceIntegerField defaultZoomField = new DataSourceIntegerField("defaultZoom");
	DataSourceIntegerField requestChunkField = new DataSourceIntegerField("requestChunk");
	
	setFields(pkField, sosItemNameField, sosVersionField, sosURLField, waterMLField, cachedField, llEastingField, llNorthingField, urEastingField, urNorthingField, defaultZoomField, requestChunkField);
	setDataURL(SOS_INSTANCES_DATA_SOURCE);
}
 
Example 3
Source File: UserDataSource.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public UserDataSource() {
    setID(ID);

    ClientMessages i18n = GWT.create(ClientMessages.class);

    setDataURL(RestConfig.URL_USER);

    DataSourceIntegerField userId = new DataSourceIntegerField(FIELD_ID);
    userId.setPrimaryKey(true);
    userId.setCanEdit(false);
    userId.setHidden(true);
    userId.setTitle(i18n.UsersView_ListHeader_Id_Title());

    DataSourceTextField userName = new DataSourceTextField(FIELD_USERNAME);
    userName.setCanEdit(false);
    userName.setRequired(true);
    userName.setReadOnlyEditorProperties(new StaticTextItem());
    userName.setTitle(i18n.UsersView_ListHeader_Username_Title());
    userName.setPrompt(i18n.UsersView_ListHeader_Username_Hint());

    DataSourcePasswordField passwd = new DataSourcePasswordField(FIELD_PASSWORD);
    passwd.setHidden(true);
    passwd.setTitle(i18n.UsersView_ListHeader_Password_Title());

    DataSourceTextField surname = new DataSourceTextField(UserResourceApi.USER_SURNAME);
    surname.setRequired(true);
    surname.setTitle(i18n.UsersView_ListHeader_Surname_Title());

    DataSourceTextField forename = new DataSourceTextField(UserResourceApi.USER_FORENAME);
    forename.setTitle(i18n.UsersView_ListHeader_Forename_Title());

    DataSourceTextField organization = new DataSourceTextField(UserResourceApi.USER_ORGANIZATION);
    organization.setTitle(i18n.UsersView_ListHeader_Organization_Title());
    organization.setValueMap(Organization.getMap());
    organization.setReadOnlyEditorProperties(new StaticTextItem());

    DataSourceTextField role = new DataSourceTextField(UserResourceApi.USER_ROLE);
    role.setTitle(i18n.UsersView_ListHeader_Role_Title());
    role.setValueMap(UserRole.getMap());
    role.setReadOnlyEditorProperties(new StaticTextItem());

    DataSourceTextField email = new DataSourceTextField(UserResourceApi.USER_EMAIL);
    email.setTitle(i18n.UsersView_ListHeader_Email_Title());

    DataSourceTextField home = new DataSourceTextField(UserResourceApi.USER_HOME);
    home.setCanEdit(false);
    home.setReadOnlyEditorProperties(new StaticTextItem());
    home.setHidden(true);
    home.setTitle(i18n.UsersView_ListHeader_Home_Title());

    DataSourceDateTimeField created = new DataSourceDateTimeField(UserResourceApi.USER_CREATED);
    created.setCanEdit(false);
    created.setTitle(i18n.UsersView_ListHeader_Created_Title());
    created.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);

    DataSourceTextField remoteName = new DataSourceTextField(UserResourceApi.USER_REMOTENAME);
    remoteName.setTitle(i18n.UsersView_ListHeader_RemoteName_Title());
    remoteName.setCanEdit(false);
    remoteName.setHidden(true);

    DataSourceTextField remoteType = new DataSourceTextField(UserResourceApi.USER_REMOTETYPE);
    remoteType.setTitle(i18n.UsersView_ListHeader_RemoteType_Title());
    remoteType.setCanEdit(false);
    remoteType.setHidden(true);

    setFields(userId, userName, passwd, surname, forename, organization, role, email, created, remoteName, remoteType, home);

    setOperationBindings(RestConfig.createAddOperation(), RestConfig.createUpdateOperation());
    setRequestProperties(RestConfig.createRestRequest(getDataFormat()));
}
 
Example 4
Source File: WorkflowTaskDataSource.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public WorkflowTaskDataSource() {
        setID(ID);
        setDataURL(RestConfig.URL_WORKFLOW_TASK);
        final ClientMessages i18n = GWT.create(ClientMessages.class);

        allTaskStates = new LinkedHashMap<String, String>() {{
            put(State.WAITING.name(), i18n.WorkflowTask_State_Waiting_Title());
            put(State.READY.name(), i18n.WorkflowTask_State_Ready_Title());
            put(State.STARTED.name(), i18n.WorkflowTask_State_Started_Title());
            put(State.FINISHED.name(), i18n.WorkflowTask_State_Finished_Title());
            put(State.CANCELED.name(), i18n.WorkflowTask_State_Canceled_Title());
        }};
        DataSourceIntegerField fieldId = new DataSourceIntegerField(FIELD_ID);
        fieldId.setPrimaryKey(Boolean.TRUE);
        fieldId.setDetail(true);
        fieldId.setTitle(i18n.WorkflowTask_Field_Id_Title());
        fieldId.setCanEdit(false);

        DataSourceTextField label = new DataSourceTextField(FIELD_LABEL);
        label.setTitle(i18n.WorkflowTask_Field_Label_Title());
        label.setLength(255);
        label.setCanEdit(false);

        DataSourceTextField jobId = new DataSourceTextField(FIELD_JOB_ID);
        jobId.setTitle(i18n.WorkflowTask_Field_JobId_Title());
        jobId.setDetail(true);
        jobId.setCanEdit(false);

        DataSourceTextField jobLabel = new DataSourceTextField(FIELD_JOB_LABEL);
        jobLabel.setTitle(i18n.WorkflowTask_Field_JobLabel_Title());
        jobLabel.setDetail(true);
        jobLabel.setCanEdit(false);

        DataSourceEnumField state = new DataSourceEnumField(FIELD_STATE);
        state.setTitle(i18n.WorkflowTask_Field_State_Title());
        state.setValueMap(allTaskStates);
        state.setRequired(true);

        DataSourceTextField owner = new DataSourceTextField(FIELD_OWNER);
        owner.setTitle(i18n.WorkflowTask_Field_Owner_Title());
        owner.setDisplayField(WorkflowModelConsts.TASK_OWNERNAME);

        DataSourceTextField note = new DataSourceTextField(FIELD_NOTE);
        note.setTitle(i18n.WorkflowTask_Field_Note_Title());
        note.setDetail(true);

        DataSourceTextField type = new DataSourceTextField(FIELD_TYPE);
        type.setTitle(i18n.WorkflowTask_Field_Profile_Title());
        type.setDetail(true);
        type.setCanEdit(false);

        DataSourceEnumField priority = new DataSourceEnumField(FIELD_PRIORITY);
        priority.setTitle(i18n.WorkflowTask_Field_Priority_Title());
        priority.setDetail(true);
        priority.setValueMap(new LinkedHashMap() {{
            put("1", i18n.Workflow_Priority_1_Title());
            put("2", i18n.Workflow_Priority_2_Title());
            put("3", i18n.Workflow_Priority_3_Title());
            put("4", i18n.Workflow_Priority_4_Title());
        }});

        DataSourceDateTimeField created = new DataSourceDateTimeField(FIELD_CREATED);
        created.setTitle(i18n.WorkflowTask_Field_Created_Title());
        created.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
        created.setCanEdit(false);
        created.setDetail(true);

        DataSourceDateTimeField modified = new DataSourceDateTimeField(FIELD_MODIFIED);
        modified.setTitle(i18n.WorkflowTask_Field_Modified_Title());
        modified.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
        modified.setCanEdit(false);
        modified.setDetail(true);

        DataSourceField params = new DataSourceField(FIELD_PARAMETERS, FieldType.ANY);
        params.setHidden(true);

        DataSourceField materials = new DataSourceField(FIELD_MATERIALS, FieldType.ANY);
        materials.setHidden(true);

        setFields(label, type, state, priority, owner, created, modified,
                fieldId, note, jobId, jobLabel, params, materials);
        setRequestProperties(RestConfig.createRestRequest(getDataFormat()));
        setOperationBindings(
                RestConfig.createAddOperation(),
//                RestConfig.createDeleteOperation(),
                RestConfig.createUpdatePostOperation());
    }
 
Example 5
Source File: ImportBatchItemDataSource.java    From proarc with GNU General Public License v3.0 2 votes vote down vote up
public ImportBatchItemDataSource() {
    setID(ID);

    setDataURL(RestConfig.URL_IMPORT_BATCH_ITEM);

    DataSourceField pid = new DataSourceField(FIELD_PID, FieldType.TEXT);
    pid.setPrimaryKey(true);

    DataSourceIntegerField batchId = new DataSourceIntegerField(FIELD_BATCHID);
    batchId.setPrimaryKey(true);
    batchId.setForeignKey(ImportBatchDataSource.ID + '.' + ImportBatchDataSource.FIELD_ID);

    DataSourceField timestamp = new DataSourceField(FIELD_TIMESTAMP, FieldType.TEXT);
    timestamp.setRequired(true);
    timestamp.setHidden(true);

    DataSourceTextField filename = new DataSourceTextField(FIELD_FILENAME);

    DataSourceTextField user = new DataSourceTextField(FIELD_USER);

    DataSourceTextField model = new DataSourceTextField(FIELD_MODEL);
    model.setForeignKey(MetaModelDataSource.ID + '.' + MetaModelDataSource.FIELD_PID);

    DataSourceImageField preview = new DataSourceImageField(FIELD_PREVIEW);
    preview.setImageURLPrefix(RestConfig.URL_DIGOBJECT_PREVIEW + "?");

    DataSourceImageField thumbnail = new DataSourceImageField(FIELD_THUMBNAIL);
    thumbnail.setImageURLPrefix(RestConfig.URL_DIGOBJECT_THUMBNAIL + "?");

    DataSourceField pageType = new DataSourceField(FIELD_PAGE_TYPE, FieldType.TEXT);
    DataSourceField pageTypeLabel = new DataSourceField(FIELD_PAGE_TYPE_LABEL, FieldType.TEXT);

    DataSourceField pageIndex = new DataSourceField(FIELD_PAGE_INDEX, FieldType.INTEGER, "Page Index");
    DataSourceField pageNumber = new DataSourceField(FIELD_PAGE_NUMBER, FieldType.TEXT, "Page Number");

    setFields(pid, batchId, timestamp, filename, user, model, preview, thumbnail, pageIndex, pageNumber, pageType, pageTypeLabel);

    setOperationBindings(RestConfig.createDeleteOperation());

    setRequestProperties(RestConfig.createRestRequest(getDataFormat()));

}