ObjectWeb Consortium
Search ObjectWeb Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | jawe List | April 2006 Index

<--  Date Index  --> <--  Thread Index  -->

Re: [jawe] inserting existing participants in workflow process does not work anymore with jawe 2.0


Yes, no problem, see attached patch
Please note the lots of changes in XMLElementChoiceButton are
unfortunately a side effect of doing an automatic code identation in
eclipse.

Regards,
David

Sasa Bojanic a écrit :

> We already did something similar (we are always using JList), but  it 
> would be great if you can send us your solution.
>
> Sasa.
>
> David Delbecq wrote:
>
>> I have fixed the code of menu button myself, i can provide the fix in
>> LGPL if you want.
>> If the button has to list more than 30 entries, it uses a scrollable
>> JList instead of JMenuItem, be it participant or any other listing.
>> I also added a the capability to show detailed informations on
>> participant in form of tooltip text, provided the creator of button
>> provided a list of attributes to show.
>>
>> Regards,
>> David
>>
>> Sasa Bojanic a écrit :
>>
>>  
>>
>>> Hi,
>>>
>>> yes, we noticed it, and it'll be fixed :-)
>>>
>>> There is another way to add a participant:
>>>
>>> 1. put the activity somewhere
>>> 2. open activity's property panel
>>> 3. select the performer for the activity from the list of participants
>>>
>>> Graph will automatically react upon your action, and participant's
>>> swim-line will be inserted.
>>>
>>> Regards,
>>> Sasa.
>>>
>>> David Delbecq wrote:
>>>
>>>    
>>>
>>>> Hello,
>>>>
>>>> In jawe 1.4, when you had to add existing participants imported
>>>> from an
>>>> external package to a workflow process, you simply had to show the
>>>> list
>>>> of participants, and for each participant you needed click on
>>>> 'show' to
>>>> add it to workflow process. This has been changed and seems to make it
>>>> impossible for us to use jawe 2.0 (TWE) to design workflow process.
>>>> All
>>>> i could find is a icon labeled 'Insert existing participant in the
>>>> graph'. When you click on it, you get a list of participants in a
>>>> dropdown. This dropdown has neither details on participants, neither a
>>>> scroll bar for long lists. However, as we imported the whole list of
>>>> company users, roles, we have a list of a few hundred participants
>>>> imported, only the about 60 first of them are showed. When in
>>>> contrario
>>>> going to 'external packages' -> 'Participants' menu, we indeed get a
>>>> browseable list of of participant, but no 'show' button like it was in
>>>> the past.
>>>>
>>>> I used the lastest available JaWe doc as reference:
>>>> http://jawe.objectweb.org/doc/1.4/Manual/ch05s08.html
>>>>
>>>> I attached the a screen copy of my participant list and a visual
>>>> result
>>>> of the dropdow. I used latest TWE comunity version according to
>>>> webstart
>>>> link.
>>>>
>>>> My question is, is there another way to add participants using the gui
>>>> or will i be forced to switch back to jawe 1.4?
>>>>
>>>> Thanks.
>>>> David Delbecq
>>>>
>>>> PS: I did cross-post to Shark Mailing list as it seems far more active
>>>> than Jawe one and those both product are related.
>>>>  
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>>
>>>> -- 
>>>> You receive this message as a subscriber of the jawe@xxxxxxxxxxxxx
>>>> mailing list.
>>>> To unsubscribe: mailto:jawe-unsubscribe@xxxxxxxxxxxxx
>>>> For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
>>>> ObjectWeb mailing lists service home page:
>>>> http://www.objectweb.org/wws
>>>>         
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>>
>>> -- 
>>> You receive this message as a subscriber of the jawe@xxxxxxxxxxxxx
>>> mailing list.
>>> To unsubscribe: mailto:jawe-unsubscribe@xxxxxxxxxxxxx
>>> For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
>>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>>  
>>>
>>>     
>>
>>
>>
>>  
>> ------------------------------------------------------------------------
>>
>>
>> -- 
>> You receive this message as a subscriber of the jawe@xxxxxxxxxxxxx
>> mailing list.
>> To unsubscribe: mailto:jawe-unsubscribe@xxxxxxxxxxxxx
>> For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
>> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>>   
>
>
>
>------------------------------------------------------------------------
>
>
>--
>You receive this message as a subscriber of the jawe@xxxxxxxxxxxxx mailing 
>list.
>To unsubscribe: mailto:jawe-unsubscribe@xxxxxxxxxxxxx
>For general help: mailto:sympa@xxxxxxxxxxxxx?subject=help
>ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  
>

Index: 
modules/Graph/src/org/enhydra/jawe/components/graph/GraphControllerPanel.java
===================================================================
RCS file: 
/cvsroot/jawe/JaWE/modules/Graph/src/org/enhydra/jawe/components/graph/GraphControllerPanel.java,v
retrieving revision 1.2
diff -u -r1.2 GraphControllerPanel.java
--- 
modules/Graph/src/org/enhydra/jawe/components/graph/GraphControllerPanel.java 
      28 Feb 2006 14:13:07 -0000      1.2
