Update of /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17502/src/net/sourceforge/bprocessor/gui
Modified Files:
GUI.java
Added Files:
MaterialView.java
Log Message:
materials in their own tab
--- NEW FILE: MaterialView.java ---
//---------------------------------------------------------------------------------
// $Id: MaterialView.java,v 1.1 2008/05/08 10:22:02 henryml Exp $
//
// Copyright (c) 2005 The BProcessor Team (http://bprocessor.sourceforge.net)
// Released under the Lesser GNU Public License v2.1
//---------------------------------------------------------------------------------
package net.sourceforge.bprocessor.gui;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import net.sourceforge.bprocessor.gui.attrview.AttributeView;
import net.sourceforge.bprocessor.gui.treeview.MaterialTreeView;
import net.sourceforge.bprocessor.model.Material;
import net.sourceforge.bprocessor.model.Project;
/**
* A component for displaying views
*
*/
public class MaterialView extends JPanel implements ActionListener {
private JButton add;
private JButton remove;
private MaterialTreeView content;
/**
* The constructor
*
*/
public MaterialView() {
super();
setSize(100, 500);
this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
content = new MaterialTreeView();
add(new JScrollPane(content), BorderLayout.CENTER);
JPanel panel = new JPanel();
panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS));
add = new JButton("+");
remove = new JButton("-");
add.addActionListener(this);
remove.addActionListener(this);
panel.add(add);
panel.add(remove);
this.add(panel, BorderLayout.SOUTH);
}
/**
* Handle the actions on plus and minus
* @param a The actionevent
*/
public void actionPerformed(ActionEvent a) {
Object which = a.getSource();
Project p = Project.getInstance();
if (which == add) {
Material m = new Material();
m.setName("new material");
Project.getInstance().add(m);
AttributeView.instance().display(m);
Project.getInstance().changed(Project.getInstance());
Project.getInstance().checkpoint();
} else if (which == remove) {
System.out.println("REMOVE");
}
}
}
Index: GUI.java
===================================================================
RCS file: /cvsroot/bprocessor/gui/src/net/sourceforge/bprocessor/gui/GUI.java,v
retrieving revision 1.99
retrieving revision 1.100
diff -C2 -d -r1.99 -r1.100
*** GUI.java 1 Apr 2008 13:37:15 -0000 1.99
--- GUI.java 8 May 2008 10:22:03 -0000 1.100
***************
*** 751,754 ****
--- 751,755 ----
tree.addTab("Project", new JScrollPane (new SpaceTreeView()));
tree.addTab("Views", new CameraView());
+ tree.addTab("Materials", new MaterialView());
tree.addTab("Library", new JScrollPane (new LibraryTreeView()));
tree.addTab("DBK", new JScrollPane (new DBKTreeView()));
|