use of org.eclipse.swt.widgets.Composite 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.widgets.Composite 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;
}
use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.
the class OfflineActiveDialog method createNavigation.
private void createNavigation(Composite parent) {
Label label = new Label(parent, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.operatenavigation"));
RowLayout layout = new RowLayout();
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(layout);
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.inputlicenseid"));
label.setForeground(Display.getDefault().getSystemColor(SWT.COLOR_BLUE));
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.seperate"));
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.getactivekey"));
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.seperate"));
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.getgrantfile"));
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.seperate"));
label = new Label(comp, SWT.NONE);
label.setText(Messages.getString("license.OfflineActiveDialog.activefinish"));
}
use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.
the class ActiveMethodDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite tparent = (Composite) super.createDialogArea(parent);
GridLayout layout = new GridLayout();
layout.marginWidth = 10;
layout.marginTop = 5;
tparent.setLayout(layout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(tparent);
Group groupActiveMethod = new Group(tparent, SWT.NONE);
groupActiveMethod.setText(Messages.getString("license.ActiveMethodDialog.activemethod"));
GridLayout groupLayout = new GridLayout();
groupLayout.marginWidth = 20;
groupLayout.marginHeight = 20;
groupLayout.verticalSpacing = 10;
groupLayout.numColumns = 2;
groupActiveMethod.setLayout(groupLayout);
GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActiveMethod);
Button btnOnline = new Button(groupActiveMethod, SWT.NONE);
GridData btnData = new GridData();
btnData.widthHint = 200;
btnData.heightHint = 40;
btnOnline.setLayoutData(btnData);
btnOnline.setText(Messages.getString("license.ActiveMethodDialog.activeonline"));
btnOnline.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setReturnCode(OK);
Point p = getShell().getLocation();
close();
LicenseManageDialog dialog = new LicenseManageDialog(getShell(), Constants.STATE_NOT_ACTIVATED, null, null, true, p);
int result = dialog.open();
if (result != IDialogConstants.OK_ID) {
System.exit(0);
}
}
});
Label labelRecommend = new Label(groupActiveMethod, SWT.NONE);
labelRecommend.setText(Messages.getString("license.ActiveMethodDialog.recommend"));
Label labelOnline = new Label(groupActiveMethod, SWT.WRAP);
labelOnline.setText(Messages.getString("license.ActiveMethodDialog.onlinemessage"));
GridData dataLabel = new GridData();
dataLabel.horizontalSpan = 2;
dataLabel.widthHint = 450;
labelOnline.setLayoutData(dataLabel);
Label labelSpace = new Label(groupActiveMethod, SWT.NONE);
GridData dataSpace = new GridData();
dataSpace.horizontalSpan = 2;
dataSpace.heightHint = 20;
labelSpace.setLayoutData(dataSpace);
Button btnOffline = new Button(groupActiveMethod, SWT.NONE);
GridData btnData1 = new GridData();
btnData1.widthHint = 200;
btnData1.heightHint = 40;
btnData1.horizontalSpan = 2;
btnOffline.setLayoutData(btnData1);
btnOffline.setText(Messages.getString("license.ActiveMethodDialog.activeoffline"));
btnOffline.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setReturnCode(OK);
Point p = getShell().getLocation();
close();
OfflineActiveDialog dialog = new OfflineActiveDialog(getShell(), p);
int result = dialog.open();
if (result != IDialogConstants.OK_ID) {
System.exit(0);
}
}
});
Label labelOffline = new Label(groupActiveMethod, SWT.WRAP);
labelOffline.setText(Messages.getString("license.ActiveMethodDialog.offlinemessage"));
labelOffline.setLayoutData(dataLabel);
Label labelOffline1 = new Label(groupActiveMethod, SWT.WRAP);
labelOffline1.setText(Messages.getString("license.ActiveMethodDialog.offlinemessage1"));
GridData dataLabel1 = new GridData();
dataLabel1.horizontalSpan = 2;
dataLabel1.widthHint = 450;
labelOffline1.setLayoutData(dataLabel1);
return super.createDialogArea(parent);
}
use of org.eclipse.swt.widgets.Composite in project translationstudio8 by heartsome.
the class GetActiveKeyDialog 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 groupActivekey = new Group(tparent, SWT.NONE);
groupActivekey.setText(Messages.getString("license.GetActiveKeyDialog.activekey"));
GridDataFactory.fillDefaults().grab(true, true).applyTo(groupActivekey);
GridLayout layoutGroup = new GridLayout(2, false);
layoutGroup.marginWidth = 5;
layoutGroup.marginHeight = 20;
groupActivekey.setLayout(layoutGroup);
StyledText text = new StyledText(groupActivekey, SWT.WRAP | SWT.READ_ONLY);
text.setBackground(text.getParent().getBackground());
text.setText(Messages.getString("license.GetActiveKeyDialog.activemessage"));
GridData dataText = new GridData();
dataText.horizontalSpan = 2;
dataText.widthHint = 470;
text.setLayoutData(dataText);
int start = Messages.getString("license.GetActiveKeyDialog.activemessage").indexOf(Messages.getString("license.GetActiveKeyDialog.ts"));
int length = Messages.getString("license.GetActiveKeyDialog.ts").length();
StyleRange styleRange = new StyleRange();
styleRange.start = start;
styleRange.length = length;
styleRange.fontStyle = SWT.BOLD;
styleRange.foreground = Display.getDefault().getSystemColor(SWT.COLOR_BLUE);
text.setStyleRange(styleRange);
Label label = new Label(groupActivekey, SWT.WRAP | SWT.NONE);
label.setText(Messages.getString("license.GetActiveKeyDialog.activemessage1"));
GridDataFactory.fillDefaults().span(2, 1).applyTo(label);
textActivekey = new Text(groupActivekey, SWT.MULTI | SWT.WRAP);
textActivekey.setEditable(false);
textActivekey.setText(activekey);
textActivekey.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
GridDataFactory.fillDefaults().grab(true, false).hint(SWT.DEFAULT, 150).applyTo(textActivekey);
Button btnCopy = new Button(groupActivekey, SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.END).applyTo(btnCopy);
btnCopy.setImage(Activator.getImageDescriptor("images/help/copy.png").createImage());
btnCopy.setToolTipText(Messages.getString("license.GetActiveKeyDialog.copytoclipboard"));
btnCopy.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
Clipboard cb = new Clipboard(Display.getCurrent());
String textData = textActivekey.getText();
TextTransfer textTransfer = TextTransfer.getInstance();
cb.setContents(new Object[] { textData }, new Transfer[] { textTransfer });
}
});
return tparent;
}
Aggregations