Update of /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8571/src/org/javaowl/editor/swing
Modified Files:
BrowsePage.java
Log Message:
Added remove statement?
Is not changing de prevalent model.
Index: BrowsePage.java
===================================================================
RCS file: /cvsroot/javaowl/JavaOWL/src/org/javaowl/editor/swing/BrowsePage.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** BrowsePage.java 27 Jul 2004 15:59:56 -0000 1.4
--- BrowsePage.java 27 Jul 2004 17:25:36 -0000 1.5
***************
*** 22,25 ****
--- 22,27 ----
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
+ import java.awt.event.KeyAdapter;
+ import java.awt.event.KeyEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
***************
*** 54,60 ****
private final Component component;
! private final JCheckBox allInstances = new JCheckBox("Show inferred instances");
- private final JCheckBox allProperties = new JCheckBox("Show inferred properties");
private final Editor e;
--- 56,65 ----
private final Component component;
! private final JCheckBox allInstances = new JCheckBox(
! "Show inferred instances");
!
! private final JCheckBox allProperties = new JCheckBox(
! "Show inferred properties");
private final Editor e;
***************
*** 79,105 ****
MouseListener mouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
! int index = instancesList.locationToIndex(e.getPoint());
! Resource resource = (Resource) instances.elementAt(index);
! notifyEditResource(resource);
}
};
instancesList.addMouseListener(mouseListener);
instancesList.setCellRenderer(renderer);
allProperties.addItemListener(this);
allInstances.addItemListener(this);
JPanel propertiesPane = new JPanel();
! propertiesPane.setLayout(new BoxLayout(propertiesPane, BoxLayout.Y_AXIS));
propertiesPane.add(new JScrollPane(propertiesList));
propertiesPane.add(allProperties);
JPanel instancesPane = new JPanel();
-
instancesPane.setLayout(new BoxLayout(instancesPane, BoxLayout.Y_AXIS));
instancesPane.add(new JScrollPane(instancesList));
instancesPane.add(allInstances);
! JSplitPane left = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(tree
! .getComponent()), propertiesPane);
left.setDividerLocation(300);
left.setResizeWeight(0.5);
! JSplitPane center = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, instancesPane);
center.setDividerLocation(600);
center.setResizeWeight(0.5);
--- 84,124 ----
MouseListener mouseListener = new MouseAdapter() {
public void mouseClicked(MouseEvent e) {
! if (e.getClickCount() == 2) {
! int index = instancesList.locationToIndex(e.getPoint());
! Resource resource = (Resource) instances.elementAt(index);
! notifyEditResource(resource);
! }
}
};
instancesList.addMouseListener(mouseListener);
+ instancesList.addKeyListener(new KeyAdapter() {
+ public void keyReleased(KeyEvent e) {
+ if (KeyEvent.VK_DELETE == e.getKeyCode()) {
+ Resource resource = (Resource) instancesList
+ .getSelectedValue();
+ instances.removeElement(resource);
+ notifyRemoveResource(resource);
+ }
+
+ }
+ });
instancesList.setCellRenderer(renderer);
allProperties.addItemListener(this);
allInstances.addItemListener(this);
JPanel propertiesPane = new JPanel();
! propertiesPane
! .setLayout(new BoxLayout(propertiesPane, BoxLayout.Y_AXIS));
propertiesPane.add(new JScrollPane(propertiesList));
propertiesPane.add(allProperties);
JPanel instancesPane = new JPanel();
instancesPane.setLayout(new BoxLayout(instancesPane, BoxLayout.Y_AXIS));
instancesPane.add(new JScrollPane(instancesList));
instancesPane.add(allInstances);
! JSplitPane left = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
! new JScrollPane(tree.getComponent()), propertiesPane);
left.setDividerLocation(300);
left.setResizeWeight(0.5);
! JSplitPane center = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left,
! instancesPane);
center.setDividerLocation(600);
center.setResizeWeight(0.5);
***************
*** 114,118 ****
e.editResource(resource);
}
!
private void notifySetStatus() {
e.setStatus(getStatus());
--- 133,141 ----
e.editResource(resource);
}
!
! private void notifyRemoveResource(Resource resource) {
! editor.removeResource(resource);
! }
!
private void notifySetStatus() {
e.setStatus(getStatus());
***************
*** 136,142 ****
Util.setList(resources, editor.getAllClasses());
if (resource != null) {
! Util.setList(properties, editor
! .getProperties(resource, allProperties.isSelected()));
! Util.setList(instances, editor.getInstances(resource, allInstances.isSelected()));
}
notifySetStatus();
--- 159,166 ----
Util.setList(resources, editor.getAllClasses());
if (resource != null) {
! Util.setList(properties, editor.getProperties(resource,
! allProperties.isSelected()));
! Util.setList(instances, editor.getInstances(resource, allInstances
! .isSelected()));
}
notifySetStatus();
***************
*** 144,149 ****
private String getStatus() {
! return (resource != null) ? Util.getPropertyValue(resource, RDFS.label, true) : null;
}
! }
--- 168,174 ----
private String getStatus() {
! return (resource != null) ? Util.getPropertyValue(resource, RDFS.label,
! true) : null;
}
! }
\ No newline at end of file
|