+++ 
modules/Graph/src/org/enhydra/jawe/components/graph/GraphControllerPanel.java 
      25 Apr 2006 12:22:10 -0000
@@ -51,7 +51,7 @@
       toolbar.setFloatable(false);
       // creating button panel
       ImageIcon curIc = controller.getGraphSettings().getParticipantsIcon();
-      showParticipantChoiceButton = new 
XMLElementChoiceButton(Participant.class,controller,curIc);
+      showParticipantChoiceButton = new 
XMLElementChoiceButton(Participant.class,controller,curIc,new String[] 
{"Id","Name","ParticipantType","Description"});
       
showParticipantChoiceButton.setToolTipText(controller.getSettings().getLanguageDependentString("InsertExistingParticipant"
 + BarFactory.TOOLTIP_POSTFIX));
       curIc = controller.getGraphSettings().getActivitySetSelectIcon();
       asChoiceButton = new XMLElementChoiceButton(ActivitySet.class, 
controller, curIc);
Index: modules/Utilities/src/org/enhydra/jawe/XMLElementChoiceButton.java
===================================================================
RCS file: 
/cvsroot/jawe/JaWE/modules/Utilities/src/org/enhydra/jawe/XMLElementChoiceButton.java,v
retrieving revision 1.1
diff -u -r1.1 XMLElementChoiceButton.java
--- modules/Utilities/src/org/enhydra/jawe/XMLElementChoiceButton.java  30 
Dec 2005 12:45:09 -0000      1.1
+++ modules/Utilities/src/org/enhydra/jawe/XMLElementChoiceButton.java  25 
Apr 2006 12:22:10 -0000
@@ -1,17 +1,29 @@
 package org.enhydra.jawe;
 
+import java.awt.Component;
 import java.awt.Dimension;
 import java.awt.Insets;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import javax.swing.ImageIcon;
+import javax.swing.JLabel;
+import javax.swing.JList;
 import javax.swing.JMenuItem;
 import javax.swing.JPopupMenu;
+import javax.swing.JScrollPane;
+import javax.swing.ListCellRenderer;
+import javax.swing.ToolTipManager;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
 
+import org.enhydra.jawe.base.panel.InlinePanel;
 import org.enhydra.shark.utilities.SequencedHashMap;
+import org.enhydra.shark.xpdl.XMLComplexElement;
 import org.enhydra.shark.xpdl.XMLElement;
 
 /**
@@ -20,66 +32,123 @@
  * @author Sasa Bojanic
  * @author Miroslav Popov
  */
