コード例 #1
0
ファイル: MainUI.java プロジェクト: gongnaixiao/Study
  private Composite createWinStatusBar(Composite composite) {
    Composite winStatusbar = new Composite(composite, SWT.NONE);
    winStatusbar.setLayoutData(new RowData(850, 25));

    Label smlIconLabel = new Label(winStatusbar, SWT.NONE);
    smlIconLabel.setBounds(565, 7, 16, 16);
    smlIconLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/icon_sml.png"));

    CLabel smlLabel = new CLabel(winStatusbar, SWT.NONE);
    smlLabel.setForeground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    smlLabel.setBounds(585, 5, 67, 20);
    smlLabel.setText("软件小助手");

    Label settingIconLabel = new Label(winStatusbar, SWT.NONE);
    settingIconLabel.setBounds(655, 7, 16, 16);
    settingIconLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/setting.png"));

    CLabel lsettingLbel = new CLabel(winStatusbar, SWT.NONE);
    lsettingLbel.setForeground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    lsettingLbel.setBounds(668, 5, 30, 20);
    lsettingLbel.setText("设置");

    Label downloadMgrIconLabel = new Label(winStatusbar, SWT.NONE);
    downloadMgrIconLabel.setBounds(705, 5, 16, 16);
    downloadMgrIconLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/downloadMgr.png"));

    CLabel downloadMgrLabel = new CLabel(winStatusbar, SWT.NONE);
    downloadMgrLabel.setForeground(
        SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    downloadMgrLabel.setBounds(725, 5, 117, 20);
    downloadMgrLabel.setText("已下载软件共 10 款");

    return winStatusbar;
  }
コード例 #2
0
  /**
   * Create contents of the wizard.
   *
   * @param parent
   */
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    setControl(container);

    table = new Table(container, SWT.BORDER | SWT.FULL_SELECTION);
    table.setBounds(10, 58, 520, 110);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn tblclmnClass = new TableColumn(table, SWT.NONE);
    tblclmnClass.setWidth(180);
    tblclmnClass.setText("Class has similar feature with");

    TableColumn tblclmnClasses = new TableColumn(table, SWT.NONE);
    tblclmnClasses.setWidth(199);
    tblclmnClasses.setText("Class");

    TableColumn tblclmnNewColumn = new TableColumn(table, SWT.NONE);
    tblclmnNewColumn.setWidth(140);
    tblclmnNewColumn.setText("Attributes");

    Label lblSimilarFeaturesAmong = new Label(container, SWT.NONE);
    lblSimilarFeaturesAmong.setBounds(10, 38, 285, 14);
    lblSimilarFeaturesAmong.setText("Similar Features among the selected classes:");

    Label lblClassName = new Label(container, SWT.NONE);
    lblClassName.setBounds(10, 10, 78, 14);
    lblClassName.setText("Class name:");

    text = new Text(container, SWT.BORDER);
    text.setBounds(82, 5, 438, 19);

    fillTable(table);
  }
コード例 #3
0
ファイル: InformationDialog.java プロジェクト: jongbok/notij
  protected Control createContents(Composite parent) {
    ViewForm form = new ViewForm(parent, SWT.NONE);
    form.setSize(400, 290);
    final Composite shell = new Composite(form.getShell(), SWT.NONE);
    Label lbApp1 = new Label(shell, SWT.NONE);
    lbApp1.setText("Version:");
    lbApp1.setBounds(10, 10, 50, 20);
    controls.add(lbApp1);
    Label lbApp2 = new Label(shell, SWT.NONE);
    lbApp2.setText("noti-J 1.0");
    lbApp2.setBounds(UIUtils.getBoundsH(lbApp1, 10, 100));
    controls.add(lbApp2);

    Label lbStatus1 = new Label(shell, SWT.NONE);
    lbStatus1.setText("State:");
    lbStatus1.setBounds(UIUtils.getBoundsV(lbApp1, 10));
    controls.add(lbStatus1);
    Label lbStatus2 = new Label(shell, SWT.NONE);
    lbStatus2.setText(connected ? "connected" : "disconnect");
    lbStatus2.setForeground(
        Display.getDefault().getSystemColor(connected ? SWT.COLOR_BLUE : SWT.COLOR_RED));
    lbStatus2.setBounds(UIUtils.getBoundsV(lbApp2, 10));
    controls.add(lbStatus2);

    Label lbUser1 = new Label(shell, SWT.NONE);
    lbUser1.setText("Account:");
    lbUser1.setBounds(UIUtils.getBoundsV(lbStatus1, 10));
    controls.add(lbUser1);
    Label lbUser2 = new Label(shell, SWT.NONE);
    lbUser2.setText(userid + "(" + userName + ")");
    lbUser2.setBounds(UIUtils.getBoundsV(lbStatus2, 10));
    controls.add(lbUser2);

    Label lbLic1 = new Label(shell, SWT.NONE);
    lbLic1.setText("License:");
    lbLic1.setBounds(UIUtils.getBoundsV(lbUser1, 10));
    controls.add(lbLic1);
    Label lbLic2 = new Label(shell, SWT.NONE);
    lbLic2.setText("GPL 3.0");
    lbLic2.setBounds(UIUtils.getBoundsV(lbUser2, 10));
    controls.add(lbLic2);

    Label lbDev1 = new Label(shell, SWT.NONE);
    lbDev1.setText("Author:");
    lbDev1.setBounds(UIUtils.getBoundsV(lbLic1, 10));
    controls.add(lbDev1);
    Label lbDev2 = new Label(shell, SWT.NONE);
    lbDev2.setText("Jong-Bok,Park([email protected])");
    lbDev2.setBounds(UIUtils.getBoundsV(lbLic2, 10, 300));
    controls.add(lbDev2);

    Text txError = new Text(shell, SWT.NONE | SWT.WRAP);
    txError.setText(errorMsg == null ? "" : errorMsg);
    txError.setBounds(UIUtils.getBoundsV(lbDev1, 10, 300, 100));
    txError.setEditable(false);
    controls.add(txError);
    controls.add(form);
    return form;
  }
コード例 #4
0
ファイル: InfoPage.java プロジェクト: purejava/viarcorsms
  /**
   * Create the info message page
   *
   * @author Ralph Plawetzki
   * @param parent parent shell
   * @param style SWT style
   * @param message text to be displayed on the info message page
   */
  public InfoPage(Composite parent, int style, String message) {
    super(parent, style);

    lblNewLabel = new Label(this, SWT.CENTER);
    lblNewLabel.setBounds(63, 51, 319, 25);
    lblNewLabel.setText(message);
  }
コード例 #5
0
ファイル: MainUI.java プロジェクト: gongnaixiao/Study
  private Composite createWinToolBar(Composite composite) {
    Composite winToolbar = new Composite(composite, SWT.NONE);
    winToolbar.setLayoutData(new RowData(850, 88));

    TabButton button1 =
        new TabButton(winToolbar, SWT.NONE, true, "/res/tab_button_SoftCenter.png", 3, null, this);
    button1.setBounds(20, 0, 74, 82);
    TabButton button2 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_AppCenter.png", 3, null, this);
    button2.setBounds(20 + 74 + 5, 0, 74, 82);
    TabButton button3 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_GameCenter.png", 3, null, this);
    button3.setBounds(20 + 74 * 2 + 5, 0, 74, 82);
    TabButton button4 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_Update.png", 3, null, this);
    button4.setBounds(20 + 74 * 3 + 5, 0, 74, 82);
    TabButton button5 =
        new TabButton(winToolbar, SWT.NONE, false, "/res/tab_button_Uninstall.png", 3, null, this);
    button5.setBounds(20 + 74 * 4 + 5, 0, 74, 82);
    TabButton button6 =
        new TabButton(
            winToolbar, SWT.NONE, false, "/res/tab_button_StartupAccelerate.png", 3, null, this);
    button6.setBounds(20 + 74 * 5 + 5, 0, 74, 82);
    TabButton button7 =
        new TabButton(
            winToolbar, SWT.NONE, false, "/res/tab_button_MobileEssential.png", 3, null, this);
    button7.setBounds(20 + 74 * 6 + 5, 0, 74, 82);

    Label logoLabel = new Label(winToolbar, SWT.NONE);
    logoLabel.setBounds(690, 5, 140, 67);
    logoLabel.setImage(SWTResourceManager.getImage(getClass(), "/res/logo.png"));

    return winToolbar;
  }
コード例 #6
0
  public void addExpressionRow(String expressionName) {
    RowData rowdata = (RowData) expressionGroup.getLayoutData();
    rowdata.height += 120;
    expressionGroup.setLayoutData(new RowData(rowdata.width, rowdata.height));
    Rectangle rect = expressionGroup.getBounds();
    rect.height += 120;
    expressionGroup.setBounds(rect);
    /*Create a row*/
    ExpressionBean expBean = expressions.get(new Integer(expCount - 1));
    Label previousLabel = expBean.getLabel();
    rect = previousLabel.getBounds();
    Label lblNew = new Label(expressionGroup, SWT.NONE);
    lblNew.setBounds(10, rect.y + 90, 120, 15);
    lblNew.setText(expressionName);
    lblNew.setFocus();

    Text previousText = expBean.getText();
    rect = previousText.getBounds();

    Text newText = new Text(expressionGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    newText.setBounds(135, rect.y + 90, 550, 70);
    expressions.put(new Integer(expCount), new ExpressionBean(lblNew, newText));
    expCount++;
    expScrolledComposite.setMinSize(expressionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  }
コード例 #7
0
ファイル: NewReports.java プロジェクト: edias17/idart-jss
  private void createGrpMandEReports() {
    grpMandEReports = new Group(getShell(), SWT.NONE);
    grpMandEReports.setBounds(new Rectangle(475, 305, 325, 200));
    grpMandEReports.setText(Messages.getString("NewReports.section.m_and_e")); // $NON-NLS-1$
    grpMandEReports.setFont(ResourceUtils.getFont(iDartFont.VERASANS_12));

    lblPicMandEReports = new Label(grpMandEReports, SWT.NONE);
    lblPicMandEReports.setBounds(new org.eclipse.swt.graphics.Rectangle(10, 0, 50, 43));
    lblPicMandEReports.setImage(ResourceUtils.getImage(iDartImage.REPORT_STOCKCONTROLPERCLINIC));

    tblMandEReports = new Table(grpMandEReports, SWT.BORDER);
    tblMandEReports.setBounds(new Rectangle(20, 50, 285, 130));
    tblMandEReports.setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));

    TableColumn tblColReportsAvailable = new TableColumn(tblMandEReports, SWT.NONE);
    tblColReportsAvailable.setWidth(270);
    tblColReportsAvailable.setText(Messages.getString("NewReports.table.title")); // $NON-NLS-1$

    tblMandEReports.addMouseListener(
        new MouseAdapter() {
          @Override
          public void mouseDown(MouseEvent event) {
            clearSelections();
            // Determine where the mouse was clicked
            Point pt = new Point(event.x, event.y);

            // Determine which row was selected
            final TableItem item = tblMandEReports.getItem(pt);
            if (item != null) {
              launchReport(item);
              tblMandEReports.select(tblMandEReports.indexOf(item));
            }
          }
        });
  }
