gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] fenfire/org/fenfire/loom Loom.java ViewSettings...


From: Benja Fallenstein
Subject: [Gzz-commits] fenfire/org/fenfire/loom Loom.java ViewSettings...
Date: Sun, 16 Mar 2003 08:44:14 -0500

CVSROOT:        /cvsroot/fenfire
Module name:    fenfire
Changes by:     Benja Fallenstein <address@hidden>      03/03/16 08:44:14

Modified files:
        org/fenfire/loom: Loom.java ViewSettings.java 
Added files:
        org/fenfire/loom: LoomMenuBar.java 

Log message:
        Move code

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/LoomMenuBar.java?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/Loom.java.diff?tr1=1.37&tr2=1.38&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/fenfire/fenfire/org/fenfire/loom/ViewSettings.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: fenfire/org/fenfire/loom/Loom.java
diff -u fenfire/org/fenfire/loom/Loom.java:1.37 
fenfire/org/fenfire/loom/Loom.java:1.38
--- fenfire/org/fenfire/loom/Loom.java:1.37     Sat Mar 15 16:57:59 2003
+++ fenfire/org/fenfire/loom/Loom.java  Sun Mar 16 08:44:14 2003
@@ -40,6 +40,7 @@
 import com.hp.hpl.mesa.rdf.jena.mem.*;
 
 /** The main Fenfire Loom application.
+ *  The code in this class is currently not tested.
  */
 public class Loom {
 
@@ -63,17 +64,6 @@
        NamespaceMap names = new NamespaceMap();
        names.loadMappings(new java.io.FileReader(file));
 
-       initialize(names);
-    }
-
-    /** Initialize the cursor and PUI after a model has been loaded.
-     */
-    protected void initialize(NamespaceMap names) throws RDFException, 
IOException,
-                                                        
org.xml.sax.SAXException {
-       Collection classes = new TreeSet(names.getComparator());
-       classes.addAll(ModelUtil.getClasses(model));
-       classes = new ArrayList(classes);
-
        propertiesBox.setModel(model, names);
        
        Statement stmt = model.listStatements().next();
@@ -82,54 +72,19 @@
                       propertiesBox.getStatementSelector(), names,
                       stmt.getSubject(), 1, stmt.getObject());
 
-       List properties = 
-           new ArrayList(ModelUtil.getNonNumericProperties(model));
-       Collections.sort(properties, names.getComparator());
-
-       showClassMenu.removeAll();
-       showClassBy.clear();
-       classes.add(null);
-       for(Iterator j=classes.iterator(); j.hasNext();) {
-           final Resource cls = (Resource)j.next();
-           Menu menu;
-           if(cls != null)
-               menu = new Menu(cursor.names.getAbbrev(cls.toString()));
-           else
-               menu = new Menu("All others");
-           showClassMenu.add(menu);
-           
-           MenuItem byURI = new MenuItem("by URI"); menu.add(byURI);
-           byURI.addActionListener(new ActionListener() {
-                   public void actionPerformed(ActionEvent _) {
-                       showClassBy.remove(cls);
-                       AbstractUpdateManager.chg();
-                   }
-               });
-           MenuItem sep = new MenuItem("-"); menu.add(sep);
-           for(Iterator k=properties.iterator(); k.hasNext();) {
-               final Property prop = (Property)k.next();
-               MenuItem mi = new MenuItem("by 
"+cursor.names.getAbbrev(prop.toString()));
-               menu.add(mi);
-               mi.addActionListener(new ActionListener() {
-                       public void actionPerformed(ActionEvent _) {
-                           if(cls != null)
-                               showClassBy.put(cls, prop);
-                           else
-                               showNoClassBy = prop;
-                           AbstractUpdateManager.chg();
-                       }
-                   });
-           }
-       }
+       menuBar.setModel(model, names);
     }
 
     protected Frame propFrame = new Frame("Properties");
 
     protected Dialog goTo;
     protected TextField goToText;
