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.util.editor;
025:
026: import org.eclipse.swt.SWT;
027: import org.eclipse.swt.events.SelectionAdapter;
028: import org.eclipse.swt.events.SelectionEvent;
029: import org.eclipse.swt.layout.FormAttachment;
030: import org.eclipse.swt.layout.FormData;
031: import org.eclipse.swt.layout.GridData;
032: import org.eclipse.swt.layout.GridLayout;
033: import org.eclipse.swt.widgets.Button;
034: import org.eclipse.swt.widgets.Composite;
035: import org.eclipse.swt.widgets.Group;
036: import org.eclipse.swt.widgets.Label;
037: import org.eclipse.swt.widgets.Text;
038:
039: import com.bostechcorp.cbesb.common.i18n.I18N;
040: import com.bostechcorp.cbesb.common.i18n.Messages;
041:
042: public abstract class TestEditorPageControlComposite extends
043: BaseFormatPanel {
044:
045: protected Label labelCurrentPage;
046:
047: protected Button buttonPrev;
048:
049: protected Text textGoTo;
050:
051: protected Button buttonNext;
052:
053: protected Button buttonGoTo;
054:
055: private Composite newCom;
056:
057: public TestEditorPageControlComposite() {
058:
059: }
060:
061: /**
062: * @param parent
063: * @param aboveLable
064: * Create page control composite in Map Testing Editor or Format
065: * Testing Editor.
066: */
067: public void createPageControlComposite(Group parent,
068: Label aboveLable) {
069: newCom = new Composite(parent, SWT.NONE);
070: final GridLayout gridLayout = new GridLayout();
071: gridLayout.marginHeight = 0;
072: gridLayout.marginWidth = 0;
073: gridLayout.horizontalSpacing = 0;
074: gridLayout.numColumns = 5;
075: newCom.setLayout(gridLayout);
076: final FormData formData = new FormData();
077: formData.right = new FormAttachment(100, 0);
078: formData.bottom = new FormAttachment(newCom, 25, SWT.TOP);
079: formData.top = new FormAttachment(aboveLable, 10, SWT.BOTTOM);
080: formData.left = new FormAttachment(aboveLable, 0, SWT.LEFT);
081: newCom.setLayoutData(formData);
082:
083: labelCurrentPage = new Label(newCom, SWT.NONE);
084: labelCurrentPage.setLayoutData(new GridData(80, SWT.DEFAULT));
085: labelCurrentPage.setText("Page 0 of 0");
086:
087: buttonPrev = new Button(newCom, SWT.NONE);
088: buttonPrev.setLayoutData(new GridData(49, SWT.DEFAULT));
089: buttonPrev.addSelectionListener(new SelectionAdapter() {
090: public void widgetSelected(final SelectionEvent e) {
091: buttonPrevListener();
092: }
093: });
094: buttonPrev.setText("<<");
095:
096: buttonNext = new Button(newCom, SWT.NONE);
097: buttonNext.setLayoutData(new GridData(52, SWT.DEFAULT));
098: buttonNext.addSelectionListener(new SelectionAdapter() {
099:
100: public void widgetSelected(SelectionEvent e) {
101: buttonNextListener();
102: }
103:
104: });
105: buttonNext.setText(">>");
106:
107: textGoTo = new Text(newCom, SWT.BORDER);
108: final GridData gridData = new GridData(36, SWT.DEFAULT);
109: textGoTo.setLayoutData(gridData);
110:
111: buttonGoTo = new Button(newCom, SWT.NONE);
112: buttonGoTo.setLayoutData(new GridData(57, SWT.DEFAULT));
113: buttonGoTo.addSelectionListener(new SelectionAdapter() {
114: public void widgetSelected(final SelectionEvent e) {
115: buttonGoToListener();
116: }
117: });
118: buttonGoTo.setText(I18N.getString(Messages.GOTO));
119:
120: }
121:
122: /**
123: * Button goto listener.Subclasses must implement the method.
124: */
125: protected abstract void buttonGoToListener();
126:
127: /**
128: * Button prev listener.Subclasses must implement the method.
129: */
130: protected abstract void buttonPrevListener();
131:
132: /**
133: * Button next listener.Subclasses must implement the method.
134: */
135: protected abstract void buttonNextListener();
136:
137: public Button getButtonGoTo() {
138: return buttonGoTo;
139: }
140:
141: public void setButtonGoTo(Button buttonGoTo) {
142: this .buttonGoTo = buttonGoTo;
143: }
144:
145: public Button getButtonNext() {
146: return buttonNext;
147: }
148:
149: public void setButtonNext(Button buttonNext) {
150: this .buttonNext = buttonNext;
151: }
152:
153: public Button getButtonPrev() {
154: return buttonPrev;
155: }
156:
157: public void setButtonPrev(Button buttonPrev) {
158: this .buttonPrev = buttonPrev;
159: }
160:
161: public Label getLabelCurrentPage() {
162: return labelCurrentPage;
163: }
164:
165: public void setLabelCurrentPage(Label labelCurrentPage) {
166: this .labelCurrentPage = labelCurrentPage;
167: }
168:
169: public Text getTextGoTo() {
170: return textGoTo;
171: }
172:
173: public void setTextGoTo(Text textGoTo) {
174: this .textGoTo = textGoTo;
175: }
176:
177: public Composite getNewCom() {
178: return newCom;
179: }
180:
181: }
|