コード例 #8
0
ファイル: SWTView.java プロジェクト: greggreg/ProjetEbook
  public void buildView(List<String> files) {
    this.files = files;

    display = new Display();
    shell = new Shell(display);
    shell.setText("Ebook converter");
    shell.setSize(300, 400);

    list = new org.eclipse.swt.widgets.List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    list.setBounds(40, 20, 220, 100);
    label = new Label(shell, SWT.BORDER);
    label.setBounds(60, 130, 160, 25);
    label.setText("Converted:");
    listConverted = new org.eclipse.swt.widgets.List(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL);
    listConverted.setBounds(40, 170, 220, 100);
    updateList();

    list.addListener(SWT.DefaultSelection, this);
    listConverted.addListener(
        SWT.DefaultSelection,
        new Listener() {
          public void handleEvent(Event event) {
            try {
              int i = listConverted.getSelectionIndices()[0];
              System.err.println(i);
              Runtime.getRuntime().exec(pdfViewer + " " + listConverted.getItem(i));
            } catch (IOException e) {
              e.printStackTrace();
            }
          }
        });
  }
コード例 #9
0
  public void addDescriptionRow(String sectionName) {
    RowData rowdata = (RowData) descriptionGroup.getLayoutData();
    rowdata.height += 60;
    descriptionGroup.setLayoutData(new RowData(rowdata.width, rowdata.height));
    Rectangle rect = descriptionGroup.getBounds();
    rect.height += 60;
    descriptionGroup.setBounds(rect);

    /*Add the row*/
    Text prevText = sections.get(new Integer(secCount - 1)).getEndTokens();
    rect = prevText.getBounds();
    Text newText_1 = new Text(descriptionGroup, SWT.BORDER);
    newText_1.setBounds(10, rect.y + 40, 75, 20);
    newText_1.setFocus();

    Label lblNew = new Label(descriptionGroup, SWT.NONE);
    lblNew.setBounds(120, rect.y + 40, 145, 20);
    lblNew.setText(sectionName);

    Text newText_2 = new Text(descriptionGroup, SWT.BORDER);
    newText_2.setBounds(270, rect.y + 40, 115, 20);

    Text newText_3 = new Text(descriptionGroup, SWT.BORDER);
    newText_3.setBounds(420, rect.y + 40, 115, 20);

    Text newText_4 = new Text(descriptionGroup, SWT.BORDER);
    newText_4.setBounds(570, rect.y + 40, 115, 20);
    sections.put(
        new Integer(secCount), new SectionBean(newText_1, lblNew, newText_2, newText_3, newText_4));
    secCount++;

    descScrolledComposite.setMinSize(descriptionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  }
コード例 #10
0
ファイル: SecurityCamera.java プロジェクト: hafnium/Hafnium
  public void add(Composite mainContentContainer, Point position) {
    super.add(mainContentContainer, position);
    {
      nightVisionLabel = new Label(componentContainer, SWT.NONE);
      nightVisionLabel.setText("Night Vision Setting:");
      nightVisionLabel.setBounds(80, 107, 180, 27);
      nightVisionLabel.setFont(SWTResourceManager.getFont("Gill Sans MT", 12, 1, false, false));
    }
    /*{
    	nightVisionValue = new Label(componentContainer, SWT.NONE);
    	nightVisionValue.setText("Off");
    	nightVisionValue.setBounds(270, 109, 64, 23);
    	nightVisionValue.setFont(SWTResourceManager.getFont("Gill Sans MT",12,1,false,false));
    	nightVisionValue.setForeground(SWTResourceManager.getColor(255,0,0));
    }*/

    // BUTTON:: {PowerOn | PowerOff}
    {
      nightVisionButton = new Button(componentContainer, SWT.PUSH | SWT.CENTER);
      nightVisionButton.setText("Off");
      nightVisionButton.setBounds(270, 109, 75, 25);
      nightVisionButton.setFont(SWTResourceManager.getFont("Gill Sans MT", 12, 1, false, false));
      nightVisionButton.setForeground(SWTResourceManager.getColor(255, 0, 0));
      nightVisionButton.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent evt) {
              nightVisionPowerButtonMouseDown(evt, 0);
            }
          });
    }
  }
コード例 #11
0
ファイル: Sleak.java プロジェクト: cbsrbiobank/biobank
 void layout() {
   Rectangle rect = shell.getClientArea();
   // String[] strings = new String[objects.length];
   int width = 0;
   String[] items = list.getItems();
   GC gc = new GC(list);
   for (int i = 0; i < objects.length; i++) {
     width = Math.max(width, gc.stringExtent(items[i]).x);
   }
   gc.dispose();
   Point size1 = start.computeSize(SWT.DEFAULT, SWT.DEFAULT);
   Point size2 = stop.computeSize(SWT.DEFAULT, SWT.DEFAULT);
   Point size3 = check.computeSize(SWT.DEFAULT, SWT.DEFAULT);
   Point size4 = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
   width = Math.max(size1.x, Math.max(size2.x, Math.max(size3.x, width)));
   width = Math.max(64, Math.max(size4.x, list.computeSize(width, SWT.DEFAULT).x));
   start.setBounds(0, 0, width, size1.y);
   stop.setBounds(0, size1.y, width, size2.y);
   check.setBounds(0, size1.y + size2.y, width, size3.y);
   label.setBounds(0, rect.height - size4.y, width, size4.y);
   int height = size1.y + size2.y + size3.y;
   list.setBounds(0, height, width, rect.height - height - size4.y);
   text.setBounds(width, 0, rect.width - width, rect.height);
   canvas.setBounds(width, 0, rect.width - width, rect.height);
 }
コード例 #12
0
ファイル: ScaledWidgetFactory.java プロジェクト: kthoms/toast
 public Label createLabel(
     Composite parent, int flags, int x, int y, int width, int height, Font font, String text) {
   Label label = new Label(parent, flags);
   if (font != null) label.setFont(font);
   if (text != null) label.setText(text);
   label.setBounds(getScaledBounds(x, y, width, height));
   return label;
 }
コード例 #13
0
  /** Create contents of the window */
  protected void createContents() {
    setImage(
        SWTResourceManager.getImage(FileDownloadShell.class, "/org/wayne/feiq/ui/image/ico.png"));
    setSize(443, 141);
    setText("download file..");

    lblMsg = new Label(this, SWT.NONE);
    lblMsg.setText("Counting file size...");
    lblMsg.setBounds(10, 51, 350, 16);

    progressBar = new ProgressBar(this, SWT.SMOOTH);
    progressBar.setMaximum(100);
    progressBar.setBounds(10, 86, 417, 16);

    lblFile = new Label(this, SWT.NONE);
    lblFile.setBounds(10, 66, 350, 16);
    //
  }
コード例 #14
0
  private void createMiddlePanel() {
    int numLines = 7;
    lblFinalEstimation = new Label[numLines];
    textFinalEstimation = new Text[numLines];
    textFinalEstHighInterval = new Text[numLines];
    textFinalEstLowInterval = new Text[numLines];

    int lblWidth = 140;
    int textWidth = 70;
    int gap = 8;
    int xCord = 435;
    Label label_1 = new Label(shell, SWT.NONE);
    label_1.setBounds(xCord + gap + lblWidth, 10, textWidth, 18);
    label_1.setText("Estimates");

    Label label_2 = new Label(shell, SWT.NONE);
    label_2.setBounds(xCord + 2 * gap + lblWidth + textWidth, 10, textWidth, 18);
    label_2.setText("L Bound");

    Label label_3 = new Label(shell, SWT.NONE);
    label_3.setBounds(xCord + 3 * gap + lblWidth + 2 * textWidth, 10, textWidth, 18);
    label_3.setText("H Bound");

    for (int i = 0; i < numLines; i++) {
      lblFinalEstimation[i] = new Label(shell, SWT.NONE);
      lblFinalEstimation[i].setBounds(xCord, 40 + i * 30, lblWidth, 18);
      lblFinalEstimation[i].setText("");

      textFinalEstimation[i] = new Text(shell, SWT.BORDER);
      textFinalEstimation[i].setBounds(gap + xCord + lblWidth, 40 + i * 30, textWidth, 18);
      textFinalEstimation[i].setEditable(false);

      textFinalEstLowInterval[i] = new Text(shell, SWT.BORDER);
      textFinalEstLowInterval[i].setBounds(
          2 * gap + xCord + lblWidth + textWidth, 40 + i * 30, textWidth, 18);
      textFinalEstLowInterval[i].setEditable(false);

      textFinalEstHighInterval[i] = new Text(shell, SWT.BORDER);
      textFinalEstHighInterval[i].setBounds(
          3 * gap + xCord + lblWidth + 2 * textWidth, 40 + i * 30, textWidth, 18);
      textFinalEstHighInterval[i].setEditable(false);
    }
  }
