001: package org.osbl.issue.gui;
002:
003: import org.osbl.client.wings.form.*;
004: import org.osbl.client.wings.form.editor.OneToManyCompositionEditor;
005: import org.osbl.client.wings.form.layouter.*;
006: import org.osbl.client.wings.shell.Client;
007: import org.osbl.issue.model.*;
008: import org.osbl.issue.model.Issue;
009: import org.conform.wings.editor.StringsEditor;
010: import org.conform.wings.ComponentFactory;
011: import org.conform.wings.PropertyEditableCellRenderer;
012: import org.conform.modifier.*;
013: import org.conform.*;
014: import org.wings.*;
015: import org.wings.session.SessionManager;
016: import org.wings.table.STableColumnModel;
017: import org.wingx.table.XTableColumnModel;
018: import org.wingx.table.EditableTableCellRenderer;
019:
020: import javax.swing.*;
021: import java.awt.event.ActionEvent;
022: import java.util.*;
023: import java.text.Collator;
024:
025: public class IssueForm extends GenericObjectForm {
026: public IssueForm() {
027: setDocumentLook(true);
028: }
029:
030: @Override
031: protected Object getObject(String path) {
032: if (ComponentProvider.ROOT.equals(path))
033: return object;
034:
035: return null;
036: }
037:
038: @Override
039: protected void setObject(String path, Object object) {
040: if (ComponentProvider.ROOT.equals(path))
041: this .object = object;
042: }
043:
044: protected Instruction createLayoutInstruction() {
045: return new Page(new Division(Issue.class.getName(),
046: new Column(new LabelAndEditor(ComponentProvider.ROOT,
047: "key"), new LabelAndEditor(
048: ComponentProvider.ROOT, "name"),
049: new LabelAndEditor(ComponentProvider.ROOT,
050: "assignee")), new Column(
051: new LabelAndEditors("businessobject.created",
052: new Editor(ComponentProvider.ROOT,
053: "created"), new Editor(
054: ComponentProvider.ROOT,
055: "createdBy")),
056: new LabelAndEditor(ComponentProvider.ROOT,
057: "due"), new LabelAndEditor(
058: ComponentProvider.ROOT, "done"))),
059: new Division(Issue.class.getName() + ".links",
060: new Column(new LabelAndEditor(
061: ComponentProvider.ROOT, "links"))),
062: new Division("businessobject.description", new Column(
063: new LabelAndEditor(ComponentProvider.ROOT,
064: "description"))));
065: }
066:
067: protected BeanMeta createBeanMeta(String path) {
068: if (ComponentProvider.ROOT.equals(path)) {
069: return createIssueMeta();
070: } else if ("links".equals(path)) {
071: return createLinkMeta();
072: }
073: throw new RuntimeException("No BeanMeta for path " + path);
074: }
075:
076: protected BeanMeta createLinkMeta() {
077: return new VariationBeanMetaProvider(Client.getInstance()
078: .getBeanMetaProvider()).addModifier(
079: new HiddenModifier()).addModifier(
080: new PropertyOrderModifier("name", "link")).addModifier(
081: new InlineModifier() {
082: protected void configure() {
083: property("name").setReadable(true);
084: property("name").setWritable(true);
085: property("link").setReadable(true);
086: property("link").setWritable(true);
087: }
088: }).getBeanMeta(Link.class);
089: }
090:
091: protected BeanMeta createIssueMeta() {
092: return new VariationBeanMetaProvider(Client.getInstance()
093: .getBeanMetaProvider()).addModifier(
094: new InlineModifier() {
095: protected void configure() {
096: property("links").setAttribute(
097: org.conform.wings.Editor.CUSTOM_EDITOR,
098: new ClickableLinksEditor());
099: property("links").setRelationBean(
100: getBeanMeta("links"));
101: }
102: }).getBeanMeta(Issue.class);
103: }
104: }
|