use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class BingPreferencePage method createContents.
// private Label label;
/**
* (non-Javadoc)
* @see org.eclipse.jface.preference.PreferencePage#createContents(org.eclipse.swt.widgets.Composite)
*/
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout(1, false));
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group apiKeySettingGroup = new Group(tparent, SWT.NONE);
apiKeySettingGroup.setText(Messages.getString("preference.BingPreferencePage.apiKeySettingGroup"));
apiKeySettingGroup.setLayout(new GridLayout(1, false));
apiKeySettingGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
HsImageLabel lbKeySetting = new HsImageLabel(Messages.getString("preference.BingPreferencePage.lbKeySetting"), Activator.getImageDescriptor("images/trans_bing_key_32.png"));
Composite com = lbKeySetting.createControl(apiKeySettingGroup);
com.setLayout(new GridLayout(3, false));
Label lblId = new Label(com, SWT.NONE);
lblId.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblId.setText(Messages.getString("preference.BingPreferencePage.lblId"));
idText = new Text(com, SWT.BORDER);
idText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(com, SWT.NONE);
Label lblApiKey = new Label(com, SWT.NONE);
lblApiKey.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
lblApiKey.setText(Messages.getString("preference.BingPreferencePage.lblApiKey"));
bingKeyText = new Text(com, SWT.BORDER);
bingKeyText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
stateLabel = new Label(com, SWT.NONE);
new Label(com, SWT.NONE);
Button validateKey = new Button(com, SWT.NONE);
validateKey.setText(Messages.getString("preference.BingPreferencePage.validateKey"));
validateKey.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
String id = idText.getText();
String bingKey = bingKeyText.getText();
if (id == null || id.equals("")) {
MessageDialog.openInformation(getShell(), Messages.getString("preference.BingPreferencePage.msgTitle"), Messages.getString("preference.BingPreferencePage.msg1"));
return;
}
if (bingKey == null || bingKey.equals("")) {
MessageDialog.openInformation(getShell(), Messages.getString("preference.BingPreferencePage.msgTitle"), Messages.getString("preference.BingPreferencePage.msg2"));
return;
}
validator();
enableComponent(state);
if (!state) {
MessageDialog.openInformation(getShell(), Messages.getString("preference.BingPreferencePage.msgTitle"), Messages.getString("preference.BingPreferencePage.msg3"));
return;
}
}
});
new Label(com, SWT.NONE);
new Label(com, SWT.NONE);
Link link = new Link(com, SWT.NONE);
link.setText("<a>" + Messages.getString("preference.BingPreferencePage.link") + "</a>");
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch("http://msdn.microsoft.com/en-us/library/hh454950.aspx");
}
});
link.setToolTipText("http://msdn.microsoft.com/en-us/library/hh454950.aspx");
new Label(com, SWT.NONE);
lbKeySetting.computeSize();
Group apiAccessibilityGroup = new Group(tparent, SWT.NONE);
apiAccessibilityGroup.setLayout(new GridLayout(1, false));
apiAccessibilityGroup.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
apiAccessibilityGroup.setText(Messages.getString("preference.BingPreferencePage.apiAccessibilityGroup"));
HsImageLabel accessibility = new HsImageLabel(Messages.getString("preference.BingPreferencePage.accessibility"), Activator.getImageDescriptor("images/trans_bing_set_32.png"));
Composite accessibilityComp = accessibility.createControl(apiAccessibilityGroup);
accessibilityComp.setLayout(new GridLayout());
noRepeatAccessBtn = new Button(accessibilityComp, SWT.RADIO);
noRepeatAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
noRepeatAccessBtn.setText(Messages.getString("preference.BingPreferencePage.noRepeatAccessBtn"));
noRepeatAccessBtn.setEnabled(false);
noRepeatAccessBtn.setSelection(false);
alwaysAccessBtn = new Button(accessibilityComp, SWT.RADIO);
alwaysAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
alwaysAccessBtn.setText(Messages.getString("preference.BingPreferencePage.alwaysAccessBtn"));
alwaysAccessBtn.setEnabled(false);
alwaysAccessBtn.setSelection(false);
manualAccessBtn = new Button(accessibilityComp, SWT.RADIO);
manualAccessBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
manualAccessBtn.setText(Messages.getString("preference.BingPreferencePage.neverAccessBtn"));
manualAccessBtn.setEnabled(false);
manualAccessBtn.setSelection(false);
accessibility.computeSize();
if (CommonFunction.checkEdition("U")) {
Group preTransGroup = new Group(tparent, SWT.NONE);
preTransGroup.setLayout(new GridLayout(1, false));
preTransGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
preTransGroup.setText(Messages.getString("preference.BingPreferencePage.preTransGroup"));
HsImageLabel preTrans = new HsImageLabel(Messages.getString("preference.BingPreferencePage.preTrans"), Activator.getImageDescriptor("images/trans_bing_trans_32.png"));
Composite group = preTrans.createControl(preTransGroup);
group.setLayout(new GridLayout());
suportPreTransBtn = new Button(group, SWT.CHECK);
suportPreTransBtn.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
suportPreTransBtn.setText(Messages.getString("preference.BingPreferencePage.suportPreTransBtn"));
suportPreTransBtn.setEnabled(false);
suportPreTransBtn.setSelection(false);
preTrans.computeSize();
}
setValues(false);
return tparent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class ExportDocxDialog method createDialogArea.
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayoutFactory.swtDefaults().extendedMargins(5, 5, 0, 0).numColumns(1).applyTo(tparent);
GridDataFactory.fillDefaults().hint(600, 420).grab(true, true).applyTo(tparent);
Group grpExport = new Group(tparent, SWT.None);
grpExport.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
grpExport.setLayout(new GridLayout());
grpExport.setText(Messages.getString("ExportDocxDialog.exportContent"));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("ExportDocxDialog.lable.lblInfo"), Activator.getImageDescriptor(DocxConstant.EXPORT_GROUP_IMAGE_PATH));
Composite cmp = imageLabel.createControl(grpExport);
cmp.setLayout(new GridLayout());
Composite cmpTemp = (Composite) imageLabel.getControl();
cmpTemp.setLayoutData(new GridData(GridData.FILL_BOTH));
Composite cmpContent = new Composite(cmpTemp, SWT.None);
cmpContent.setLayout(new GridLayout(3, false));
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 2;
cmpContent.setLayoutData(data);
new Label(cmpContent, SWT.None).setText(Messages.getString("ExportDocxDialog.lable.xliff"));
xliffPathTxt = new Text(cmpContent, SWT.BORDER);
xliffPathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
xliffPathTxt.setEditable(false);
if (strXliffRelativePath != null) {
xliffPathTxt.setText(strXliffRelativePath);
}
btnBrowseXLIFF = new Button(cmpContent, SWT.None);
btnBrowseXLIFF.setText(Messages.getString("ExportDocxDialog.browseXliffBtn"));
statusBtn = new Button(cmpContent, SWT.CHECK);
statusBtn.setText(Messages.getString("ExportDocxDialog.statusBtn"));
statusBtn.setSelection(true);
GridDataFactory.fillDefaults().span(3, 1).applyTo(statusBtn);
commentBtn = new Button(cmpContent, SWT.CHECK);
commentBtn.setText(Messages.getString("ExportDocxDialog.commentBtn"));
GridDataFactory.fillDefaults().span(3, 1).applyTo(commentBtn);
Group groupFilter = new Group(tparent, SWT.None);
groupFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupFilter.setLayout(new GridLayout(2, false));
groupFilter.setText(Messages.getString("ExportDocxDialog.groupFilter"));
excludeBtn = new Button(groupFilter, SWT.RADIO);
excludeBtn.setText(Messages.getString("ExportDocxDialog.excludeBtn"));
excludeBtn.setSelection(true);
onlyExportBtn = new Button(groupFilter, SWT.RADIO);
onlyExportBtn.setText(Messages.getString("ExportDocxDialog.onlyExportBtn"));
Composite cmpFilter = new Composite(tparent, SWT.None);
GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).spacing(30, 5).applyTo(cmpFilter);
cmpFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
excludeGroup = new Group(cmpFilter, SWT.None);
excludeGroup.setLayout(new GridLayout());
excludeGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
excludeGroup.setText(Messages.getString("ExportDocxDialog.excludeGroup"));
excludeLockedBtn = new Button(excludeGroup, SWT.CHECK);
excludeLockedBtn.setText(Messages.getString("ExportDocxDialog.excludeLockedBtn"));
excludeLockedBtn.setSelection(true);
exclude101Btn = new Button(excludeGroup, SWT.CHECK);
exclude101Btn.setText(Messages.getString("ExportDocxDialog.exclude101Btn"));
exclude100Btn = new Button(excludeGroup, SWT.CHECK);
exclude100Btn.setText(Messages.getString("ExportDocxDialog.exclude100Btn"));
onlyExportGroup = new Group(cmpFilter, SWT.None);
onlyExportGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
onlyExportGroup.setLayout(new GridLayout());
onlyExportGroup.setText(Messages.getString("ExportDocxDialog.onlyExportGroup"));
onlyExportNoteBtn = new Button(onlyExportGroup, SWT.RADIO);
onlyExportNoteBtn.setText(Messages.getString("ExportDocxDialog.onlyExportNoteBtn"));
onlyExportNoteBtn.setSelection(true);
onlyExportNoteBtn.setEnabled(false);
onlyExportReviewBtn = new Button(onlyExportGroup, SWT.RADIO);
onlyExportReviewBtn.setText(Messages.getString("ExportDocxDialog.onlyExportReviewBtn"));
onlyExportReviewBtn.setEnabled(false);
onlyExportGroup.setEnabled(false);
Composite cmpRTF = new Composite(tparent, SWT.None);
GridDataFactory.fillDefaults().applyTo(cmpRTF);
cmpRTF.setLayout(new GridLayout(3, false));
new Label(cmpRTF, SWT.None).setText(Messages.getString("ExportDocxDialog.label.docxPath"));
docxPathTxt = new Text(cmpRTF, SWT.BORDER);
docxPathTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
docxPathTxt.setEditable(false);
browseDocxBtn = new Button(cmpRTF, SWT.None);
browseDocxBtn.setText(Messages.getString("ExportDocxDialog.browseDocxBtn"));
for (IProject project : root.getProjects()) {
lstProject.add(project.getLocation().toOSString());
}
initListener();
imageLabel.computeSize();
initRtfPath();
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class ExcelPreferencePage method createContents.
@Override
protected Control createContents(Composite parent) {
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group groupCommon = new Group(tparent, SWT.NONE);
groupCommon.setLayout(new GridLayout());
groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupCommon.setText(Messages.getString("preference.ExcelPreferencePage.groupCommon"));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("preference.ExcelPreferencePage.imageLabel"), Activator.getImageDescriptor(Constants.PREFERENCE_EXCEL_32));
Composite cmpCommon = imageLabel.createControl(groupCommon);
cmpCommon.setLayout(new GridLayout());
cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnRedFont = new Button(cmpCommon, SWT.CHECK);
btnRedFont.setText(Messages.getString("preference.ExcelPreferencePage.btnRedFont"));
GridDataFactory.fillDefaults().applyTo(btnRedFont);
imageLabel.computeSize();
btnRedFont.setSelection(preferenceStore.getBoolean(Constants.EXCEL_FILTER));
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class FileAnalysisInstalPage method createContents.
@Override
protected Control createContents(Composite parent) {
isInit = true;
Composite tparent = new Composite(parent, SWT.NONE);
tparent.setLayout(new GridLayout());
tparent.setLayoutData(new GridData(GridData.FILL_BOTH));
Group faGroup = new Group(tparent, SWT.NONE);
faGroup.setLayout(new GridLayout());
faGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
faGroup.setText(Messages.getString("preference.FileAnalysisInstalPage.faGroup"));
String tip = Messages.getString("preference.FileAnalysisInstalPage.faImgLbl");
HsImageLabel faImgLbl = new HsImageLabel(tip, Activator.getImageDescriptor(ImageConstant.PREFERENCE_FA_analysis));
Composite faLblCmp = faImgLbl.createControl(faGroup);
faLblCmp.setLayout(new GridLayout());
faLblCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
ignoreCaseBtn = new Button(faLblCmp, SWT.CHECK);
ignoreCaseBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.ignoreCaseBtn"));
ignoreTagBtn = new Button(faLblCmp, SWT.CHECK);
ignoreTagBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.ignoreTagBtn"));
ignoreTagBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
setTagPenaltyEnable();
}
public void widgetDefaultSelected(SelectionEvent e) {
setTagPenaltyEnable();
}
});
GridData spinnerData = new GridData(30, SWT.DEFAULT);
// 罚分制度
Composite tagPenaltyCmp = new Composite(faLblCmp, SWT.NONE);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).applyTo(tagPenaltyCmp);
tagPenaltyCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
tagPenaltyLbl = new Label(tagPenaltyCmp, SWT.NONE);
tagPenaltyLbl.setText(Messages.getString("preference.FileAnalysisInstalPage.tagPenalty"));
tagPenaltySpi = new Spinner(tagPenaltyCmp, SWT.BORDER);
tagPenaltySpi.setLayoutData(spinnerData);
GridLayout pGl = new GridLayout(2, false);
pGl.marginHeight = 0;
pGl.marginWidth = 0;
tagPenaltySpi.setMinimum(1);
tagPenaltySpi.setMaximum(100);
if (CommonFunction.checkEdition("U")) {
// 上下文个数
Composite contextCmp = new Composite(faLblCmp, SWT.NONE);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).numColumns(3).applyTo(contextCmp);
contextCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label contextLbl = new Label(contextCmp, SWT.NONE);
contextLbl.setText(Messages.getString("preference.FileAnalysisInstalPage.contextLbl"));
contextSpinner = new Spinner(contextCmp, SWT.BORDER);
contextSpinner.setLayoutData(spinnerData);
contextSpinner.setMinimum(1);
contextSpinner.setMaximum(100);
// 步值为1
contextSpinner.setIncrement(1);
contextSpinner.setSelection(1);
Label unitLbl = new Label(contextCmp, SWT.NONE);
unitLbl.setText(Messages.getString("preference.FileAnalysisInstalPage.unitLbl"));
}
faImgLbl.computeSize();
// 分析文件设置
Group faFileGroup = new Group(tparent, SWT.NONE);
faFileGroup.setLayout(new GridLayout());
faFileGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
faFileGroup.setText(Messages.getString("preference.FileAnalysisInstalPage.faFileGroup"));
String faFileTip = Messages.getString("preference.FileAnalysisInstalPage.faFileTip");
HsImageLabel faFileImgLbl = new HsImageLabel(faFileTip, Activator.getImageDescriptor(ImageConstant.PREFERENCE_FA_fileAnalysis));
Composite faFileLblCmp = faFileImgLbl.createControl(faFileGroup);
faFileLblCmp.setLayout(new GridLayout());
faFileLblCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
interRepateBtn = new Button(faFileLblCmp, SWT.CHECK);
interRepateBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.faFileInterRepeate"));
interMatchBtn = new Button(faFileLblCmp, SWT.CHECK);
interMatchBtn.setText(Messages.getString("preference.FileAnalysisInstalPage.faFileInterMatch"));
faFileImgLbl.computeSize();
initListener();
initValue();
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class QAPage method addTgtLengthGroup.
/**
* 添加目标文本段长度限制检查
* @param tParent
*/
private void addTgtLengthGroup(Composite tParent) {
Group group = new Group(tParent, SWT.NONE);
group.setText(Messages.getString("preference.QAPage.group"));
group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
group.setLayout(new GridLayout());
HsImageLabel tgtLengthSetLbl = new HsImageLabel(Messages.getString("preference.QAPage.tgtLengthSetLbl"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_Page_tgtLengthSet));
Composite tgtLengthLblCmp = tgtLengthSetLbl.createControl(group);
tgtLengthLblCmp.setLayout(new GridLayout(3, false));
tgtLengthLblCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Composite tgtLengthSetCmp = new Composite(tgtLengthLblCmp, SWT.NONE);
GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 0).equalWidth(false).numColumns(3).applyTo(tgtLengthSetCmp);
GridDataFactory.fillDefaults().span(3, SWT.DEFAULT).grab(true, true).applyTo(tgtLengthSetCmp);
GridData txtData = new GridData(SWT.LEFT, SWT.CENTER, false, false);
txtData.widthHint = 200;
minBtn = new Button(tgtLengthSetCmp, SWT.CHECK);
minBtn.setText(Messages.getString("preference.QAPage.minBtn"));
minTxt = new Text(tgtLengthSetCmp, SWT.BORDER);
minTxt.setLayoutData(txtData);
Label label = new Label(tgtLengthSetCmp, SWT.NONE);
label.setText("%");
maxBtn = new Button(tgtLengthSetCmp, SWT.CHECK);
maxBtn.setText(Messages.getString("preference.QAPage.maxBtn"));
maxTxt = new Text(tgtLengthSetCmp, SWT.BORDER);
maxTxt.setLayoutData(txtData);
label = new Label(tgtLengthSetCmp, SWT.NONE);
label.setText("%");
tgtLengthSetLbl.computeSize();
minTxt.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
validMinValue(isNumericRegex);
}
});
maxTxt.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
validMaxValue(isNumericRegex);
}
});
minBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
validMinValue(isNumericRegex);
}
public void widgetDefaultSelected(SelectionEvent e) {
validMinValue(isNumericRegex);
}
});
maxBtn.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
validMaxValue(isNumericRegex);
}
public void widgetDefaultSelected(SelectionEvent e) {
validMaxValue(isNumericRegex);
}
});
}
Aggregations