コード例 #15
0
  public PasswordCheckingDialog() {
    display = new Display();
    shlObaLogin = new Shell(display);
    shlObaLogin.setText("OBA Login");
    shlObaLogin.setSize(300, 150);

    bar = new ProgressBar(shlObaLogin, SWT.SMOOTH | SWT.INDETERMINATE);
    bar.setBounds(10, 51, 262, 32);

    Label lblLoginUsingSaved = new Label(shlObaLogin, SWT.NONE);
    lblLoginUsingSaved.setAlignment(SWT.CENTER);
    lblLoginUsingSaved.setBounds(10, 10, 262, 20);
    lblLoginUsingSaved.setText("Login using saved password...");
  }
コード例 #16
0
  /** This method initializes compOptions */
  @Override
  protected void createCompOptions() {
    Label lblInfoText = new Label(getShell(), SWT.WRAP);
    lblInfoText.setBounds(new Rectangle(50, 80, 500, 40));
    lblInfoText.setText(Messages.getString("PatientIdDialog.info_text")); // $NON-NLS-1$

    tblViewer = new TableViewer(getShell(), SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION);
    tblViewer.getTable().setBounds(new org.eclipse.swt.graphics.Rectangle(50, 130, 500, 330));
    tblViewer.getTable().setFont(ResourceUtils.getFont(iDartFont.VERASANS_8));
    tblViewer.setContentProvider(new ArrayContentProvider());
    tblViewer.getTable().setHeaderVisible(true);
    tblViewer.getTable().setLinesVisible(true);
    createColumns(tblViewer);
  }
コード例 #17
0
  /** Create contents of the window. */
  protected void createContents() {
    shell = new Shell();
    shell.setSize(340, 286);
    shell.setText("New customer");
    Utils.centerDialogOnScreen(shell);

    Label lblGuestId = new Label(shell, SWT.NONE);
    lblGuestId.setBounds(33, 42, 61, 17);
    lblGuestId.setText("Guest ID");

    text = new Text(shell, SWT.BORDER);
    text.setBounds(167, 42, 100, 23);
    text.setText(UUID.randomUUID().toString().substring(0, 3));

    Label lblGuestAmount = new Label(shell, SWT.NONE);
    lblGuestAmount.setBounds(33, 71, 94, 17);
    lblGuestAmount.setText("Guest amount");

    text_1 = new Text(shell, SWT.BORDER);
    text_1.setBounds(167, 71, 100, 23);

    Button btnCommit = new Button(shell, SWT.NONE);
    btnCommit.setBounds(103, 211, 80, 27);
    btnCommit.setText("Commit");

    btnAllowSeatTogether = new Button(shell, SWT.CHECK);
    btnAllowSeatTogether.setBounds(69, 108, 219, 17);
    btnAllowSeatTogether.setText("Allow to seat with other customer.");

    lblNewLabel = new Label(shell, SWT.NONE);
    lblNewLabel.setBounds(33, 131, 61, 17);
    lblNewLabel.setText("Additional infomation");
    btnCommit.addSelectionListener(new btnCommitForNewCustomerListener());

    text_2 = new Text(shell, SWT.BORDER);
    text_2.setBounds(33, 154, 255, 23);
  }
コード例 #18
0
  public SWTLabelApp(Display display) {
    Shell shell = new Shell();
    shell.setText("Window");
    shell.setSize(250, 250);

    Label label = new Label(shell, SWT.LEFT);
    label.setText("This is a label");
    Point p = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    label.setBounds(10, 10, p.x + 10, p.y + 10);

    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
  }
コード例 #19
0
  /** Create contents of the dialog */
  protected void createContents() {
    shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
    shell.setSize(505, 258);
    shell.setText("Options");

    final Button saveButton = new Button(shell, SWT.NONE);
    saveButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {

            saveOptions();

            result = "Options saved";
            shell.dispose();
          }
        });
    saveButton.setText("Save");
    saveButton.setBounds(171, 193, 59, 23);

    final Button cancelButton = new Button(shell, SWT.NONE);
    cancelButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(final SelectionEvent e) {

            shell.dispose();
            result = "Options discarded";
          }
        });
    cancelButton.setBounds(271, 193, 59, 23);
    cancelButton.setText("Cancel");

    final Group sendOptionsGroup = new Group(shell, SWT.NONE);
    sendOptionsGroup.setText("Send Options");
    sendOptionsGroup.setBounds(10, 10, 302, 163);

    ignoreHostCertificatesButton = new Button(sendOptionsGroup, SWT.CHECK);
    ignoreHostCertificatesButton.setBounds(10, 21, 195, 16);
    ignoreHostCertificatesButton.setText("Ignore Host Certificates (for HTTPS)*");

    final Label restartRequiredLabel = new Label(shell, SWT.NONE);
    restartRequiredLabel.setText("* Restart Required");
    restartRequiredLabel.setBounds(10, 176, 123, 13);
    //
  }
コード例 #20
0
 @Override
 protected void createContents(Composite parent) {
   parent.setLayout(new FormLayout());
   backgroundColor = new Color(parent.getDisplay(), 0x31, 0x61, 0x9C);
   header = new Composite(parent, SWT.NONE);
   header.setBackground(backgroundColor);
   header.setBackgroundMode(SWT.INHERIT_DEFAULT);
   header.setLayoutData(createLayoutDataForHeader());
   Label label = new Label(header, SWT.NONE);
   label.setText("RAP Controls Demo");
   label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
   label.setBounds(40, 30, 250, 30);
   tree = new Tree(parent, SWT.FULL_SELECTION);
   tree.setLayoutData(createLayoutDataForTree());
   exampleParent = new Composite(parent, SWT.NONE);
   exampleParent.setLayout(new FillLayout());
   exampleParent.setLayoutData(createLayoutDataForExampleParent());
   fillTree(parent);
 }
コード例 #21
0
ファイル: Sample4_5.java プロジェクト: yufangabc123/YF1
 public static void main(String[] args) {
   Display display = new Display(); // 创建一个display对象。
   final Shell shell = new Shell(display); // shell是程序的主窗体
   shell.setText("下拉框示例");
   final Combo combo = new Combo(shell, SWT.NONE);
   combo.setBounds(10, 10, 100, 25);
   lb = new Label(shell, SWT.WRAP); // 创建标签,可自动换行
   lb.setBounds(120, 10, 100, 35);
   Button bt1 = new Button(shell, SWT.NONE);
   bt1.setBounds(20, 60, 100, 25);
   bt1.setText("设值");
   bt1.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent e) { // 按钮的单击事件
           combo.removeAll(); // 清空combo
           for (int i = 1; i <= 3; i++) {
             combo.add("第" + i + "项"); // 循环添加选项
           }
           combo.select(0); // 设置默认选项
         }
       });
   Button bt2 = new Button(shell, SWT.NONE);
   bt2.setBounds(130, 60, 100, 25);
   bt2.setText("取值");
   bt2.addSelectionListener(
       new SelectionAdapter() {
         public void widgetSelected(SelectionEvent e) { // 按钮的单击事件
           lb.setText("你选择的是:" + combo.getText());
         }
       });
   shell.pack();
   shell.open();
   while (!shell.isDisposed()) { // 如果主窗体没有关闭则一直循环
     if (!display.readAndDispatch()) { // 如果display不忙
       display.sleep(); // 休眠
     }
   }
   display.dispose(); // 销毁display
 }
コード例 #22
0
  /** Create contents of the dialog. */
  private void createContents() {
    shell = new Shell(getParent(), getStyle());
    shell.setSize(450, 190);

    Label label = new Label(shell, SWT.NONE);
    label.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    label.setBounds(43, 10, 82, 27);
    label.setText("\u5546\u54C1\u7F16\u7801\uFF1A");

    Label label_1 = new Label(shell, SWT.NONE);
    label_1.setText("\u5546\u54C1\u540D\u79F0\uFF1A");
    label_1.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    label_1.setBounds(43, 43, 82, 27);

    Label label_2 = new Label(shell, SWT.NONE);
    label_2.setText("\u5E93\u5B58\u603B\u91CF\uFF1A");
    label_2.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    label_2.setBounds(43, 76, 82, 27);

    Button btnNewButton = new Button(shell, SWT.NONE);
    btnNewButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            shell.close();
          }
        });
    btnNewButton.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    btnNewButton.setBounds(123, 125, 134, 27);
    btnNewButton.setText("\u786E\u5B9A");

    Label label_3 = new Label(shell, SWT.BORDER);
    label_3.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    label_3.setBounds(131, 10, 153, 27);
    label_3.setText(list.get(0).get(0));

    Label label_4 = new Label(shell, SWT.BORDER);
    label_4.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    label_4.setBounds(131, 43, 153, 27);
    label_4.setText(list.get(0).get(1));

    Label label_5 = new Label(shell, SWT.BORDER);
    label_5.setFont(SWTResourceManager.getFont("微软雅黑", 11, SWT.NORMAL));
    label_5.setBounds(131, 76, 153, 27);
    label_5.setText(list.get(0).get(2));
  }
コード例 #23
0
  /** Create contents of the window. */
  protected void createContents() {

    shell = new Shell();
    shell.setImage(SWTResourceManager.getImage(PrintedLumpWindow.class, "/icon/App.ico"));
    shell.setSize(457, 244);
    shell.setText(loader.getValue(LabelConstants.LAYOUT_PRINTED_LUMPS_NEW_PRINTED_LUMPS));
    Label lblNameOfTheLump = new Label(shell, SWT.NONE);
    lblNameOfTheLump.setBounds(24, 38, 249, 15);
    lblNameOfTheLump.setText(loader.getValue(LabelConstants.LAYOUT_PRINTED_LUMPS_NAME_OF_THE_LUMP));

    txtNameOfTheLump = new Text(shell, SWT.BORDER);
    txtNameOfTheLump.setBounds(20, 77, 397, 25);

    Button btnPrintedLumpCancel = new Button(shell, SWT.NONE);
    btnPrintedLumpCancel.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            shell.setVisible(false);
            shell.dispose();
          }
        });
    btnPrintedLumpCancel.setBounds(20, 149, 105, 32);
    btnPrintedLumpCancel.setText(loader.getValue(LabelConstants.LAYOUT_CANCEL));

    btnPrintedLumpSave = new Button(shell, SWT.NONE);
    btnPrintedLumpSave.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            lumpsInterface.addPrintedLump(txtNameOfTheLump.getText());
            shell.setVisible(false);
            shell.dispose();
          }
        });
    btnPrintedLumpSave.setBounds(312, 149, 105, 32);
    btnPrintedLumpSave.setText(loader.getValue(LabelConstants.LAYOUT_SAVE));
  }
