Author: ms1279
Date: Wed Feb 25 08:58:17 2009
New Revision: 2951
Modified:
trunk/regress/ca/sqlpower/architect/TestingArchitectSession.java
trunk/regress/ca/sqlpower/architect/etl/kettle/CreateKettleJobTest.java
trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java
trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java
trunk/src/ca/sqlpower/architect/SourceObjectIntegrityWatcher.java
trunk/src/ca/sqlpower/architect/etl/kettle/KettleJob.java
trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java
trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
trunk/src/ca/sqlpower/architect/swingui/SwingUIUserPrompterFactory.java
Log:
Implemented the changed version of the createUserPrompter method to have
the UserPromptOptions optionType as a parameter as well as String ...
buttonNames(which contains the labels for each of the responses).
Modified: trunk/regress/ca/sqlpower/architect/TestingArchitectSession.java
==============================================================================
--- trunk/regress/ca/sqlpower/architect/TestingArchitectSession.java
(original)
+++ trunk/regress/ca/sqlpower/architect/TestingArchitectSession.java Wed
Feb 25 08:58:17 2009
@@ -42,6 +42,7 @@
import ca.sqlpower.sqlobject.SQLObjectRoot;
import ca.sqlpower.util.DefaultUserPrompterFactory;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
/**
@@ -121,10 +122,9 @@
/**
* Returns a default prompter
*/
- public UserPrompter createUserPrompter(String question, String okText,
String newText, String notOkText,
- String cancelText, UserPromptType responseType,
UserPromptResponse defaultResponseType,
- Object defaultResponse) {
- return defaultUPF.createUserPrompter(question, okText, newText,
notOkText, cancelText, responseType,
- defaultResponseType, defaultResponse);
+ public UserPrompter createUserPrompter(String question, UserPromptType
responseType, UserPromptOptions optionType, UserPromptResponse
defaultResponseType,
+ Object defaultResponse, String ... buttonNames) {
+ return defaultUPF.createUserPrompter(question, responseType,
optionType,
+ defaultResponseType, defaultResponse, buttonNames);
}
}
Modified:
trunk/regress/ca/sqlpower/architect/etl/kettle/CreateKettleJobTest.java
==============================================================================
--- trunk/regress/ca/sqlpower/architect/etl/kettle/CreateKettleJobTest.java
(original)
+++ trunk/regress/ca/sqlpower/architect/etl/kettle/CreateKettleJobTest.java
Wed Feb 25 08:58:17 2009
@@ -61,6 +61,7 @@
import ca.sqlpower.sqlobject.SQLDatabase;
import ca.sqlpower.sqlobject.SQLTable;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
public class CreateKettleJobTest extends TestCase {
@@ -80,9 +81,8 @@
}
@Override
- public UserPrompter createUserPrompter(String question, String
okText, String newText, String notOkText,
- String cancelText, UserPromptType responseType,
UserPromptResponse defaultResponseType,
- Object defaultResponse) {
+ public UserPrompter createUserPrompter(String question,
UserPromptType responseType, UserPromptOptions optionType,
UserPromptResponse defaultResponseType,
+ Object defaultResponse, String ... buttonNames) {
return new UserPrompter() {
public Object getUserSelectedResponse() {
Modified:
trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java
==============================================================================
---
trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java
(original)
+++
trunk/regress/ca/sqlpower/architect/swingui/TestingArchitectSwingSession.java
Wed Feb 25 08:58:17 2009
@@ -49,6 +49,7 @@
import ca.sqlpower.swingui.event.SessionLifecycleListener;
import ca.sqlpower.util.DefaultUserPrompterFactory;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
/**
@@ -337,10 +338,9 @@
return printSettings;
}
- public UserPrompter createUserPrompter(String question, String okText,
String newText, String notOkText,
- String cancelText, UserPromptType responseType,
UserPromptResponse defaultResponseType,
- Object defaultResponse) {
- return new
DefaultUserPrompterFactory().createUserPrompter(question, okText, newText,
notOkText, cancelText, responseType, defaultResponseType, defaultResponse);
+ public UserPrompter createUserPrompter(String question, UserPromptType
responseType, UserPromptOptions optionType, UserPromptResponse
defaultResponseType,
+ Object defaultResponse, String ... buttonNames) {
+ return new
DefaultUserPrompterFactory().createUserPrompter(question, responseType,
optionType, defaultResponseType, defaultResponse, buttonNames);
}
}
Modified: trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java (original)
+++ trunk/src/ca/sqlpower/architect/ArchitectSessionImpl.java Wed Feb 25
08:58:17 2009
@@ -32,6 +32,7 @@
import ca.sqlpower.util.DefaultUserPrompterFactory;
import ca.sqlpower.util.UserPrompter;
import ca.sqlpower.util.UserPrompterFactory;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
/**
@@ -151,11 +152,11 @@
profileManager = manager;
}
- public UserPrompter createUserPrompter(String question, String okText,
String newText, String notOkText,
- String cancelText, UserPromptType responseType,
UserPromptResponse defaultResponseType,
- Object defaultResponse) {
- return userPrompterFactory.createUserPrompter(question, okText,
newText, notOkText, cancelText,
- responseType, defaultResponseType, defaultResponse);
+ public UserPrompter createUserPrompter(String question, UserPromptType
responseType,
+ UserPromptOptions optionType, UserPromptResponse
defaultResponseType,
+ Object defaultResponse, String ... buttonNames) {
+ return userPrompterFactory.createUserPrompter(question,
responseType,
+ optionType, defaultResponseType, defaultResponse,
buttonNames);
}
/**
Modified: trunk/src/ca/sqlpower/architect/SourceObjectIntegrityWatcher.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/SourceObjectIntegrityWatcher.java
(original)
+++ trunk/src/ca/sqlpower/architect/SourceObjectIntegrityWatcher.java Wed
Feb 25 08:58:17 2009
@@ -11,6 +11,7 @@
import ca.sqlpower.sqlobject.SQLObjectPreEventListener;
import ca.sqlpower.sqlobject.SQLObjectUtils;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
import ca.sqlpower.util.UserPrompterFactory.UserPromptType;
@@ -32,8 +33,9 @@
public void dbChildrenPreRemove(SQLObjectPreEvent e) {
UserPrompter up = session.createUserPrompter(
Messages.getString("SourceObjectIntegrityWatcher.removingETLLineageWarning"),
//$NON-NLS-1$
-
Messages.getString("SourceObjectIntegrityWatcher.forgetLineageOption"),
null,
Messages.getString("SourceObjectIntegrityWatcher.keepSourceConnectionOption"),
Messages.getString("cancel"),
- UserPromptType.BOOLEAN, UserPromptResponse.OK,
Boolean.TRUE); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ UserPromptType.BOOLEAN, UserPromptOptions.OK_NOTOK_CANCEL,
UserPromptResponse.OK, Boolean.TRUE,
+
Messages.getString("SourceObjectIntegrityWatcher.forgetLineageOption"),
Messages.getString("SourceObjectIntegrityWatcher.keepSourceConnectionOption"),
+ Messages.getString("cancel")); //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
for (SQLObject so : e.getChildren()) {
SQLDatabase db = (SQLDatabase) so;
try {
Modified: trunk/src/ca/sqlpower/architect/etl/kettle/KettleJob.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/etl/kettle/KettleJob.java (original)
+++ trunk/src/ca/sqlpower/architect/etl/kettle/KettleJob.java Wed Feb 25
08:58:17 2009
@@ -58,6 +58,7 @@
import ca.sqlpower.util.Monitorable;
import ca.sqlpower.util.MonitorableImpl;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
import ca.sqlpower.util.UserPrompterFactory.UserPromptType;
import ca.sqlpower.sql.SPDataSource;
@@ -418,8 +419,8 @@
outputs.put(new File(fileName), job.getXML());
UserPrompter up = session.createUserPrompter(
- "The file {0} already exists. Overwrite?",
- "Overwrite", null, "Don't Overwrite", "Cancel",
UserPromptType.BOOLEAN, UserPromptResponse.NOT_OK, false);
+ "The file {0} already exists. Overwrite?",
UserPromptType.BOOLEAN, UserPromptOptions.OK_NOTOK_CANCEL,
UserPromptResponse.NOT_OK,
+ false, "Overwrite", "Don't Overwrite", "Cancel");
for (File f : outputs.keySet()) {
try {
logger.debug("The file to output is " + f.getPath());
@@ -500,8 +501,8 @@
try {
UserPrompter up = session.createUserPrompter(
- "{0} {1} already exists in the repository.
Replace?",
- "Replace", null, "Don't Replace", "Cancel",
UserPromptType.BOOLEAN, UserPromptResponse.NOT_OK, false);
+ "{0} {1} already exists in the repository.
Replace?", UserPromptType.BOOLEAN, UserPromptOptions.OK_NOTOK_CANCEL,
+ UserPromptResponse.NOT_OK,
false, "Replace", "Don't Replace", "Cancel");
for (TransMeta tm: transformations) {
if (monitor.isCancelled()) {
cancel();
Modified: trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java
(original)
+++ trunk/src/ca/sqlpower/architect/profile/ProfileManagerImpl.java Wed Feb
25 08:58:17 2009
@@ -41,6 +41,7 @@
import ca.sqlpower.sqlobject.SQLObjectPreEventListener;
import ca.sqlpower.sqlobject.SQLTable;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
import ca.sqlpower.util.UserPrompterFactory.UserPromptType;
@@ -67,8 +68,8 @@
"{0} tables have been profiled from the database
{1}.\n" +
"\n" +
"If you proceed, the profiling information from the
database" +
- " will be removed.",
- "Remove Profiles", null, "Keep Profiles", "Cancel",
UserPromptType.BOOLEAN, UserPromptResponse.OK, Boolean.TRUE);
+ " will be removed.", UserPromptType.BOOLEAN,
UserPromptOptions.OK_NOTOK_CANCEL, UserPromptResponse.OK,
+ Boolean.TRUE, "Remove Profiles", null, "Keep
Profiles", "Cancel");
for (SQLObject so : e.getChildren()) {
SQLDatabase db = (SQLDatabase) so;
List<TableProfileResult> refs = new
ArrayList<TableProfileResult>();
Modified:
trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/ArchitectSwingSessionImpl.java
Wed Feb 25 08:58:17 2009
@@ -77,6 +77,7 @@
import ca.sqlpower.swingui.event.SessionLifecycleEvent;
import ca.sqlpower.swingui.event.SessionLifecycleListener;
import ca.sqlpower.util.UserPrompter;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
public class ArchitectSwingSessionImpl implements ArchitectSwingSession {
@@ -850,11 +851,10 @@
*
* @see ModalDialogUserPrompter
*/
- public UserPrompter createUserPrompter(String question, String okText,
String newText, String notOkText,
- String cancelText, UserPromptType responseType,
UserPromptResponse defaultResponseType,
- Object defaultResponse) {
- return swinguiUserPrompterFactory.createUserPrompter(question,
okText, newText, notOkText, cancelText,
- responseType, defaultResponseType, defaultResponse);
+ public UserPrompter createUserPrompter(String question, UserPromptType
responseType, UserPromptOptions optionType, UserPromptResponse
defaultResponseType,
+ Object defaultResponse, String ... buttonNames) {
+ return swinguiUserPrompterFactory.createUserPrompter(question,
+ responseType, optionType, defaultResponseType,
defaultResponse, buttonNames);
}
Modified:
trunk/src/ca/sqlpower/architect/swingui/SwingUIUserPrompterFactory.java
==============================================================================
--- trunk/src/ca/sqlpower/architect/swingui/SwingUIUserPrompterFactory.java
(original)
+++ trunk/src/ca/sqlpower/architect/swingui/SwingUIUserPrompterFactory.java
Wed Feb 25 08:58:17 2009
@@ -27,6 +27,7 @@
import ca.sqlpower.swingui.ModalDialogUserPrompter;
import ca.sqlpower.util.UserPrompter;
import ca.sqlpower.util.UserPrompterFactory;
+import ca.sqlpower.util.UserPrompter.UserPromptOptions;
import ca.sqlpower.util.UserPrompter.UserPromptResponse;
public class SwingUIUserPrompterFactory implements UserPrompterFactory {
@@ -39,15 +40,13 @@
this.dsCollection = dsCollection;
}
- public UserPrompter createUserPrompter(String question, String okText,
String newText, String notOkText,
- String cancelText, UserPromptType responseType,
UserPromptResponse defaultResponseType,
- Object defaultResponse) {
+ public UserPrompter createUserPrompter(String question, UserPromptType
responseType, UserPromptOptions optionType, UserPromptResponse
defaultResponseType,
+ Object defaultResponse, String ... buttonNames) {
switch (responseType) {
case BOOLEAN :
- return new ModalDialogUserPrompter(defaultResponseType,
owner, question, okText, notOkText, cancelText);
+ return new ModalDialogUserPrompter(optionType,
defaultResponseType, owner, question, buttonNames);
case DATA_SOURCE:
- return new DataSourceUserPrompter(defaultResponseType,
(SPDataSource) defaultResponse, owner, question, okText, newText,
notOkText, cancelText,
- dsCollection);
+ return new DataSourceUserPrompter(optionType,
defaultResponseType, (SPDataSource) defaultResponse, owner, question,
dsCollection, buttonNames);
default :
throw new UnsupportedOperationException("User prompt
type " + responseType + " is unknown.");
}