001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */
024: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
025:
026: import org.eclipse.jface.wizard.IWizardPage;
027: import org.eclipse.swt.SWT;
028: import org.eclipse.swt.events.SelectionAdapter;
029: import org.eclipse.swt.events.SelectionEvent;
030: import org.eclipse.swt.layout.FormAttachment;
031: import org.eclipse.swt.layout.FormData;
032: import org.eclipse.swt.layout.FormLayout;
033: import org.eclipse.swt.layout.GridData;
034: import org.eclipse.swt.layout.GridLayout;
035: import org.eclipse.swt.widgets.Button;
036: import org.eclipse.swt.widgets.Composite;
037:
038: import com.bostechcorp.cbesb.common.i18n.I18N;
039: import com.bostechcorp.cbesb.common.i18n.Messages;
040:
041: public class JMSReliableDelMain extends PropertyWizardPage {
042:
043: private Button useDefaultButton;
044: IWizardPage nextPage = null;
045:
046: protected JMSReliableDelMain(String pageName) {
047: super (pageName);
048: setTitle(I18N.getString(Messages.JMS_CONSUMER_TITLE));// "Choose
049: setDescription(I18N.getString(Messages.WIZARD_ENTER_TIP));
050: }
051:
052: public void createControl(Composite parent) {
053:
054: Composite topLevel = new Composite(parent, SWT.NONE);
055: topLevel.setLayout(new FormLayout());
056: topLevel.setLayoutData(new GridData(
057: GridData.VERTICAL_ALIGN_FILL
058: | GridData.HORIZONTAL_ALIGN_FILL));
059: topLevel.setFont(parent.getFont());
060: this .setControl(topLevel);
061:
062: final Composite composite = new Composite(topLevel, SWT.NONE);
063: final GridLayout gridLayout = new GridLayout();
064: gridLayout.numColumns = 2;
065: composite.setLayout(gridLayout);
066: final FormData formData = new FormData();
067: formData.right = new FormAttachment(99, 0);
068: formData.bottom = new FormAttachment(100, -5);
069: formData.top = new FormAttachment(0, 5);
070: formData.left = new FormAttachment(0, 5);
071: composite.setLayoutData(formData);
072:
073: useDefaultButton = new Button(composite, SWT.CHECK);
074: useDefaultButton.addSelectionListener(new SelectionAdapter() {
075: public void widgetSelected(final SelectionEvent e) {
076: dialogChanged();
077: }
078: });
079: useDefaultButton.setText(I18N
080: .getString(Messages.JMS_USE_DEFAULT_SETTING));
081: useDefaultButton.setSelection(false);
082:
083: /*if (this.getWizard().isUpdateOperation()) {
084: modelsToControl();
085: }*/
086: dialogChanged();
087: }
088:
089: private void dialogChanged() {
090:
091: /*if(useDefaultButton.getSelection())
092: {
093: ((JMSPropertyWizard)super.getWizard()).setUseDefault(true);
094: }
095: else
096: ((JMSPropertyWizard)super.getWizard()).setUseDefault(false);
097:
098: ((JMSPropertyWizard)super.getWizard()).setReliableDelivery(true);*/
099: setPageComplete(true);
100:
101: }
102:
103: private void updateStatus(String message) {
104: setErrorMessage(message);
105: // this.getWizard().canFinish();
106: }
107:
108: @Override
109: public void controlToModels() {/*
110:
111: JMSPropertyWizard JMSWizard = (JMSPropertyWizard) this.getWizard();
112:
113: JMS models = JMSWizard.getModels();
114: if (models == null)
115: return;
116: try {
117: models.getJmsConsumer().setDefaultMep(
118: DefaultMepType.get(comboDefaultMep.getText()));
119: models.getJmsConsumer().setDestinationStyle(
120: DestinationStyleType.getByName(comboDestinationStyle
121: .getText()));
122: models.getJmsConsumer().setCharset(comboReadCharset.getText());
123: models.getJmsConsumer().setJndiConnectionFactoryName(
124: textJNDIFactoryName.getText());
125: models.getJmsConsumer().setJndiInitialContextFactory(
126: textJNDIFactory.getText());
127: models.getJmsConsumer().setJndiProviderUrl(textJNDIUrl.getText());
128: models.getJmsConsumer().setReadStyle(
129: ReadStyleType.get(comboReadStyle.getText()));
130: models.getJmsConsumer().setRecordsPerMessage(
131: textRecordsPerMessage.getText());
132: models.getJmsConsumer().setRecordType(
133: RecordTypeType.get(comboRecordType.getText()));
134: models.getJmsConsumer().setReplyDestinationName(
135: textReplyDestinationName.getText());
136: models.getJmsConsumer().setTargetDestinationName(
137: textTargetName.getText());
138: models.getJmsConsumer().setWriteStyle(
139: ReadStyleType.get(comboWriteStyle.getText()));
140:
141: } catch (Exception e) {
142: e.printStackTrace();
143: }
144:
145:
146: */
147: }
148:
149: public IWizardPage getNextPage() {
150: if (((JMSPropertyWizardPageMain) this .getWizard().getMainPage())
151: .isUseDefault())
152: nextPage = null;
153: else
154: nextPage = super .getWizard().getPage("ConsumerProperty");
155: return nextPage;
156: }
157:
158: @Override
159: public void modelsToControl() {/*
160:
161: JMSPropertyWizard JMSWizard = (JMSPropertyWizard) this.getWizard();
162: if (!JMSWizard.isUpdateOperation())
163: return;
164: try {
165: JMS models = JMSWizard.getModels();
166: String mepType = models.getJmsConsumer().getDefaultMep()
167: .getLiteral();
168: comboDefaultMep.select(comboDefaultMep.indexOf(mepType));
169:
170: comboDestinationStyle.select(comboDestinationStyle.indexOf(models
171: .getJmsConsumer().getDestinationStyle().getLiteral()));
172: comboReadCharset.select(comboReadCharset.indexOf(models
173: .getJmsConsumer().getCharset()));
174: comboRecordType.select(comboRecordType.indexOf(models
175: .getJmsConsumer().getRecordType().getLiteral()));
176: comboReadStyle.select(comboReadStyle.indexOf(models
177: .getJmsConsumer().getReadStyle().getLiteral()));
178: comboWriteStyle.select(comboWriteStyle.indexOf(models
179: .getJmsConsumer().getWriteStyle().getLiteral()));
180: if (models.getJmsConsumer().getJndiConnectionFactoryName() != null)
181: textJNDIFactoryName.setText(models.getJmsConsumer()
182: .getJndiConnectionFactoryName());
183: else
184: textJNDIFactoryName.setText("");
185:
186: if (models.getJmsConsumer().getJndiInitialContextFactory() != null)
187: textJNDIFactory.setText(models.getJmsConsumer()
188: .getJndiInitialContextFactory());
189: else
190: textJNDIFactory.setText("");
191:
192: if (models.getJmsConsumer().getJndiProviderUrl() != null)
193: textJNDIUrl.setText(models.getJmsConsumer()
194: .getJndiProviderUrl());
195: else
196: textJNDIUrl.setText("");
197:
198: if (models.getJmsConsumer().getRecordsPerMessage() != null)
199: textRecordsPerMessage.setText(models.getJmsConsumer()
200: .getRecordsPerMessage());
201: else
202: textRecordsPerMessage.setText("");
203:
204: if (models.getJmsConsumer().getTargetDestinationName() != null)
205: textTargetName.setText(models.getJmsConsumer()
206: .getTargetDestinationName());
207: else
208: textTargetName.setText("");
209:
210: if (mepType.equalsIgnoreCase("in-out")) {
211: replyDestinationNameLabel.setVisible(true);
212: textReplyDestinationName.setVisible(true);
213: writeStyleLabel.setVisible(true);
214: comboWriteStyle.setVisible(true);
215: comboWriteStyle.select(comboWriteStyle.indexOf(models
216: .getJmsConsumer().getWriteStyle().getLiteral()));
217:
218: if (models.getJmsConsumer().getReplyDestinationName() != null)
219: textReplyDestinationName.setText(models.getJmsConsumer()
220: .getReplyDestinationName());
221: else
222: textReplyDestinationName.setText("");
223: }
224:
225: } catch (Exception e) {
226: e.printStackTrace();
227: }
228:
229:
230: */
231: }
232:
233: public Button getUseDefaultButton() {
234: return useDefaultButton;
235: }
236:
237: public void setUseDefaultButton(Button useDefaultButton) {
238: this.useDefaultButton = useDefaultButton;
239: }
240: }
|