コード例 #24
0
ファイル: SMSTextPage.java プロジェクト: purejava/viarcorsms
  /**
   * Create the SMSTextPage
   *
   * @author Ralph Plawetzki
   * @param parent parent shell
   * @param style SWT style
   * @param app App - main application
   */
  public SMSTextPage(Composite parent, int style, App app) {
    super(parent, style);

    this.app = app;

    lblNewLabel = new Label(this, SWT.NONE);
    lblNewLabel.setBounds(17, 21, 106, 22);
    lblNewLabel.setText("Empfänger");

    lblcommaSeperated = new Label(this, SWT.NONE);
    lblcommaSeperated.setBounds(17, 46, 139, 21);
    lblcommaSeperated.setText("(Trennung mit Komma)");

    combo = new Combo(this, SWT.NONE);
    combo.setItems(app.getAddressComboContent());
    combo.setText(app.getPullDownText());
    combo.setBounds(156, 21, 238, 23);

    int length = 0;
    if (app.getMessage() != null) length = app.getMessage().length();
    smsCount = new Label(this, SWT.NONE);
    smsCount.setBounds(149, 66, 15, 16);
    smsCount.setText(new Integer(calculateSMSCount(length)).toString());

    lblNewLabel_4 = new Label(this, SWT.CENTER);
    lblNewLabel_4.setBounds(170, 66, 34, 16);
    lblNewLabel_4.setText("SMS");

    numberCharsLeft = new Label(this, SWT.RIGHT);
    numberCharsLeft.setBounds(222, 66, 34, 15);
    numberCharsLeft.setText(
        new Integer(getMaxSMSLengthPossible(app.getMaxSMSpossible()) - length).toString());

    lblNewLabel_5 = new Label(this, SWT.CENTER);
    lblNewLabel_5.setBounds(262, 66, 15, 15);
    lblNewLabel_5.setText("/");

    numberSMSLength = new Label(this, SWT.NONE);
    numberSMSLength.setBounds(283, 66, 34, 15);
    numberSMSLength.setText(
        new Integer(getMaxSMSLengthPossible(app.getMaxSMSpossible())).toString());

    lblNewLabel_7 = new Label(this, SWT.NONE);
    lblNewLabel_7.setBounds(321, 66, 94, 21);
    lblNewLabel_7.setText("Zeichen übrig");

    lblSmsText = new Label(this, SWT.NONE);
    lblSmsText.setBounds(72, 66, 68, 15);
    lblSmsText.setText("SMS text");

    message = new Text(this, SWT.MULTI | SWT.WRAP | SWT.BORDER);
    message.setBounds(72, 87, 324, 91);
    if (app.getMessage() != null) message.setText(app.getMessage());
    message.addKeyListener(
        new KeyAdapter() {
          public void keyReleased(KeyEvent evt) {
            messageKeyReleased(evt);
          }
        });
    message.setFocus();

    lblNewLabel_1 = new Label(this, SWT.NONE);
    lblNewLabel_1.setBounds(102, 185, 87, 28);
    lblNewLabel_1.setText("gesendet von");

    sender = new Label(this, SWT.NONE);
    sender.setBounds(195, 184, 184, 22);
    sender.setText(app.geteMail());

    smsLeft = new Label(this, SWT.RIGHT);
    smsLeft.setBounds(36, 226, 26, 15);
    smsLeft.setText(app.getSmsLeft());

    lblNewLabel_9 = new Label(this, SWT.CENTER);
    lblNewLabel_9.setBounds(65, 226, 15, 15);
    lblNewLabel_9.setText("/");

    smsTotal = new Label(this, SWT.NONE);
    smsTotal.setBounds(82, 226, 26, 15);
    smsTotal.setText(app.getSmsTotal());

    lblNewLabel_2 = new Label(this, SWT.CENTER);
    lblNewLabel_2.setBounds(110, 225, 15, 15);
    lblNewLabel_2.setText("+");

    smsBought = new Label(this, SWT.NONE);
    smsBought.setBounds(125, 226, 23, 15);
    smsBought.setText(app.getSmsBought());

    lblNewLabel_11 = new Label(this, SWT.NONE);
    lblNewLabel_11.setBounds(155, 226, 86, 23);
    lblNewLabel_11.setText("SMS übrig");

    btnSendSms = new Button(this, SWT.NONE);
    btnSendSms.setBounds(310, 216, 84, 28);
    btnSendSms.setText("Sende SMS");
  }
コード例 #25
0
  public void addNomenclatureRow(String name) {

    RowData rowdata = (RowData) nomenclatureGroup.getLayoutData();
    rowdata.height += 30;
    nomenclatureGroup.setLayoutData(new RowData(rowdata.width, rowdata.height));
    Rectangle rect = nomenclatureGroup.getBounds();
    rect.height += 30;
    nomenclatureGroup.setBounds(rect);

    /*Create a row*/

    NomenclatureBean nbean = nomenclatures.get(new Integer(nomenCount - 1));
    Label previousLabel = nbean.getLabel();
    rect = previousLabel.getBounds();
    rect.y += 45;

    Label lblNew = new Label(nomenclatureGroup, SWT.NONE);
    lblNew.setBounds(rect);
    lblNew.setText(name);
    lblNew.setFocus();

    /* Create the first group*/
    Group prevGroup = nbean.getParent();
    rect = prevGroup.getBounds();
    Group group_1 = new Group(nomenclatureGroup, SWT.NONE);
    group_1.setBounds(100, rect.y + 45, 182, 40);

    Button buttonYes_1 = new Button(group_1, SWT.RADIO);
    buttonYes_1.setText("Yes");
    buttonYes_1.setBounds(10, 13, 39, 16);

    Button buttonNo_1 = new Button(group_1, SWT.RADIO);
    buttonNo_1.setText("No");
    buttonNo_1.setBounds(55, 13, 39, 16);

    Text text1 = new Text(group_1, SWT.BORDER);
    text1.setBounds(100, 11, 76, 21);

    nomenclatures.put(
        new Integer(nomenCount),
        new NomenclatureBean(group_1, buttonYes_1, buttonNo_1, text1, lblNew));
    nomenCount++;
    ///////////////////////////////////

    /*Create the second group */
    Group group_2 = new Group(nomenclatureGroup, SWT.NONE);
    group_2.setBounds(300, rect.y + 45, 182, 40);

    Button buttonYes_2 = new Button(group_2, SWT.RADIO);
    buttonYes_2.setText("Yes");
    buttonYes_2.setBounds(10, 13, 39, 16);

    Button buttonNo_2 = new Button(group_2, SWT.RADIO);
    buttonNo_2.setText("No");
    buttonNo_2.setBounds(55, 13, 39, 16);

    Text text2 = new Text(group_2, SWT.BORDER);
    text2.setBounds(100, 11, 76, 21);

    nomenclatures.put(
        new Integer(nomenCount),
        new NomenclatureBean(group_2, buttonYes_2, buttonNo_2, text2, lblNew));
    nomenCount++;

    /* Create the third group */
    Group group_3 = new Group(nomenclatureGroup, SWT.NONE);
    group_3.setBounds(500, rect.y + 45, 182, 40);

    Button buttonYes_3 = new Button(group_3, SWT.RADIO);
    buttonYes_3.setText("Yes");
    buttonYes_3.setBounds(10, 13, 39, 16);

    Button buttonNo_3 = new Button(group_3, SWT.RADIO);
    buttonNo_3.setText("No");
    buttonNo_3.setBounds(55, 13, 39, 16);

    Text text3 = new Text(group_3, SWT.BORDER);
    text3.setBounds(100, 11, 76, 21);

    nomenclatures.put(
        new Integer(nomenCount),
        new NomenclatureBean(group_3, buttonYes_3, buttonNo_3, text3, lblNew));
    nomenCount++;
    nomenScrolledComposite.setMinSize(nomenclatureGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));
  }
