please see this Testcase using Simplicity skin:
BuiltInDS.java:
Code:
package com.smartgwt.sample.client; import com.google.gwt.core.client.EntryPoint; import com.smartgwt.client.core.KeyIdentifier; import com.smartgwt.client.data.Criteria; import com.smartgwt.client.data.DSCallback; import com.smartgwt.client.data.DSRequest; import com.smartgwt.client.data.DSResponse; import com.smartgwt.client.data.DataSource; import com.smartgwt.client.types.ReadOnlyDisplayAppearance; import com.smartgwt.client.util.PageKeyHandler; import com.smartgwt.client.util.Page; import com.smartgwt.client.util.SC; import com.smartgwt.client.widgets.form.DynamicForm; import com.smartgwt.client.widgets.form.fields.ComboBoxItem; import com.smartgwt.client.widgets.form.fields.SelectItem; import com.smartgwt.client.widgets.form.fields.SpinnerItem; import com.smartgwt.client.widgets.form.fields.StaticTextItem; import com.smartgwt.client.widgets.form.fields.TextAreaItem; import com.smartgwt.client.widgets.form.fields.TextItem; import com.smartgwt.client.widgets.layout.HStack; public class BuiltInDS implements EntryPoint { public void onModuleLoad() { KeyIdentifier debugKey = new KeyIdentifier(); debugKey.setCtrlKey(true); debugKey.setKeyName("D"); Page.registerKey(debugKey, new PageKeyHandler() { public void execute(String keyName) { SC.showConsole(); } }); HStack stack = new HStack(); stack.setLeft(20); stack.setTop(20); stack.setWidth100(); stack.setMembersMargin(20); Testform enabledForm = new Testform("ENABLED"); Testform roroForm = new Testform("Readonly-Readonly"); roroForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.READONLY); roroForm.setCanEdit(false); Testform rodiForm = new Testform("Readonly-Disabled"); rodiForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.DISABLED); rodiForm.setCanEdit(false); Testform rostForm = new Testform("Readonly-Static"); rostForm.setReadOnlyDisplay(ReadOnlyDisplayAppearance.STATIC); rostForm.setCanEdit(false); Testform disabledForm = new Testform("DISABLED"); disabledForm.setDisabled(true); stack.addMembers(enabledForm, roroForm, rodiForm, rostForm, disabledForm); stack.draw(); } private class Testform extends DynamicForm { private StaticTextItem typeField; private TextItem scientificName; private TextItem commonName; private SelectItem status; private ComboBoxItem status2; private SpinnerItem lifeSpan; private TextAreaItem information; public Testform(final String type) { super(); setWidth(200); setDataSource(DataSource.get("animals")); typeField = new StaticTextItem("TYPE"); commonName = new TextItem("commonName"); scientificName = new TextItem("scientificName"); status = new SelectItem("status", "Status(SI)"); status2 = new ComboBoxItem("status", "Status(CBI)"); lifeSpan = new SpinnerItem("lifeSpan"); information = new TextAreaItem("information"); information.setHeight(100); setFields(typeField, commonName, scientificName, status, status2, lifeSpan, information); fetchData(new Criteria("scientificName", "Loxodonta africana"), new DSCallback() { @Override public void execute(DSResponse dsResponse, Object data, DSRequest dsRequest) { typeField.setValue(type); } }); } } }
- See (1) in the screenshot. I can't tell apart the TextItems and TextAreaItems in enabled and setCanEdit(false)+ReadOnlyDisplayAppearance.READONLY. Also for the other items it is not that intuitive/easy to see.
- See (2) in the screenshot. I can't use setDisabled(true) or setCanEdit(false)+ReadOnlyDisplayAppearance.DISABLED, because of the unusable native scrollbars. I get valid user complaints.
- See (3) in the screenshot. Minor unrelated bug.
To answer your question 2:
- I can't c&p in setDisabled(true) or setCanEdit(false)+ReadOnlyDisplayAppearance.DISABLED (correct behaviour per docs)
- I can't scroll in setDisabled(true) or setCanEdit(false)+ReadOnlyDisplayAppearance.DISABLED (see linked thread above)
- c&p and scrolling from setCanEdit(false)+ReadOnlyDisplayAppearance.READONLY
- Gray font for both data and label from setDisabled(true) or setCanEdit(false)+ReadOnlyDisplayAppearance.DISABLED
This mode would have the best from both worlds and the other two modes would not be needed then, anymore IMHO. Again, "disabled" is unusable because of the TextAreaItem problem.
I'd see ReadOnlyDisplayAppearance.STATIC as more of a print-preview mode. It hides the nature of the data (free entry or dropdown).
To answer your question 3:
You had a checkbox "start disabled" in the marked location in the 2nd screenshot, which affected all samples.
Best regards
Blama
Leave a comment: