001: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
002:
003: import org.eclipse.jface.wizard.IWizardPage;
004: import org.eclipse.swt.SWT;
005: import org.eclipse.swt.layout.GridData;
006: import org.eclipse.swt.layout.GridLayout;
007: import org.eclipse.swt.widgets.Combo;
008: import org.eclipse.swt.widgets.Composite;
009: import org.eclipse.swt.widgets.Label;
010:
011: import com.bostechcorp.cbesb.common.i18n.I18N;
012: import com.bostechcorp.cbesb.common.i18n.Messages;
013: import com.bostechcorp.cbesb.common.util.SystemCharacterEncoding;
014: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.Consumer;
015: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.DefaultMepType;
016: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.RecordTypeType;
017: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.TCPIP;
018:
019: public class TCPIPConsumerSettingsWizardPage extends PropertyWizardPage {
020:
021: private Combo comboCharacterSet;
022:
023: private Combo comboRecordType;
024:
025: private Combo comboMEP;
026:
027: protected TCPIPConsumerSettingsWizardPage(String pageName) {
028: super (pageName);
029: setTitle(I18N.getString(Messages.TCPIP_CONSUMER_TITLE));
030: setDescription(I18N
031: .getString(Messages.TCPIP_CONSUMER_DESCRIPTION));
032: }
033:
034: public void createControl(Composite parent) {
035: final Composite topLevel = new Composite(parent, SWT.NONE);
036: final GridLayout gridLayout = new GridLayout();
037: gridLayout.numColumns = 2;
038: gridLayout.horizontalSpacing = 10;
039: topLevel.setLayout(gridLayout);
040: topLevel.setLayoutData(new GridData(
041: GridData.VERTICAL_ALIGN_FILL
042: | GridData.HORIZONTAL_ALIGN_FILL));
043: topLevel.setFont(parent.getFont());
044: this .setControl(topLevel);
045:
046: final Label label = new Label(topLevel, SWT.NONE);
047: label.setText(I18N.getString(Messages.MES_EXC_PAT));
048: label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false,
049: false));
050:
051: comboMEP = new Combo(topLevel, SWT.READ_ONLY);
052: comboMEP.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
053: false));
054: comboMEP.setItems(new String[] { "in-only", "in-out",
055: "reliablein" });
056: if (!this .getWizard().isUpdateOperation())
057: comboMEP.setText("in-only");
058:
059: final Label labelRecordType = new Label(topLevel, SWT.NONE);
060: labelRecordType.setLayoutData(new GridData(SWT.FILL, SWT.FILL,
061: false, false));
062: labelRecordType.setText(I18N.getString(Messages.REC_TYPE));
063:
064: comboRecordType = new Combo(topLevel, SWT.READ_ONLY);
065: comboRecordType.setLayoutData(new GridData(SWT.FILL,
066: SWT.CENTER, true, false));
067: comboRecordType.add("string");
068: comboRecordType.add("xml");
069: comboRecordType.add("binary");
070: if (!this .getWizard().isUpdateOperation())
071: comboRecordType.setText("string");
072:
073: final Label labelCharacterSet = new Label(topLevel, SWT.NONE);
074: labelCharacterSet.setLayoutData(new GridData(SWT.FILL,
075: SWT.FILL, false, false));
076: labelCharacterSet.setText(I18N.getString(Messages.CHAR_SET));
077:
078: comboCharacterSet = new Combo(topLevel, SWT.READ_ONLY);
079:
080: comboCharacterSet.setLayoutData(new GridData(SWT.FILL,
081: SWT.CENTER, true, false));
082:
083: // comboCharacterSet.setItems(new String[] {"SYSTEM_DEFAULT",
084: // "ISO-8859-1", "USASCII", "UTF-8", "UTF-16BE", "UTF-16LE",
085: // "windows-1252", "EUC-JP", "Shift_JIS", "Big5", "Big5-HKSCS"});
086: comboCharacterSet.setItems(SystemCharacterEncoding
087: .getSupportedCharacterSets());
088:
089: if (!this .getWizard().isUpdateOperation())
090: comboCharacterSet.setText("SYSTEM_DEFAULT");
091:
092: if (this .getWizard().isUpdateOperation()) {
093: modelsToControl();
094: }
095: }
096:
097: public IWizardPage getNextPage() {
098: if (this .getWizard().getMainPage().isUseCCSL())
099: return this .getWizard().getCcslConsumerPage();
100: else
101: return null;
102: }
103:
104: @Override
105: public void controlToModels() {
106: TCPIPPropertyWizard TCPIPWizard = (TCPIPPropertyWizard) this
107: .getWizard();
108: TCPIP model = TCPIPWizard.getModels();
109: Consumer consumer = model.getConsumer();
110: if (model == null || consumer == null) {
111: return;
112: }
113: consumer.setRecordType(RecordTypeType.getByName(comboRecordType
114: .getText()));
115: consumer.setCharset(comboCharacterSet.getText());
116: consumer.setDefaultMep(DefaultMepType.get(comboMEP.getText()));
117: }
118:
119: @Override
120: public void modelsToControl() {
121: TCPIPPropertyWizard TCPIPWizard = (TCPIPPropertyWizard) this
122: .getWizard();
123: TCPIP model = TCPIPWizard.getModels();
124: if (model == null || model.getConsumer() == null) {
125: return;
126: }
127: comboRecordType.select(comboRecordType.indexOf(model
128: .getConsumer().getRecordType().getLiteral()));
129: comboCharacterSet.select(comboCharacterSet.indexOf(model
130: .getConsumer().getCharset()));
131: String mepType = model.getConsumer().getDefaultMep()
132: .getLiteral();
133: comboMEP.select(comboMEP.indexOf(mepType));
134: }
135: }
|