📄 exampleeditlayout.java
字号:
package ExampleViewer.common;
import org.eclipse.swt.SWT;
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.Text;
import ExampleViewer.data.ExampleViewContentProvider;
import ExampleViewer.form.CheckField;
import ExampleViewer.form.ComboField;
import ExampleViewer.form.Field;
import ExampleViewer.form.FieldMode;
import ExampleViewer.form.Form;
import ExampleViewer.form.TextField;
public class ExampleEditLayout extends Form {
/**
* @param parent
* @param style
* @param mode
* @param content
*/
public ExampleEditLayout(Composite parent, int style, int mode,
ExampleViewContentProvider content) {
super(parent, style, mode, content);
}
/*
* (non-Javadoc)
*
* @see ExampleViewer.form.IForm#switchMode(ExampleViewer.form.Field)
*/
public void switchMode(Field mode) {
}
/*
* (non-Javadoc)
*
* @see ExampleViewer.form.IForm#createControls(int)
*/
public void createControls(int style) {
GridData gridData;
Text textFld, subjectFld;
Control toLabel, ccLabel, bccLabel;
Control fromDateTime;
Control control;
Button durationText;
Button submit;
GridLayout layout = new GridLayout(2, false);
layout.marginWidth = 0;
layout.marginHeight = 4;
setLayout(layout);
// Label
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
LabelFactory.create(this, Messages.getString("ExampleEditLayout.Title"), gridData); //$NON-NLS-1$
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 40;
LabelFactory.create(this, "", gridData);
//Text
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
control = LabelFactory.create(this, Messages.getString("ExampleEditLayout.Email"), gridData); //$NON-NLS-1$
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
control = TextFactory.create(this,
SWT.BORDER | SWT.V_SCROLL | SWT.WRAP, gridData, FieldMode.Edit); //$NON-NLS-1$
addField(new TextField(control, ExampleViewContentProvider.FIRST_INDEX));
//Combo
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
LabelFactory.create(this, Messages.getString("ExampleEditLayout.Group"), gridData); //$NON-NLS-1$
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 40;
control = ComboFactory.create(this, FieldMode.Edit, false, gridData); //$NON-NLS-1$
addField(new ComboField(control,
ExampleViewContentProvider.SECOND_INDEX));
//radio
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
LabelFactory.create(this,
Messages.getString("ExampleEditLayout.Digest"), gridData); //$NON-NLS-1$
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 40;
durationText = new Button(this, SWT.RADIO);
durationText.setText(Messages.getString("ExampleEditLayout.Yesno")); //$NON-NLS-1$
durationText.setLayoutData(gridData);
addField(new CheckField(durationText,
ExampleViewContentProvider.THIRD_INDEX));
//CheckField
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
LabelFactory.create(this,
Messages.getString("ExampleEditLayout.Updates"), gridData); //$NON-NLS-1$
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 40;
durationText = new Button(this, SWT.CHECK);
durationText.setLayoutData(gridData);
addField(new CheckField(durationText,
ExampleViewContentProvider.FOURTH_INDEX));
//Submit Button
gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 10;
LabelFactory.create(this, "", gridData);
gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING
| GridData.VERTICAL_ALIGN_CENTER);
gridData.horizontalIndent = 40;
submit = new Button(this, SWT.PUSH);
submit.setText(Messages.getString("ExampleEditLayout.Submit")); //$NON-NLS-1$
submit.setLayoutData(gridData);
addField(new CheckField(durationText,
ExampleViewContentProvider.FIFTH_INDEX));
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -