cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r442563 [3/3] - in /incubator/cayenne/soc/trunk/cayenne-rop/rop-browser: ./ src/org/apache/cayenne/ropbrowser/ src/org/apache/cayenne/ropbrowser/actions/ src/org/apache/cayenne/ropbrowser/commands/ src/org/apache/cayenne/ropbrowser/figures/...
Date Tue, 12 Sep 2006 11:28:54 GMT
Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectParametersPage.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectParametersPage.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectParametersPage.java
(original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectParametersPage.java
Tue Sep 12 04:28:51 2006
@@ -19,7 +19,7 @@
 import java.util.HashMap;
 import java.util.Hashtable;
 
-import org.apache.cayenne.ropbrowser.TypeConverter;
+import org.apache.cayenne.ropbrowser.model.TypeConverter;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ColumnWeightData;
 import org.eclipse.jface.viewers.ComboBoxCellEditor;
@@ -131,7 +131,7 @@
 		}
 		
 		public int getCayenneValue() {
-			return cayenneValue;
+			return this.cayenneValue;
 		}
 	};
 
@@ -139,8 +139,8 @@
 		super(pageName);
 		this.context = context;
 		this.entityName = entityName;
-		paramMap = new HashMap<String, Object>();
-		operatorMap = new HashMap<String, Operator>();
+		this.paramMap = new HashMap<String, Object>();
+		this.operatorMap = new HashMap<String, Operator>();
 	}
 
 	/**
@@ -162,57 +162,57 @@
 		tableData.horizontalSpan = 2;
 		GridData errorLabelData = new GridData(SWT.FILL, SWT.NULL, true, false);
 
-		attributeTable = new TableViewer(base, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION | SWT.V_SCROLL
| SWT.H_SCROLL);
-		attributeTable.setContentProvider(new AttributeTableContentProvider());
-		attributeTable.setLabelProvider(new AttributeTableLabelProvider());
-		attributeTable.setColumnProperties(COLUMN_NAMES);
-		attributeTable.setCellModifier(new AttributeTableCellModifier());
+		this.attributeTable = new TableViewer(base, SWT.BORDER | SWT.SINGLE | SWT.FULL_SELECTION
| SWT.V_SCROLL | SWT.H_SCROLL);
+		this.attributeTable.setContentProvider(new AttributeTableContentProvider());
+		this.attributeTable.setLabelProvider(new AttributeTableLabelProvider());
+		this.attributeTable.setColumnProperties(COLUMN_NAMES);
+		this.attributeTable.setCellModifier(new AttributeTableCellModifier());
 		CellEditor [] editors = new CellEditor[4];
 		Operator [] operators = Operator.values();
 		String [] opNames = new String[operators.length];
 		for (int i = 0; i < operators.length; i++) {
 			opNames[i] = operators[i].toString();
 		}
-		editors[2] = new ComboBoxCellEditor(attributeTable.getTable(), opNames, SWT.READ_ONLY);
-		editors[3] = new TextCellEditor(attributeTable.getTable());
-		attributeTable.setCellEditors(editors);
-		attributeTable.getTable().setHeaderVisible(true);
-		attributeTable.getTable().setLinesVisible(true);
-		attributeTable.getTable().setLayoutData(tableData);
-		
-		attributeName = new TableColumn(attributeTable.getTable(), SWT.NULL);
-		attributeName.setText(COLUMN_NAMES[0]);
-		attributeType = new TableColumn(attributeTable.getTable(), SWT.NULL);
-		attributeType.setText(COLUMN_NAMES[1]);
-		operator = new TableColumn(attributeTable.getTable(), SWT.NULL);
-		operator.setText(COLUMN_NAMES[2]);
-		value = new TableColumn(attributeTable.getTable(), SWT.NULL);
-		value.setText(COLUMN_NAMES[3]);
+		editors[2] = new ComboBoxCellEditor(this.attributeTable.getTable(), opNames, SWT.READ_ONLY);
+		editors[3] = new TextCellEditor(this.attributeTable.getTable());
+		this.attributeTable.setCellEditors(editors);
+		this.attributeTable.getTable().setHeaderVisible(true);
+		this.attributeTable.getTable().setLinesVisible(true);
+		this.attributeTable.getTable().setLayoutData(tableData);
+		
+		this.attributeName = new TableColumn(this.attributeTable.getTable(), SWT.NULL);
+		this.attributeName.setText(COLUMN_NAMES[0]);
+		this.attributeType = new TableColumn(this.attributeTable.getTable(), SWT.NULL);
+		this.attributeType.setText(COLUMN_NAMES[1]);
+		this.operator = new TableColumn(this.attributeTable.getTable(), SWT.NULL);
+		this.operator.setText(COLUMN_NAMES[2]);
+		this.value = new TableColumn(this.attributeTable.getTable(), SWT.NULL);
+		this.value.setText(COLUMN_NAMES[3]);
 		
 		TableLayout tableLayout = new TableLayout();
 		tableLayout.addColumnData(new ColumnWeightData(2));
 		tableLayout.addColumnData(new ColumnWeightData(2));
 		tableLayout.addColumnData(new ColumnWeightData(1));
 		tableLayout.addColumnData(new ColumnWeightData(2));
-		attributeTable.getTable().setLayout(tableLayout);
+		this.attributeTable.getTable().setLayout(tableLayout);
 		
 		// get the attributes for this entity
-		EntityResolver entityResolver = context.getEntityResolver();
-		ObjEntity entity = entityResolver.getObjEntity(entityName);
+		EntityResolver entityResolver = this.context.getEntityResolver();
+		ObjEntity entity = entityResolver.getObjEntity(this.entityName);
 		Collection attributes = entity.getAttributes();
 		for (Object o : attributes) {
 			ObjAttribute attribute = (ObjAttribute) o;
-			operatorMap.put(attribute.getName(), Operator.EQUAL_TO);
+			this.operatorMap.put(attribute.getName(), Operator.EQUAL_TO);
 		}
-		attributeTable.setInput(attributes);
+		this.attributeTable.setInput(attributes);
 		
-		errorLabel = new Label(base, SWT.NULL);
-		errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-		errorLabel.setLayoutData(errorLabelData);
+		this.errorLabel = new Label(base, SWT.NULL);
+		this.errorLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
+		this.errorLabel.setLayoutData(errorLabelData);
 		
-		clearAllButton = new Button(base, SWT.PUSH | SWT.BORDER);
-		clearAllButton.setText("Clear all");
-		clearAllButton.addSelectionListener(this);
+		this.clearAllButton = new Button(base, SWT.PUSH | SWT.BORDER);
+		this.clearAllButton.setText("Clear all");
+		this.clearAllButton.addSelectionListener(this);
 		
 		base.setLayout(layout);
 		
@@ -222,6 +222,7 @@
 	/**
 	 * Overridden to set page 2 values when next is pressed
 	 */
