use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class LanguageCodesPreferencePage method initContents.
/**
* 构建界面显示控件
* @param parent
* 顶层容器 ;
*/
private Composite initContents(Composite parent) {
final Composite page = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(1, false);
layout.marginWidth = 0;
page.setLayout(layout);
// 不显示过滤文本框
PlatformUI.getPreferenceStore().setDefault(IWorkbenchPreferenceConstants.SHOW_FILTERED_TEXTS, false);
Group groupParent = new Group(page, SWT.None);
groupParent.setLayout(new GridLayout());
groupParent.setLayoutData(new GridData(GridData.FILL_BOTH));
groupParent.setText(Messages.getString("languagecode.LanguageCodesPreferencePage.groupParent"));
HsImageLabel imageLabel = new HsImageLabel(Messages.getString("languagecode.LanguageCodesPreferencePage.imageLabel"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_LANG_CODE));
Composite cmp = imageLabel.createControl(groupParent);
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(layout);
GridData data = new GridData(GridData.FILL_BOTH);
data.horizontalSpan = 2;
cmpContent.setLayoutData(data);
// 放置过滤文本框的容器
createFilterControls(cmpContent);
// 创建添加、删除按钮
createLanguageControls(page);
// 暂注释掉 创建与当前语言区域相关的数字、货币、时间、短日期、长日期的格式显示控件
// createLocaleFormatControls(page);
imageLabel.computeSize();
// cmpContent.computeSize(SWT.DEFAULT, SWT.DEFAULT);
return page;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class ProjectPropertiesPreferencePage 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 groupField = new Group(tparent, SWT.NONE);
groupField.setLayout(new GridLayout());
groupField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupField.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.groupField"));
HsImageLabel imageLabel1 = new HsImageLabel(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.imageLabel1"), Activator.getImageDescriptor("images/preference/projectProperties/field_32.png"));
Composite cmpField = imageLabel1.createControl(groupField);
cmpField.setLayout(new GridLayout(2, false));
cmpField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label lbl = new Label(cmpField, SWT.None);
lbl.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.lblField"));
GridDataFactory.swtDefaults().span(2, 1).applyTo(lbl);
fieldList = new List(cmpField, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
GridData listData = new GridData();
listData.widthHint = 130;
if (Util.isLinux()) {
listData.heightHint = 150;
} else {
listData.heightHint = 80;
}
fieldList.setLayoutData(listData);
Composite cmpFieldBtn = new Composite(cmpField, SWT.None);
cmpFieldBtn.setLayout(new GridLayout());
cmpFieldBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnFieldAdd = new Button(cmpFieldBtn, SWT.None);
btnFieldAdd.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnFieldAdd"));
btnFieldEdit = new Button(cmpFieldBtn, SWT.None);
btnFieldEdit.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnFieldEdit"));
btnFieldDel = new Button(cmpFieldBtn, SWT.None);
btnFieldDel.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnFieldDel"));
Point fieldAddPoint = btnFieldAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point fieldEditPoint = btnFieldEdit.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point fieldDelPoint = btnFieldDel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
GridData btnData = new GridData();
int width = Math.max(fieldEditPoint.x, Math.max(fieldAddPoint.x, fieldDelPoint.x));
btnData.widthHint = width + 10;
btnFieldAdd.setLayoutData(btnData);
btnFieldEdit.setLayoutData(btnData);
btnFieldDel.setLayoutData(btnData);
Group groupAttr = new Group(tparent, SWT.NONE);
groupAttr.setLayout(new GridLayout());
groupAttr.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupAttr.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.groupAttr"));
HsImageLabel imageLabel2 = new HsImageLabel(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.imageLabel2"), Activator.getImageDescriptor("images/preference/projectProperties/attribute_32.png"));
Composite cmpAttr = imageLabel2.createControl(groupAttr);
cmpAttr.setLayout(new GridLayout(4, false));
cmpAttr.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
lbl = new Label(cmpAttr, SWT.None);
lbl.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.lblAttrName"));
GridDataFactory.swtDefaults().span(2, 1).applyTo(lbl);
lbl = new Label(cmpAttr, SWT.None);
lbl.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.lblAttrVal"));
GridDataFactory.swtDefaults().span(2, 1).applyTo(lbl);
attrNameList = new List(cmpAttr, SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
attrNameList.setLayoutData(listData);
Composite cmpAttrNameBtn = new Composite(cmpAttr, SWT.None);
cmpAttrNameBtn.setLayout(new GridLayout());
cmpAttrNameBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnAttrNameAdd = new Button(cmpAttrNameBtn, SWT.None);
btnAttrNameAdd.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrNameAdd"));
btnAttrNameEdit = new Button(cmpAttrNameBtn, SWT.None);
btnAttrNameEdit.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrNameEdit"));
btnAttrNameDel = new Button(cmpAttrNameBtn, SWT.None);
btnAttrNameDel.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrNameDel"));
Point atrrNameAddPoint = btnAttrNameAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point atrrNameEditPoint = btnAttrNameEdit.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point atrrNameDelPoint = btnAttrNameDel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
btnData = new GridData();
width = Math.max(atrrNameEditPoint.x, Math.max(atrrNameAddPoint.x, atrrNameDelPoint.x));
btnData.widthHint = width + 10;
btnAttrNameAdd.setLayoutData(btnData);
btnAttrNameEdit.setLayoutData(btnData);
btnAttrNameDel.setLayoutData(btnData);
attrValList = new List(cmpAttr, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
attrValList.setLayoutData(listData);
Composite cmpAttrValBtn = new Composite(cmpAttr, SWT.None);
cmpAttrValBtn.setLayout(new GridLayout());
cmpAttrValBtn.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
btnAttrValAdd = new Button(cmpAttrValBtn, SWT.None);
btnAttrValAdd.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrValAdd"));
btnAttrValEdit = new Button(cmpAttrValBtn, SWT.None);
btnAttrValEdit.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrValEdit"));
btnAttrValDel = new Button(cmpAttrValBtn, SWT.None);
btnAttrValDel.setText(Messages.getString("preferencepage.ProjectPropertiesPreferencePage.btnAttrValDel"));
Point atrrValAddPoint = btnAttrValAdd.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point atrrValEditPoint = btnAttrValEdit.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
Point atrrValDelPoint = btnAttrValDel.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
btnData = new GridData();
width = Math.max(atrrValEditPoint.x, Math.max(atrrValAddPoint.x, atrrValDelPoint.x));
btnData.widthHint = width + 10;
btnAttrValAdd.setLayoutData(btnData);
btnAttrValEdit.setLayoutData(btnData);
btnAttrValDel.setLayoutData(btnData);
imageLabel1.computeSize(-100);
imageLabel2.computeSize(-100);
initListener();
setValue(false);
return parent;
}
use of net.heartsome.cat.common.ui.HsImageLabel in project translationstudio8 by heartsome.
the class SystemPreferencePage 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 groupCommon = new Group(tparent, SWT.NONE);
groupCommon.setLayout(new GridLayout());
groupCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupCommon.setText(Messages.getString("preferencepage.SystemPreferencePage.groupCommon"));
HsImageLabel imageLabel1 = new HsImageLabel(Messages.getString("preferencepage.SystemPreferencePage.imageLabel1"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_UPDATE));
Composite cmpCommon = imageLabel1.createControl(groupCommon);
cmpCommon.setLayout(new GridLayout());
cmpCommon.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnCheckUpdateWithStartup = new Button(cmpCommon, SWT.RADIO);
btnCheckUpdateWithStartup.setText(Messages.getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithStartup"));
GridDataFactory.fillDefaults().applyTo(btnCheckUpdateWithStartup);
btnCheckUpdateWithStartup.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
if (btnCheckUpdateWithStartup.getSelection()) {
btnCheckUpdateWithMonthly.setSelection(false);
btnCheckUpdateWithWeekly.setSelection(false);
btnCheckUpdateWithNever.setSelection(false);
selectDateSpi.setEnabled(false);
cmbSelectWeek.setEnabled(false);
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
cmpMonthly = new Composite(cmpCommon, SWT.None);
GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).spacing(0, 0).applyTo(cmpMonthly);
cmpMonthly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnCheckUpdateWithMonthly = new Button(cmpMonthly, SWT.RADIO);
btnCheckUpdateWithMonthly.setText(Messages.getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly1"));
GridData spinnaData = new GridData();
spinnaData.widthHint = 20;
selectDateSpi = new Spinner(cmpMonthly, SWT.BORDER);
selectDateSpi.setMinimum(1);
selectDateSpi.setMaximum(31);
selectDateSpi.setTextLimit(2);
selectDateSpi.setEnabled(false);
selectDateSpi.setLayoutData(spinnaData);
selectDateSpi.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String text = selectDateSpi.getText();
if (text != null && !text.trim().equals("")) {
if (Integer.parseInt(text.trim()) > 31) {
selectDateSpi.setSelection(31);
} else if (Integer.parseInt(text.trim()) < 1) {
selectDateSpi.setSelection(1);
}
}
}
});
new Label(cmpMonthly, SWT.None).setText(Messages.getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithMonthly2"));
btnCheckUpdateWithMonthly.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
selectDateSpi.setEnabled(btnCheckUpdateWithMonthly.getSelection());
if (btnCheckUpdateWithMonthly.getSelection()) {
btnCheckUpdateWithStartup.setSelection(false);
btnCheckUpdateWithWeekly.setSelection(false);
btnCheckUpdateWithNever.setSelection(false);
cmbSelectWeek.setEnabled(false);
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
cmpWeekly = new Composite(cmpCommon, SWT.None);
GridLayoutFactory.swtDefaults().numColumns(3).equalWidth(false).margins(0, 0).spacing(0, 0).applyTo(cmpWeekly);
cmpWeekly.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnCheckUpdateWithWeekly = new Button(cmpWeekly, SWT.RADIO);
btnCheckUpdateWithWeekly.setText(Messages.getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly1"));
cmbSelectWeek = new Combo(cmpWeekly, SWT.READ_ONLY);
cmbSelectWeek.setItems(arrWeek);
cmbSelectWeek.setEnabled(false);
cmbSelectWeek.select(0);
GridDataFactory.swtDefaults().applyTo(cmbSelectWeek);
new Label(cmpWeekly, SWT.NONE).setText(Messages.getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithWeekly2"));
btnCheckUpdateWithWeekly.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
cmbSelectWeek.setEnabled(btnCheckUpdateWithWeekly.getSelection());
if (btnCheckUpdateWithWeekly.getSelection()) {
btnCheckUpdateWithStartup.setSelection(false);
btnCheckUpdateWithMonthly.setSelection(false);
btnCheckUpdateWithNever.setSelection(false);
selectDateSpi.setEnabled(false);
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
btnCheckUpdateWithNever = new Button(cmpCommon, SWT.RADIO);
btnCheckUpdateWithNever.setText(Messages.getString("preferencepage.SystemPreferencePage.btnCheckUpdateWithNever"));
btnCheckUpdateWithNever.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
GridDataFactory.fillDefaults().applyTo(btnCheckUpdateWithNever);
btnCheckUpdateWithNever.addSelectionListener(new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
if (btnCheckUpdateWithNever.getSelection()) {
btnCheckUpdateWithMonthly.setSelection(false);
btnCheckUpdateWithWeekly.setSelection(false);
btnCheckUpdateWithStartup.setSelection(false);
selectDateSpi.setEnabled(false);
cmbSelectWeek.setEnabled(false);
}
}
public void widgetDefaultSelected(SelectionEvent e) {
}
});
Group groupLanguage = new Group(tparent, SWT.NONE);
groupLanguage.setLayout(new GridLayout());
groupLanguage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupLanguage.setText(Messages.getString("preferencepage.SystemPreferencePage.groupLanguage"));
HsImageLabel imageLabel2 = new HsImageLabel(Messages.getString("preferencepage.SystemPreferencePage.imageLabel3"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_LANGUAGE));
Composite cmpLang = imageLabel2.createControl(groupLanguage);
cmpLang.setLayout(new GridLayout());
cmpLang.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnLanguageWithEN = new Button(cmpLang, SWT.RADIO);
btnLanguageWithEN.setText(Messages.getString("preferencepage.SystemPreferencePage.btnLanguageWithEN"));
btnLanguageWithEN.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
btnLanguageWithZHCN = new Button(cmpLang, SWT.RADIO);
btnLanguageWithZHCN.setText(Messages.getString("preferencepage.SystemPreferencePage.btnLanguageWithZHCN"));
btnLanguageWithZHCN.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Group groupFont = new Group(tparent, SWT.NONE);
groupFont.setLayout(new GridLayout());
groupFont.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupFont.setText(Messages.getString("preferencepage.SystemPreferencePage.groupFont"));
HsImageLabel imageLabel4 = new HsImageLabel(Messages.getString("preferencepage.SystemPreferencePage.groupFont.desc"), Activator.getImageDescriptor("images/preference/system/font.png"));
Composite cmpFont = imageLabel4.createControl(groupFont);
GridLayout cmpFontGl = new GridLayout(2, true);
cmpFontGl.marginLeft = 0;
cmpFontGl.marginRight = 0;
cmpFontGl.marginTop = 0;
cmpFontGl.marginBottom = 0;
cmpFontGl.marginWidth = 0;
cmpFontGl.marginHeight = 0;
cmpFont.setLayout(cmpFontGl);
GridData cmpFontGd = new GridData(SWT.FILL, SWT.FILL, true, true);
cmpFont.setLayoutData(cmpFontGd);
editorFontSetting = new HSFontSettingComposite(cmpFont, SWT.NONE, Messages.getString("preferencepage.fontsetting.editor.title"));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
editorFontSetting.setLayoutData(gd);
matchViewFontSetting = new HSFontSettingComposite(cmpFont, SWT.NONE, Messages.getString("preferencepage.fontsetting.matchView.title"));
matchViewFontSetting.setLayoutData(gd);
Group groupSystemUser = new Group(tparent, SWT.NONE);
groupSystemUser.setLayout(new GridLayout());
groupSystemUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
groupSystemUser.setText(Messages.getString("preferencepage.SystemPreferencePage.groupSystemUser"));
HsImageLabel imageLabel3 = new HsImageLabel(Messages.getString("preferencepage.SystemPreferencePage.imageLabel4"), Activator.getImageDescriptor(ImageConstant.PREFERENCE_SYS_USER));
Composite cmpUser = imageLabel3.createControl(groupSystemUser);
cmpUser.setLayout(new GridLayout(2, false));
cmpUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(cmpUser, SWT.NONE).setText(Messages.getString("preferencepage.SystemPreferencePage.lblUser"));
txtSystemUser = new Text(cmpUser, SWT.BORDER);
txtSystemUser.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
imageLabel1.computeSize();
imageLabel2.computeSize();
imageLabel3.computeSize();
imageLabel4.computeSize();
setInitValues(false);
return parent;
}
Aggregations