use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class AddOrEditSrxConfigDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridDataFactory.fillDefaults().grab(true, true).hint(500, 500).minSize(500, 500).applyTo(tparent);
Composite nameCmp = new Composite(tparent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(nameCmp);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(nameCmp);
Label nameLbl = new Label(nameCmp, SWT.NONE);
nameLbl.setText(Messages.getString("srx.AddOrEditSrxConfigDialog.nameLbl"));
Text nameTxt = new Text(nameCmp, SWT.BORDER);
nameTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
nameTxt.setText(curSrxName);
nameTxt.setEnabled(false);
GridData groupData = new GridData(SWT.FILL, SWT.FILL, true, true);
GridLayout groupLayout = new GridLayout(4, false);
createLanguageGroup(tparent, groupData, groupLayout);
createMapGroup(tparent, groupData, groupLayout);
initListener();
refreshLangTable(null);
refreshMapTable(null);
return tparent;
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class SrxConfigurationDialog method createButtonBar.
@Override
protected Control createButtonBar(Composite parent) {
Composite buttonCmp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.makeColumnsEqualWidth = false;
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
buttonCmp.setLayout(layout);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
buttonCmp.setLayoutData(data);
buttonCmp.setFont(parent.getFont());
Composite leftCmp = new Composite(buttonCmp, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp);
addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxConfigurationDialog.addBtn"), false);
editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxConfigurationDialog.editBtn"), false);
deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("srx.SrxConfigurationDialog.deleteBtn"), false);
Composite rightCmp = new Composite(buttonCmp, SWT.NONE);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp);
new Label(rightCmp, SWT.NONE);
Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR);
GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl);
// new Label(buttonCmp, SWT.NONE);
createHelpToolItem(buttonCmp);
Composite bottomCmp = new Composite(buttonCmp, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).applyTo(bottomCmp);
createButton(bottomCmp, IDialogConstants.CANCEL_ID, Messages.getString("srx.SrxConfigurationDialog.cancel"), true).setFocus();
initListener();
return buttonCmp;
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class PreTranslationDialog method createPageContent.
/**
* 创建页面内容
* @param parent
* ;
*/
private void createPageContent(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout gl_composite = new GridLayout(1, false);
gl_composite.marginHeight = 0;
gl_composite.marginWidth = 0;
gl_composite.verticalSpacing = 0;
composite.setLayout(gl_composite);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
viewer = new TableViewer(composite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
final Table table = viewer.getTable();
GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
tableGd.heightHint = 220;
table.setLayoutData(tableGd);
table.setLinesVisible(true);
table.setHeaderVisible(true);
String[] clmnTitles = new String[] { Messages.getString("dialog.PreTranslationDialog.clmnTitles1"), Messages.getString("dialog.PreTranslationDialog.clmnTitles2"), Messages.getString("dialog.PreTranslationDialog.clmnTitles3"), Messages.getString("dialog.PreTranslationDialog.clmnTitles4") };
int[] clmnBounds = { 80, 250, 100, 100 };
for (int i = 0; i < clmnTitles.length; i++) {
createTableViewerColumn(viewer, clmnTitles[i], clmnBounds[i], i);
}
viewer.setLabelProvider(new TableViewerLabelProvider());
viewer.setContentProvider(new ArrayContentProvider());
viewer.setInput(this.getTableViewerInput());
// 参数面板
Composite cmpPerTranParam = new Composite(composite, SWT.BORDER);
GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).applyTo(cmpPerTranParam);
GridLayoutFactory.swtDefaults().numColumns(3).applyTo(cmpPerTranParam);
// 预翻译参数
Group groupMatch = new Group(cmpPerTranParam, SWT.NONE);
GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).applyTo(groupMatch);
GridLayoutFactory.swtDefaults().applyTo(groupMatch);
groupMatch.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.match"));
Composite cmpPercent = new Composite(groupMatch, SWT.NONE);
GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).applyTo(cmpPercent);
GridLayoutFactory.fillDefaults().numColumns(3).applyTo(cmpPercent);
Label lblLowest = new Label(cmpPercent, SWT.NONE);
lblLowest.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.lowestmatch"));
spinner = new Spinner(cmpPercent, SWT.BORDER);
spinner.setMinimum(1);
spinner.setIncrement(5);
spinner.setSelection(70);
Label lblPercentage = new Label(cmpPercent, SWT.NONE);
lblPercentage.setText("%");
btnIgnoreCase = new Button(groupMatch, SWT.CHECK);
btnIgnoreCase.setSelection(true);
btnIgnoreCase.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.ignorecase"));
GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).applyTo(btnIgnoreCase);
btnIgnoretag = new Button(groupMatch, SWT.CHECK);
GridDataFactory.swtDefaults().align(SWT.LEFT, SWT.CENTER).span(2, 1).applyTo(btnIgnoretag);
btnIgnoretag.setSelection(true);
btnIgnoretag.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.ignoretag"));
btnIgnoretag.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
setPanalty(!btnIgnoretag.getSelection());
}
});
Composite cmpPenalty = new Composite(groupMatch, SWT.NONE);
cmpPenalty.setLayoutData(new GridData(GridData.FILL_BOTH));
GridLayoutFactory.fillDefaults().margins(15, 0).numColumns(2).applyTo(cmpPenalty);
lblTagPenalty = new Label(cmpPenalty, SWT.NONE);
lblTagPenalty.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.tagPenalty"));
spinnnerPanalty = new Spinner(cmpPenalty, SWT.BORDER);
spinnnerPanalty.setSelection(2);
setPanalty(false);
// 锁定参数
String lockGrpText = Messages.getString("dialog.PreTranslationDialog.pertrans.lock");
Group groupLockWhenPerTrans = new Group(cmpPerTranParam, SWT.MULTI | SWT.WRAP);
GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).applyTo(groupLockWhenPerTrans);
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(groupLockWhenPerTrans);
groupLockWhenPerTrans.setText(lockGrpText);
btn101Match = new Button(groupLockWhenPerTrans, SWT.CHECK);
btn101Match.setSelection(true);
btn101Match.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.fullMatch"));
btnContextMatch = new Button(groupLockWhenPerTrans, SWT.CHECK);
btnContextMatch.setSelection(true);
btnContextMatch.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.contextMatch"));
Label lbl = new Label(groupLockWhenPerTrans, SWT.NONE);
lbl.setText(lockGrpText);
lbl.setVisible(false);
// 覆盖策略
Group groupHandleOldTarget = new Group(cmpPerTranParam, SWT.NONE);
GridDataFactory.createFrom(new GridData(GridData.FILL_BOTH)).applyTo(groupHandleOldTarget);
GridLayoutFactory.swtDefaults().numColumns(1).applyTo(groupHandleOldTarget);
groupHandleOldTarget.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.handleTargetText"));
btnKeepOld = new Button(groupHandleOldTarget, SWT.RADIO);
btnKeepOld.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.keepOld"));
btnKeepBestMatch = new Button(groupHandleOldTarget, SWT.RADIO);
btnKeepBestMatch.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.keepBestMatch"));
btnKeepNew = new Button(groupHandleOldTarget, SWT.RADIO);
btnKeepNew.setText(Messages.getString("dialog.PreTranslationDialog.pertrans.keepNew"));
setDefaultValues();
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class PreTranslationResultDialog method createDialogArea.
/**
* Create contents of the dialog.
* @param parent
*/
@Override
protected Control createDialogArea(Composite parent) {
Composite container = (Composite) super.createDialogArea(parent);
container.setLayout(new GridLayout(1, false));
Composite composite = new Composite(container, SWT.NONE);
GridLayout gl_composite = new GridLayout(1, false);
gl_composite.verticalSpacing = 0;
gl_composite.marginWidth = 0;
gl_composite.marginHeight = 0;
composite.setLayout(gl_composite);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.H_SCROLL);
Table table = tableViewer.getTable();
GridData tableGd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
tableGd.heightHint = 220;
table.setLayoutData(tableGd);
table.setLinesVisible(true);
table.setHeaderVisible(true);
String[] clmnTitles = new String[] { Messages.getString("dialog.PreTranslationResultDialog.clmnTitles1"), Messages.getString("dialog.PreTranslationResultDialog.clmnTitles2"), Messages.getString("dialog.PreTranslationResultDialog.clmnTitles3"), Messages.getString("dialog.PreTranslationResultDialog.clmnTitles4"), Messages.getString("dialog.PreTranslationResultDialog.clmnTitles5"), Messages.getString("dialog.PreTranslationResultDialog.clmnTitles6") };
int[] clmnBounds = { 60, 200, 100, 110, 110, 110 };
for (int i = 0; i < clmnTitles.length; i++) {
createTableViewerColumn(tableViewer, clmnTitles[i], clmnBounds[i], i);
}
tableViewer.setLabelProvider(new TableViewerLabelProvider());
tableViewer.setContentProvider(new ArrayContentProvider());
tableViewer.setInput(this.getTableViewerInput());
return container;
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class AddOrEditXmlConvertConfigDialog method createButtonBar.
@Override
protected Control createButtonBar(Composite parent) {
Composite buttonCmp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.makeColumnsEqualWidth = false;
layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
buttonCmp.setLayout(layout);
GridData data = new GridData(SWT.FILL, SWT.FILL, true, false);
buttonCmp.setLayoutData(data);
buttonCmp.setFont(parent.getFont());
Composite leftCmp = new Composite(buttonCmp, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(leftCmp);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).equalWidth(false).applyTo(leftCmp);
addBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.addBtn"), false);
editBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.editBtn"), false);
deleteBtn = createButton(leftCmp, IDialogConstants.CLIENT_ID, Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.deleteBtn"), false);
Composite rightCmp = new Composite(buttonCmp, SWT.NONE);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(1).equalWidth(false).applyTo(rightCmp);
// createButton(rightCmp, IDialogConstants.CLIENT_ID, "分析XML(&N)", false);
new Label(rightCmp, SWT.NONE);
Label separatorLbl = new Label(buttonCmp, SWT.HORIZONTAL | SWT.SEPARATOR);
GridDataFactory.fillDefaults().span(2, SWT.DEFAULT).applyTo(separatorLbl);
new Label(buttonCmp, SWT.NONE);
Composite bottomCmp = new Composite(buttonCmp, SWT.NONE);
GridDataFactory.fillDefaults().grab(false, false).applyTo(bottomCmp);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(2).applyTo(bottomCmp);
createButton(bottomCmp, IDialogConstants.OK_ID, Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.ok"), false);
createButton(bottomCmp, IDialogConstants.CANCEL_ID, Messages.getString("dialogs.AddOrEditXmlConvertConfigDialog.cancel"), true).setFocus();
initListener();
return buttonCmp;
}
Aggregations