[Ds-java-dev] svn commit r14459 - trunk/solutions/data-services/java/modules/ide/src/org/wso2/ws/dataservice/ide/dialog

svn at wso2.org svn at wso2.org
Mon Mar 3 07:49:41 PST 2008


Author: sandakith
Date: Mon Mar  3 07:49:37 2008
New Revision: 14459

Log:

Add Dialog to represent the Add New Query Dialog UI

Added:
   trunk/solutions/data-services/java/modules/ide/src/org/wso2/ws/dataservice/ide/dialog/AddQueryDialog.java

Added: trunk/solutions/data-services/java/modules/ide/src/org/wso2/ws/dataservice/ide/dialog/AddQueryDialog.java
==============================================================================
--- (empty file)
+++ trunk/solutions/data-services/java/modules/ide/src/org/wso2/ws/dataservice/ide/dialog/AddQueryDialog.java	Mon Mar  3 07:49:37 2008
@@ -0,0 +1,253 @@
+/*
+ * Copyright 2005,2006 WSO2, Inc. http://www.wso2.org
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.wso2.ws.dataservice.ide.dialog;
+
+import org.eclipse.jface.dialogs.Dialog;
+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.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * Dialog represent the Add Query configuration UI
+ */
+public class AddQueryDialog extends Dialog{
+
+	private Button inputMappingButton;
+	private Button outMappingButton;
+
+	public AddQueryDialog(Shell parentShell) {
+		super(parentShell);
+	}
+
+	/**
+	 * Create the dialog area with the controls
+	 */
+	protected Control createDialogArea(final Composite parent) {
+		Composite container = (Composite) super.createDialogArea(parent);
+
+		GridLayout layout = new GridLayout();
+		container.setLayout(layout);
+		layout.numColumns = 3;
+		layout.verticalSpacing = 10;
+
+		Label label = new Label(container, SWT.NULL);
+		label.setText("SQL Query / Stored Procedure Configuration");
+		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+		
+		label = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText("Query ID *");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		label.setLayoutData(gd);
+
+		Text queryIDText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		queryIDText.setLayoutData(gd);
+		queryIDText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				textChanged();
+			}
+		});
+		
+		label = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText("");
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText("SQL");
+		gd = new GridData();
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText("SQL Statement *");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		label.setLayoutData(gd);
+
+		Text sqlStatementText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		sqlStatementText.setLayoutData(gd);
+		sqlStatementText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				textChanged();
+			}
+		});
+
+		inputMappingButton = new Button(container, SWT.BORDER);
+		inputMappingButton.setText("Add New Input Mapping");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		inputMappingButton.setLayoutData(gd);
+		inputMappingButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleNewInputMapping();
+			}
+		});
+		
+		label = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText("");
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText(" Result ( Output Mapping ) ");
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		label = new Label(container, SWT.NULL);
+		label.setText("Group By Element");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		label.setLayoutData(gd);
+
+		Text groupByElementText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		groupByElementText.setLayoutData(gd);
+		groupByElementText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				textChanged();
+			}
+		});
+
+		label = new Label(container, SWT.NULL);
+		label.setText("Row Name");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		label.setLayoutData(gd);
+
+		Text rowNameText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		rowNameText.setLayoutData(gd);
+		rowNameText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				textChanged();
+			}
+		});
+
+		label = new Label(container, SWT.NULL);
+		label.setText("Row Namespace");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		label.setLayoutData(gd);
+
+		Text rowNamespaceText = new Text(container, SWT.BORDER | SWT.SINGLE);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 2;
+		rowNamespaceText.setLayoutData(gd);
+		rowNamespaceText.addModifyListener(new ModifyListener() {
+			public void modifyText(ModifyEvent e) {
+				textChanged();
+			}
+		});
+
+		outMappingButton = new Button(container, SWT.BORDER);
+		outMappingButton.setText("Add New Output Mapping");
+		gd = new GridData();
+		gd.horizontalSpan = 1;
+		outMappingButton.setLayoutData(gd);
+		outMappingButton.addSelectionListener(new SelectionAdapter() {
+			public void widgetSelected(SelectionEvent e) {
+				handleNewOutputMapping();
+			}
+		});
+
+		label = new Label(container, SWT.NULL);
+		label.setText("");
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 1;
+		label.setLayoutData(gd);
+		
+		label = new Label(container, SWT.HORIZONTAL | SWT.SEPARATOR);
+		gd = new GridData(GridData.FILL_HORIZONTAL);
+		gd.horizontalSpan = 3;
+		label.setLayoutData(gd);
+
+		return super.createDialogArea(parent);
+	}
+
+	/**
+	 * Handler method for the Output Mapping
+	 */
+	private void handleNewOutputMapping() {
+		//New Output Mapping
+		AddOutputMappingDialog addOutputMappingDialog = new AddOutputMappingDialog(getShell());
+		addOutputMappingDialog.create();
+		addOutputMappingDialog.getShell().setSize(500, 350);
+		addOutputMappingDialog.open();
+	}
+
+	/**
+	 * Handler method for the Output Mapping
+	 */
+	private void handleNewInputMapping() {
+		//New Input Mapping
+		AddInputParamDialog addInputParamDialog = new AddInputParamDialog(getShell());
+		addInputParamDialog.create();
+		addInputParamDialog.getShell().setSize(500, 350);
+		addInputParamDialog.open();
+	}
+
+	private void textChanged() {
+		//update the data model
+	}
+
+}
\ No newline at end of file



More information about the Ds-java-dev mailing list