コード例 #26
0
ファイル: Explorer.java プロジェクト: BackupTheBerlios/jadabs
  /**
   * This method creates the SWT elements for an explorer
   *
   * @param parent Parent is the base composite
   */
  protected Control createContents(Composite parent) {

    parent.setBounds(0, 0, 550, 500);

    // upper sash
    SashForm sash = new SashForm(parent, SWT.VERTICAL | SWT.NULL);
    sash.setBounds(0, 0, 550, 480);
    // lower sash
    SashForm sash_form = new SashForm(sash, SWT.VERTICAL | SWT.NULL);
    sash_form.setBounds(0, 0, 200, 200);

    Composite composite = new Composite(sash, SWT.NONE);
    composite.setBounds(0, 0, 345, 220);

    final Label label = new Label(composite, SWT.NONE);
    label.setBounds(15, 15, 60, 20);
    label.setText("Root:");

    final Combo combo = new Combo(composite, SWT.NONE);
    combo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            tv.setInput(new File(combo.getText()));
          }
        });
    combo.setBounds(80, 10, 100, 20);
    File[] roots = File.listRoots();
    for (int i = 0; i < roots.length; i++) {
      combo.add(roots[i].toString());
    }
    combo.select(0);

    // explorer
    tv = new TreeViewer(sash_form);
    tv.setContentProvider(new FileTreeContentProvider());
    tv.setLabelProvider(new FileTreeLabelProvider());
    tv.setInput(new File(combo.getText()));

    final Label labelFile = new Label(composite, SWT.NONE);
    labelFile.setBounds(15, 45, 30, 25);
    if (buttonString.startsWith(saveString)) {
      labelFile.setText("Konfig:");
    } else {
      labelFile.setText("File:");
    }

    final Text fileName = new Text(composite, SWT.BORDER);
    fileName.setBounds(80, 40, 350, 25);

    final Label labelPath = new Label(composite, SWT.NONE);
    labelPath.setBounds(15, 75, 45, 25);
    labelPath.setText("Path:");

    final Label pathName = new Label(composite, SWT.NONE);
    pathName.setBounds(80, 75, 300, 25);

    if (buttonString.equals(loadString)) {
      final Label labedTemp = new Label(composite, SWT.NONE);
      labedTemp.setBounds(15, 230, 100, 25);
      labedTemp.setText("Temp:");

      textTemp = new Text(composite, SWT.BORDER);
      textTemp.setBounds(130, 230, 300, 25);
      textTemp.setText(Controller.loadTemp());

      final Label labelXargs = new Label(composite, SWT.NONE);
      labelXargs.setBounds(15, 195, 100, 25);
      labelXargs.setText("xargs template:");

      textXargs = new Text(composite, SWT.BORDER);
      textXargs.setBounds(130, 195, 300, 25);
      textXargs.setText(Controller.loadXarg());

      final Label labelLocal = new Label(composite, SWT.NONE);
      labelLocal.setBounds(15, 160, 100, 25);
      labelLocal.setText("Local deploy path:");

      textLocal = new Text(composite, SWT.BORDER);
      textLocal.setBounds(130, 160, 300, 25);
      textLocal.setText(Controller.loadLocal());
    }

    final Button exitButton = new Button(composite, SWT.NONE);
    exitButton.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            closeExplorer();
          }
        });
    exitButton.setBounds(50, 110, 100, 25);
    exitButton.setText("Cancel");

    if (buttonString == loadString) {
      final Button deployButton = new Button(composite, SWT.NONE);
      deployButton.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent e) {

              String fullPath = "";

              char lastChar = pathName.getText().charAt(pathName.getText().length() - 1);
              if (lastChar != File.separatorChar) {
                pathName.setText(pathName.getText() + File.separatorChar);
              }

              if (fileName.getText().length() <= 0) {
                Controller.activateErrorView("choose a filename !");
                System.out.println("choose a filename !");
                return;
              }

              AmonemUI.amonemManager.setFolders(
                  textTemp.getText(), textLocal.getText(), textXargs.getText(), textTemp.getText());

              AmonemUI.amonemManager.importDAG(pathName.getText() + fileName.getText(), true);

              Controller.closeExplorer();
            }
          });
      deployButton.setBounds(270, 110, 100, 25);
      deployButton.setText("Deploy");
    }

    Button button = new Button(composite, 0);
    button.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {

            //				if(pathName.getText().length()<=0 || fileName.getText().length()<=0){
            //					System.out.println("path directory error");
            //					return;
            //				}

            String fullPath = "";
            //				if(pathName.getText().endsWith(String.valueOf(Path.SEPARATOR)) ||
            // pathName.getText().endsWith("\\")){
            //					fullPath = pathName.getText()+fileName.getText();
            //				}else{
            //					fullPath = pathName.getText()+String.valueOf(Path.SEPARATOR)+fileName.getText();
            //				}
            //				if(pathName.getText().lastIndexOf("/") != pathName.getText().firstIndexOf("/")){
            //
            //				}
            //				System.out.println(pathName.getText());
            //				System.out.println(fileName.getText());
            //				System.out.println(pathName.getText()+fileName.getText());
            //
            char lastChar = pathName.getText().charAt(pathName.getText().length() - 1);
            //				if(!(lastChar == Path.SEPARATOR || lastChar == '\\')){
            //					pathName.setText(pathName.getText()+Path.SEPARATOR);
            //				}

            if (lastChar != File.separatorChar) {
              pathName.setText(pathName.getText() + File.separatorChar);
            }

            // System.out.println(pathName.getText());

            if (buttonString == okString) {
              if (mode == DIRECTORY) {
                text.setText(pathName.getText());
              } else if (mode == FILE) {
                text.setText(pathName.getText() + fileName.getText());
              }
            } else {
              // fileName not needed
              if (buttonString == savePeerString) {
                AmonemUI.amonemManager.exportPeer(pathName.getText(), fieldName);
              }
              // fileName needed
              else {
                if (fileName.getText().length() <= 0) {
                  Controller.activateErrorView("choose a filename !");
                  System.out.println("choose a filename !");
                  return;
                }
                // System.out.println(pathName.getText()+Path.SEPARATOR+fileName.getText());
                if (buttonString == loadString) {
                  AmonemUI.amonemManager.importDAG(pathName.getText() + fileName.getText(), false);
                } else if (buttonString == saveString) {
                  AmonemUI.amonemManager.exportDAG(pathName.getText(), fileName.getText());
                }
              }
            }
            Controller.closeExplorer();
          }
        });
    button.setBounds(160, 110, 100, 25);
    button.setText(buttonString);

    tv.addSelectionChangedListener(
        new ISelectionChangedListener() {
          public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            File selected_file = (File) selection.getFirstElement();
            if (selected_file.isDirectory()) {
              pathName.setText(selected_file.toString());
              fileName.setText("");
            }
            if (selected_file.isFile()) {
              fileName.setText(selected_file.getName());
              pathName.setText(
                  selected_file
                      .toString()
                      .substring(
                          0, selected_file.toString().length() - selected_file.getName().length()));
            }
          }
        });

    parent.pack();
    parent.update();

    return sash;
  }