+	@Override
 	public IWizardPage getNextPage() {
 		SelectObjectPage page2 = ((SelectQueryWizard) getWizard()).getObjectPage();
 		page2.onEnterPage();
@@ -253,10 +254,10 @@
 	 * Handles selection events from buttons and table
 	 */
 	public void widgetSelected(SelectionEvent e) {
-		errorLabel.setText("");
-		if (e.getSource() == clearAllButton) {
-			paramMap.clear();
-			attributeTable.refresh();
+		this.errorLabel.setText("");
+		if (e.getSource() == this.clearAllButton) {
+			this.paramMap.clear();
+			this.attributeTable.refresh();
 		}
 	}
 
@@ -264,22 +265,21 @@
 	 * @return the names and values of the parameters which have been set.
 	 */
 	public HashMap<String, Object> getParameterMap() {
-		return paramMap;
+		return this.paramMap;
 	}
 	
 	/**
 	 * @return the names of attributes and the operator to be used in the query.
 	 */
 	public HashMap<String, Operator> getOperatorMap() {
-		return operatorMap;
+		return this.operatorMap;
 	}
 	
 	class AttributeTableContentProvider implements IStructuredContentProvider {
 
 		public Object[] getElements(Object inputElement) {
-			if (inputElement instanceof Collection) {
+			if (inputElement instanceof Collection)
 				return ((Collection) inputElement).toArray(new ObjAttribute[((Collection) inputElement).size()]);
-			}
 			return null;
 		}
 		public void dispose() {
@@ -301,9 +301,9 @@
 				switch (columnIndex) {
 					case 0 : return attribute.getName();
 					case 1 : return attribute.getType();
-					case 2 : Operator operator = operatorMap.get(attribute.getName());
+					case 2 : Operator operator = SelectParametersPage.this.operatorMap.get(attribute.getName());
 							 return (operator == null ? new String("") : operator.toString());
-					case 3 : Object paramValue = paramMap.get(attribute.getName());
+					case 3 : Object paramValue = SelectParametersPage.this.paramMap.get(attribute.getName());
 							 return (paramValue == null ? new String("") : TypeConverter.getStringValue(paramValue,
paramValue.getClass().getCanonicalName()));
 				}
 			}
@@ -335,7 +335,7 @@
 			if (element instanceof ObjAttribute) {
 				if (property.equals(COLUMN_NAMES[2])) {
 					Operator [] operators = Operator.values();
-					Operator operator = operatorMap.get(((ObjAttribute) element).getName());
+					Operator operator = SelectParametersPage.this.operatorMap.get(((ObjAttribute) element).getName());
 					int i = operators.length - 1;
 					while (i > 0 && !operators[i].equals(operator)) {
 						i--;
@@ -343,7 +343,7 @@
 					return new Integer(i);
 				}
 				if (property.equals(COLUMN_NAMES[3])) {
-					Object paramValue = paramMap.get(((ObjAttribute) element).getName());
+					Object paramValue = SelectParametersPage.this.paramMap.get(((ObjAttribute) element).getName());
 					return (paramValue == null ? new String("") : TypeConverter.getStringValue(paramValue,
paramValue.getClass().getCanonicalName()));
 				}
 			}
@@ -356,23 +356,23 @@
 				if (property.equals(COLUMN_NAMES[2])) {
 					Operator [] operators = Operator.values();
 					Operator operator = operators[(Integer) value];
-					operatorMap.put(attribute.getText(0), operator);
+					SelectParametersPage.this.operatorMap.put(attribute.getText(0), operator);
 				}
 				else if (property.equals(COLUMN_NAMES[3])) {
 					if (value == null || (value instanceof String && ((String) value).length() ==
0)) {
-						paramMap.remove(attribute.getText(0));
+						SelectParametersPage.this.paramMap.remove(attribute.getText(0));
 					}
 					else {
 						try {
 							Object typedValue = TypeConverter.getValueFromString(value, attribute.getText(1));
-							paramMap.put(attribute.getText(0), typedValue);
+							SelectParametersPage.this.paramMap.put(attribute.getText(0), typedValue);
 						}
 						catch (Exception ex) {
-							errorLabel.setText("Error setting parameter value: could not be converted from String");
+							SelectParametersPage.this.errorLabel.setText("Error setting parameter value: could
not be converted from String");
 						}
 					}
 				}
-				attributeTable.refresh();
+				SelectParametersPage.this.attributeTable.refresh();
 			}
 		}
 	}

Modified: incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectQueryWizard.java
URL: http://svn.apache.org/viewvc/incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectQueryWizard.java?view=diff&rev=442563&r1=442562&r2=442563
==============================================================================
--- incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectQueryWizard.java
(original)
+++ incubator/cayenne/soc/trunk/cayenne-rop/rop-browser/src/org/apache/cayenne/ropbrowser/wizards/SelectQueryWizard.java
Tue Sep 12 04:28:51 2006
@@ -15,8 +15,6 @@
  */
 package org.apache.cayenne.ropbrowser.wizards;
 
-import java.util.HashMap;
-
 import org.apache.cayenne.ropbrowser.model.AbstractObject;
 import org.eclipse.jface.wizard.Wizard;
 import org.apache.cayenne.ObjectContext;
@@ -86,9 +84,8 @@
 	
 	@Override
 	public boolean performFinish() {
-		if (mode == RETURN_OBJECT) {
-			return (selectedObject != null);
-		}
+		if (this.mode == RETURN_OBJECT)
+			return (this.selectedObject != null);
 		return true;
 	}
 	
@@ -98,20 +95,19 @@
 		setHelpAvailable(false);
 		setNeedsProgressMonitor(false);
 		
-		parametersPage = new SelectParametersPage("Enter parameters", context, entityName);
-		addPage(parametersPage);
+		this.parametersPage = new SelectParametersPage("Enter parameters", this.context, this.entityName);
+		addPage(this.parametersPage);
 		
-		if (mode == RETURN_OBJECT) {
-			objectPage = new SelectObjectPage("Select an object", context, entityName);
-			addPage(objectPage);
+		if (this.mode == RETURN_OBJECT) {
+			this.objectPage = new SelectObjectPage("Select an object", this.context, this.entityName);
+			addPage(this.objectPage);
 		}
 	}
 
 	@Override
 	public boolean canFinish() {
-		if (mode == RETURN_OBJECT) {
-			return (selectedObject != null);
-		}
+		if (this.mode == RETURN_OBJECT)
+			return (this.selectedObject != null);
 		return true;
 	}
 	
@@ -119,35 +115,35 @@
 	 * @return the object selected by the user if mode is RETURN_OBJECT
 	 */
 	public AbstractObject getSelectedObject() {
-		return selectedObject;
+		return this.selectedObject;
 	}
 	
 	/**
 	 * @return name of the entity involved
 	 */
 	public String getEntityName() {
-		return entityName;
+		return this.entityName;
 	}
 
 	/**
 	 * @return the page used to choose an object when mode is RETURN_OBJECT
 	 */
 	public SelectObjectPage getObjectPage() {
-		return objectPage;
+		return this.objectPage;
 	}
 	
 	/**
 	 * @return the page used to input query parameters
 	 */
 	public SelectParametersPage getParametersPage() {
-		return parametersPage;
+		return this.parametersPage;
 	}
 
 	/**
 	 * @param data the object to selected by the user
 	 */
 	public void setSelectedObject(AbstractObject data) {
-		selectedObject = data;
+		this.selectedObject = data;
 		getContainer().updateButtons();
 	}
 }



Mime
View raw message