[Bprocessor-commit] gui/src/net/sourceforge/bprocessor/gui/treeview GenericTreeView.java, 1.34, 1.3
Status: Pre-Alpha
Brought to you by:
henryml
From: rimestad <rim...@us...> - 2006-08-10 13:13:34
|
Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv21548/src/net/sourceforge/bprocessor/gui/treeview Modified Files: GenericTreeView.java Log Message: made own package for modellors and made them appear in the popupmenu in databaseview Index: GenericTreeView.java =================================================================== RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/treeview/GenericTreeView.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** GenericTreeView.java 9 Aug 2006 18:14:09 -0000 1.34 --- GenericTreeView.java 10 Aug 2006 13:13:32 -0000 1.35 *************** *** 25,28 **** --- 25,29 ---- import javax.swing.ImageIcon; + import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JTree; *************** *** 44,48 **** import net.sourceforge.bprocessor.model.Edge; import net.sourceforge.bprocessor.model.Entity; - import net.sourceforge.bprocessor.model.Modellor; import net.sourceforge.bprocessor.model.Observer; import net.sourceforge.bprocessor.model.ParameterBlock; --- 45,48 ---- *************** *** 53,56 **** --- 53,57 ---- import net.sourceforge.bprocessor.model.Vertex; import net.sourceforge.bprocessor.model.Geometry; + import net.sourceforge.bprocessor.model.modellor.Modellor; import net.sourceforge.bprocessor.gui.GUI; *************** *** 407,410 **** --- 408,428 ---- /** + * Actions for a entity + */ + public abstract class EntityModellorAction extends EntityAction { + /** The modellor number */ + protected Modellor which; + /** + * The constructor + * @param ent the entity + * @param m the modellor object + */ + public EntityModellorAction(Entity ent, Modellor m) { + super(ent, m.getName()); + this.which = m; + } + } + + /** * SpaceNode */ *************** *** 493,496 **** --- 511,538 ---- }; pm.add(flip); + // Adding all modellors + Collection c = Modellor.getRegisteredModellors(); + Iterator iter = c.iterator(); + while (iter.hasNext()) { + Modellor m = (Modellor)iter.next(); + AbstractAction modellor = new EntityModellorAction((Entity)object, m) { + public void actionPerformed(ActionEvent arg0) { + Space current = (Space)entity; + Modellor created = which.newInstance(current); + if (created != null) { + current.setModellor(created); + Selection.primary().clear(); + Selection.primary().add(created); + current.changed(); + } else { + JOptionPane.showMessageDialog( + null, + "The chosen space havn't been assigned to any surface", + "No envolope surface error", JOptionPane.ERROR_MESSAGE); + } + } + }; + pm.add(modellor); + } } return pm; |