+    
+    protected LoomMenuBar menuBar = new LoomMenuBar(this);
 
     protected void showGoToDialog() {
        String uri = cursor.focus.getURI();
+       if(uri == null) uri = "";
        goToText.setText(uri);
        goToText.setCaretPosition(uri.length());
        goTo.setVisible(true);
@@ -160,7 +115,6 @@
 
     protected Map showClassBy = new HashMap();
     protected Property showNoClassBy = null;
-    protected Menu showClassMenu = new Menu("Show class");
 
     public Loom(String file, ColorScheme colors0) 
        throws RDFException, IOException, org.xml.sax.SAXException {
@@ -169,59 +123,6 @@
            load(new File(file));
        this.colors = colors0;
 
-       final MenuBar mBar = new MenuBar();
-       Menu mFile = new Menu("File"); mBar.add(mFile);
-       MenuItem mOpen = new MenuItem("Open..."); mFile.add(mOpen);
-       MenuItem mQuit = new MenuItem("Quit (Ctrl-Q)"); mFile.add(mQuit);
-       Menu mView = new Menu("View"); mBar.add(mView);
-       MenuItem mGoTo = new MenuItem("Go to URI... (Ctrl-G)"); 
-       mView.add(mGoTo); mView.add(new MenuItem("-"));
-       MenuItem mWheel = new /*Checkbox*/MenuItem("Wheel View");
-       MenuItem mSimple = new /*Checkbox*/MenuItem("Simple View"); 
-       mView.add(mWheel); mView.add(mSimple);
-       mView.add(new MenuItem("-"));
-       mView.add(showClassMenu);
-
-       mOpen.addActionListener(new ActionListener() {
-               public void actionPerformed(ActionEvent _) {
-                   fileDialog.show();
-                   if(fileDialog.getFile() != null) {
-                       try {
-                           load(new File(fileDialog.getDirectory(), 
fileDialog.getFile()));
-                       } catch(Exception e) {
-                           e.printStackTrace();
-                       }
-                   }
-                   AbstractUpdateManager.chg();
-               }
-           });
-
-       mQuit.addActionListener(new ActionListener() {
-               public void actionPerformed(ActionEvent _) {
-                   System.exit(0);
-               }
-           });
-
-       mGoTo.addActionListener(new ActionListener() {
-               public void actionPerformed(ActionEvent _) {
-                   showGoToDialog();
-               }
-           });
-
-       mWheel.addActionListener(new ActionListener() {
-               public void actionPerformed(ActionEvent _) {
-                   view.setWheelView();
-                   AbstractUpdateManager.chg();
-               }
-           });
-
-       mSimple.addActionListener(new ActionListener() {
-               public void actionPerformed(ActionEvent _) {
-                   view.setSimpleView();
-                   AbstractUpdateManager.chg();
-               }
-           });
-
        propFrame.setBounds(350, 300, 350, 200);
        propFrame.add(propertiesBox);
        propertiesBox.addItemListener(new ItemListener() {
@@ -474,7 +375,7 @@
                    
                    fileDialog = new FileDialog(frame, "Open",
                                                FileDialog.LOAD);
-                   frame.setMenuBar(mBar);
+                   frame.setMenuBar(menuBar);
                    AbstractUpdateManager.addWindow(scr);
                    scr.window.setLocation(0, 0, 640, 400);
                    propFrame.setVisible(true);
Index: fenfire/org/fenfire/loom/ViewSettings.java
diff -u fenfire/org/fenfire/loom/ViewSettings.java:1.1 
fenfire/org/fenfire/loom/ViewSettings.java:1.2
--- fenfire/org/fenfire/loom/ViewSettings.java:1.1      Sat Mar 15 16:57:59 2003
+++ fenfire/org/fenfire/loom/ViewSettings.java  Sun Mar 16 08:44:14 2003
@@ -26,7 +26,10 @@
  */
 package org.fenfire.loom;
 
-/**
+/** Loom view settings: Stores the 'current' view.
+ *  This knows whether we have the SimpleView
+ *  or the WheelView selected, and in the future
+ *  will hold other views too, as they get written.
  */
 public class ViewSettings {
     protected View[] views;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]