ram.ghadiyaram@gmail.com
21 Feb 2009, 11:13 AM
Hi the below is my code
I am using the LabelField for displaying the string.
I tried with FormBinding Class. The problem here is the value is being set as GMT string format of the date ..
How I can change to the dateformat which I want ?
for example user want dd-MMM-yyyy
publicclass AuditTrailFieldSet extends FieldSet {
public AuditTrailFieldSet(String header) {
super();
setHeading(header);
FormLayout layoutAuditTrailDetails = new FormLayout();
layoutAuditTrailDetails.setLabelWidth(120);
layoutAuditTrailDetails.setDefaultWidth(450);
layoutAuditTrailDetails.setPadding(2);
setLayout(layoutAuditTrailDetails);
int i = 0;
LabelField lastModifiedBy = new LabelField();
lastModifiedBy.setLabelSeparator(" :");
lastModifiedBy.setFieldLabel("Last Modified By");
lastModifiedBy.setName("lastModifiedBy");
insert(lastModifiedBy, i++ ,new FormData("60%"));
LabelField lastModifiedOn = new LabelField();
// DateTimePropertyEditor dt= new DateTimePropertyEditor();
// dt.setFormat(DateTimeFormat.getFormat("dd-MMM-yyyy"));
// lastModifiedOn.setPropertyEditor(dt);
// lastModifiedOn.setDateTimeFormat(DateTimeFormat.getFormat("dd-MMM-yyyy hh:mi"));
lastModifiedOn.setFieldLabel("Last Modified On");
lastModifiedOn.setLabelSeparator(" :");
lastModifiedOn.setName("lastModifiedOn");
// GWT.log(lastModifiedOn.getText() + "",null);
// DateTimeFormat dt = null;
// DateTimeFormat.format(new Date());
// dt.convertStringValue("");
// GWT.log("getval" +lastModifiedOn.getValue() + "",null);
// GWT.log("gettext" + lastModifiedOn.getText()+ "",null);
// GWT.log("getrawval" + lastModifiedOn.getRawValue()+ "",null);
// GWT.log("getid" +lastModifiedOn.getId()+ "",null);
// GWT.log("getitemid" +lastModifiedOn.getItemId() + "",null);
// GWT.log("getModel" +lastModifiedOn.getModel().get("lastModifiedOn") + "",null);
// GWT.log("getModel" +lastModifiedOn.getData("lastModifiedOn") + "",null);
lastModifiedOn.setWidth(100);
insert(lastModifiedOn, i++ ,new FormData("60%"));
CheckBox checkIsActive = new CheckBox();
checkIsActive.setFieldLabel("Is Active");
checkIsActive.setName("active");
checkIsActive.setReadOnly(true);
insert(checkIsActive,i++, new FormData("60%"));
}
I am using the LabelField for displaying the string.
I tried with FormBinding Class. The problem here is the value is being set as GMT string format of the date ..
How I can change to the dateformat which I want ?
for example user want dd-MMM-yyyy
publicclass AuditTrailFieldSet extends FieldSet {
public AuditTrailFieldSet(String header) {
super();
setHeading(header);
FormLayout layoutAuditTrailDetails = new FormLayout();
layoutAuditTrailDetails.setLabelWidth(120);
layoutAuditTrailDetails.setDefaultWidth(450);
layoutAuditTrailDetails.setPadding(2);
setLayout(layoutAuditTrailDetails);
int i = 0;
LabelField lastModifiedBy = new LabelField();
lastModifiedBy.setLabelSeparator(" :");
lastModifiedBy.setFieldLabel("Last Modified By");
lastModifiedBy.setName("lastModifiedBy");
insert(lastModifiedBy, i++ ,new FormData("60%"));
LabelField lastModifiedOn = new LabelField();
// DateTimePropertyEditor dt= new DateTimePropertyEditor();
// dt.setFormat(DateTimeFormat.getFormat("dd-MMM-yyyy"));
// lastModifiedOn.setPropertyEditor(dt);
// lastModifiedOn.setDateTimeFormat(DateTimeFormat.getFormat("dd-MMM-yyyy hh:mi"));
lastModifiedOn.setFieldLabel("Last Modified On");
lastModifiedOn.setLabelSeparator(" :");
lastModifiedOn.setName("lastModifiedOn");
// GWT.log(lastModifiedOn.getText() + "",null);
// DateTimeFormat dt = null;
// DateTimeFormat.format(new Date());
// dt.convertStringValue("");
// GWT.log("getval" +lastModifiedOn.getValue() + "",null);
// GWT.log("gettext" + lastModifiedOn.getText()+ "",null);
// GWT.log("getrawval" + lastModifiedOn.getRawValue()+ "",null);
// GWT.log("getid" +lastModifiedOn.getId()+ "",null);
// GWT.log("getitemid" +lastModifiedOn.getItemId() + "",null);
// GWT.log("getModel" +lastModifiedOn.getModel().get("lastModifiedOn") + "",null);
// GWT.log("getModel" +lastModifiedOn.getData("lastModifiedOn") + "",null);
lastModifiedOn.setWidth(100);
insert(lastModifiedOn, i++ ,new FormData("60%"));
CheckBox checkIsActive = new CheckBox();
checkIsActive.setFieldLabel("Is Active");
checkIsActive.setName("active");
checkIsActive.setReadOnly(true);
insert(checkIsActive,i++, new FormData("60%"));
}