4,10 → 4,10 |
* Coded by: Group 5, software practice summer 2003 |
* University of Bielefeld, Germany |
* |
* @version $Revision: 1.44 $ |
* @version $Revision: 1.45 $ |
* |
* Last modification: $Date: 2003/07/21 18:55:34 $ |
* $Id: UpdateView.java,v 1.44 2003/07/21 18:55:34 smcsporr Exp $ |
* Last modification: $Date: 2003/07/22 12:04:26 $ |
* $Id: UpdateView.java,v 1.45 2003/07/22 12:04:26 mdonner Exp $ |
*/ |
|
package src.gui; |
22,6 → 22,7 |
|
import javax.swing.event.TreeExpansionEvent; |
import javax.swing.event.TreeModelEvent; |
import javax.swing.event.TreeSelectionEvent; |
import javax.swing.event.TreeSelectionListener; |
import javax.swing.event.TreeModelListener; |
import javax.swing.event.TreeExpansionListener; |
45,10 → 46,10 |
* |
* @author Christian Stollenwerk |
* |
* @version $Revision: 1.44 $ Last modification: $Date: 2003/07/21 18:55:34 $ |
* @version $Revision: 1.45 $ Last modification: $Date: 2003/07/22 12:04:26 $ |
*/ |
public class UpdateView implements ActionListener, UpdateViewInterface, |
OurEventListener, TreeModelListener, TreeExpansionListener { |
OurEventListener, TreeModelListener, TreeExpansionListener, TreeSelectionListener { |
|
private GUI gui; |
private ViewFilter viewFilter = new ViewFilter(); |
149,35 → 150,40 |
newPopUpJTree = new PopUpJTree(newTreeModel); |
newPopUpJTree.addTreeExpansionListener(this); |
newPopUpJTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); |
|
|
newPopUpJTree.setShowsRootHandles(true); |
|
|
|
// set the elements visible, which have been visible before |
treeVisibleList = documentManagerInterface.getActualVisibleTree(); |
System.out.println("treeVisibleList = " + treeVisibleList); |
|
if(treeVisibleList.size() != 0) { |
makeTreeView = true; |
|
int selectedRow=((Integer)treeVisibleList.getFirst()).intValue(); |
treeVisibleList.removeFirst(); |
Integer[] intList = (Integer[])treeVisibleList.toArray(); |
Object[] intList = treeVisibleList.toArray(); |
java.util.Arrays.sort(intList); |
newPopUpJTree.expandRow(0); |
|
|
//newPopUpJTree.expandRow(1); |
System.out.println("Sorted list:"); |
|
for(int i =0; i<intList.length;i++){ |
|
System.out.println(((Integer)intList[i]).intValue()); |
newPopUpJTree.expandRow(((Integer)intList[i]).intValue()); |
|
newPopUpJTree.expandRow(intList[i].intValue()); |
|
} |
|
newPopUpJTree.setSelectionRow(selectedRow); |
newPopUpJTree.treeDidChange(); |
makeTreeView = false; |
} |
|
newPopUpJTree.setRootVisible(false); |
|
//added 070703 Sascha W. |
TreeSelectionListener hui = pluginManagerInterface.getTreeSelectionListener(); |
newPopUpJTree.setTreeSelectionListener(hui); |
newPopUpJTree.setTreeSelectionListener(this); |
newTreeModel.addTreeModelListener(this); |
|
gui.setTree(newPopUpJTree); |
318,15 → 324,35 |
*/ |
public void treeExpanded(TreeExpansionEvent arg0) { |
if(! makeTreeView) { |
newPopUpJTree.setRootVisible(true); |
Enumeration list = newPopUpJTree.getExpandedDescendants(newPopUpJTree.getPathForRow(0)); |
LinkedList ll = new LinkedList(); |
if (newPopUpJTree.getSelectionRows()==null || newPopUpJTree.getSelectionRows().length==0){ |
ll.add(new Integer(1)); |
}else{ |
|
ll.addFirst(new Integer(newPopUpJTree.getSelectionRows()[0])); |
while(list.hasMoreElements()) { |
TreePath nextElement = (TreePath)list.nextElement(); |
ll.add(new Integer(newPopUpJTree.getRowForPath(nextElement))); |
} |
|
System.out.println(ll); |
|
if (list!=null){ |
while(list.hasMoreElements()) { |
TreePath nextElement = (TreePath)list.nextElement(); |
ll.add(new Integer(newPopUpJTree.getRowForPath(nextElement))); |
|
} |
} |
System.out.println(ll); |
newPopUpJTree.setRootVisible(false); |
documentManagerInterface.setActualVisibleTree(ll); |
} |
} |
/* (non-Javadoc) |
* @see javax.swing.event.TreeSelectionListener#valueChanged(javax.swing.event.TreeSelectionEvent) |
*/ |
public void valueChanged(TreeSelectionEvent arg0) { |
treeExpanded(null); |
|
} |
|
} |