Search in sources :

Example 11 with HsImageLabel

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Text(org.eclipse.swt.widgets.Text) IProject(org.eclipse.core.resources.IProject)

Example 12 with HsImageLabel

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Example 13 with HsImageLabel

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) Spinner(org.eclipse.swt.widgets.Spinner) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Label(org.eclipse.swt.widgets.Label) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 14 with HsImageLabel

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);
        }
    });
}
Also used : Group(org.eclipse.swt.widgets.Group) FocusAdapter(org.eclipse.swt.events.FocusAdapter) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text) FocusEvent(org.eclipse.swt.events.FocusEvent) GridLayout(org.eclipse.swt.layout.GridLayout) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 15 with HsImageLabel

use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.

the class QAPage 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 notIncludeGroup = new Group(tparent, SWT.NONE);
    notIncludeGroup.setLayout(new GridLayout());
    notIncludeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    notIncludeGroup.setText(Messages.getString("qa.preference.QAPage.notInclude"));
    HsImageLabel notIncludeLbl = new HsImageLabel(Messages.getString("preference.QAPage.notIncludeLbl"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_QA_Page_ignore));
    Composite notIncludeCmp = notIncludeLbl.createControl(notIncludeGroup);
    notIncludeCmp.setLayout(new GridLayout());
    notIncludeCmp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    if (CommonFunction.checkEdition("U")) {
        // 上下文匹配
        contextBtn = new Button(notIncludeCmp, SWT.CHECK);
        contextBtn.setText(Messages.getString("qa.preference.QAPage.content"));
    }
    // 完全匹配的文本段
    fullMatchBtn = new Button(notIncludeCmp, SWT.CHECK);
    fullMatchBtn.setText(Messages.getString("qa.preference.QAPage.fullMatch"));
    // 已锁定的文本段
    lockedBtn = new Button(notIncludeCmp, SWT.CHECK);
    lockedBtn.setText(Messages.getString("qa.preference.QAPage.locked"));
    notIncludeLbl.computeSize();
    // 文本段一致性检查的按钮区
    addParaGroup(tparent);
    addTgtLengthGroup(tparent);
    setInitValue();
    // 初始化事件
    initListener();
    return parent;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) HsImageLabel(net.heartsome.cat.common.ui.HsImageLabel) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData)

Aggregations

HsImageLabel (net.heartsome.cat.common.ui.HsImageLabel)28 GridData (org.eclipse.swt.layout.GridData)27 GridLayout (org.eclipse.swt.layout.GridLayout)27 Composite (org.eclipse.swt.widgets.Composite)27 Group (org.eclipse.swt.widgets.Group)24 Button (org.eclipse.swt.widgets.Button)23 Label (org.eclipse.swt.widgets.Label)13 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 Text (org.eclipse.swt.widgets.Text)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)6 SelectionListener (org.eclipse.swt.events.SelectionListener)5 Link (org.eclipse.swt.widgets.Link)4 Point (org.eclipse.swt.graphics.Point)3 Spinner (org.eclipse.swt.widgets.Spinner)3 ArrayContentProvider (org.eclipse.jface.viewers.ArrayContentProvider)2 ComboViewer (org.eclipse.jface.viewers.ComboViewer)2 TableComboViewer (org.eclipse.nebula.jface.tablecomboviewer.TableComboViewer)2 ModifyEvent (org.eclipse.swt.events.ModifyEvent)2 ModifyListener (org.eclipse.swt.events.ModifyListener)2 Table (org.eclipse.swt.widgets.Table)2