Changeset 4458


Ignore:
Timestamp:
Mar 20, 2013, 2:37:09 PM (10 years ago)
Author:
olle
Message:

Refs #803. Refs #283. Biomaterial - file associations can now be defined by selecting biomaterials to be associated with a file, instead of the other way around:

  1. Class/file action/file/ViewActiveFile.java in client/servlet/ updated to always show the association table. The table tool-bar is updated with a new button "Add BioMaterials" coupled to action link to new class/file action/file/AddFileBioMaterial.java in client/servlet/.
  2. New class/file action/file/AddFileBioMaterial.java in client/servlet/ added. It uses class ViewItemTable to display a table of available biomaterials to select from, after which action is forwarded to new class CreateFileBioMaterial.
  3. Class/file action/ViewItemTable.java in client/servlet/ is based on class/file action/directory/ViewActiveDirectory.java in client/servlet/, but without the extra complexity added by the directory table. ViewItemTable is intended to be used for item classes of type Class<? extends BasicItem>. If session attribute VBoolean ViewItemTable.VSELECT is null or true, select mode will be used. The list of integer id values for selected items is available in valid parameter FormFactory.VID.
  4. New class/file action/file/CreateFileBioMaterial.java in client/servlet/ added. It obtains a list of biomaterial id values from valid parameter FormFactory.VID and adds the items to the file.
  5. English dictionary file locale/en/dictionary in client/servlet/ updated with new entries for various string keys.
  6. Default icon settings file icons/default in client/servlet/ updated with icon assignments for new string keys.
Location:
trunk/client/servlet/src
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/client/servlet/src/icons/default

    r4239 r4458  
    3333# Login=login.jpg
    3434Abort=icons/abort.png
     35AddBioMaterials=icons/add.png
    3536AddFiles=icons/add.png
    3637AddDiGESeparation=icons/add.png
  • trunk/client/servlet/src/locale/en/dictionary

    r4359 r4458  
    4242ActiveProject=Active Project
    4343ActiveProjectId=Active Project ID
     44AddBioMaterials=Add BioMaterials
    4445AddContactInfo=Add contact info
    4546AddSampleInfo=Add sample name
  • trunk/client/servlet/src/org/proteios/action/file/ViewActiveFile.java

    r4433 r4458  
    3636import org.proteios.action.biomaterial.ViewBioMaterial;
    3737import org.proteios.action.directory.ViewActiveDirectory;
     38import org.proteios.action.sample.AddSampleFile;
    3839import org.proteios.action.write.AddAnnotation;
    3940import org.proteios.action.write.DeleteActiveItem;
     
    5758import org.proteios.gui.Toolbar;
    5859import org.proteios.gui.form.AnnotationsForm;
     60import org.proteios.gui.form.BioMaterialIdField;
    5961import org.proteios.gui.form.Checkbox;
     62import org.proteios.gui.form.FileField;
    6063import org.proteios.gui.form.Form;
    6164import org.proteios.gui.form.FormFactory;
     
    113116    Table annotationTable, bioTable;
    114117    String mimeType;
    115     Row row;
    116118    Image img;
    117119    RowLayout layout;
     
    316318  {
    317319    Table bioTable = null;
     320    bioTable = new Table("biomaterials");
     321    bioTable.setTitle("AnnotatedBiomaterials");
     322    bioTable.setUseCheckBox(true);
     323    bioTable.add(new Column<Checkbox<VInteger>>(""));
     324    bioTable.add(new Column<String>("Name"));
     325    bioTable.add(new Column<String>("ExternalId"));
    318326    Iterator<BioMaterial> bioit = file.getBioMaterials().iterator();
    319     if (bioit.hasNext())
    320     {
    321       bioTable = new Table("biomaterials");
    322       bioTable.setTitle("AnnotatedBiomaterials");
    323       bioTable.setUseCheckBox(true);
    324       bioTable.add(new Column<Checkbox<VInteger>>(""));
    325       bioTable.add(new Column<String>("Name"));
    326       bioTable.add(new Column<String>("ExternalId"));
    327       while (bioit.hasNext())
    328       {
    329         BioMaterial<?> bm = bioit.next();
    330         Row row = new Row(bm.getId());
    331         ActionLink viewSample = getActionFactory().getActionLink(
    332           ViewBioMaterial.class, "View");
    333         viewSample.addParameter(FormFactory.VID, bm.getId());
    334         Checkbox<VInteger> cb = new Checkbox<VInteger>(RemoveBioMaterialsFromFile.VBIOMATERIALID);
    335         cb.setValue(bm.getId());
    336         Cell<Checkbox<VInteger>> chk = new Cell<Checkbox<VInteger>>(cb);
    337         row.addCell(chk);
    338         Cell<String> name = new Cell<String>(bm.getName());
    339         name.setActionLink(viewSample);
    340         row.addCell(name);
    341         row.addCell(new Cell<String>(bm.getExternalId()));
    342         bioTable.addRow(row);
    343       }
    344       Toolbar toolbar = new Toolbar();
    345       ActionLink al = getActionFactory().getActionLink(
    346         RemoveBioMaterialsFromFile.class, "Remove");
    347       al.addParameter(RemoveBioMaterialsFromFile.VFILEID, file.getId());
    348       toolbar.add(al);
    349       bioTable.setToolbar(toolbar);
    350 
    351     }
     327    while (bioit.hasNext())
     328    {
     329      BioMaterial<?> bm = bioit.next();
     330      Row row = new Row(bm.getId());
     331      ActionLink viewSample = getActionFactory().getActionLink(
     332        ViewBioMaterial.class, "View");
     333      viewSample.addParameter(FormFactory.VID, bm.getId());
     334      Checkbox<VInteger> cb = new Checkbox<VInteger>(RemoveBioMaterialsFromFile.VBIOMATERIALID);
     335      cb.setValue(bm.getId());
     336      Cell<Checkbox<VInteger>> chk = new Cell<Checkbox<VInteger>>(cb);
     337      row.addCell(chk);
     338      Cell<String> name = new Cell<String>(bm.getName());
     339      name.setActionLink(viewSample);
     340      row.addCell(name);
     341      row.addCell(new Cell<String>(bm.getExternalId()));
     342      bioTable.addRow(row);
     343    }
     344    Toolbar toolbar = new Toolbar();
     345    ActionLink bioMaterialLink = getActionFactory().getActionLink(AddFileBioMaterial.class,
     346                "AddBioMaterials");
     347        bioMaterialLink.addParameter(ViewActiveFile.VFILEID, file.getId());
     348        toolbar.add(bioMaterialLink);
     349    ActionLink al = getActionFactory().getActionLink(
     350      RemoveBioMaterialsFromFile.class, "Remove");
     351    al.addParameter(RemoveBioMaterialsFromFile.VFILEID, file.getId());
     352    toolbar.add(al);
     353    bioTable.setToolbar(toolbar);
    352354    return bioTable;
    353355  }
Note: See TracChangeset for help on using the changeset viewer.