Skip to main content
summaryrefslogtreecommitdiffstats
path: root/jpa
diff options
context:
space:
mode:
authortle2008-04-20 21:19:33 +0000
committertle2008-04-20 21:19:33 +0000
commitd3f4c36aac41a4bc1aa5ba20ee6b23a1cf73c61e (patch)
tree2d655f7bbc6a087279bbc4cfe429bc920bf9dbab /jpa
parent5ca506bdf7802a504a56fa2bffacd822d67a73cd (diff)
downloadwebtools.dali-d3f4c36aac41a4bc1aa5ba20ee6b23a1cf73c61e.tar.gz
webtools.dali-d3f4c36aac41a4bc1aa5ba20ee6b23a1cf73c61e.tar.xz
webtools.dali-d3f4c36aac41a4bc1aa5ba20ee6b23a1cf73c61e.zip
Added Password field factory method - patch from Pascal
Diffstat (limited to 'jpa')
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/WidgetFactory.java8
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java247
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/DefaultWidgetFactory.java87
-rw-r--r--jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/FormWidgetFactory.java87
4 files changed, 228 insertions, 201 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/WidgetFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/WidgetFactory.java
index 881660b249..0a957daf53 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/WidgetFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/WidgetFactory.java
@@ -153,6 +153,14 @@ public interface WidgetFactory {
Text createMultiLineText(Composite parent);
/**
+ * Creates a new editable text field that handles password.
+ *
+ * @param container The parent container
+ * @return A new <code>Text</code>
+ */
+ Text createPasswordText(Composite container);
+
+ /**
* Creates a new push button (toggle between selected and unselected).
*
* @param parent The parent container
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java
index 4376bf29ed..f55c82127c 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/AbstractPane.java
@@ -11,6 +11,7 @@ package org.eclipse.jpt.ui.internal.widgets;
import java.util.ArrayList;
import java.util.Collection;
+
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.IBaseLabelProvider;
@@ -2262,6 +2263,111 @@ public abstract class AbstractPane<T extends Model>
}
/**
+ * Creates a new container that will have a text field as the center control
+ * labeled with the given label.
+ *
+ * @param container The parent container
+ * @param textHolder The holder of the text field's input
+ * @return The newly created <code>Text</code>
+ *
+ * @category Layout
+ */
+ protected final Text buildLabeledPasswordText(Composite container,
+ String labelText,
+ WritablePropertyValueModel<String> textHolder) {
+
+ return this.buildLabeledPasswordText(
+ container,
+ labelText,
+ textHolder,
+ null
+ );
+ }
+
+ /**
+ * Creates a new container that will have a text field as the center control
+ * labeled with the given label.
+ *
+ * @param container The parent container
+ * @param labelText The text field's label
+ * @param rightComponent The component to be placed to the right of the text
+ * field
+ * @param textHolder The holder of the text field's input
+ * @param helpId The topic help ID to be registered for the text field
+ * @return The newly created <code>Text</code>
+ *
+ * @category Layout
+ */
+ protected final Text buildLabeledPasswordText(Composite container,
+ String labelText,
+ WritablePropertyValueModel<String> textHolder,
+ Control rightComponent,
+ String helpId) {
+
+ Text text = this.buildPasswordText(container, textHolder);
+
+ this.buildLabeledComposite(
+ container,
+ labelText,
+ text,
+ rightComponent,
+ helpId
+ );
+
+ return text;
+ }
+
+ /**
+ * Creates a new container that will have a text field as the center control
+ * labeled with the given label.
+ *
+ * @param container The parent container
+ * @param textHolder The holder of the text field's input
+ * @param helpId The topic help ID to be registered for the text field
+ * @return The newly created <code>Text</code>
+ *
+ * @category Layout
+ */
+ protected final Text buildLabeledPasswordText(Composite container,
+ String labelText,
+ WritablePropertyValueModel<String> textHolder,
+ String helpId) {
+
+ return this.buildLabeledPasswordText(
+ container,
+ labelText,
+ textHolder,
+ null,
+ helpId
+ );
+ }
+
+ /**
+ * Creates a new container that will have a text field as the center control
+ * labeled with the given label.
+ *
+ * @param container The parent container
+ * @param textHolder The holder of the text field's input
+ * @param helpId The topic help ID to be registered for the text field
+ * @return The newly created <code>Text</code>
+ *
+ * @category Layout
+ */
+ protected final Text buildLabeledPawordText(Composite container,
+ String labelText,
+ WritablePropertyValueModel<String> textHolder,
+ String helpId) {
+
+ return this.buildLabeledPasswordText(
+ container,
+ labelText,
+ textHolder,
+ null,
+ helpId
+ );
+ }
+
+ /**
* Creates a new spinner.
*
* @param parent The parent container
@@ -2468,127 +2574,6 @@ public abstract class AbstractPane<T extends Model>
* labeled with the given label.
*
* @param container The parent container
- * @param labelText The text field's label
- * @param textListener The listener that is notified when the text field's
- * input changes
- * @return The newly created <code>Text</code>
- *
- * @category Layout
- */
- protected final Text buildLabeledText(Composite container,
- String labelText,
- ModifyListener textListener) {
-
- Text text = this.buildText(container);
- text.addModifyListener(textListener);
-
- this.buildLabeledComposite(
- container,
- labelText,
- text
- );
-
- return text;
- }
-
- /**
- * Creates a new container that will have a text field as the center control
- * labeled with the given label.
- *
- * @param container The parent container
- * @param textListener The listener that is notified when the text field's
- * input changes
- * @param rightControl The control shown to the right of the main widget
- * @return The newly created <code>Text</code>
- *
- * @category Layout
- */
- protected final Text buildLabeledText(Composite container,
- String labelText,
- ModifyListener textListener,
- Control rightControl) {
-
- Text text = this.buildText(container);
- text.addModifyListener(textListener);
-
- this.buildLabeledComposite(
- container,
- labelText,
- text,
- rightControl
- );
-
- return text;
- }
-
- /**
- * Creates a new container that will have a text field as the center control
- * labeled with the given label.
- *
- * @param container The parent container
- * @param textListener The listener that is notified when the text field's
- * input changes
- * @param rightControl The control shown to the right of the main widget
- * @param helpId The topic help ID to be registered for the text field
- * @return The newly created <code>Text</code>
- *
- * @category Layout
- */
- protected final Text buildLabeledText(Composite container,
- String labelText,
- ModifyListener textListener,
- Control rightControl,
- String helpId) {
-
- Text text = this.buildText(container);
- text.addModifyListener(textListener);
-
- this.buildLabeledComposite(
- container,
- labelText,
- text,
- rightControl,
- helpId
- );
-
- return text;
- }
-
- /**
- * Creates a new container that will have a text field as the center control
- * labeled with the given label.
- *
- * @param container The parent container
- * @param textListener The listener that is notified when the text field's
- * input changes
- * @param helpId The topic help ID to be registered for the text field
- * @return The newly created <code>Text</code>
- *
- * @category Layout
- */
- protected final Text buildLabeledText(Composite container,
- String labelText,
- ModifyListener textListener,
- String helpId) {
-
- Text text = this.buildText(container);
- text.addModifyListener(textListener);
-
- this.buildLabeledComposite(
- container,
- labelText,
- text,
- helpId
- );
-
- return text;
- }
-
- /**
- * Creates a new container that will have a text field as the center control
- * labeled with the given label.
- *
- * @param container The parent container
* @param textHolder The holder of the text field's input
* @return The newly created <code>Text</code>
*
@@ -2925,6 +2910,26 @@ public abstract class AbstractPane<T extends Model>
}
/**
+ * Creates a new <code>Text</code> widget.
+ *
+ * @param container The parent container
+ * @param textHolder The holder of the text field's input
+ * @return The newly created <code>Text</code> widget
+ *
+ * @category Layout
+ */
+ protected final Text buildPasswordText(Composite container,
+ WritablePropertyValueModel<String> textHolder) {
+
+ Text text = this.widgetFactory.createPasswordText(container);
+ text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ TextFieldModelAdapter.adapt(textHolder, text);
+
+ return text;
+ }
+
+ /**
* Creates a new push button using the given information.
*
* @param parent The parent container
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/DefaultWidgetFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/DefaultWidgetFactory.java
index e52a2ba88d..feb75a9138 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/DefaultWidgetFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/DefaultWidgetFactory.java
@@ -58,8 +58,8 @@ public class DefaultWidgetFactory implements WidgetFactory {
return INSTANCE;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createButton(Composite parent, String text) {
return this.createButton(parent, text, SWT.NULL);
@@ -80,50 +80,50 @@ public class DefaultWidgetFactory implements WidgetFactory {
return button;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public CCombo createCCombo(Composite parent) {
return new CCombo(parent, SWT.BORDER | SWT.READ_ONLY);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createCheckBox(Composite parent, String text) {
return this.createButton(parent, text, SWT.CHECK);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Combo createCombo(Composite parent) {
return new Combo(parent, SWT.BORDER | SWT.READ_ONLY);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Composite createComposite(Composite parent) {
return new Composite(parent, SWT.NULL);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public CCombo createEditableCCombo(Composite parent) {
return new CCombo(parent, SWT.BORDER);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Combo createEditableCombo(Composite parent) {
return new Combo(parent, SWT.BORDER);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Group createGroup(Composite parent, String title) {
Group group = new Group(parent, SWT.NULL);
@@ -131,8 +131,8 @@ public class DefaultWidgetFactory implements WidgetFactory {
return group;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Hyperlink createHyperlink(Composite parent, String text) {
Hyperlink hyperlink = new Hyperlink(parent, SWT.NULL);
@@ -140,8 +140,8 @@ public class DefaultWidgetFactory implements WidgetFactory {
return hyperlink;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Label createLabel(Composite parent, String labelText) {
Label label = new Label(parent, SWT.WRAP);
@@ -149,15 +149,15 @@ public class DefaultWidgetFactory implements WidgetFactory {
return label;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public List createList(Composite parent, int style) {
return new List(parent, SWT.BORDER | style);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public FormText createMultiLineLabel(Composite parent, String labelText) {
@@ -184,57 +184,64 @@ public class DefaultWidgetFactory implements WidgetFactory {
return text;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Text createMultiLineText(Composite parent) {
return new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
+ */
+ public Text createPasswordText(Composite parent) {
+ return new Text(parent, SWT.BORDER | SWT.PASSWORD);
+ }
+
+ /**
+ * {@inheritDoc}
*/
public Button createPushButton(Composite parent, String text) {
return this.createButton(parent, text, SWT.PUSH);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createRadioButton(Composite parent, String text) {
return this.createButton(parent, text, SWT.RADIO);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Section createSection(Composite parent, int style) {
return new Section(parent, style);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Spinner createSpinner(Composite parent) {
return new Spinner(parent, SWT.NULL);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Table createTable(Composite parent, int style) {
return new Table(parent, SWT.BORDER | style);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Text createText(Composite parent) {
return new Text(parent, SWT.BORDER);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createTriStateCheckBox(Composite parent, String text) {
TriStateCheckBox checkBox = new TriStateCheckBox(parent, text, this);
diff --git a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/FormWidgetFactory.java b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/FormWidgetFactory.java
index 194c54d669..db31c1840a 100644
--- a/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/FormWidgetFactory.java
+++ b/jpa/plugins/org.eclipse.jpt.ui/src/org/eclipse/jpt/ui/internal/widgets/FormWidgetFactory.java
@@ -93,8 +93,8 @@ public class FormWidgetFactory implements WidgetFactory {
return container;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createButton(Composite parent, String text) {
return createButton(parent, text, SWT.NULL);
@@ -113,8 +113,8 @@ public class FormWidgetFactory implements WidgetFactory {
return widgetFactory.createButton(parent, text, SWT.FLAT | style);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public CCombo createCCombo(Composite parent) {
return createCCombo(parent, SWT.READ_ONLY);
@@ -141,22 +141,22 @@ public class FormWidgetFactory implements WidgetFactory {
return combo;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createCheckBox(Composite parent, String text) {
return createButton(parent, text, SWT.CHECK);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Combo createCombo(Composite parent) {
return new Combo(parent, SWT.READ_ONLY);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Composite createComposite(Composite parent) {
Composite composite = widgetFactory.createComposite(parent);
@@ -164,15 +164,15 @@ public class FormWidgetFactory implements WidgetFactory {
return composite;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public CCombo createEditableCCombo(Composite parent) {
return createCCombo(parent, SWT.NULL);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Combo createEditableCombo(Composite parent) {
Combo combo = new Combo(parent, SWT.FLAT);
@@ -180,8 +180,8 @@ public class FormWidgetFactory implements WidgetFactory {
return combo;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Group createGroup(Composite parent, String title) {
Group group = new Group(parent, SWT.SHADOW_NONE);
@@ -191,22 +191,22 @@ public class FormWidgetFactory implements WidgetFactory {
return group;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Hyperlink createHyperlink(Composite parent, String text) {
return widgetFactory.createHyperlink(parent, text, SWT.FLAT);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Label createLabel(Composite container, String labelText) {
return widgetFactory.createLabel(container, labelText, SWT.WRAP);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public List createList(Composite container, int style) {
List list = new List(container, SWT.FLAT | style);
@@ -214,8 +214,8 @@ public class FormWidgetFactory implements WidgetFactory {
return list;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public FormText createMultiLineLabel(Composite parent, String labelText) {
@@ -241,36 +241,43 @@ public class FormWidgetFactory implements WidgetFactory {
return text;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Text createMultiLineText(Composite parent) {
return createText(parent, SWT.MULTI | SWT.V_SCROLL);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
+ */
+ public Text createPasswordText(Composite parent) {
+ return createText(parent, SWT.PASSWORD);
+ }
+
+ /**
+ * {@inheritDoc}
*/
public Button createPushButton(Composite parent, String text) {
return createButton(parent, text, SWT.PUSH);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createRadioButton(Composite parent, String text) {
return createButton(parent, text, SWT.RADIO);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Section createSection(Composite parent, int style) {
return widgetFactory.createSection(parent, SWT.FLAT | style);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Spinner createSpinner(Composite parent) {
parent = createBorderContainer(parent);
@@ -282,8 +289,8 @@ public class FormWidgetFactory implements WidgetFactory {
return spinner;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Table createTable(Composite parent, int style) {
Table table = this.widgetFactory.createTable(parent, SWT.BORDER | style);
@@ -291,8 +298,8 @@ public class FormWidgetFactory implements WidgetFactory {
return table;
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Text createText(Composite parent) {
return createText(parent, SWT.NULL);
@@ -302,8 +309,8 @@ public class FormWidgetFactory implements WidgetFactory {
return widgetFactory.createText(parent, null, SWT.FLAT | style);
}
- /*
- * (non-Javadoc)
+ /**
+ * {@inheritDoc}
*/
public Button createTriStateCheckBox(Composite parent, String text) {
TriStateCheckBox checkBox = new TriStateCheckBox(parent, text, this);

Back to the top