--- /dev/null
+package com.quantum.wizards;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import com.quantum.Messages;
+import com.quantum.model.JDBCDriver;
+
+
+class BookmarkConnectionWizardPage extends PropertyChangeWizardPage {
+
+ /* use this to paint a more helpful UI for the JDBC URL */
+ private JDBCDriver driver;
+ private String userid;
+ private String password;
+ private String connectionURL;
+ private boolean prompt;
+
+ /**
+ * Constructor for BookmarkPage.
+ * @param pageName
+ */
+ public BookmarkConnectionWizardPage(String pageName) {
+ super(pageName);
+ setTitle(Messages.getString(getClass(), "title"));
+ setDescription(Messages.getString(getClass(), "description"));
+ }
+ public void createControl(Composite parent) {
+ setPageComplete(false);
+
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+
+ Label label = new Label(container, SWT.NULL);
+ label.setText(Messages.getString(getClass(), "userid")); //$NON-NLS-1$
+ Text username = new Text(container, SWT.BORDER | SWT.SINGLE);
+
+
+ GridData fullHorizontal = new GridData(GridData.FILL_HORIZONTAL);
+ fullHorizontal.horizontalSpan = 2;
+ username.setLayoutData(fullHorizontal);
+ username.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ String userid = ((Text) event.getSource()).getText();
+ setUserid(userid);
+ updateButtonState();
+ }
+ });
+
+ label = new Label(container, SWT.NULL);
+ label.setText(Messages.getString(getClass(), "password")); //$NON-NLS-1$
+ final Text password = new Text(container, SWT.BORDER | SWT.SINGLE);
+ password.setEchoChar('*');
+ fullHorizontal = new GridData(GridData.FILL_HORIZONTAL);
+ fullHorizontal.horizontalSpan = 2;
+ password.setLayoutData(fullHorizontal);
+ password.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ String password = ((Text) event.getSource()).getText();
+ setPassword(password);
+ updateButtonState();
+ }
+ });
+
+ Button prompt = new Button(container, SWT.CHECK);
+ prompt.setText(Messages.getString(getClass(), "prompt")); //$NON-NLS-1$
+ fullHorizontal = new GridData(GridData.FILL_HORIZONTAL);
+ fullHorizontal.horizontalSpan = 3;
+ prompt.setLayoutData(fullHorizontal);
+
+ label = new Label(container, SWT.NULL);
+ label.setText(Messages.getString(getClass(), "url")); //$NON-NLS-1$
+
+ Text connect = new Text(container, SWT.BORDER | SWT.SINGLE);
+ fullHorizontal = new GridData(GridData.FILL_HORIZONTAL);
+ fullHorizontal.horizontalSpan = 2;
+ connect.setLayoutData(fullHorizontal);
+ connect.addModifyListener(new ModifyListener() {
+ public void modifyText(ModifyEvent event) {
+ String connectionURL = ((Text) event.getSource()).getText();
+ setConnectionURL(connectionURL);
+ updateButtonState();
+ }
+ });
+ prompt.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ Button prompt = ((Button) event.getSource());
+ password.setEditable(!prompt.getSelection());
+ setPrompt(prompt.getSelection());
+ updateButtonState();
+ }
+ });
+
+ setControl(container);
+ }
+
+ /**
+ * @return Returns the driver.
+ */
+ public JDBCDriver getDriver() {
+ return this.driver;
+ }
+ /**
+ * @param driver The driver to set.
+ */
+ public void setDriver(JDBCDriver driver) {
+ this.driver = driver;
+ }
+ /**
+ *
+ */
+ private void updateButtonState() {
+ boolean complete = true;
+ complete &= (this.connectionURL != null
+ && this.connectionURL.trim().length() > 0);
+ complete &= (this.userid != null
+ && this.userid.trim().length() > 0);
+ setPageComplete(complete);
+ }
+ /**
+ * @return Returns the userid.
+ */
+ public String getUserid() {
+ return this.userid;
+ }
+ /**
+ * @param userid The userid to set.
+ */
+ public void setUserid(String userid) {
+ if (userid != null && !userid.equals(this.userid)) {
+ String original = this.userid;
+ this.userid = userid;
+ firePropertyChange("userid", original, userid);
+ }
+ }
+ /**
+ * @return Returns the prompt.
+ */
+ public boolean isPrompt() {
+ return this.prompt;
+ }
+ /**
+ * @param prompt The prompt to set.
+ */
+ public void setPrompt(boolean prompt) {
+ if (this.prompt != prompt) {
+ boolean original = this.prompt;
+ this.prompt = prompt;
+ firePropertyChange("prompt", original, prompt);
+ }
+ }
+ /**
+ * @return Returns the connectionURL.
+ */
+ public String getConnectionURL() {
+ return this.connectionURL;
+ }
+ /**
+ * @param connectionURL The connectionURL to set.
+ */
+ public void setConnectionURL(String connectionURL) {
+ if (connectionURL != null && !connectionURL.equals(this.connectionURL)) {
+ String original = this.connectionURL;
+ this.connectionURL = connectionURL;
+ firePropertyChange("connectionURL", original, connectionURL);
+ }
+ }
+ /**
+ * @return Returns the password.
+ */
+ public String getPassword() {
+ return this.password;
+ }
+ /**
+ * @param password The password to set.
+ */
+ public void setPassword(String password) {
+ if (password != null && !password.equals(this.password)) {
+ String original = this.password;
+ this.password = password;
+ firePropertyChange("password", original, password);
+ }
+ }
+}
\ No newline at end of file