Author: jfuerth
Date: Tue Sep 2 15:21:44 2008
New Revision: 2676
Modified:
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateMeasureAction.java
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateOLAPChildAction.java
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateVirtualCubeAction.java
Log:
Added compound undo support to creation of virtual cubes, plus measure,
level, and hierarchy via generic code in the CreateOLAPChildAction.
Modified:
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateMeasureAction.java
==============================================================================
---
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateMeasureAction.java
(original)
+++
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateMeasureAction.java
Tue Sep 2 15:21:44 2008
@@ -53,7 +53,13 @@
@Override
protected DataEntryPanel createDataEntryPanel(Measure model) {
try {
- return new MeasureEditPanel(model);
+ return new MeasureEditPanel(model) {
+ @Override
+ public boolean applyChanges() {
+ boolean applied = super.applyChanges();
+ return applied;
+ }
+ };
} catch (ArchitectException e) {
throw new ArchitectRuntimeException(e);
}
Modified:
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateOLAPChildAction.java
==============================================================================
---
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateOLAPChildAction.java
(original)
+++
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateOLAPChildAction.java
Tue Sep 2 15:21:44 2008
@@ -123,19 +123,24 @@
public void actionPerformed(ActionEvent e) {
List<PlayPenComponent> selectedItems = playpen.getSelectedItems();
- P pane = paneClass.cast(selectedItems.get(0));
+ final P pane = paneClass.cast(selectedItems.get(0));
+
+ pane.getModel().startCompoundEdit("Add " + friendlyChildName);
final C child = addNewChild(pane);
final DataEntryPanel mep = createDataEntryPanel(child);
Callable<Boolean> okCall = new Callable<Boolean>() {
public Boolean call() throws Exception {
- return mep.applyChanges();
+ boolean applied = mep.applyChanges();
+ pane.getModel().endCompoundEdit();
+ return applied;
}
};
Callable<Boolean> cancelCall = new Callable<Boolean>() {
public Boolean call() throws Exception {
child.getParent().removeChild(child);
+ pane.getModel().endCompoundEdit();
return true;
}
};
Modified:
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateVirtualCubeAction.java
==============================================================================
---
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateVirtualCubeAction.java
(original)
+++
trunk/src/ca/sqlpower/architect/swingui/olap/action/CreateVirtualCubeAction.java
Tue Sep 2 15:21:44 2008
@@ -75,7 +75,9 @@
@Override
public DataEntryPanel place(Point p) throws ArchitectException {
+ schema.startCompoundEdit("Create a virtual cube");
schema.addVirtualCube(vcp.getModel());
+
playpen.selectNone();
playpen.addPlayPenComponent(vcp, p);
vcp.setSelected(true,SelectionEvent.SINGLE_SELECT);
@@ -84,6 +86,14 @@
@Override
public void discardChanges() {
schema.removeVirtualCube(vcp.getModel());
+ schema.endCompoundEdit();
+ }
+
+ @Override
+ public boolean applyChanges() {
+ boolean applied = super.applyChanges();
+ schema.endCompoundEdit();
+ return applied;
}
};
return editPanel;