コード例 #27
0
  /** @wbp.parser.entryPoint */
  public void showType2Document() {
    final Display display = Display.getDefault();

    shlTypeDocument = new Shell(display);
    shlTypeDocument.setText("Type 2 Document");
    shlTypeDocument.setSize(780, 634);
    shlTypeDocument.setLocation(display.getBounds().x + 200, display.getBounds().y + 100);

    Composite composite = new Composite(shlTypeDocument, SWT.NONE);
    composite.setBounds(0, 0, 759, 557);

    TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
    tabFolder.setBounds(10, 10, 742, 545);

    TabItem tbtmText = new TabItem(tabFolder, SWT.NONE);
    tbtmText.setText("Text");

    Group grpText = new Group(tabFolder, SWT.NONE);
    grpText.setText("Text");
    tbtmText.setControl(grpText);
    // The first tab!  --> Text
    Label lblLeadingIndentionOf = new Label(grpText, SWT.NONE);
    lblLeadingIndentionOf.setBounds(10, 82, 374, 15);
    lblLeadingIndentionOf.setText("Leading indention of other paragraph:");

    text = new Text(grpText, SWT.BORDER);
    text.setBounds(422, 79, 76, 21);

    Label lblCharacters = new Label(grpText, SWT.NONE);
    lblCharacters.setBounds(504, 82, 85, 15);
    lblCharacters.setText("characters");

    Label lblSpacingBetweenCharacters = new Label(grpText, SWT.NONE);
    lblSpacingBetweenCharacters.setBounds(10, 116, 374, 15);
    lblSpacingBetweenCharacters.setText("Spacing between paragraphs:");

    text_1 = new Text(grpText, SWT.BORDER);
    text_1.setBounds(422, 113, 76, 21);

    Label lblLines = new Label(grpText, SWT.NONE);
    lblLines.setBounds(504, 116, 85, 15);
    lblLines.setText("lines");

    Label lblstParagraph = new Label(grpText, SWT.NONE);
    lblstParagraph.setBounds(10, 47, 374, 15);
    lblstParagraph.setText("1st Paragraph:");

    text_2 = new Text(grpText, SWT.BORDER);
    text_2.setBounds(422, 47, 76, 21);

    Label label_2 = new Label(grpText, SWT.NONE);
    label_2.setBounds(504, 47, 85, 15);
    label_2.setText("characters");

    Label lblEstimatedAverageLengths = new Label(grpText, SWT.NONE);
    lblEstimatedAverageLengths.setBounds(10, 154, 374, 15);
    lblEstimatedAverageLengths.setText("Estimated average length(s) of a line:");

    text_3 = new Text(grpText, SWT.BORDER);
    text_3.setBounds(422, 148, 76, 21);

    Label label_3 = new Label(grpText, SWT.NONE);
    label_3.setBounds(504, 154, 85, 15);
    label_3.setText("characters");

    Label lblPageNumberForms = new Label(grpText, SWT.NONE);
    lblPageNumberForms.setBounds(10, 194, 141, 15);
    lblPageNumberForms.setText("Page number forms:");

    text_4 = new Text(grpText, SWT.BORDER);
    text_4.setBounds(161, 191, 477, 21);

    Label lblSectionHeadings = new Label(grpText, SWT.NONE);
    lblSectionHeadings.setBounds(10, 237, 141, 15);
    lblSectionHeadings.setText("Section headings:");

    Button btnCapitalized = new Button(grpText, SWT.RADIO);
    btnCapitalized.setBounds(169, 236, 90, 16);
    btnCapitalized.setText("Capitalized");

    Button btnAllCapital = new Button(grpText, SWT.RADIO);
    btnAllCapital.setBounds(263, 237, 90, 16);
    btnAllCapital.setText("ALL CAPITAL");

    text_5 = new Text(grpText, SWT.BORDER);
    text_5.setBounds(366, 231, 272, 21);

    Label lblFooterTokens = new Label(grpText, SWT.NONE);
    lblFooterTokens.setBounds(10, 283, 85, 15);
    lblFooterTokens.setText("Footer tokens:");

    Button btnHasFooters = new Button(grpText, SWT.CHECK);
    btnHasFooters.setBounds(123, 282, 93, 16);
    btnHasFooters.setText("Has footers");

    text_6 = new Text(grpText, SWT.BORDER);
    text_6.setBounds(222, 280, 98, 21);

    Label lblHeaderTokens = new Label(grpText, SWT.NONE);
    lblHeaderTokens.setBounds(337, 283, 85, 15);
    lblHeaderTokens.setText("Header tokens:");

    Button btnHasHeaders = new Button(grpText, SWT.CHECK);
    btnHasHeaders.setBounds(428, 282, 93, 16);
    btnHasHeaders.setText("Has headers");

    text_7 = new Text(grpText, SWT.BORDER);
    text_7.setBounds(523, 277, 98, 21);

    textBean =
        new TextBean(
            text_2,
            text,
            text_1,
            text_3,
            text_4,
            btnCapitalized,
            btnAllCapital,
            text_5,
            new SpecialBean(btnHasFooters, btnHasHeaders, text_6, text_7));

    TabItem tbtmNomenclature = new TabItem(tabFolder, SWT.NONE);
    tbtmNomenclature.setText("Nomenclature");

    Group grpNomenclature = new Group(tabFolder, SWT.NONE);
    grpNomenclature.setText("Nomenclature");
    tbtmNomenclature.setControl(grpNomenclature);

    Label lblWhatIsIn = new Label(grpNomenclature, SWT.NONE);
    lblWhatIsIn.setBounds(10, 28, 111, 15);
    lblWhatIsIn.setText("What is in a name?");

    Label lblFamily = new Label(grpNomenclature, SWT.NONE);
    lblFamily.setBounds(233, 28, 55, 15);
    lblFamily.setText("Family");

    Label lblGenus = new Label(grpNomenclature, SWT.NONE);
    lblGenus.setBounds(399, 28, 55, 15);
    lblGenus.setText("Genus");

    Label lblSpecies = new Label(grpNomenclature, SWT.NONE);
    lblSpecies.setBounds(569, 28, 55, 15);
    lblSpecies.setText("Species");

    nomenScrolledComposite =
        new ScrolledComposite(grpNomenclature, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    nomenScrolledComposite.setBounds(10, 53, 714, 278);
    nomenScrolledComposite.setExpandHorizontal(true);
    nomenScrolledComposite.setExpandVertical(true);

    nomenclatureGroup = new Group(nomenScrolledComposite, SWT.NONE);
    nomenclatureGroup.setLayoutData(new RowData());

    Label lblName = new Label(nomenclatureGroup, SWT.NONE);
    lblName.setBounds(10, 20, 75, 15);
    lblName.setText("Name");

    Group group_2 = new Group(nomenclatureGroup, SWT.NONE);
    group_2.setBounds(100, 10, 182, 40);

    Button button = new Button(group_2, SWT.RADIO);
    button.setText("Yes");
    button.setBounds(10, 13, 39, 16);

    Button button_1 = new Button(group_2, SWT.RADIO);
    button_1.setText("No");
    button_1.setBounds(55, 13, 39, 16);

    text_14 = new Text(group_2, SWT.BORDER);
    text_14.setBounds(100, 11, 76, 21);
    nomenclatures.put(
        new Integer(nomenCount), new NomenclatureBean(group_2, button, button_1, text_14, lblName));
    nomenCount++;

    Group group_1 = new Group(nomenclatureGroup, SWT.NONE);
    group_1.setBounds(300, 10, 182, 40);

    Button button_2 = new Button(group_1, SWT.RADIO);
    button_2.setText("Yes");
    button_2.setBounds(10, 13, 39, 16);

    Button button_3 = new Button(group_1, SWT.RADIO);
    button_3.setText("No");
    button_3.setBounds(55, 13, 39, 16);

    text_15 = new Text(group_1, SWT.BORDER);
    text_15.setBounds(100, 11, 76, 21);

    nomenclatures.put(
        new Integer(nomenCount),
        new NomenclatureBean(group_1, button_2, button_3, text_15, lblName));
    nomenCount++;

    ///////////////
    Group group_4 = new Group(nomenclatureGroup, SWT.NONE);
    group_4.setBounds(500, 10, 182, 40);

    Button button_4 = new Button(group_4, SWT.RADIO);
    button_4.setText("Yes");
    button_4.setBounds(10, 13, 39, 16);

    Button button_5 = new Button(group_4, SWT.RADIO);
    button_5.setText("No");
    button_5.setBounds(55, 13, 39, 16);

    text_16 = new Text(group_4, SWT.BORDER);
    text_16.setBounds(100, 11, 76, 21);

    nomenclatures.put(
        new Integer(nomenCount),
        new NomenclatureBean(group_4, button_4, button_5, text_16, lblName));
    nomenCount++;

    String[] nomenclatureArray = {"Authors", "Date", "Publication", "Taxon Rank"};
    for (String name : nomenclatureArray) {
      addNomenclatureRow(name);
    }

    nomenScrolledComposite.setContent(nomenclatureGroup);
    // When you add a row, reset the size of scrolledComposite
    nomenScrolledComposite.setMinSize(nomenclatureGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Button btnAddARow = new Button(grpNomenclature, SWT.NONE);
    btnAddARow.setBounds(10, 337, 75, 25);
    btnAddARow.setText("Add a Row");
    btnAddARow.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            identifier = null;
            showInputBox();
            if (identifier != null && !identifier.equals("")) {
              addNomenclatureRow(identifier);
            }
          }
        });

    TabItem tbtmExpressions = new TabItem(tabFolder, SWT.NONE);
    tbtmExpressions.setText("Expressions");

    Group grpExpressionsUsedIn = new Group(tabFolder, SWT.NONE);
    grpExpressionsUsedIn.setText("Expressions used in Nomenclature");
    tbtmExpressions.setControl(grpExpressionsUsedIn);

    Label lblUseCapLetters = new Label(grpExpressionsUsedIn, SWT.NONE);
    lblUseCapLetters.setBounds(10, 22, 426, 15);
    lblUseCapLetters.setText("Use CAP words for fixed tokens; use small letters for variables");

    Label lblHononyms = new Label(grpExpressionsUsedIn, SWT.NONE);
    lblHononyms.setBounds(348, 22, 99, 15);
    lblHononyms.setText("Hononyms:");

    expScrolledComposite =
        new ScrolledComposite(grpExpressionsUsedIn, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    expScrolledComposite.setBounds(10, 43, 714, 440);
    expScrolledComposite.setExpandHorizontal(true);
    expScrolledComposite.setExpandVertical(true);

    expressionGroup = new Group(expScrolledComposite, SWT.NONE);
    expressionGroup.setLayoutData(new RowData());

    // count of number of rows
    expCount = 0;
    Label lblSpecialTokensUsed = new Label(expressionGroup, SWT.NONE);
    lblSpecialTokensUsed.setBounds(10, 20, 120, 15);
    lblSpecialTokensUsed.setText("Special tokens used:");

    text_29 = new Text(expressionGroup, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    text_29.setBounds(135, 20, 550, 70);

    expressions.put(new Integer(expCount), new ExpressionBean(lblSpecialTokensUsed, text_29));
    expCount++;

    String[] expressionArray = {"Minor Amendment:", "Past name:", "Name origin:", "Homonyms:"};
    for (String name : expressionArray) {
      addExpressionRow(name);
    }

    expScrolledComposite.setContent(expressionGroup);
    expScrolledComposite.setMinSize(expressionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Button btnAddARow_2 = new Button(grpExpressionsUsedIn, SWT.NONE);
    btnAddARow_2.setBounds(10, 489, 75, 25);
    btnAddARow_2.setText("Add a row");
    btnAddARow_2.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            identifier = null;
            showInputBox();
            if (identifier != null && !identifier.equals("")) {
              addExpressionRow(identifier);
            }
          }
        });

    TabItem tbtmDescription = new TabItem(tabFolder, SWT.NONE);
    tbtmDescription.setText("Description");

    Group grpMorphologicalDescriptions = new Group(tabFolder, SWT.NONE);
    tbtmDescription.setControl(grpMorphologicalDescriptions);

    Label lblAllInOne = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblAllInOne.setBounds(10, 53, 160, 15);
    lblAllInOne.setText("All in one paragraph");

    Button btnYes = new Button(grpMorphologicalDescriptions, SWT.RADIO);
    btnYes.setBounds(241, 52, 90, 16);
    btnYes.setText("Yes");

    Button btnNo = new Button(grpMorphologicalDescriptions, SWT.RADIO);
    btnNo.setBounds(378, 52, 90, 16);
    btnNo.setText("No");

    Label lblOtherInformationMay = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblOtherInformationMay.setBounds(10, 85, 438, 15);
    lblOtherInformationMay.setText(
        "Other information may also be included in a description paragraph:");

    Combo combo = new Combo(grpMorphologicalDescriptions, SWT.NONE);
    combo.setItems(new String[] {"Nomenclature", "Habitat", "Distribution", "Discussion", "Other"});
    combo.setBounds(496, 82, 177, 23);

    descriptionBean = new DescriptionBean(btnYes, btnNo, combo, sections);

    Label lblMorphological = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblMorphological.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblMorphological.setBounds(10, 25, 242, 15);
    lblMorphological.setText("Morphological Descriptions: ");

    Label lblOrder = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblOrder.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblOrder.setBounds(22, 142, 55, 15);
    lblOrder.setText("Order");

    Label lblSection = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblSection.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblSection.setBounds(140, 142, 55, 15);
    lblSection.setText("Section");

    Label lblStartTokens = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblStartTokens.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblStartTokens.setBounds(285, 142, 90, 15);
    lblStartTokens.setText("Start tokens");

    Label lblEndTokens = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblEndTokens.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblEndTokens.setBounds(443, 142, 68, 15);
    lblEndTokens.setText("End tokens");

    Label lblEmbeddedTokens = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblEmbeddedTokens.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblEmbeddedTokens.setBounds(592, 142, 132, 15);
    lblEmbeddedTokens.setText("Embedded tokens");

    descScrolledComposite =
        new ScrolledComposite(
            grpMorphologicalDescriptions, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    descScrolledComposite.setBounds(10, 169, 714, 310);
    descScrolledComposite.setExpandHorizontal(true);
    descScrolledComposite.setExpandVertical(true);

    descriptionGroup = new Group(descScrolledComposite, SWT.NONE);
    descriptionGroup.setLayoutData(new RowData());

    text_33 = new Text(descriptionGroup, SWT.BORDER);
    text_33.setBounds(10, 20, 75, 20);

    Label lblNomenclature = new Label(descriptionGroup, SWT.NONE);
    lblNomenclature.setBounds(120, 20, 145, 20);
    lblNomenclature.setText("Nomenclature");

    text_40 = new Text(descriptionGroup, SWT.BORDER);
    text_40.setBounds(270, 20, 115, 20);

    text_41 = new Text(descriptionGroup, SWT.BORDER);
    text_41.setBounds(420, 20, 115, 20);

    text_42 = new Text(descriptionGroup, SWT.BORDER);
    text_42.setBounds(570, 20, 115, 20);

    sections.put(
        new Integer(secCount),
        new SectionBean(text_33, lblNomenclature, text_40, text_41, text_42));
    secCount++;

    String[] sectionArray = {
      "Morph. description", "Habitat", "Distribution", "Discussion", "Keys", "References"
    };
    for (String name : sectionArray) {
      addDescriptionRow(name);
    }

    descScrolledComposite.setContent(descriptionGroup);
    descScrolledComposite.setMinSize(descriptionGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Button btnAddARow_1 = new Button(grpMorphologicalDescriptions, SWT.NONE);
    btnAddARow_1.setBounds(10, 482, 75, 25);
    btnAddARow_1.setText("Add a row");
    btnAddARow_1.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            identifier = null;
            showInputBox();
            if (identifier != null && !identifier.equals("")) {
              addDescriptionRow(identifier);
            }
          }
        });

    Label lblSectionIndicationsAnd = new Label(grpMorphologicalDescriptions, SWT.NONE);
    lblSectionIndicationsAnd.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
    lblSectionIndicationsAnd.setBounds(10, 116, 222, 15);
    lblSectionIndicationsAnd.setText("Section indications and order:");

    TabItem tbtmSpecial = new TabItem(tabFolder, SWT.NONE);
    tbtmSpecial.setText("Special");

    Group grpSpecialSections = new Group(tabFolder, SWT.NONE);
    grpSpecialSections.setText("Special Sections");
    tbtmSpecial.setControl(grpSpecialSections);

    Label lblGlossaries = new Label(grpSpecialSections, SWT.NONE);
    lblGlossaries.setBounds(10, 51, 55, 15);
    lblGlossaries.setText("Glossaries:");

    Button btnHasGlossaries = new Button(grpSpecialSections, SWT.CHECK);
    btnHasGlossaries.setBounds(96, 51, 93, 16);
    btnHasGlossaries.setText("has glossaries");

    Label lblGlossaryHeading = new Label(grpSpecialSections, SWT.NONE);
    lblGlossaryHeading.setBounds(257, 51, 93, 15);
    lblGlossaryHeading.setText("Glossary heading");

    text_9 = new Text(grpSpecialSections, SWT.BORDER);
    text_9.setBounds(377, 48, 76, 21);

    Label lblReferences = new Label(grpSpecialSections, SWT.NONE);
    lblReferences.setBounds(10, 102, 69, 15);
    lblReferences.setText("References :");

    Button btnHasReferences = new Button(grpSpecialSections, SWT.CHECK);
    btnHasReferences.setBounds(96, 102, 93, 16);
    btnHasReferences.setText("has references");

    Label lblReferencesHeading = new Label(grpSpecialSections, SWT.NONE);
    lblReferencesHeading.setBounds(257, 102, 114, 15);
    lblReferencesHeading.setText("References heading:");

    text_10 = new Text(grpSpecialSections, SWT.BORDER);
    text_10.setBounds(377, 99, 76, 21);
    special = new SpecialBean(btnHasGlossaries, btnHasReferences, text_9, text_10);

    TabItem tbtmAbbreviations = new TabItem(tabFolder, SWT.NONE);
    tbtmAbbreviations.setText("Abbreviations");

    Group grpAbbreviationsUsedIn = new Group(tabFolder, SWT.NONE);
    tbtmAbbreviations.setControl(grpAbbreviationsUsedIn);

    text_11 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
    text_11.setBounds(10, 52, 691, 69);
    abbreviations.put("Text", text_11);

    Label lblAbbreviationsUsedIn = new Label(grpAbbreviationsUsedIn, SWT.NONE);
    lblAbbreviationsUsedIn.setBounds(10, 31, 272, 15);
    lblAbbreviationsUsedIn.setText("Abbreviations used in text:");

    Label lblAbbreviationsUsedIn_1 = new Label(grpAbbreviationsUsedIn, SWT.NONE);
    lblAbbreviationsUsedIn_1.setBounds(10, 150, 272, 15);
    lblAbbreviationsUsedIn_1.setText("Abbreviations used in bibliographical citations:");

    text_12 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    text_12.setBounds(10, 175, 691, 69);
    abbreviations.put("Bibliographical Citations", text_12);

    Label lblAbbreviationsUsedIn_2 = new Label(grpAbbreviationsUsedIn, SWT.NONE);
    lblAbbreviationsUsedIn_2.setBounds(10, 275, 272, 15);
    lblAbbreviationsUsedIn_2.setText("Abbreviations used in authorities:");

    text_13 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    text_13.setBounds(10, 296, 691, 69);
    abbreviations.put("Authorities", text_13);

    Label lblAbbreviationsUsedIn_3 = new Label(grpAbbreviationsUsedIn, SWT.NONE);
    lblAbbreviationsUsedIn_3.setBounds(10, 395, 204, 15);
    lblAbbreviationsUsedIn_3.setText("Abbreviations used in others:");

    text_8 = new Text(grpAbbreviationsUsedIn, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    text_8.setBounds(10, 416, 691, 69);
    abbreviations.put("Others", text_8);
    final Type2Bean bean =
        new Type2Bean(
            textBean, nomenclatures, expressions, descriptionBean, special, abbreviations);
    Button btnSave = new Button(shlTypeDocument, SWT.NONE);
    btnSave.setBounds(670, 563, 75, 25);
    btnSave.setText("Save");
    btnSave.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            try {
              if (configDb.saveType2Details(bean)) {
                ApplicationUtilities.showPopUpWindow(
                    ApplicationUtilities.getProperty("popup.info.savetype3"),
                    ApplicationUtilities.getProperty("popup.header.info"),
                    SWT.ICON_INFORMATION);
                shlTypeDocument.dispose();
              }
            } catch (SQLException exe) {

            }
          }
        });

    /* Load previously saved details here */
    try {
      configDb.retrieveType2Details(bean, this);
    } catch (SQLException exe) {
      exe.printStackTrace();
    }

    shlTypeDocument.open();
    shlTypeDocument.layout();
    while (!shlTypeDocument.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
  }
