Changeset 3405


Ignore:
Timestamp:
Sep 7, 2009, 9:19:30 AM (13 years ago)
Author:
Gregory Vincic
Message:

Refs #440. LabeledExtract? related actions modified to use FormFactory?.getForm(Class, Object) method

Location:
trunk/client/servlet
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/doc/form_factory_design.class.violet

    r3398 r3405  
    22<java version="1.6.0_15" class="java.beans.XMLDecoder">
    33 <object class="com.horstmann.violet.ClassDiagramGraph">
    4   <void method="addNode">
    5    <object id="InterfaceNode0" class="com.horstmann.violet.InterfaceNode">
    6     <void property="methods">
    7      <void property="text">
    8       <string>+populate(E obj)
    9 +getForm() : Form</string>
    10      </void>
    11     </void>
    12     <void property="name">
    13      <void property="text">
    14       <string>«interface»
    15 ObjectForm&lt;E extends Object&gt;</string>
    16      </void>
    17     </void>
    18    </object>
    19    <object class="java.awt.geom.Point2D$Double">
    20     <void method="setLocation">
    21      <double>768.0</double>
    22      <double>242.0</double>
    23     </void>
    24    </object>
    25   </void>
    264  <void method="addNode">
    275   <object id="ClassNode0" class="com.horstmann.violet.ClassNode">
     
    3311    <void property="methods">
    3412     <void property="text">
    35       <string>+getForm(Class&lt;BasicItem&gt; cls, BasicItem obj) : Form
    36 +getForm(Class&lt;BasicItem&gt; cls) : Form</string>
    37      </void>
    38     </void>
    39     <void property="name">
    40      <void property="text">
    41       <string>FormFactory</string>
    42      </void>
    43     </void>
    44    </object>
    45    <object class="java.awt.geom.Point2D$Double">
    46     <void method="setLocation">
    47      <double>203.0</double>
    48      <double>335.0</double>
    49     </void>
    50    </object>
    51   </void>
    52   <void method="addNode">
    53    <object id="ClassNode1" class="com.horstmann.violet.ClassNode">
    54     <void property="attributes">
    55      <void property="text">
    56       <string>...</string>
    57      </void>
    58     </void>
    59     <void property="methods">
    60      <void property="text">
    61       <string>+populate(LabeledExtract obj)
    62 +Form getForm()</string>
     13      <string>LabeledExtract(Select&lt;VInteger&gt;, LabeledExtract obj)
     14LabeledExtract(Select&lt;VInteger&gt;)</string>
    6315     </void>
    6416    </void>
     
    7123   <object class="java.awt.geom.Point2D$Double">
    7224    <void method="setLocation">
    73      <double>764.0</double>
    74      <double>488.0</double>
     25     <double>504.0</double>
     26     <double>401.0</double>
    7527    </void>
    7628   </object>
    7729  </void>
    7830  <void method="addNode">
    79    <object id="NoteNode0" class="com.horstmann.violet.NoteNode">
    80     <void property="text">
     31   <object id="ClassNode1" class="com.horstmann.violet.ClassNode">
     32    <void property="name">
    8133     <void property="text">
    82       <string>The FormFactory returns a form for the given BasicItem class.
    83 </string>
     34      <string>NameableProperties</string>
    8435     </void>
    8536    </void>
     
    8738   <object class="java.awt.geom.Point2D$Double">
    8839    <void method="setLocation">
    89      <double>178.0</double>
    90      <double>225.0</double>
    91     </void>
    92    </object>
    93   </void>
    94   <void method="addNode">
    95    <object id="NoteNode1" class="com.horstmann.violet.NoteNode">
    96     <void property="text">
    97      <void property="text">
    98       <string>The getForm() method builds the form which can populated with an object.
    99 NOTE that the form must be created during object construction so that
    100 populate(obj) may be executed before getForm().</string>
    101      </void>
    102     </void>
    103    </object>
    104    <object class="java.awt.geom.Point2D$Double">
    105     <void method="setLocation">
    106      <double>610.0</double>
    107      <double>110.0</double>
     40     <double>1020.0</double>
     41     <double>402.0</double>
    10842    </void>
    10943   </object>
     
    11145  <void method="addNode">
    11246   <object id="ClassNode2" class="com.horstmann.violet.ClassNode">
    113     <void property="methods">
    114      <void property="text">
    115       <string>+getFieldset() : Fieldset</string>
    116      </void>
    117     </void>
    118     <void property="name">
    119      <void property="text">
    120       <string>NameableFields</string>
    121      </void>
    122     </void>
    123    </object>
    124    <object class="java.awt.geom.Point2D$Double">
    125     <void method="setLocation">
    126      <double>1167.0</double>
    127      <double>463.0</double>
    128     </void>
    129    </object>
    130   </void>
    131   <void method="addNode">
    132    <object id="ClassNode3" class="com.horstmann.violet.ClassNode">
    13347    <void property="name">
    13448     <void property="text">
     
    13953   <object class="java.awt.geom.Point2D$Double">
    14054    <void method="setLocation">
    141      <double>1173.0</double>
    142      <double>372.0</double>
     55     <double>738.0</double>
     56     <double>243.0</double>
    14357    </void>
    14458   </object>
    14559  </void>
    14660  <void method="addNode">
    147    <object id="NoteNode2" class="com.horstmann.violet.NoteNode">
    148     <void property="text">
     61   <object id="ClassNode3" class="com.horstmann.violet.ClassNode">
     62    <void property="name">
    14963     <void property="text">
    150       <string>Each item class should have it&apos;s own
    151 implementation of the ObjectForm.</string>
     64      <string>Fieldset</string>
    15265     </void>
    15366    </void>
     
    15568   <object class="java.awt.geom.Point2D$Double">
    15669    <void method="setLocation">
    157      <double>322.0</double>
    158      <double>511.0</double>
     70     <double>1045.0</double>
     71     <double>244.0</double>
    15972    </void>
    16073   </object>
    16174  </void>
    16275  <void method="addNode">
    163    <object id="PointNode0" class="com.horstmann.violet.PointNode">
    164     <void id="Rectangle2D$Double0" property="bounds">
    165      <void method="setRect">
    166       <double>983.0</double>
    167       <double>111.0</double>
    168       <double>0.0</double>
    169       <double>0.0</double>
     76   <object id="NoteNode0" class="com.horstmann.violet.NoteNode">
     77    <void property="text">
     78     <void property="text">
     79      <string>Extended forms should have one constructor that
     80creates an empty form for new items and one for
     81creating forms for existing items.
     82The most obvious difference is the itemId field which should
     83not be present in new item forms.
     84The itemId field should however be present when an item object is
     85passed to the constructor.</string>
    17086     </void>
    171     </void>
    172     <void property="bounds">
    173      <object idref="Rectangle2D$Double0"/>
    17487    </void>
    17588   </object>
    17689   <object class="java.awt.geom.Point2D$Double">
    17790    <void method="setLocation">
    178      <double>983.0</double>
    179      <double>111.0</double>
     91     <double>153.0</double>
     92     <double>208.0</double>
    18093    </void>
    18194   </object>
    182   </void>
    183   <void method="connect">
    184    <object class="com.horstmann.violet.ClassRelationshipEdge">
    185     <void property="bentStyle">
    186      <object class="com.horstmann.violet.BentStyle" field="HVH"/>
    187     </void>
    188     <void property="endArrowHead">
    189      <object class="com.horstmann.violet.ArrowHead" field="V"/>
    190     </void>
    191    </object>
    192    <object idref="ClassNode0"/>
    193    <object idref="InterfaceNode0"/>
    194   </void>
    195   <void method="connect">
    196    <object class="com.horstmann.violet.ClassRelationshipEdge">
    197     <void property="bentStyle">
    198      <object class="com.horstmann.violet.BentStyle" field="VHV"/>
    199     </void>
    200     <void property="endArrowHead">
    201      <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/>
    202     </void>
    203     <void property="lineStyle">
    204      <object class="com.horstmann.violet.LineStyle" field="DOTTED"/>
    205     </void>
    206     <void property="middleLabel">
    207      <string>LabeledExtract</string>
    208     </void>
    209    </object>
    210    <object idref="ClassNode1"/>
    211    <object idref="InterfaceNode0"/>
    212   </void>
    213   <void method="connect">
    214    <object class="com.horstmann.violet.NoteEdge"/>
    215    <object idref="ClassNode0"/>
    216    <object idref="NoteNode0"/>
    21795  </void>
    21896  <void method="connect">
     
    225103    </void>
    226104   </object>
     105   <object idref="ClassNode0"/>
    227106   <object idref="ClassNode1"/>
    228    <object idref="ClassNode2"/>
    229107  </void>
    230108  <void method="connect">
    231109   <object class="com.horstmann.violet.ClassRelationshipEdge">
    232110    <void property="bentStyle">
    233      <object class="com.horstmann.violet.BentStyle" field="HVH"/>
     111     <object class="com.horstmann.violet.BentStyle" field="VHV"/>
    234112    </void>
    235     <void property="startArrowHead">
    236      <object class="com.horstmann.violet.ArrowHead" field="DIAMOND"/>
     113    <void property="endArrowHead">
     114     <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/>
    237115    </void>
    238116   </object>
     
    241119  </void>
    242120  <void method="connect">
    243    <object class="com.horstmann.violet.NoteEdge"/>
    244    <object idref="ClassNode1"/>
    245    <object idref="NoteNode2"/>
     121   <object class="com.horstmann.violet.ClassRelationshipEdge">
     122    <void property="bentStyle">
     123     <object class="com.horstmann.violet.BentStyle" field="VHV"/>
     124    </void>
     125    <void property="endArrowHead">
     126     <object class="com.horstmann.violet.ArrowHead" field="TRIANGLE"/>
     127    </void>
     128   </object>
     129   <object idref="ClassNode0"/>
     130   <object idref="ClassNode2"/>
    246131  </void>
    247132  <void method="connect">
    248133   <object class="com.horstmann.violet.NoteEdge"/>
    249    <object idref="InterfaceNode0"/>
    250    <object idref="NoteNode1"/>
    251   </void>
    252   <void method="connect">
    253    <object class="com.horstmann.violet.NoteEdge"/>
    254    <object idref="NoteNode1"/>
    255    <object idref="PointNode0"/>
     134   <object idref="ClassNode0"/>
     135   <object idref="NoteNode0"/>
    256136  </void>
    257137 </object>
  • trunk/client/servlet/src/org/proteios/action/extract/NewLabeledExtract.java

    r2414 r3405  
    3131import org.proteios.core.DbControl;
    3232import org.proteios.core.Extract;
     33import org.proteios.core.LabeledExtract;
    3334import org.proteios.core.ItemFactory;
    3435import org.proteios.gui.Title;
    3536import org.proteios.gui.Toolbar;
    3637import org.proteios.gui.form.Form;
     38import org.proteios.gui.form.LabeledExtractForm;
    3739import org.proteios.gui.layout.RowLayout;
    3840
     
    5961     */
    6062    verifySessionAttributes(ViewActiveExtract.VEXTRACTID);
    61     /***********************************************************************
    62      * Extract form
    63      */
    64     Integer extractId = getSessionAttribute(ViewActiveExtract.VEXTRACTID);
    65     DbControl dc = newDbControl();
    66     ItemFactory factory = getItemFactory(dc);
    67     Extract extract = null;
     63
     64  // Define
     65    Integer extractId;
     66  DbControl dc;
     67  ItemFactory factory;
     68  Extract extract;
     69  Form form;
     70  Toolbar tb;
     71  RowLayout layout;
     72  Title title;
     73
     74  // Create
     75    extractId = getSessionAttribute(ViewActiveExtract.VEXTRACTID);
     76    dc = newDbControl();
     77    factory = getItemFactory(dc);
     78    extract = null;
     79    tb = new Toolbar();
     80  title = new Title("New labeled extract");
     81
     82  // Use
    6883    if (extractId != null && extractId > 0)
    6984    {
    7085      extract = factory.getById(Extract.class, extractId);
    7186    }
    72     Form form = getFormFactory().getLabeledExtractForm(null,dc,extract);
     87  form = getFormFactory().getForm(LabeledExtract.class, null);
     88   
    7389    if (extract != null)
    7490    {
     
    7793    //populateForm(form); // In case saving failed
    7894    // Toolbar
    79     Toolbar tb = new Toolbar();
     95
    8096    form.setToolbar(tb);
    81     tb.add(getActionFactory().getActionLink(AddLabeledExtract.class,
    82       "Save"));
    83     /***********************************************************************
    84      * Layout
    85      */
    86     RowLayout layout = getLayoutFactory().getRowLayout();
    87     layout.add(new Title("New labeled extract"));
     97    tb.add(getActionFactory().getActionLink(AddLabeledExtract.class, "Save"));
     98
     99    layout = getLayoutFactory().getRowLayout();
     100    layout.add(title);
    88101    layout.add(form);
    89102    setLayout(layout);
  • trunk/client/servlet/src/org/proteios/action/extract/SaveLabeledExtract.java

    r2554 r3405  
    5454     */
    5555    DbControl dc = newDbControl();
    56     Form form = getFormFactory().getLabeledExtractForm(null, dc, null);
     56    Form form = getFormFactory().getForm(LabeledExtract.class, null);
    5757    verifyParameters(form);
    5858    /***********************************************************************
  • trunk/client/servlet/src/org/proteios/action/extract/ViewActiveLabeledExtract.java

    r2967 r3405  
    9090    LabeledExtract extract = itemFactory.getById(LabeledExtract.class,
    9191      extractId);
    92     Form form = getFormFactory().getLabeledExtractForm(extract, dc, null);
     92    Form form = getFormFactory().getForm(LabeledExtract.class, extract);
    9393    form.setTitle("Labeled extract");
    9494    // Toolbar for Labeled Extract form
Note: See TracChangeset for help on using the changeset viewer.