[Bojangles-cvs] cvs: bojangles / MainWindow.java /widgets Widget.java
Status: Alpha
Brought to you by:
nehresma
|
From: kai5263499 <boj...@li...> - 2002-09-23 21:19:46
|
kai5263499 Mon Sep 23 14:19:45 2002 EDT
Modified files:
/bojangles MainWindow.java
/bojangles/widgets Widget.java
Log:
I'm getting closer to making the delete thing work...
Index: bojangles/MainWindow.java
diff -u bojangles/MainWindow.java:1.32 bojangles/MainWindow.java:1.33
--- bojangles/MainWindow.java:1.32 Thu Sep 12 13:25:57 2002
+++ bojangles/MainWindow.java Mon Sep 23 14:19:45 2002
@@ -491,33 +491,34 @@
curSelectedItem = tp;
if (-1 == row) {
if (xmlHandler.doesPathExist(null)) {
+ // We can't delete nothing...
return;
}
- } else {
+ }
+ else {
// retrieve the clicked on DefaultMutableTreeNode
Object pathArray[] = tp.getPath();
DefaultMutableTreeNode n = (DefaultMutableTreeNode)pathArray[pathArray.length-1];
Hashtable h = correlations.getCorrelation(n);
String path = (String)h.get("path");
- System.out.println(path);
- // get outer_type
- String outerType = xmlHandler.getOuterType(path);
-
- if (null == outerType) return;
-
- // now for what we've really been wanting to get -- the widget's defined class
- String widgetClass = ((Document)widgetDefinitions.get(outerType)).selectSingleNode("/widget/class").getText();
- if (widgetClass.equalsIgnoreCase("component")) {
-
- } else {
-
+ Component com_widget = (Container)h.get("widget");
+ Container parent = null;
+
+ // if we are the first thing in the tree, then set the parent equal to the displayPanel
+ if (null == popupOnTreeNode)
+ parent = displayPanel;
+ else {
+ Hashtable hip = correlations.getCorrelation(popupOnTreeNode);
+ parent = (Container)hip.get("widget");
}
- popupOnTreeNode = (DefaultMutableTreeNode)tp.getLastPathComponent();
+
+ // remove this component from the parent container and then the document's xml then the correlation's file
+ System.out.println("Parent: " + parent.getName());
+ parent.remove(com_widget);
+ //doc.
+ //correlations.removeCorrelation(path);
+ System.out.println("Path: " + path);
}
- //treePopup.show((Component)evt.getSource(), evt.getX(), evt.getY());
-
- System.out.println("I think: " + curSelectedItem.getPath().toString() + " has " + curSelectedItem.getLastPathComponent().toString() + " children...");
- System.out.println("There is no spoon...");
appModified(true);
}
@@ -623,7 +624,7 @@
}
Container parent = null;
- // if we are the first thing in the tree, t hen set the parent equal to the displayPanel
+ // if we are the first thing in the tree, then set the parent equal to the displayPanel
if (null == popupOnTreeNode)
parent = displayPanel;
else {
@@ -657,7 +658,6 @@
treeNode = new DefaultMutableTreeNode(name);
treeModel.insertNodeInto(treeNode, parentTreeNode, parentTreeNode.getChildCount());
path = xmlHandler.addElement(parentPath, name, null);
- appModified(true);
}
// add the widget's defined properties to the application's XML document
@@ -672,6 +672,7 @@
// map the element, path, and the treenode into the correlations table
correlations.addCorrelation(path, treeNode, w);
+ appModified(true);
}
private void addWidgetProperties(Document doc, String path, String name, String type) {
@@ -1023,6 +1024,7 @@
statusBar.setBounds(0, 230, 400, 20);
pack();
dlgFrame.setSize(407,269);
+ dlgFrame.setResizable(false);
dlgframe = dlgFrame;
}
@@ -1030,4 +1032,4 @@
public static void main(String[] args) {
MainWindow win = new MainWindow();
}
-}
\ No newline at end of file
+}
Index: bojangles/widgets/Widget.java
diff -u bojangles/widgets/Widget.java:1.4 bojangles/widgets/Widget.java:1.5
--- bojangles/widgets/Widget.java:1.4 Thu Aug 22 06:43:26 2002
+++ bojangles/widgets/Widget.java Mon Sep 23 14:19:45 2002
@@ -122,6 +122,7 @@
}
public void keyTyped(KeyEvent e) {
+ System.out.println("got: " + e.KEY_PRESSED);
}
|