issue 50 - Delete not active on new blank page
MODIFY
builder/src/main/java/builder/controller/Controller.java
builder/src/main/java/builder/controller/Controller.java
@@ -408,7 +408,7 @@ public class Controller extends JInternalFrame
if (list.size() < 1) { // could be a widget or page selected in TreeView
// ask tree view if anyone selected?
String selected = TreeView.getInstance().getSelectedWidget();
- if (selected != null) {
+ if (selected != null && !selected.isEmpty()) {
if (selected.startsWith("Page")) {
PagePane p = findPage(selected);
if (p != null) {
@@ -423,6 +423,7 @@ public class Controller extends JInternalFrame
return;
}
}
+
} else { // widget removal
delWidget(list);
return;

MODIFY
builder/src/main/java/builder/views/PagePane.java
builder/src/main/java/builder/views/PagePane.java
@@ -401,13 +401,6 @@ public class PagePane extends JPanel implements iSubscriber {
w.unSelect();
doSelectedCount(w);
toolBar.setEditButtons(selectedCnt, selectedGroupCnt);
- if (selectedCnt == 0) {
- MsgEvent ev = new MsgEvent();
- ev.message ="";
- ev.parent = getKey();
- ev.code = MsgEvent.OBJECT_UNSELECT_PAGEPANE;
- MsgBoard.getInstance().publish(ev);
- }
}
/**
@@ -429,6 +422,13 @@ public class PagePane extends JPanel implements iSubscriber {
}
if (selectedCnt > 0) selectedCnt--;
}
+ if (selectedCnt == 0) {
+ MsgEvent ev = new MsgEvent();
+ ev.message ="";
+ ev.parent = getKey();
+ ev.code = MsgEvent.OBJECT_UNSELECT_PAGEPANE;
+ MsgBoard.getInstance().publish(ev);
+ }
}
/**
@@ -675,6 +675,12 @@ public class PagePane extends JPanel implements iSubscriber {
selectNone();
if (w == null) {
bMultiSelectionBox = true;
+ toolBar.setEditButtons(selectedCnt, selectedGroupCnt);
+ MsgEvent ev = new MsgEvent();
+ ev.message ="";
+ ev.parent = getKey();
+ ev.code = MsgEvent.OBJECT_UNSELECT_PAGEPANE;
+ MsgBoard.getInstance().publish(ev);
} else {
selectWidget(w);
MsgEvent ev = new MsgEvent();

MODIFY
builder/src/main/java/builder/views/ToolBar.java
builder/src/main/java/builder/views/ToolBar.java
@@ -135,7 +135,10 @@ public class ToolBar extends JToolBar {
add(btn_redo);
btn_delete = new JButton(new ImageIcon(Builder.class.getResource("/resources/icons/delete.png")));
- btn_delete.setDisabledIcon(new ImageIcon(Builder.class.getResource("/resources/icons/disable_delete.png")));
+/* The builder's pagepane doesn't know if its selected or not and so we can't
+ * dynamically turn Delete button on/off. Symptoms: Users can't delete empty page
+ * btn_delete.setDisabledIcon(new ImageIcon(Builder.class.getResource("/resources/icons/disable_delete.png")));
+ */
btn_delete.setToolTipText("Delete Widget");
btn_delete.setActionCommand("delete");
add(btn_delete);
@@ -323,7 +326,6 @@ public class ToolBar extends JToolBar {
btn_aligncenter.setEnabled(true);
btn_alignleft.setEnabled(true);
btn_alignright.setEnabled(true);
- btn_delete.setEnabled(true);
}
public void disableSingleEdits() {
@@ -336,7 +338,6 @@ public class ToolBar extends JToolBar {
btn_alignvspace.setEnabled(false);
btn_alignwidth.setEnabled(false);
btn_alignheight.setEnabled(false);
- btn_delete.setEnabled(false);
}
public void enableMultiEdits() {
@@ -349,7 +350,6 @@ public class ToolBar extends JToolBar {
btn_alignvspace.setEnabled(true);
btn_alignwidth.setEnabled(true);
btn_alignheight.setEnabled(true);
- btn_delete.setEnabled(true);
}
public void disableMultiEdits() {

issue 50 - Delete not active on new blank page