Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: ShuttleList component and bindings

  1. #1
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default ShuttleList component and bindings

    I know that RCP's mission is not to create components, but it all boils down to components at some point :wink:

    I've put together a ShuttleList component (standard 2 lists with shuttle buttons). I've created an RCP binder and binding for it as well.

    The implementation is a little unique in that it really behaves like a different UI implementation for a single list. (I didn't actually do that since I don't know much about creating alternate UI implementations). The ShuttleList presents a typical selection model that represents the "chosen" elements. It can be used identically to the BoundList implementation that is part of RCP.

    If anyone is interested, I'm happy to share the code.

    Also, if anyone knows of a similar component that I should have looked at, please post it since I'd like to compare implementations.

    Larry.

  2. #2
    Join Date
    Aug 2004
    Posts
    109

    Default

    what is shuttle list?
    can you send me a jar with it? (alex at law dot columbia dot edu)
    Cool controls never hurt :-)

    Thanks,
    Alex
    Thanks,
    Alex.

  3. #3
    Join Date
    Jul 2005
    Location
    Beijing, China
    Posts
    35

    Default Re: ShuttleList component and bindings

    Quote Originally Posted by lstreepy
    If anyone is interested, I'm happy to share the code.
    Hi larry,
    I am now working on a shufflelist of a project. I am very anxious of your shufflelist code, would you share it
    many thanks!
    sword in the hand but not mind

  4. #4
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default

    Ok - I've created a place for user community components on the wiki and posted the code for this one.

    Here's the link:

    http://opensource2.atlassian.com/con...nt+Integration

  5. #5

    Default Can you post an example of how to use this?

    Can you post an example of how to use this?

  6. #6
    Join Date
    Dec 2005
    Posts
    24

    Default

    --------------------------------------------------------------------------------

    Hi
    I use the component ShuttleList Larry posted. It is a nice component. I follow the sample he posted in the following link:http://opensource2.atlassian.com/con.../Contributions.

    It is cool. But I got two problems:
    1. when I push the edit button, the two lists are shown in the dialog. But they are in the compact format. I mean the contents of two lists are not shown immediatly. You must drag the dialog to make the dialog larger and then the whole two lists with contents are shown. Is there any one else who met that similar problem before?

    2. I want to manipulate the selected values in the list. I know there is a method of getSelectedValues() in the ShuttleList. But for the shuttle list creation, I have only shuttlelistForm for right now. How to get the selected values for this condition? I need to get the selected values to be saved into database. How can I do that?

    Thanks.
    Jeff

  7. #7
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default

    Jeff,

    2. I want to manipulate the selected values in the list. I know there is a method of getSelectedValues() in the ShuttleList. But for the shuttle list creation, I have only shuttlelistForm for right now. How to get the selected values for this condition? I need to get the selected values to be saved into database. How can I do that?
    If you are using the shuttle list as a component bound to a domain object property, then there's no need for you to access the component's selected values directly. They are automatically placed into the bound property whenever they selected list changes. Can you explain why you would need to handle the value commit yourself?

    In any case, if you need to access the shuttle list component, you can do it using the normal return value of the form builder's add method, like this:

    Code:
    ShuttleList shuttle = (ShuttleList) subformBuilder.add( bf.createBoundShuttleList( "fhmSpecialty",
                MasterLists.FHM_SPECIALTY_DESCRIPTIONS ), "align=left" )[1];
    shuttle.setVisibleRowCount( 5 );
    Note that the "createBoundShuttleList" comes from an extended binding factory as explained in the wiki.

    HTH,
    Larry.

  8. #8
    Join Date
    Dec 2005
    Posts
    24

    Default

    Thanks, Larry
    Actually, I figure that out that It has no need to manually control the selected values. It is nice. Actually I integrate the springRCP and hibernate, there is a many-to-many relationship between project and equipment. I use the shuttlelist to assign existing equipment to a project. For that condition, I just code

    equipmentShuttleListForm.commit();
    projectManager.storeProject(project);(projectManag er is similar to clinic in the petclinic sample)

    in the onfinish() method. I am not sure whether I am correct or not. It throws an exception: ERROR BasicPropertyAccessor:115 - IllegalArgumentException in class: Equipment, getter method of property: id. It seems that The project don't know which equipments are assigned. Could you give me some hints? Thank you.

    Jeff

  9. #9
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default

    Hi Jeff,

    I'm sorry, but I've never used Hibernate, so I don't know off hand what the specific error message means.

    A couple of things come to mind:

    1. If the onFinish method you mention is the ApplicationDialog.onFinish, then the commit of the form(s) associated with the dialog have already been committed. So, the call to equipmentShuttleListForm.commit() would seem redundant, unless you're doing something out of the ordinary.

    2. I don't know where the reference to "project" is coming from and it was updated by the form(s) associated with the dialog. Further, from a quick search of the web, the error you post implies that there is a problem with the "id" accessor method on the Equipment class. Beyond that, I really don't have enough context to help out.

    Larry.

  10. #10
    Join Date
    Dec 2005
    Posts
    24

    Default

    Larry,
    I posted the code of my shuttlelist form and Assign Command:
    package sjgeophysics.fieldman.ui;


    public class EquipmentShuttleListForm extends AbstractForm{
    private Collection allEquipments;
    private ArrayList equipmentNameList = new ArrayList();


    public static final String EQUIPMENTSHUTTLELIST_FORM_PAGE = "equipmentShuttleListProperties";


    public EquipmentShuttleListForm(FormModel formModel) {
    super(formModel, EQUIPMENTSHUTTLELIST_FORM_PAGE);

    }

    protected JComponent createFormControl() {
    PdbBindingFactory pdf = (PdbBindingFactory)getBindingFactory();
    TableFormBuilder formBuilder = new TableFormBuilder(getBindingFactory());
    for (Iterator i = allEquipments.iterator(); i.hasNext() {
    Equipment equipment = (Equipment) i.next();
    equipmentNameList.add(equipment.getModel() + " " + equipment.getType());
    }
    formBuilder.add(pdf.createBoundShuttleList("equipm ents", equipmentNameList));
    return formBuilder.getForm();

    }

    public void setAllEquipments(Collection equipments) {
    this.allEquipments = equipments;
    // TODO Auto-generated method stub

    }

    }

    // Assign an Equipment to a project
    private class AssignEquipmentAction extends ActionCommand {

    public AssignEquipmentAction() {
    super("assignEquipmentCommand");
    }

    protected void doExecuteCommand() {

    final Project project = getSelectedProject();

    Collection equipments = projectManager.getEquipments();
    final HierarchicalFormModel formModel = FormModelHelper
    .createCompoundFormModel(project,
    "equipmentShuttleListModel");

    final EquipmentShuttleListForm equipmentShuttleListForm = new EquipmentShuttleListForm(
    formModel);

    equipmentShuttleListForm.setAllEquipments(equipmen ts);

    final FormBackedDialogPage dialogPage = new FormBackedDialogPage(
    equipmentShuttleListForm);

    TitledPageApplicationDialog dialog = new TitledPageApplicationDialog(
    dialogPage, getWindowControl()) {
    protected void onAboutToShow() {
    setEnabled(dialogPage.isPageComplete());
    }

    protected boolean onFinish() {
    // add assign code here
    equipmentShuttleListForm.commit();
    projectManager.storeProject(project);

    return true;
    }
    };
    dialog.showDialog();

    }
    }

    Thanks.
    Jeff

Similar Threads

  1. Replies: 2
    Last Post: Jul 22nd, 2005, 04:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •