Search in sources :

Example 46 with Composite

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);
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) ModifyEvent(org.eclipse.swt.events.ModifyEvent) Composite(org.eclipse.swt.widgets.Composite) ModifyListener(org.eclipse.swt.events.ModifyListener) GridData(org.eclipse.swt.layout.GridData) Label(org.eclipse.swt.widgets.Label) Text(org.eclipse.swt.widgets.Text)

Example 47 with Composite

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) MouseListener(org.eclipse.swt.events.MouseListener) MouseEvent(org.eclipse.swt.events.MouseEvent) Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) Label(org.eclipse.swt.widgets.Label) GridData(org.eclipse.swt.layout.GridData)

Example 48 with Composite

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"));
}
Also used : Composite(org.eclipse.swt.widgets.Composite) RowLayout(org.eclipse.swt.layout.RowLayout) Label(org.eclipse.swt.widgets.Label)

Example 49 with Composite

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);
}
Also used : Group(org.eclipse.swt.widgets.Group) GridLayout(org.eclipse.swt.layout.GridLayout) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) Label(org.eclipse.swt.widgets.Label) Point(org.eclipse.swt.graphics.Point)

Example 50 with Composite

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;
}
Also used : Group(org.eclipse.swt.widgets.Group) StyledText(org.eclipse.swt.custom.StyledText) Composite(org.eclipse.swt.widgets.Composite) StyleRange(org.eclipse.swt.custom.StyleRange) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) Label(org.eclipse.swt.widgets.Label) StyledText(org.eclipse.swt.custom.StyledText) Text(org.eclipse.swt.widgets.Text) Point(org.eclipse.swt.graphics.Point) GridLayout(org.eclipse.swt.layout.GridLayout) Button(org.eclipse.swt.widgets.Button) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) TextTransfer(org.eclipse.swt.dnd.TextTransfer) Transfer(org.eclipse.swt.dnd.Transfer) Clipboard(org.eclipse.swt.dnd.Clipboard) TextTransfer(org.eclipse.swt.dnd.TextTransfer)

Aggregations

Composite (org.eclipse.swt.widgets.Composite)2054 GridData (org.eclipse.swt.layout.GridData)1441 GridLayout (org.eclipse.swt.layout.GridLayout)1419 Label (org.eclipse.swt.widgets.Label)853 Button (org.eclipse.swt.widgets.Button)694 SelectionEvent (org.eclipse.swt.events.SelectionEvent)577 Text (org.eclipse.swt.widgets.Text)519 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)463 Group (org.eclipse.swt.widgets.Group)305 Combo (org.eclipse.swt.widgets.Combo)210 Point (org.eclipse.swt.graphics.Point)198 FillLayout (org.eclipse.swt.layout.FillLayout)188 ModifyListener (org.eclipse.swt.events.ModifyListener)186 SelectionListener (org.eclipse.swt.events.SelectionListener)183 ScrolledComposite (org.eclipse.swt.custom.ScrolledComposite)182 ModifyEvent (org.eclipse.swt.events.ModifyEvent)168 Table (org.eclipse.swt.widgets.Table)159 TableViewer (org.eclipse.jface.viewers.TableViewer)153 Control (org.eclipse.swt.widgets.Control)149 ArrayList (java.util.ArrayList)107