コード例 #28
0
  void doRename(boolean showPreview) {
    cancel();

    Image image = null;
    Label label = null;

    fShowPreview |= showPreview;
    try {
      ISourceViewer viewer = fEditor.getViewer();
      if (viewer instanceof SourceViewer) {
        SourceViewer sourceViewer = (SourceViewer) viewer;
        Control viewerControl = sourceViewer.getControl();
        if (viewerControl instanceof Composite) {
          Composite composite = (Composite) viewerControl;
          Display display = composite.getDisplay();

          // Flush pending redraw requests:
          while (!display.isDisposed() && display.readAndDispatch()) {}

          // Copy editor area:
          GC gc = new GC(composite);
          Point size;
          try {
            size = composite.getSize();
            image = new Image(gc.getDevice(), size.x, size.y);
            gc.copyArea(image, 0, 0);
          } finally {
            gc.dispose();
            gc = null;
          }

          // Persist editor area while executing refactoring:
          label = new Label(composite, SWT.NONE);
          label.setImage(image);
          label.setBounds(0, 0, size.x, size.y);
          label.moveAbove(null);
        }
      }

      String newName = fNamePosition.getContent();
      if (fOriginalName.equals(newName)) {
        return;
      }
      RenameSupport renameSupport = undoAndCreateRenameSupport(newName);
      if (renameSupport == null) {
        return;
      }

      Shell shell = fEditor.getSite().getShell();
      if (renameSupport.hasUnresolvedNameReferences()) {
        fShowPreview = true;
      }
      boolean executed;
      if (fShowPreview) { // could have been updated by undoAndCreateRenameSupport(..)
        executed = renameSupport.openDialog(shell, true);
      } else {
        renameSupport.perform(shell, fEditor.getSite().getWorkbenchWindow());
        executed = true;
      }
      if (executed) {
        restoreFullSelection();
      }
    } catch (CoreException ex) {
      DartToolsPlugin.log(ex);
    } catch (InterruptedException ex) {
      // canceling is OK -> redo text changes in that case?
    } catch (InvocationTargetException ex) {
      DartToolsPlugin.log(ex);
    } catch (BadLocationException e) {
      DartToolsPlugin.log(e);
    } finally {
      if (label != null) {
        label.dispose();
      }
      if (image != null) {
        image.dispose();
      }
    }
  }
