use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class LicenseManageDialog method createStatusComp.
private void createStatusComp(Composite parent) {
Group statusGroup = new Group(parent, SWT.NONE);
statusGroup.setText(Messages.getString("license.LicenseManageDialog.statusGroup"));
GridData dataStatusGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
dataStatusGroup.heightHint = 150;
statusGroup.setLayoutData(dataStatusGroup);
statusGroup.setLayout(new GridLayout());
GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
RowLayout layout = new RowLayout();
layout.center = true;
Composite comp0 = new Composite(statusGroup, SWT.NONE);
comp0.setLayoutData(data);
comp0.setLayout(layout);
Label statusLbl = new Label(comp0, SWT.NONE);
statusLbl.setText(Messages.getString("license.LicenseManageDialog.statusLabel"));
if (type == Constants.STATE_NOT_ACTIVATED) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.notActiveLabel"));
} else if (type == Constants.STATE_VALID) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.activeLabel"));
new Label(comp0, SWT.NONE).setLayoutData(new RowData(30, SWT.DEFAULT));
Button btnCancelActive = new Button(comp0, SWT.NONE);
btnCancelActive.setText(Messages.getString("license.LicenseManageDialog.cancelActiveButton"));
btnCancelActive.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean result = MessageDialog.openConfirm(getShell(), Messages.getString("license.LicenseManageDialog.confirm"), Messages.getString("license.LicenseManageDialog.confirmMessage"));
if (result) {
try {
int re = ServiceUtil.cancel();
if (re == Constants.LOGOUT_SUCCESS) {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), Messages.getString("license.LicenseManageDialog.unactiveSuccess"));
LicenseManageDialog.this.close();
PlatformUI.getWorkbench().restart();
} else {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.notice"), Messages.getString("license.LicenseManageDialog.unactiveFail"));
}
} catch (Exception e1) {
e1.printStackTrace();
Throwable t = e1;
while (t.getCause() != null) {
t = t.getCause();
}
if (t instanceof java.security.cert.CertificateException) {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.titleNet"), MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoNet"), Constants.EXCEPTION_STRING16));
} else {
MessageDialog.openInformation(getShell(), Messages.getString("license.LicenseManageDialog.titleNet"), MessageFormat.format(Messages.getString("license.LicenseManageDialog.infoNet"), Constants.EXCEPTION_STRING17));
}
}
}
}
});
Composite comp1 = new Composite(statusGroup, SWT.NONE);
comp1.setLayoutData(data);
comp1.setLayout(layout);
Label typeLbl = new Label(comp1, SWT.NONE);
typeLbl.setText(Messages.getString("license.LicenseManageDialog.typeLabel"));
Label typeLbl1 = new Label(comp1, SWT.NONE);
typeLbl1.setText(Messages.getString(utilDate == null ? "license.LicenseManageDialog.typeBusiness" : "license.LicenseManageDialog.typeTemp"));
if (utilDate != null) {
Composite comp2 = new Composite(statusGroup, SWT.NONE);
comp2.setLayoutData(data);
comp2.setLayout(layout);
Label typeLbl2 = new Label(comp2, SWT.NONE);
typeLbl2.setText(Messages.getString("license.LicenseManageDialog.utilDate"));
Label dateLbl = new Label(comp2, SWT.NONE);
dateLbl.setText(utilDate);
}
} else if (type == Constants.STATE_INVALID) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.invalidLicense"));
} else if (type == Constants.STATE_EXPIRED) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.expired"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
comp1.setLayoutData(data);
comp1.setLayout(layout);
Label typeLbl = new Label(comp1, SWT.NONE);
typeLbl.setText(Messages.getString("license.LicenseManageDialog.typeLabel"));
Label typeLbl1 = new Label(comp1, SWT.NONE);
typeLbl1.setText(Messages.getString(utilDate == null ? "license.LicenseManageDialog.typeBusiness" : "license.LicenseManageDialog.typeTemp"));
if (utilDate != null) {
Composite comp2 = new Composite(statusGroup, SWT.NONE);
comp2.setLayoutData(data);
comp2.setLayout(layout);
Label typeLbl2 = new Label(comp2, SWT.NONE);
typeLbl2.setText(Messages.getString("license.LicenseManageDialog.utilDate"));
Label dateLbl = new Label(comp2, SWT.NONE);
dateLbl.setText(utilDate);
}
} else if (type == Constants.EXCEPTION_INT16 || type == Constants.EXCEPTION_INT17) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.unvalidate"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.noticeLbl"), StringUtils.getErrorCode(type)));
} else if (type == Constants.EXCEPTION_INT14) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.noSameVersion"), getVersionContent(System.getProperty("TSEdition")), getVersionContent(new LicenseIdGenerator(licenseId).getVersion())));
} else if (type == Constants.EXCEPTION_INT15) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(Messages.getString("license.LicenseManageDialog.maccodeError"));
} else if (type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.licenseExceptionInfo1"), StringUtils.getErrorCode(type)));
} else {
Label statusLbl1 = new Label(comp0, SWT.NONE);
statusLbl1.setText(Messages.getString("license.LicenseManageDialog.licenseException"));
Composite comp1 = new Composite(statusGroup, SWT.NONE);
GridData data1 = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
comp1.setLayoutData(data1);
GridLayout layout1 = new GridLayout();
comp1.setLayout(layout1);
Label noticeLbl = new Label(comp1, SWT.WRAP);
GridData dataLabel = new GridData(GridData.FILL_HORIZONTAL);
noticeLbl.setLayoutData(dataLabel);
noticeLbl.setText(MessageFormat.format(Messages.getString("license.LicenseManageDialog.licenseExceptionInfo"), StringUtils.getErrorCode(type)));
}
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class LicenseManageDialog method createBarComp.
private void createBarComp(Composite parent) {
Composite barComp = new Composite(parent, SWT.NONE);
GridLayout barLayout = new GridLayout();
barLayout.marginTop = 10;
barComp.setLayout(barLayout);
barComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label4 = new Label(barComp, SWT.NONE);
label4.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
bar = new ProgressBar(barComp, SWT.NONE);
bar.setMaximum(10);
bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
setVisible(false);
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class LicenseManageDialog method createActiveComp.
private void createActiveComp(Composite parent) {
Group licenseIdGroup = new Group(parent, SWT.NONE);
licenseIdGroup.setText(Messages.getString("license.LicenseManageDialog.licenseIdGroup"));
GridData dataLicenseIdGroup = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
dataLicenseIdGroup.heightHint = 110;
licenseIdGroup.setLayoutData(dataLicenseIdGroup);
GridLayout layoutGroup = new GridLayout(2, false);
layoutGroup.marginLeft = 5;
layoutGroup.marginHeight = 10;
licenseIdGroup.setLayout(layoutGroup);
Label label = new Label(licenseIdGroup, SWT.NONE);
label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel"));
createIdInputComp(licenseIdGroup);
Composite compLink = new Composite(licenseIdGroup, SWT.NONE);
RowLayout layoutLink = new RowLayout();
layoutLink.marginTop = 20;
layoutLink.marginRight = 0;
layoutLink.marginLeft = 0;
layoutLink.marginBottom = 10;
compLink.setLayout(layoutLink);
GridData linkData = new GridData(GridData.FILL_HORIZONTAL);
linkData.horizontalSpan = 2;
compLink.setLayoutData(linkData);
Label label1 = new Label(compLink, SWT.NONE);
label1.setText(Messages.getString("license.LicenseManageDialog.label1"));
if (!"L".equals(System.getProperty("TSEdition"))) {
Label link1 = new Label(compLink, SWT.NONE);
link1.setText(Messages.getString("license.LicenseManageDialog.link1"));
link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
link1.setCursor(cursor);
link1.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
}
public void mouseDoubleClick(MouseEvent e) {
}
});
Label label2 = new Label(compLink, SWT.NONE);
label2.setText(Messages.getString("license.LicenseManageDialog.label2"));
}
Label link2 = new Label(compLink, SWT.NONE);
link2.setText(Messages.getString("license.LicenseManageDialog.link2"));
link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
link2.setCursor(cursor);
link2.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
}
public void mouseDoubleClick(MouseEvent e) {
}
});
Label label3 = new Label(compLink, SWT.NONE);
label3.setText(Messages.getString("license.LicenseManageDialog.label3"));
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class LicenseManageDialog method createIdInputComp.
private void createIdInputComp(Composite parent) {
if (type == Constants.STATE_NOT_ACTIVATED || type == Constants.STATE_INVALID || type == Constants.STATE_EXPIRED || type == Constants.EXCEPTION_INT14 || type == Constants.EXCEPTION_INT15 || type == Constants.EXCEPTION_INT1 || type == Constants.EXCEPTION_INT2 || type == Constants.EXCEPTION_INT3 || type == Constants.EXCEPTION_INT4) {
Composite comp = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(11, false);
layout.marginHeight = 0;
layout.marginWidth = 0;
comp.setLayout(layout);
GridData compData = new GridData();
comp.setLayoutData(compData);
GridData textData = new GridData();
textData.widthHint = 40;
GridData labelData = new GridData();
labelData.widthHint = 5;
text1 = new Text(comp, SWT.BORDER);
text1.setLayoutData(textData);
text1.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String s = text1.getText();
s = s.replaceAll("-", "");
int length = s.length();
for (int i = 0; i < 4; i++) {
if (i >= length) {
break;
}
char c = s.charAt(i);
if (Character.isDigit(c) || Character.isLetter(c)) {
if (i == 3) {
if (length > 4) {
text1.setText(s.substring(0, 4));
text2.setFocus();
text2.setText(s.substring(4));
} else if (length == 4) {
text2.setFocus();
}
}
} else {
text1.setText(s.substring(0, i));
break;
}
}
}
});
Label label = new Label(comp, SWT.NONE);
label.setLayoutData(labelData);
text2 = new Text(comp, SWT.BORDER);
text2.setLayoutData(textData);
text2.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String s = text2.getText();
s = s.replaceAll("-", "");
int length = s.length();
for (int i = 0; i < 4; i++) {
if (i >= length) {
break;
}
char c = s.charAt(i);
if (Character.isDigit(c) || Character.isLetter(c)) {
if (i == 3) {
if (length > 4) {
text2.setText(s.substring(0, 4));
text3.setFocus();
text3.setText(s.substring(4));
} else if (length == 4) {
text3.setFocus();
}
}
} else {
text2.setText(s.substring(0, i));
}
}
}
});
label = new Label(comp, SWT.NONE);
label.setLayoutData(labelData);
text3 = new Text(comp, SWT.BORDER);
text3.setLayoutData(textData);
text3.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String s = text3.getText();
s = s.replaceAll("-", "");
int length = s.length();
for (int i = 0; i < 4; i++) {
if (i >= length) {
break;
}
char c = s.charAt(i);
if (Character.isDigit(c) || Character.isLetter(c)) {
if (i == 3) {
if (length > 4) {
text3.setText(s.substring(0, 4));
text4.setFocus();
text4.setText(s.substring(4));
} else if (length == 4) {
text4.setFocus();
}
}
} else {
text3.setText(s.substring(0, i));
}
}
}
});
label = new Label(comp, SWT.NONE);
label.setLayoutData(labelData);
text4 = new Text(comp, SWT.BORDER);
text4.setLayoutData(textData);
text4.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String s = text4.getText();
s = s.replaceAll("-", "");
int length = s.length();
for (int i = 0; i < 4; i++) {
if (i >= length) {
break;
}
char c = s.charAt(i);
if (Character.isDigit(c) || Character.isLetter(c)) {
if (i == 3) {
if (length > 4) {
text4.setText(s.substring(0, 4));
text5.setFocus();
text5.setText(s.substring(4));
} else if (length == 4) {
text5.setFocus();
}
}
} else {
text4.setText(s.substring(0, i));
}
}
}
});
label = new Label(comp, SWT.NONE);
label.setLayoutData(labelData);
text5 = new Text(comp, SWT.BORDER);
text5.setLayoutData(textData);
text5.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String s = text5.getText();
s = s.replaceAll("-", "");
int length = s.length();
for (int i = 0; i < 4; i++) {
if (i >= length) {
break;
}
char c = s.charAt(i);
if (Character.isDigit(c) || Character.isLetter(c)) {
if (i == 3) {
if (length > 4) {
text5.setText(s.substring(0, 4));
text6.setFocus();
text6.setText(s.substring(4));
} else if (length == 4) {
text6.setFocus();
}
}
} else {
text5.setText(s.substring(0, i));
}
}
}
});
label = new Label(comp, SWT.NONE);
label.setLayoutData(labelData);
text6 = new Text(comp, SWT.BORDER);
text6.setLayoutData(textData);
text6.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
String s = text6.getText();
s = s.replaceAll("-", "");
int length = s.length();
for (int i = 0; i < 4; i++) {
if (i >= length) {
break;
}
char c = s.charAt(i);
if (Character.isDigit(c) || Character.isLetter(c)) {
if (i == 3) {
if (length > 4) {
text6.setText(s.substring(0, 4));
}
}
} else {
text6.setText(s.substring(0, i));
}
}
}
});
} else {
text = new Text(parent, SWT.NONE);
text.setText(StringUtils.groupString(licenseId));
text.setBackground(parent.getBackground());
text.setEditable(false);
}
}
use of org.eclipse.swt.layout.GridLayout in project translationstudio8 by heartsome.
the class OfflineActiveDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = 10;
layout.marginTop = 10;
tparent.setLayout(layout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
Composite compNav = new Composite(tparent, SWT.NONE);
GridLayout navLayout = new GridLayout();
compNav.setLayout(navLayout);
createNavigation(compNav);
Group groupLicenseId = new Group(tparent, SWT.NONE);
groupLicenseId.setText(Messages.getString("license.OfflineActiveDialog.licenseIdGroup"));
GridDataFactory.fillDefaults().grab(true, true).applyTo(groupLicenseId);
GridLayout layoutGroup = new GridLayout(2, false);
layoutGroup.marginLeft = 5;
layoutGroup.marginHeight = 100;
groupLicenseId.setLayout(layoutGroup);
Label label = new Label(groupLicenseId, SWT.NONE);
label.setText(Messages.getString("license.LicenseManageDialog.licenseIdLabel"));
createIdInputComp(groupLicenseId);
Composite compLink = new Composite(groupLicenseId, SWT.NONE);
RowLayout layoutLink = new RowLayout();
layoutLink.marginTop = 20;
layoutLink.marginRight = 0;
layoutLink.marginLeft = 0;
layoutLink.marginBottom = 10;
compLink.setLayout(layoutLink);
GridData linkData = new GridData(GridData.FILL_HORIZONTAL);
linkData.horizontalSpan = 2;
compLink.setLayoutData(linkData);
Label label1 = new Label(compLink, SWT.NONE);
label1.setText(Messages.getString("license.LicenseManageDialog.label1"));
if (!"L".equals(System.getProperty("TSEdition"))) {
Label link1 = new Label(compLink, SWT.NONE);
link1.setText(Messages.getString("license.LicenseManageDialog.link1"));
link1.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
link1.setCursor(cursor);
link1.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
Program.launch(Messages.getString("license.LicenseManageDialog.urlr8buy") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
}
public void mouseDoubleClick(MouseEvent e) {
}
});
} else {
Label link2 = new Label(compLink, SWT.NONE);
link2.setText(Messages.getString("license.LicenseManageDialog.link2"));
link2.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
link2.setCursor(cursor);
link2.addMouseListener(new MouseListener() {
public void mouseUp(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
Program.launch(Messages.getString("license.LicenseManageDialog.urlr8trial") + "&PRODUCT=" + ProtectionFactory.getProduct() + "&PLATFORM=" + ProtectionFactory.getPlatform());
}
public void mouseDoubleClick(MouseEvent e) {
}
});
}
Label label3 = new Label(compLink, SWT.NONE);
label3.setText(Messages.getString("license.LicenseManageDialog.label3"));
return tparent;
}
Aggregations