-public class XMLElementChoiceButton extends ChoiceButton implements 
ActionListener {
-
-   protected ChoiceButtonListener parent;
-   
-   protected SequencedHashMap choiceMap=new SequencedHashMap();
-   protected JPopupMenu popup=new JPopupMenu();
-
-   protected Class choiceType;
-   public XMLElementChoiceButton(Class choiceType,ChoiceButtonListener 
parent,ImageIcon icon) {
-      this.parent = parent;
-      this.choiceType=choiceType;
-      
-      setIcon(icon);
-      addActionListener(this);
-      setMargin(new Insets(1, 2, 1, 2));
-      setSize(new Dimension(10, 8));
-      setAlignmentY(0.5f);
-   }
-
-   public void actionPerformed(ActionEvent ae) {
-      if (ae.getSource() == this) {
-         refresh();
-         if (choiceMap.size() > 0) {
-            popup.show(this.getParent(), this.getX(), 
this.getY()+this.getHeight());
-         }
-      } else {
-         JMenuItem selected = (JMenuItem) ae.getSource();
-         int sel=popup.getComponentIndex(selected);
-         Object obj=choiceMap.getValue(sel);
-         parent.selectionChanged(this,obj);
-         choiceMap.clear();
-      }
-      
-   }
-
-   protected void refresh () {
-      choiceMap.clear();
-      popup.removeAll();
-      List choices=parent.getChoices(this);
-      if (choices!=null) {
-         Iterator it=choices.iterator();
-         while (it.hasNext()) {
-            XMLElement choice=(XMLElement)it.next();
-            //choiceMap.put(getDisplayName(choice),choice);
-            
choiceMap.put(JaWEManager.getInstance().getDisplayNameGenerator().getDisplayName(choice),choice);
-         }
-      }
-
-      if (choiceMap.size() > 0) {
-         String[] names = new String[choiceMap.size()];
-         choiceMap.keySet().toArray(names);
-         for (int i = 0; i < choiceMap.size(); i++) {
-            JMenuItem mi = popup.add(names[i]);
-            mi.addActionListener(this);
-         }
-      }
-   }
-
-   public Class getChoiceType () {
-      return choiceType;
-   }
-   
+public class XMLElementChoiceButton extends ChoiceButton implements 
ActionListener, ListSelectionListener {
+       
+       protected ChoiceButtonListener parent;
+       
+       protected SequencedHashMap choiceMap=new SequencedHashMap();
+       protected JPopupMenu popup=new JPopupMenu();
+       
+       protected Class choiceType;
+       protected String[] columnsToShow;
+       public XMLElementChoiceButton(Class choiceType,ChoiceButtonListener 
parent,ImageIcon icon) {
+        this(choiceType,parent,icon,null);
+       }
+       public XMLElementChoiceButton(Class choiceType,ChoiceButtonListener 
parent,ImageIcon icon, String[] columnsToShow) {
+               this.parent = parent;
+               this.choiceType=choiceType;
+               this.columnsToShow=columnsToShow;
+               
+               setIcon(icon);
+               addActionListener(this);
+               setMargin(new Insets(1, 2, 1, 2));
+               setSize(new Dimension(10, 8));
+               setAlignmentY(0.5f);
+               ToolTipManager.sharedInstance().setDismissDelay(12000);
+       }
+       
+       public void actionPerformed(ActionEvent ae) {
+               if (ae.getSource() == this) {
+                       refresh();
+                       if (choiceMap.size() > 0) {
+                               popup.show(this.getParent(), this.getX(), 
this.getY()+this.getHeight());
+                       }
+               } else {
+                       JMenuItem selected = (JMenuItem) ae.getSource();
+                       int sel=popup.getComponentIndex(selected);
+                       Object obj=choiceMap.getValue(sel);
+                       parent.selectionChanged(this,obj);
+                       choiceMap.clear();
+               }
+               
+       }
+       public void valueChanged(ListSelectionEvent e) {
+               if (!e.getValueIsAdjusting()){
+                       JList l = (JList)e.getSource();
+                       Object obj = 
((Map.Entry)l.getSelectedValue()).getValue();
+                       parent.selectionChanged(this,obj);
+                       choiceMap.clear();
+                       popup.setVisible(false);
+               }
+       }
+       
+       protected void refresh () {
+               choiceMap.clear();
+               popup.removeAll();
+               List choices=parent.getChoices(this);
+               if (choices!=null) {
+                       Iterator it=choices.iterator();
+                       while (it.hasNext()) {
+                               XMLElement choice=(XMLElement)it.next();
+                               
//choiceMap.put(getDisplayName(choice),choice);
+                               
choiceMap.put(JaWEManager.getInstance().getDisplayNameGenerator().getDisplayName(choice),choice);
+                       }
+               }
+               if (choiceMap.size()>30){
+                       JList list = new 
JList(choiceMap.entrySet().toArray()){
+                               public String getToolTipText(MouseEvent evt) {
+                           int index = locationToIndex(evt.getPoint());
+                           Object item = getModel().getElementAt(index);
+                           return 
getElementTooltipText((XMLElement)((Map.Entry)item).getValue());
+                       }
+                       };
+                       list.setCellRenderer(new ListCellRenderer() {
+                               private JLabel renderComponent = new JLabel();
+                               public Component 
getListCellRendererComponent(JList list,
+                                               Object value, int index, 
boolean isSelected,
+                                               boolean cellHasFocus) {
+                                       String key = 
((Map.Entry)value).getKey().toString();
+                                       renderComponent.setText(key);
+                                       return renderComponent;
+                               }
+                       });
+                       list.setVisibleRowCount(30);
+                       list.addListSelectionListener(this);
+                       JScrollPane p = new JScrollPane(list);
+                       popup.add(p);
+               }
+               else if (choiceMap.size() > 0) {
+                       String[] names = new String[choiceMap.size()];
+                       choiceMap.keySet().toArray(names);
+                       for (int i = 0; i < choiceMap.size(); i++) {
+                               JMenuItem mi = new JMenuItem(names[i]);
+                               
mi.setToolTipText(getElementTooltipText((XMLElement)choiceMap.get(names[i])));
+                               popup.add(mi);
+                               mi.addActionListener(this);
+                       }
+               }
+       }
+       
+       public Class getChoiceType () {
+               return choiceType;
+       }
+       private String getElementTooltipText(XMLElement element){
+               StringBuffer buf = new StringBuffer();
+               InlinePanel pc = new InlinePanel();
+               if ((columnsToShow!=null) && (columnsToShow.length>0) && 
(element instanceof XMLComplexElement)) {
+                       XMLComplexElement cmel=(XMLComplexElement) element;
+                       for (int i=0;i<columnsToShow.length;i++){
+                               if (i>0)
+                                       buf.append(" / ");
+                               
buf.append(columnsToShow[i].toString()).append(": ");
+                               XMLElement el = 
cmel.get(columnsToShow[i].toString());
+                               if (el!=null) {
+                                       buf.append(el.toValue());
+                               }
+                       }
+               } else {
+                       buf.append(element.toValue());
+               }
+               return buf.toString();
+       }
 }


<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 1999-2005, ObjectWeb Consortium | contact | webmaster.