Exemple #1
0
  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;
  }
  /**
   * 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();
  }
Exemple #3
0
  private Composite createWinTitle(Composite composite) {
    Composite winTitle = new Composite(composite, SWT.NONE);
    winTitle.setLayoutData(new RowData(850, 25));

    SystemButton menuBtn =
        new SystemButton(
            winTitle,
            SWT.NONE,
            "/res/sysbtn_menu.png",
            4,
            "菜单",
            this,
            new Listener() {

              @Override
              public void handleEvent(Event e) {
                int x = e.getBounds().x;
                int y = e.getBounds().y;
                if (x < 0 || y < 0) return;
                ((Composite) (e.widget)).getMenu().setVisible(true);
              }
            });
    menuBtn.setLocation(769, 0);
    Menu menu = new Menu(menuBtn);
    menuBtn.setMenu(menu);
    MenuItem mntmCaidan = new MenuItem(menu, SWT.NONE);
    mntmCaidan.setText("设置");

    MenuItem menuItem = new MenuItem(menu, SWT.NONE);
    menuItem.setText("\u65B0\u7248\u529F\u80FD");

    MenuItem menuItem_1 = new MenuItem(menu, SWT.NONE);
    menuItem_1.setText("\u5B98\u65B9\u5FAE\u535A");

    MenuItem menuItem_2 = new MenuItem(menu, SWT.NONE);
    menuItem_2.setText("\u95EE\u9898\u53CD\u9988\u4E0E\u5EFA\u8BAE");

    MenuItem menuItem_3 = new MenuItem(menu, SWT.NONE);
    menuItem_3.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {}
        });
    menuItem_3.setText("\u7528\u6237\u9690\u79C1\u4FDD\u62A4\u653F\u7B56");

    MenuItem menuItem_4 = new MenuItem(menu, SWT.NONE);
    menuItem_4.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            MessageBox mb = new MessageBox(shell, SWT.ABORT);
            mb.setMessage("开源中国 @xwalker QQ:909854136");
            mb.setText("关于");
            mb.open();
          }
        });
    menuItem_4.setText("\u5173\u4E8E\u6211\u4EEC");

    SystemButton minBtn =
        new SystemButton(
            winTitle,
            SWT.NONE,
            "/res/sysbtn_min.png",
            4,
            "最小化",
            this,
            new Listener() {

              @Override
              public void handleEvent(Event event) {
                shell.setMinimized(true);
              }
            });
    minBtn.setLocation(796, 0);

    SystemButton closeBtn =
        new SystemButton(
            winTitle,
            SWT.NONE,
            "/res/sysbtn_close.png",
            4,
            "关闭",
            this,
            new Listener() {

              @Override
              public void handleEvent(Event event) {
                MessageBox mb = new MessageBox(shell, SWT.OK | SWT.CANCEL);
                mb.setMessage("确定退出?");
                mb.setText("确定");
                if (mb.open() == SWT.OK) {
                  shell.close();
                  shell.dispose();
                }
              }
            });
    closeBtn.setLocation(823, 0);

    CLabel lblJava = new CLabel(winTitle, SWT.NONE);
    lblJava.setFont(SWTResourceManager.getFont("微软雅黑", 9, SWT.BOLD));
    lblJava.setForeground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    lblJava.setBounds(5, 0, 309, 23);
    lblJava.setText("Java\u684C\u9762\u7A0B\u5E8F \u4EFF360\u8F6F\u4EF6\u7BA1\u5BB6 QQ:909854136");

    return winTitle;
  }