com.smartgwt.client.types.DateDisplayFormat Java Examples

The following examples show how to use com.smartgwt.client.types.DateDisplayFormat. 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: I18N.java    From document-management-software with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static DateDisplayFormat getDateDisplayFormat(boolean withTime) {
	if ("yyyy/MM/dd".equals(I18N.message("format_dateshort"))) {
		if (withTime)
			return DateDisplayFormat.TOJAPANSHORTDATETIME;
		else
			return DateDisplayFormat.TOJAPANSHORTDATE;
	} else if (I18N.message("format_dateshort").contains("MM/dd")) {
		if (withTime)
			return DateDisplayFormat.TOUSSHORTDATETIME;
		else
			return DateDisplayFormat.TOUSSHORTDATE;
	} else {
		if (withTime)
			return DateDisplayFormat.TOEUROPEANSHORTDATETIME;
		else
			return DateDisplayFormat.TOEUROPEANSHORTDATE;
	}
}
 
Example #2
Source File: SearchDataSource.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public SearchDataSource() {
    setID(ID);
    setDataURL(RestConfig.URL_DIGOBJECT_SEARCH);

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

    DataSourceField owner = new DataSourceField(FIELD_OWNER, FieldType.TEXT);
    DataSourceField label = new DataSourceField(FIELD_LABEL, FieldType.TEXT);
    DataSourceField state = new DataSourceField(FIELD_STATE, FieldType.ENUM);
    HashMap<String, String> states = new HashMap<String, String>();
    states.put("fedora-system:def/model#Active", "Active");
    states.put("fedora-system:def/model#Inactive", "Inactive");
    states.put("fedora-system:def/model#Deleted", "Deleted");
    state.setValueMap(states);
    DataSourceDateTimeField created = new DataSourceDateTimeField(FIELD_CREATED);
    created.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    DataSourceDateTimeField modified = new DataSourceDateTimeField(FIELD_MODIFIED);
    modified.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    DataSourceField export = new DataSourceField(FIELD_EXPORT, FieldType.TEXT);
    DataSourceField ndkExport = new DataSourceField(FIELD_NDK_EXPORT, FieldType.TEXT);
    DataSourceField archiveExport = new DataSourceField(FIELD_ARCHIVE_EXPORT, FieldType.TEXT);
    DataSourceField krameriusExport = new DataSourceField(FIELD_KRAMERIUS_EXPORT, FieldType.TEXT);
    DataSourceField crossreffExport = new DataSourceField(FIELD_CROSSREF_EXPORT, FieldType.TEXT);
    DataSourceField organization = new DataSourceField(FIELD_ORGANIZATION, FieldType.TEXT);
    DataSourceField user = new DataSourceField(FIELD_USER, FieldType.TEXT);
    DataSourceField status = new DataSourceField(FIELD_STATUS, FieldType.TEXT);
    organization.setValueMap(Organization.getMap());
    DataSourceTextField model = new DataSourceTextField(FIELD_MODEL);
    model.setForeignKey(MetaModelDataSource.ID + '.' + MetaModelDataSource.FIELD_PID);

    setFields(label, model, pid, created, modified, owner, state, export, ndkExport, archiveExport, krameriusExport, crossreffExport, organization, user, status);
    setRequestProperties(RestConfig.createRestRequest(getDataFormat()));
}
 
Example #3
Source File: FormGenerator.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
public DateItem getDateFormItem(Field f, String lang) {
        DateItem item = new DateItem(f.getName(), f.getTitle(activeLocale));
        item.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATE);
        item.setUseTextField(true);
//        item.setEnforceDate(true);
        return item;
    }
 
Example #4
Source File: DocumentsListGrid.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public DateDisplayFormat getDateFormatter() {
	return I18N.getDateDisplayFormat(false);
}
 
Example #5
Source File: DocumentsListGrid.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public DateDisplayFormat getDatetimeFormatter() {
	return I18N.getDateDisplayFormat(true);
}
 
Example #6
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 #7
Source File: RelationDataSource.java    From proarc with GNU General Public License v3.0 4 votes vote down vote up
public RelationDataSource() {
    setID(ID);

    setDataURL(RestConfig.URL_DIGOBJECT_CHILDREN);

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

    DataSourceField parent = new DataSourceField(FIELD_PARENT, FieldType.TEXT);
    parent.setForeignKey(ID + '.' + FIELD_PID);
    // canView:false excludes column from grid picker menu
    parent.setCanView(false);
    parent.setHidden(true);

    DataSourceField root = new DataSourceField(FIELD_ROOT, FieldType.TEXT);
    root.setHidden(true);

    DataSourceTextField model = new DataSourceTextField(FIELD_MODEL);
    DataSourceField owner = new DataSourceField(FIELD_OWNER, FieldType.TEXT);
    DataSourceField label = new DataSourceField(FIELD_LABEL, FieldType.TEXT);
    DataSourceDateTimeField created = new DataSourceDateTimeField(FIELD_CREATED);
    created.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    DataSourceDateTimeField modified = new DataSourceDateTimeField(FIELD_MODIFIED);
    modified.setDateFormatter(DateDisplayFormat.TOEUROPEANSHORTDATETIME);
    DataSourceField export = new DataSourceField(FIELD_EXPORT, FieldType.TEXT);
    DataSourceField ndkExport = new DataSourceField(FIELD_NDK_EXPORT, FieldType.TEXT);
    DataSourceField archiveExport = new DataSourceField(FIELD_ARCHIVE_EXPORT, FieldType.TEXT);
    DataSourceField krameriusExport = new DataSourceField(FIELD_KRAMERIUS_EXPORT, FieldType.TEXT);
    DataSourceField crossrefExport = new DataSourceField(FIELD_CROSSREF_EXPORT, FieldType.TEXT);
    DataSourceField organization = new DataSourceField(FIELD_ORGANIZATION, FieldType.TEXT);
    DataSourceField user = new DataSourceField(FIELD_USER, FieldType.TEXT);
    DataSourceField status = new DataSourceField(FIELD_STATUS, FieldType.TEXT);

    setFields(pid, parent, label, model, created, modified, owner, export, ndkExport, archiveExport, krameriusExport, crossrefExport, organization, user, status);
    setTitleField(FIELD_LABEL);

    setRequestProperties(RestConfig.createRestRequest(getDataFormat()));
    setOperationBindings(
            RestConfig.createAddOperation(),
            RestConfig.createDeleteOperation(),
            RestConfig.createUpdatePostOperation()
            );
    setCriteriaPolicy(CriteriaPolicy.DROPONCHANGE);
}
 
Example #8
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());
    }