コード例 #29
0
ファイル: ConfigPanel.java プロジェクト: chaoliu1024/dss
  public ConfigPanel(final Shell shell, final Composite parent, final int style) {
    super(parent, style);
    this.setBounds(0, 0, 970, 663);
    setLayout(null);
    config = new Config();
    this.shell = shell;

    Group group_2 = new Group(this, SWT.NONE);
    group_2.setText("地点配置");
    group_2.setBounds(10, 79, 937, 320);

    // Group group = new Group(group_2, SWT.NONE);
    // group.setText("裁判长");
    // group.setBounds(59, 34, 861, 93);
    //
    // Label label = new Label(group, SWT.NONE);
    // label.setBounds(25, 48, 55, 15);
    // label.setText("仲裁主任");
    //
    // intercessorText = new Text(group, SWT.BORDER);
    // intercessorText.setBounds(86, 48, 73, 21);
    //
    // Label label_1 = new Label(group, SWT.NONE);
    // label_1.setBounds(191, 48, 55, 15);
    // label_1.setText("副裁判长");
    //
    // viceRefereeText = new Text(group, SWT.BORDER);
    // viceRefereeText.setBounds(252, 48, 73, 21);
    //
    // Label label_2 = new Label(group, SWT.NONE);
    // label_2.setBounds(377, 48, 55, 15);
    // label_2.setText("总裁判长");
    //
    // refreeText = new Text(group, SWT.BORDER);
    // refreeText.setBounds(438, 48, 73, 21);

    Group group_1 = new Group(group_2, SWT.NONE);
    group_1.setText("比赛地点配置");
    group_1.setBounds(36, 69, 861, 93);

    Label label_3 = new Label(group_1, SWT.NONE);
    label_3.setBounds(40, 52, 55, 15);
    label_3.setText("参赛地点");

    locationText = new Text(group_1, SWT.BORDER);
    locationText.setBounds(113, 46, 73, 21);

    Button submit = new Button(group_2, SWT.NONE);
    submit.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            String mention = "";
            // String intercessor=intercessorText.getText();
            boolean mark = false;
            // if(intercessor==null||intercessor.equals("")){
            // mention+="未填写仲裁主任的名字\n";
            // }
            // String viceReferee=viceRefereeText.getText();
            // if(viceReferee==null||viceReferee.equals("")){
            // mention+="未填写副裁判长的名字\n";
            // }
            // String refree=refreeText.getText();
            // if(refree==null||refree.equals("")){
            // mention+="未填写总裁判长的名字\n";
            // }
            String location = locationText.getText();
            if (location == null || location.equals("")) {
              mention += "未填写比赛地点的名字\n";
            }
            if (mention.equals("")) {
              mark = true;
            } else {
              MessageBox box = new MessageBox(shell, SWT.OK | SWT.CANCEL);
              box.setText("提示");
              box.setMessage("存在以下问题是否继续??\n" + mention);
              if (box.open() == SWT.OK) {
                mark = true;
              }
            }
            if (mark) {
              // if(intercessor==null||intercessor.equals("")){
              // data.get(0).put("name", "");
              // }else{
              // data.get(0).put("name", intercessor);
              // }
              // if(viceReferee==null||viceReferee.equals("")){
              // data.get(1).put("name", "");
              // }else{
              // data.get(1).put("name", viceReferee);
              // }
              // if(refree==null||refree.equals("")){
              // data.get(2).put("name", "");
              // }else{
              // data.get(2).put("name", refree);
              // }
              if (location == null || location.equals("")) {
                data.get(0).put("location", "");
                data.get(1).put("location", "");
                data.get(2).put("location", "");
              } else {
                data.get(0).put("location", location);
                data.get(1).put("location", location);
                data.get(2).put("location", location);
              }
              MessageBox box = new MessageBox(shell, SWT.OK);
              box.setText("提示");
              if (config.updateParams(data) > -1) {
                box.setMessage("修改成功");
              } else {
                box.setMessage("修改失败");
              }
              box.open();
            }
          }
        });
    submit.setBounds(823, 275, 75, 25);
    submit.setText("确定");

    // 初始化数据
    if (config.isCollected()) {
      data = config.getParams();
      // if(data.get(0).get("name")!=null){
      // intercessorText.setText(data.get(0).get("name").toString());
      // }
      // if(data.get(1).get("name")!=null){
      // viceRefereeText.setText(data.get(1).get("name").toString());
      // }
      // if(data.get(2).get("name")!=null){
      // refreeText.setText(data.get(2).get("name").toString());
      // }
      if (data.get(2).get("location") != null) {
        locationText.setText(data.get(2).get("location").toString());
      }
    } else {
      MessageBox box = new MessageBox(this.shell, SWT.OK);
      box.setText("提示");
      box.setMessage("数据库连接失败");
      box.open();
    }
  }
  /**
   * Create the composite.
   *
   * @param parent
   * @param style
   */
  public ComputingInfrastructureServiceComposite(Composite parent, int style) {
    super(parent, style);
    setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    setLayout(new FormLayout());

    Label lblTitle = new Label(this, SWT.NONE);
    lblTitle.setBackground(SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblTitle.setFont(SWTResourceManager.getFont("Ubuntu", 13, SWT.NORMAL));
    FormData fd_lblTitle = new FormData();
    fd_lblTitle.bottom = new FormAttachment(0, 21);
    fd_lblTitle.top = new FormAttachment(0);
    fd_lblTitle.left = new FormAttachment(0);
    lblTitle.setLayoutData(fd_lblTitle);
    lblTitle.setText("Instance name:");

    Composite composite = new Composite(this, SWT.BORDER);
    FormData fd_composite = new FormData();
    fd_composite.bottom = new FormAttachment(lblTitle, 210, SWT.BOTTOM);
    fd_composite.top = new FormAttachment(lblTitle, 6);
    fd_composite.left = new FormAttachment(lblTitle, 10, SWT.LEFT);
    fd_composite.right = new FormAttachment(100, -11);
    composite.setLayoutData(fd_composite);

    CLabel label_1 = new CLabel(composite, SWT.NONE);
    label_1.setText("Instance");
    label_1.setBounds(10, 36, 115, 23);

    CLabel label_2 = new CLabel(composite, SWT.NONE);
    label_2.setText("CPU (MHz)");
    label_2.setLeftMargin(10);
    label_2.setBounds(10, 71, 115, 23);

    CLabel label_3 = new CLabel(composite, SWT.NONE);
    label_3.setText("CPU (Units)");
    label_3.setLeftMargin(10);
    label_3.setBounds(10, 100, 89, 23);

    CLabel label_4 = new CLabel(composite, SWT.NONE);
    label_4.setText("Memory (MB)");
    label_4.setLeftMargin(10);
    label_4.setBounds(10, 129, 104, 23);

    txtCpu = new Text(composite, SWT.BORDER);
    txtCpu.setText("0");
    // txtCpu.setEnabled(false);
    txtCpu.setBounds(141, 73, 70, 21);

    txtCpuUnits = new Text(composite, SWT.BORDER);
    txtCpuUnits.setText("0");
    // txtCpuUnits.setEnabled(false);
    txtCpuUnits.setBounds(141, 102, 70, 21);

    txtMemory = new Text(composite, SWT.BORDER);
    txtMemory.setText("0");
    // txtMemory.setEnabled(false);
    txtMemory.setBounds(141, 131, 70, 21);

    CLabel label_5 = new CLabel(composite, SWT.NONE);
    label_5.setText("Storage (GB)");
    label_5.setLeftMargin(10);
    label_5.setBounds(10, 158, 97, 23);

    txtStorage = new Text(composite, SWT.BORDER);
    txtStorage.setText("0");
    // txtStorage.setEnabled(false);
    txtStorage.setBounds(141, 160, 70, 21);

    Label lblHardware = new Label(composite, SWT.NONE);
    lblHardware.setBounds(10, 10, 311, 17);
    lblHardware.setText("Hardware specification");

    Composite composite_1 = new Composite(this, SWT.BORDER);
    composite_1.setLayout(new FormLayout());
    FormData fd_composite_1 = new FormData();
    fd_composite_1.bottom = new FormAttachment(100, -10);
    fd_composite_1.top = new FormAttachment(composite, 6);
    fd_composite_1.right = new FormAttachment(100, -11);
    fd_composite_1.left = new FormAttachment(0, 10);

    comboViewer = new ComboViewer(composite, SWT.NONE);
    Combo combo = comboViewer.getCombo();
    combo.setBounds(141, 36, 180, 29);
    composite_1.setLayoutData(fd_composite_1);

    Label lblComponents = new Label(composite_1, SWT.NONE);
    FormData fd_lblComponents = new FormData();
    fd_lblComponents.right = new FormAttachment(0, 88);
    fd_lblComponents.top = new FormAttachment(0, 10);
    fd_lblComponents.left = new FormAttachment(0, 10);
    lblComponents.setLayoutData(fd_lblComponents);
    lblComponents.setText("Software");

    CLabel label = new CLabel(composite_1, SWT.NONE);
    FormData fd_label = new FormData();
    fd_label.top = new FormAttachment(0, 45);
    fd_label.left = new FormAttachment(0, 10);
    label.setLayoutData(fd_label);
    label.setText("Operating system");

    textOs = new Text(composite_1, SWT.BORDER);
    FormData fd_textOs = new FormData();
    fd_textOs.bottom = new FormAttachment(0, 72);
    fd_textOs.right = new FormAttachment(0, 321);
    fd_textOs.top = new FormAttachment(0, 45);
    fd_textOs.left = new FormAttachment(0, 141);
    textOs.setLayoutData(fd_textOs);
    textOs.setText("Debian 7.1 Linux");
    textOs.setEditable(false);

    CLabel lblComponents_1 = new CLabel(composite_1, SWT.NONE);
    FormData fd_lblComponents_1 = new FormData();
    fd_lblComponents_1.left = new FormAttachment(0, 10);
    fd_lblComponents_1.right = new FormAttachment(100, -106);
    fd_lblComponents_1.top = new FormAttachment(0, 91);
    lblComponents_1.setLayoutData(fd_lblComponents_1);
    lblComponents_1.setText("Deployed platform services");

    tableViewer = new TableViewer(composite_1, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewer.addDoubleClickListener(
        new IDoubleClickListener() {
          public void doubleClick(DoubleClickEvent event) {
            if (!event.getSelection().isEmpty()) {
              IStructuredSelection selection = (IStructuredSelection) event.getSelection();
              PlatformService platformService = (PlatformService) selection.getFirstElement();
              Util.openEditor(
                  new PlatformServiceEditorInput(platformService), PlatformServiceEditor.ID);
            }
          }
        });
    table = tableViewer.getTable();
    FormData fd_table = new FormData();
    fd_table.bottom = new FormAttachment(100, -10);
    fd_table.top = new FormAttachment(lblComponents_1, 6);
    fd_table.left = new FormAttachment(0, 10);
    fd_table.right = new FormAttachment(100, -10);
    table.setLayoutData(fd_table);

    txtName = new Text(this, SWT.BORDER);
    txtName.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    FormData fd_txtName = new FormData();
    fd_txtName.top = new FormAttachment(lblTitle, 0, SWT.TOP);
    fd_txtName.bottom = new FormAttachment(composite, -6);
    fd_txtName.right = new FormAttachment(100, -11);
    fd_txtName.left = new FormAttachment(lblTitle, 6);
    txtName.setLayoutData(fd_txtName);

    // Should not be called -- the call is auto-generated
    if (computingInfrastructureService != null) m_bindingContext = initDataBindings();
  }