Ejemplo n.º 1
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);
    //
  }
Ejemplo n.º 2
0
  /**
   * Create the composite.
   *
   * @param parent
   * @param style
   */
  public GoogleComposite(Composite parent, int style) {
    super(parent, style);
    setLayout(new FillLayout());
    // setSize(150, 200);
    setBounds(0, 0, 150, 200);

    PShelf shelf = new PShelf(this, SWT.NONE);
    shelf.setRenderer(new RedmondShelfRenderer());

    PShelfItem shelfItem = new PShelfItem(shelf, SWT.NONE);
    shelfItem.setText("Conta Google - Sincronizar dados");
    shelfItem.getBody().setLayout(new BorderLayout(0, 0));

    Composite composite_1 = new Composite(shelfItem.getBody(), SWT.NONE);
    composite_1.setLayoutData(BorderLayout.CENTER);
    composite_1.setLayout(new BorderLayout(0, 0));

    Composite compositeHeader = new Composite(composite_1, SWT.NONE);
    compositeHeader.setLayoutData(BorderLayout.NORTH);
    compositeHeader.setLayout(new RowLayout(SWT.VERTICAL));

    Composite composite = new Composite(composite_1, SWT.NONE);
    composite.setLayoutData(BorderLayout.CENTER);
    composite.setLayout(new BorderLayout(0, 0));

    Composite composite_2 = new Composite(composite, SWT.NONE);
    composite_2.setLayoutData(BorderLayout.WEST);
    composite_2.setLayout(new BorderLayout(0, 0));

    Composite composite_4 = new Composite(composite_2, SWT.NONE);
    composite_4.setLayoutData(BorderLayout.NORTH);
    FillLayout fl_composite_4 = new FillLayout(SWT.VERTICAL);
    fl_composite_4.marginHeight = 25;
    composite_4.setLayout(fl_composite_4);

    Label label = new Label(composite_4, SWT.NONE);
    label.setImage(
        SWTResourceManager.getImage(
            GoogleComposite.class,
            "/com/twocents/ui/resources/images/TwoCents-GmailRepository_Icon_48X48.png"));

    Composite composite_3 = new Composite(composite, SWT.NONE);
    composite_3.setLayoutData(BorderLayout.CENTER);
    composite_3.setLayout(new BorderLayout(0, 0));

    Composite composite_5 = new Composite(composite_3, SWT.NONE);
    composite_5.setLayoutData(BorderLayout.NORTH);
    FillLayout fl_composite_5 = new FillLayout(SWT.VERTICAL);
    fl_composite_5.marginWidth = 5;
    composite_5.setLayout(fl_composite_5);

    Label lblUsurio = new Label(composite_5, SWT.NONE);
    lblUsurio.setText("Usu\u00E1rio :");

    username = new Text(composite_5, SWT.BORDER);

    Label lblSenha = new Label(composite_5, SWT.NONE);
    lblSenha.setText("Senha :");

    password = new Text(composite_5, SWT.BORDER | SWT.PASSWORD);

    // UIImages.COM_TWOCENTS_UI_RESOURCES_IMAGES_BOTAO_CONECTAR01_PNG

    setConnect(new Button(composite_5, SWT.NONE));
    getConnect()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent arg0) {

                getAction().connect(username.getText(), password.getText());
              }
            });
    getConnect().setText(CONECTAR);

    Composite composite_7 = new Composite(composite_3, SWT.NONE);
    composite_7.setLayoutData(BorderLayout.SOUTH);
    composite_7.setLayout(new RowLayout(SWT.HORIZONTAL));

    Composite composite_8 = new Composite(composite_3, SWT.NONE);
    composite_8.setLayoutData(BorderLayout.CENTER);
    FillLayout fl_composite_8 = new FillLayout(SWT.VERTICAL);
    fl_composite_8.marginWidth = 5;
    composite_8.setLayout(fl_composite_8);

    Composite composite_6 = new Composite(composite_8, SWT.NONE);

    setSaveData(new Button(composite_8, SWT.NONE));
    getSaveData()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent arg0) {

                getAction().saveData();
              }
            });
    getSaveData().setText("Salvar dados");

    getSaveData().setVisible(false);

    setRecoverData(new Button(composite_8, SWT.NONE));
    getRecoverData()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent arg0) {
                getAction().recoverData();
              }
            });
    getRecoverData().setText("Recuperar dados");
    getRecoverData().setVisible(false);
    Composite composite_9 = new Composite(composite_8, SWT.NONE);
  }
Ejemplo n.º 3
0
  /** Create contents of the window */
  protected void createContents() {

    m_shell = new Shell();
    m_shell.setLayout(new BorderLayout(0, 0));
    m_shell.setText("ATM Window Controller Test");
    m_shell.setSize(650, 483);

    m_shell.setImage(SWTResourceManager.getImage(ATMTestAppWnd.class, "/Properties.ico"));
    {
      try {
        m_browser = new Browser(m_shell, SWT.BORDER | SWT.MOZILLA);
        // m_browser = new Browser(m_shell, SWT.BORDER);
      } catch (Throwable th) {
        th.printStackTrace();
      }
    }

    final Group cardReaderSimulatorGroup = new Group(m_shell, SWT.NONE);
    cardReaderSimulatorGroup.setLayoutData(BorderLayout.SOUTH);
    cardReaderSimulatorGroup.setText("Hardware simulator");

    Button btnReload = new Button(cardReaderSimulatorGroup, SWT.BUTTON1);
    btnReload.setText("Reload");
    btnReload.setBounds(10, 20, 50, 24);
    btnReload.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            m_browser.refresh();
            m_browser.setFocus();
          }
        });

    Button btnBack = new Button(cardReaderSimulatorGroup, SWT.BUTTON1);
    btnBack.setText("Back");
    btnBack.setBounds(70, 20, 50, 24);
    btnBack.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            m_browser.back();
            m_browser.setFocus();
          }
        });

    Button btnIndex = new Button(cardReaderSimulatorGroup, SWT.BUTTON1);
    btnIndex.setText("Index");
    btnIndex.setBounds(130, 20, 50, 24);
    btnIndex.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            m_browser.setUrl(
                "file:///C:/WKSPs/Consolidado/SWT_ATM-Test/resources/maqueta/html/00_welcome.htm");
            m_browser.setFocus();
          }
        });

    Button btnSilence = new Button(cardReaderSimulatorGroup, SWT.BUTTON1);
    btnSilence.setText("Silence");
    btnSilence.setBounds(190, 20, 50, 24);
    btnSilence.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            TextToSpeech.ttsFree.say("", false);
            m_browser.setFocus();
          }
        });

    m_browser.setFocus();
  }
  /** Create contents of the window */
  protected void createContents() {

    m_shell = new Shell();

    m_shell.setImage(SWTResourceManager.getImage(IPAToolAppWnd.class, "/Properties.ico"));
    final BorderLayout borderLayout = new BorderLayout(0, 0);
    borderLayout.setVgap(5);
    m_shell.setLayout(borderLayout);
    m_shell.setSize(800, 400);
    m_shell.setMinimumSize(new Point(800, 400));
    m_shell.setText("IPATool2");

    Composite composite;
    composite = new Composite(m_shell, SWT.NONE);
    {
      TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
      tabFolder.setBounds(10, 10, 748, 200);

      {
        TabItem tbtmTools = new TabItem(tabFolder, SWT.NONE);
        tbtmTools.setText("Tools");

        Composite composite_1 = new Composite(tabFolder, SWT.NONE);
        tbtmTools.setControl(composite_1);

        m_txtUpdFolder = new Text(composite_1, SWT.BORDER);
        m_txtUpdFolder.setText("");
        m_txtUpdFolder.setBounds(122, 14, 564, 21);

        Button btnUpdFolder = new Button(composite_1, SWT.NONE);
        btnUpdFolder.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                _selectFolder(m_txtUpdFolder);
              }
            });
        btnUpdFolder.setText("...");
        btnUpdFolder.setBounds(692, 12, 38, 25);

        m_txtExistingFolder = new Text(composite_1, SWT.BORDER);
        m_txtExistingFolder.setText("");
        m_txtExistingFolder.setBounds(122, 45, 564, 21);

        Button btnExFolder = new Button(composite_1, SWT.NONE);
        btnExFolder.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                _selectFolder(m_txtExistingFolder);
              }
            });
        btnExFolder.setText("...");
        btnExFolder.setBounds(692, 43, 38, 25);

        m_txtITunesFolder = new Text(composite_1, SWT.BORDER);
        m_txtITunesFolder.setText("");
        m_txtITunesFolder.setBounds(122, 76, 564, 21);

        Button btnitunesFolder = new Button(composite_1, SWT.NONE);
        btnitunesFolder.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                _selectFolder(m_txtITunesFolder);
              }
            });
        btnitunesFolder.setText("...");
        btnitunesFolder.setBounds(692, 74, 38, 25);

        m_lbliTunes = new Label(composite_1, SWT.NONE);
        m_lbliTunes.setText("iTunes IPAs Folder:");
        m_lbliTunes.setBounds(10, 79, 119, 15);

        m_lblExFolder = new Label(composite_1, SWT.NONE);
        m_lblExFolder.setText("Current IPAs Folder:");
        m_lblExFolder.setBounds(10, 48, 119, 15);

        Label lblUpdFolder = new Label(composite_1, SWT.NONE);
        lblUpdFolder.setFont(SWTResourceManager.getFont("Segoe UI", 9, SWT.BOLD));
        lblUpdFolder.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED));
        lblUpdFolder.setText(" IPAs Folder:");
        lblUpdFolder.setBounds(10, 17, 119, 15);
        {
          m_chkRecurseFolders = new Button(composite_1, SWT.CHECK);
          m_chkRecurseFolders.addSelectionListener(
              new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {}
              });
          m_chkRecurseFolders.setLocation(122, 103);
          m_chkRecurseFolders.setSize(107, 16);
          m_chkRecurseFolders.setSelection(true);
          m_chkRecurseFolders.setText("Recurse folders");
        }
        {
          m_btnRenameIPAs = new Button(composite_1, SWT.NONE);
          m_btnRenameIPAs.setBackground(SWTResourceManager.getColor(SWT.COLOR_RED));
          m_btnRenameIPAs.setLocation(120, 137);
          m_btnRenameIPAs.setSize(94, 25);
          m_btnRenameIPAs.addSelectionListener(
              new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                  renameIPAs();
                }
              });
          m_btnRenameIPAs.setText("Rename IPAs");
        }

        m_btnUpdateIPAs = new Button(composite_1, SWT.NONE);
        m_btnUpdateIPAs.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                updateIPAs();
              }
            });
        m_btnUpdateIPAs.setBounds(216, 137, 94, 25);
        m_btnUpdateIPAs.setText("Update IPAs");

        m_chkUseAllFolders = new Button(composite_1, SWT.CHECK);
        m_chkUseAllFolders.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                if (m_chkUseAllFolders.getSelection()) {
                  m_lblExFolder.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED));
                  m_lbliTunes.setForeground(SWTResourceManager.getColor(SWT.COLOR_RED));
                } else {
                  m_lblExFolder.setForeground(null);
                  m_lbliTunes.setForeground(null);
                }
              }
            });
        m_chkUseAllFolders.setBounds(244, 103, 107, 16);
        m_chkUseAllFolders.setText("Use all folders");

        m_btnCleanJPGs = new Button(composite_1, SWT.NONE);
        m_btnCleanJPGs.setBackground(SWTResourceManager.getColor(SWT.COLOR_RED));
        m_btnCleanJPGs.setBounds(310, 137, 94, 25);
        m_btnCleanJPGs.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                cleanJPEGs();
              }
            });
        m_btnCleanJPGs.setText("Clean JPEGs");
      }

      TabItem tbtmCheckIPAs = new TabItem(tabFolder, SWT.NONE);
      tbtmCheckIPAs.setText("Check");

      Composite composite_1 = new Composite(tabFolder, SWT.NONE);
      tbtmCheckIPAs.setControl(composite_1);

      m_txtIPhoneFolder = new Text(composite_1, SWT.BORDER);
      m_txtIPhoneFolder.setText("");
      m_txtIPhoneFolder.setBounds(122, 14, 564, 21);

      Button btnIPhoneFolder = new Button(composite_1, SWT.NONE);
      btnIPhoneFolder.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
              _selectFolder(m_txtIPhoneFolder);
            }
          });
      btnIPhoneFolder.setText("...");
      btnIPhoneFolder.setBounds(692, 12, 38, 25);

      m_txtIPadFolder = new Text(composite_1, SWT.BORDER);
      m_txtIPadFolder.setText("");
      m_txtIPadFolder.setBounds(122, 45, 564, 21);

      Button btnIPadFolder = new Button(composite_1, SWT.NONE);
      btnIPadFolder.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
              _selectFolder(m_txtIPadFolder);
            }
          });
      btnIPadFolder.setText("...");
      btnIPadFolder.setBounds(692, 43, 38, 25);

      m_txtMixedFolder = new Text(composite_1, SWT.BORDER);
      m_txtMixedFolder.setText("");
      m_txtMixedFolder.setBounds(122, 76, 564, 21);

      Button btnMixedFolder = new Button(composite_1, SWT.NONE);
      btnMixedFolder.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
              _selectFolder(m_txtMixedFolder);
            }
          });
      btnMixedFolder.setText("...");
      btnMixedFolder.setBounds(692, 74, 38, 25);

      Label lblBothIpasFolder = new Label(composite_1, SWT.NONE);
      lblBothIpasFolder.setText("mixed Folder:");
      lblBothIpasFolder.setBounds(10, 79, 119, 15);

      Label lblIpadIpasFolder = new Label(composite_1, SWT.NONE);
      lblIpadIpasFolder.setText("iPad Folder:");
      lblIpadIpasFolder.setBounds(10, 48, 119, 15);

      Label lblIphoneFolder = new Label(composite_1, SWT.NONE);
      lblIphoneFolder.setText("iPhone Folder:");
      lblIphoneFolder.setBounds(10, 17, 119, 15);

      m_btnCheck = new Button(composite_1, SWT.NONE);
      m_btnCheck.addSelectionListener(
          new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
              checkIPAs();
            }
          });
      m_btnCheck.setText("Check IPAs");
      m_btnCheck.setBounds(122, 122, 90, 25);
    }
    composite.setLayoutData(BorderLayout.NORTH);

    final Label lblX = new Label(composite, SWT.NONE);
    lblX.setBounds(10, 10, 14, 211);
    final TabFolder m_tabTraces = new TabFolder(m_shell, SWT.NONE);
    m_tabTraces.setLayoutData(BorderLayout.CENTER);

    final Composite composite_1 = new Composite(m_shell, SWT.NONE);
    composite_1.setLayout(new BorderLayout(0, 0));
    composite_1.setLayoutData(BorderLayout.CENTER);

    // ------------------------------------------------------------------------
    // ********** TabbedTracer ***********************************************
    final CTabFolder tabTraces = m_tabbedTracer.createTabFolder(composite_1);
    tabTraces.setLayoutData(BorderLayout.CENTER);
    Tracer.setTracer(m_tabbedTracer);
  }
  /** Create contents of the window */
  protected void createContents() {

    m_BkscoverageShell = new Shell();

    m_BkscoverageShell.setImage(
        SWTResourceManager.getImage(BKSCoverageAppWnd.class, "/Properties.ico"));
    final BorderLayout borderLayout = new BorderLayout(0, 0);
    borderLayout.setVgap(5);
    m_BkscoverageShell.setLayout(borderLayout);
    m_BkscoverageShell.setSize(800, 400);
    m_BkscoverageShell.setMinimumSize(new Point(800, 400));
    m_BkscoverageShell.setText("BKSCoverage");

    Composite composite;
    composite = new Composite(m_BkscoverageShell, SWT.NONE);
    {
      TabFolder tabFolder = new TabFolder(composite, SWT.NONE);
      tabFolder.setBounds(10, 10, 748, 173);

      {
        TabItem tbtmTools = new TabItem(tabFolder, SWT.NONE);
        tbtmTools.setText("Parameters");

        Composite composite_1 = new Composite(tabFolder, SWT.NONE);
        tbtmTools.setControl(composite_1);

        m_txtWKSPFolder = new Text(composite_1, SWT.BORDER);
        m_txtWKSPFolder.setText("");
        m_txtWKSPFolder.setBounds(122, 14, 564, 21);

        Button btnWKSPFolder = new Button(composite_1, SWT.NONE);
        btnWKSPFolder.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                _selectFolder(m_txtWKSPFolder);
              }
            });
        btnWKSPFolder.setText("...");
        btnWKSPFolder.setBounds(692, 12, 38, 25);

        m_txtStorageFile = new Text(composite_1, SWT.BORDER);
        m_txtStorageFile.setText("");
        m_txtStorageFile.setBounds(122, 45, 564, 21);

        Button btnStorageFile = new Button(composite_1, SWT.NONE);
        btnStorageFile.addSelectionListener(
            new SelectionAdapter() {

              @Override
              public void widgetSelected(SelectionEvent e) {
                _selectFolder(m_txtStorageFile);
              }
            });
        btnStorageFile.setText("...");
        btnStorageFile.setBounds(692, 43, 38, 25);

        m_lblStorageFile = new Label(composite_1, SWT.NONE);
        m_lblStorageFile.setText("Storage File:");
        m_lblStorageFile.setBounds(10, 48, 119, 15);

        Label lblUpdFolder = new Label(composite_1, SWT.NONE);
        lblUpdFolder.setText("WKSP Folder:");
        lblUpdFolder.setBounds(10, 17, 119, 15);
        {
          m_chkLoadFromStorage = new Button(composite_1, SWT.CHECK);
          m_chkLoadFromStorage.addSelectionListener(
              new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {}
              });
          m_chkLoadFromStorage.setLocation(122, 75);
          m_chkLoadFromStorage.setSize(138, 16);
          m_chkLoadFromStorage.setSelection(true);
          m_chkLoadFromStorage.setText("Load From Storage");
        }
        {
          m_btnCheckWKSP = new Button(composite_1, SWT.NONE);
          m_btnCheckWKSP.setLocation(120, 109);
          m_btnCheckWKSP.setSize(90, 25);
          m_btnCheckWKSP.addSelectionListener(
              new SelectionAdapter() {

                @Override
                public void widgetSelected(SelectionEvent e) {
                  checkWKPS();
                }
              });
          m_btnCheckWKSP.setText("Check WKSP");
        }
      }
    }
    composite.setLayoutData(BorderLayout.NORTH);

    final Label lblX = new Label(composite, SWT.NONE);
    lblX.setBounds(10, 10, 14, 180);
    final CTabFolder m_tabTraces = new CTabFolder(m_BkscoverageShell, SWT.NONE);
    m_tabTraces.setLayoutData(BorderLayout.CENTER);

    m_infoTabItem = new CTabItem(m_tabTraces, SWT.NONE);
    m_infoTabItem.setText("Info");

    final Text txtInfo =
        new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER);
    txtInfo.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
    txtInfo.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    txtInfo.setEditable(false);
    m_infoTabItem.setControl(txtInfo);

    m_warnTabItem = new CTabItem(m_tabTraces, SWT.NONE);
    m_warnTabItem.setText("Warning");

    final Text txtWarn =
        new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER);
    txtWarn.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
    txtWarn.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    txtWarn.setEditable(false);
    m_warnTabItem.setControl(txtWarn);

    m_debugTabItem = new CTabItem(m_tabTraces, SWT.NONE);
    m_debugTabItem.setText("Debug");

    final Text txtDebug =
        new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER);
    txtDebug.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK));
    txtDebug.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    txtDebug.setEditable(false);
    m_debugTabItem.setControl(txtDebug);

    m_errorTabItem = new CTabItem(m_tabTraces, SWT.NONE);
    m_errorTabItem.setText("Error");

    final Text txtError =
        new Text(m_tabTraces, SWT.V_SCROLL | SWT.READ_ONLY | SWT.MULTI | SWT.H_SCROLL | SWT.BORDER);
    txtError.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
    txtError.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    txtError.setEditable(false);
    m_errorTabItem.setControl(txtError);
  }
Ejemplo n.º 6
0
  public void open() {

    final Shell parent = getParent();
    dialogShell = new Shell(parent, SWT.CLOSE | SWT.TITLE | SWT.APPLICATION_MODAL);

    com.cloudgarden.resource.SWTResourceManager.registerResourceUser(dialogShell);

    closeListener = new CloseShellListener(dialogShell);
    dialogShell.addListener(SWT.Close, closeListener);

    dialogShell.layout();
    dialogShell.pack();
    dialogShell.setText("TwoCents Wizard");
    dialogShell.setSize(394, 596);
    dialogShell.setLocation(300, 200);

    dialogShell.setLocation(getParent().toDisplay(100, 100));
    // int positionX=parent.getBounds().x+(parent.getBounds().width /4);
    // Move the dialog to the center of the top level shell.
    Rectangle shellBounds = getParent().getBounds();
    Point dialogSize = dialogShell.getSize();

    dialogShell.setLocation(
        shellBounds.x + (shellBounds.width - dialogSize.x) / 2,
        shellBounds.y + (shellBounds.height - dialogSize.y) / 2);

    dialogShell.setBackgroundImage(
        SWTResourceManager.getImage(
            TwWizard.class, UIDefault.COM_TWOCENTS_UI_RESOURCES_IMAGES_LOGIN_SCREEN_PNG));

    dialogShell.setBackgroundMode(SWT.INHERIT_DEFAULT);

    createWizardNoticeScreen(dialogShell);

    Label lblNewLabel_3 = new Label(dialogShell, SWT.NONE);
    lblNewLabel_3.setFont(
        org.eclipse.wb.swt.SWTResourceManager.getFont("Segoe UI", 10, SWT.NORMAL));
    lblNewLabel_3.setForeground(org.eclipse.wb.swt.SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_3.setText("Informa\u00E7\u00F5es sobre corretora :");

    Group groupBroker = new Group(dialogShell, SWT.NONE);
    groupBroker.setForeground(org.eclipse.wb.swt.SWTResourceManager.getColor(SWT.COLOR_WHITE));
    groupBroker.setLayout(new GridLayout(2, false));
    groupBroker.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Label lblNewLabel_1 = new Label(groupBroker, SWT.NONE);
    lblNewLabel_1.setForeground(org.eclipse.wb.swt.SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_1.setFont(
        org.eclipse.wb.swt.SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
    lblNewLabel_1.setText("Nome :");

    txtCorretora = new Text(groupBroker, SWT.BORDER);
    txtCorretora.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblNewLabel_2 = new Label(groupBroker, SWT.NONE);
    lblNewLabel_2.setForeground(org.eclipse.wb.swt.SWTResourceManager.getColor(SWT.COLOR_WHITE));
    lblNewLabel_2.setFont(
        org.eclipse.wb.swt.SWTResourceManager.getFont("Segoe UI", 12, SWT.NORMAL));
    lblNewLabel_2.setText("Corretagem :");

    txtFixa = new Text(groupBroker, SWT.BORDER);
    txtFixa.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    new Label(dialogShell, SWT.NONE);

    final Button nextBtn = new Button(dialogShell, SWT.NONE);
    nextBtn.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    nextBtn.setText("Cadastrar");

    nextBtn.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent arg0) {

            try {

              fillAndRegisterStockBroker();

              Broker broker = new Broker();

              StockBroker stockBrokeradded = fillAndRegisterBroker(broker);

              TwUser user =
                  new PopulateData()
                      .populateUser(
                          stockBrokeradded.getName(),
                          stockBrokeradded.getPassword(),
                          "",
                          stockBrokeradded.getEmail(),
                          stockBrokeradded.getTelefone());

              new AccountFacade().addAccount(user, stockBrokeradded, broker.getName(), "1");

              dialogShell.removeListener(SWT.Close, closeListener);
              dialogShell.close();

            } catch (Exception e) {
              DialogUtil.errorMessage(dialogShell, e.getMessage(), e.getMessage());
            }
          }
        });

    dialogShell.open();
    Display display = dialogShell.getDisplay();
    while (!dialogShell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
  }
Ejemplo n.º 7
0
  /**
   * Create the shell.
   *
   * @param display
   */
  public AdministratorShell(Display display) {
    super(display, SWT.SHELL_TRIM);
    setImage(
        SWTResourceManager.getImage(AdministratorShell.class, "/com/hms/icon/hms-admin-icon.png"));

    Group grpNgiSDng = new Group(this, SWT.NONE);
    grpNgiSDng.setText(Messages.getString("HMS.AdministratorShell.group.user"));
    grpNgiSDng.setBounds(10, 10, 216, 319);

    List list = new List(grpNgiSDng, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    list.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.NORMAL));
    list.setItems(
        new String[] {
          "Nguyễn Văn A0",
          "Nguyễn Văn B0",
          "Nguyễn Văn C0",
          "Nguyễn Văn A",
          "Nguyễn Văn B",
          "Nguyễn Văn C",
          "Nguyễn Văn A",
          "Nguyễn Văn B",
          "Nguyễn Văn C",
          "Nguyễn Văn A",
          "Nguyễn Văn B",
          "Nguyễn Văn C",
          "Nguyễn Văn A",
          "Nguyễn Văn B",
          "Nguyễn Văn C1",
          "Nguyễn Văn A1",
          "Nguyễn Văn B2",
          "Nguyễn Văn C2"
        });
    list.setBounds(10, 20, 196, 289);

    Group grpThngTinNgi = new Group(this, SWT.NONE);
    grpThngTinNgi.setText(Messages.getString("HMS.AdministratorShell.group.user_info"));
    grpThngTinNgi.setBounds(232, 10, 650, 213);

    Label lblTnngNhp = new Label(grpThngTinNgi, SWT.NONE);
    lblTnngNhp.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblTnngNhp.setBounds(10, 33, 136, 21);
    lblTnngNhp.setText(Messages.getString("HMS.AdministratorShell.group.user_info.label.username"));

    text = new Text(grpThngTinNgi, SWT.BORDER);
    text.addFocusListener(
        new FocusAdapter() {
          @Override
          public void focusGained(FocusEvent e) {
            text.selectAll();
          }
        });
    text.setBounds(152, 33, 251, 21);
    text.setFocus();
    text.setTopIndex(0);

    Label lblMtKhu = new Label(grpThngTinNgi, SWT.NONE);
    lblMtKhu.setText(Messages.getString("HMS.AdministratorShell.group.user_info.label.password"));
    lblMtKhu.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblMtKhu.setBounds(10, 60, 136, 21);

    text_1 = new Text(grpThngTinNgi, SWT.BORDER | SWT.PASSWORD);
    text_1.setBounds(152, 60, 251, 21);
    text_1.setTopIndex(1);

    Label lblXcNhnMt = new Label(grpThngTinNgi, SWT.NONE);
    lblXcNhnMt.setText(
        Messages.getString("HMS.AdministratorShell.group.user_info.label.confirm_password"));
    lblXcNhnMt.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblXcNhnMt.setBounds(10, 87, 136, 21);

    text_2 = new Text(grpThngTinNgi, SWT.BORDER | SWT.PASSWORD);
    text_2.setBounds(152, 87, 251, 21);
    text_2.setTopIndex(2);

    Label label = new Label(grpThngTinNgi, SWT.SEPARATOR | SWT.HORIZONTAL);
    label.setBounds(0, 114, 650, 2);

    Label lblTny = new Label(grpThngTinNgi, SWT.NONE);
    lblTny.setText(Messages.getString("HMS.AdministratorShell.group.user_info.label.fullname"));
    lblTny.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblTny.setBounds(10, 122, 136, 21);

    text_3 = new Text(grpThngTinNgi, SWT.BORDER);
    text_3.setBounds(152, 122, 251, 21);
    text_3.setTopIndex(3);

    Label lblEmail = new Label(grpThngTinNgi, SWT.NONE);
    lblEmail.setText(Messages.getString("HMS.AdministratorShell.group.user_info.label.email"));
    lblEmail.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblEmail.setBounds(10, 149, 136, 21);

    text_4 = new Text(grpThngTinNgi, SWT.BORDER);
    text_4.setBounds(152, 149, 251, 21);
    text_4.setTopIndex(4);

    Label lblHnhnh = new Label(grpThngTinNgi, SWT.NONE);
    lblHnhnh.setText(Messages.getString("HMS.AdministratorShell.group.user_info.label.picture"));
    lblHnhnh.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblHnhnh.setBounds(10, 176, 136, 21);

    text_5 = new Text(grpThngTinNgi, SWT.BORDER);
    text_5.setBounds(152, 176, 251, 21);
    text_5.setTopIndex(5);

    Group grpQuynSDng = new Group(this, SWT.NONE);
    grpQuynSDng.setText(Messages.getString("HMS.AdministratorShell.group.user_privileges"));
    grpQuynSDng.setBounds(232, 229, 650, 370);

    Label lblNhmChcNng = new Label(grpQuynSDng, SWT.NONE);
    lblNhmChcNng.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblNhmChcNng.setBounds(10, 27, 120, 21);
    lblNhmChcNng.setText(
        Messages.getString("HMS.AdministratorShell.group.user_privileges.label.group_function"));

    final List list_1 = new List(grpQuynSDng, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    list_1.setTopIndex(6);

    final java.util.List<LinkedList<String>> list_2_model = new LinkedList<LinkedList<String>>();
    LinkedList<String> tempList = new LinkedList<String>();
    tempList.add("Sử dụng CN 1");
    tempList.add("Thêm CN 1");
    tempList.add("Xóa CN 1");

    list_2_model.add(tempList);

    tempList = new LinkedList<String>();
    tempList.add("Thêm CN 2");
    tempList.add("Xóa CN 2");

    list_2_model.add(tempList);

    final java.util.List<LinkedList<String>> list_3_model = new LinkedList<LinkedList<String>>();
    list_3_model.add(new LinkedList<String>());
    list_3_model.add(new LinkedList<String>());

    final List list_2 = new List(grpQuynSDng, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    list_2.setTopIndex(7);
    final List list_3 = new List(grpQuynSDng, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
    list_3.setTopIndex(12);

    list_1.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            List list = (List) e.widget;
            int[] selectedItems = list.getSelectionIndices();
            list_2.removeAll();
            list_3.removeAll();

            if (selectedItems.length == 1) {
              switch (selectedItems[0]) {
                case 0:
                  for (String item : list_2_model.get(0)) {
                    list_2.add(item);
                  }

                  for (String item : list_3_model.get(0)) {
                    list_3.add(item);
                  }

                  break;
                case 1:
                  for (String item : list_2_model.get(1)) {
                    list_2.add(item);
                  }

                  for (String item : list_3_model.get(1)) {
                    list_3.add(item);
                  }

                  break;
              }
            }
          }
        });
    list_1.setItems(new String[] {"Chức năng 1", "Chức năng 2"});
    list_1.setBounds(10, 54, 178, 306);

    Label label_2 = new Label(grpQuynSDng, SWT.SEPARATOR | SWT.VERTICAL);
    label_2.setBounds(204, 10, 2, 357);

    Label lblCcQuynSn = new Label(grpQuynSDng, SWT.NONE);
    lblCcQuynSn.setText(
        Messages.getString("HMS.AdministratorShell.group.user_privileges.label.privileges"));
    lblCcQuynSn.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblCcQuynSn.setBounds(220, 27, 120, 21);

    list_2.setBounds(220, 54, 178, 306);

    Label lblCcQuync = new Label(grpQuynSDng, SWT.NONE);
    lblCcQuync.setText(
        Messages.getString("HMS.AdministratorShell.group.user_privileges.label.used_privileges"));
    lblCcQuync.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    lblCcQuync.setBounds(462, 27, 165, 21);

    Button button = new Button(grpQuynSDng, SWT.NONE);
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            LinkedList<String> temp = new LinkedList<String>();

            for (int selectedIndex : list_2.getSelectionIndices()) {
              list_3_model.get(list_1.getSelectionIndex()).add(list_2.getItem(selectedIndex));
              list_3.add(list_2.getItem(selectedIndex));

              temp.add(list_2_model.get(list_1.getSelectionIndex()).get(selectedIndex));
            }

            // Set selected items on destination list
            list_3.setSelection(
                list_3.getItemCount() - list_2.getSelectionCount(), list_3.getItemCount());

            // Remove on source list
            list_2.remove(list_2.getSelectionIndices());

            for (String removedItem : temp) {
              list_2_model.get(list_1.getSelectionIndex()).remove(removedItem);
            }
          }
        });
    button.setText(">");
    button.setBounds(411, 125, 37, 30);

    Button button_1 = new Button(grpQuynSDng, SWT.NONE);
    button_1.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            LinkedList<String> temp = new LinkedList<String>();

            for (int selectedIndex : list_3.getSelectionIndices()) {
              list_2_model.get(list_1.getSelectionIndex()).add(list_3.getItem(selectedIndex));
              list_2.add(list_3.getItem(selectedIndex));

              temp.add(list_3_model.get(list_1.getSelectionIndex()).get(selectedIndex));
            }

            // Set selected items on destination list
            list_2.setSelection(
                list_2.getItemCount() - list_3.getSelectionCount(), list_2.getItemCount());

            // Remove on source list
            list_3.remove(list_3.getSelectionIndices());

            for (String removedItem : temp) {
              list_3_model.get(list_1.getSelectionIndex()).remove(removedItem);
            }
          }
        });
    button_1.setText("<");
    button_1.setBounds(411, 170, 37, 30);

    Button button_2 = new Button(grpQuynSDng, SWT.NONE);
    button_2.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            for (int i = 0; i < list_2.getItemCount(); i++) {
              list_3_model.get(list_1.getSelectionIndex()).add(list_2.getItem(i));
              list_3.add(list_2.getItem(i));
            }

            // Select all items of destination list
            list_3.selectAll();

            // Remove source list
            list_2.removeAll();
            list_2_model.get(list_1.getSelectionIndex()).clear();
          }
        });
    button_2.setText(">>");
    button_2.setBounds(411, 215, 37, 30);

    Button button_3 = new Button(grpQuynSDng, SWT.NONE);
    button_3.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            for (int i = 0; i < list_3.getItemCount(); i++) {
              list_2_model.get(list_1.getSelectionIndex()).add(list_3.getItem(i));
              list_2.add(list_3.getItem(i));
            }

            // Select all items of destination list
            list_2.selectAll();

            // Remove source list
            list_3.removeAll();
            list_3_model.get(list_1.getSelectionIndex()).clear();
          }
        });
    button_3.setToolTipText("");
    button_3.setText("<<");
    button_3.setBounds(411, 260, 37, 30);

    list_3.setBounds(462, 54, 178, 306);

    Composite composite = new Composite(this, SWT.BORDER);
    composite.setBounds(232, 605, 650, 55);

    Button btnLu = new Button(composite, SWT.NONE);
    btnLu.setImage(
        SWTResourceManager.getImage(AdministratorShell.class, "/com/hms/icon/hms-save-icon.png"));
    btnLu.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    btnLu.setText(Messages.getString("HMS.AdministratorShell.button.save"));
    btnLu.setBounds(350, 10, 110, 30);

    Button btnHy = new Button(composite, SWT.NONE);
    btnHy.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            dispose();
          }
        });
    btnHy.setImage(
        SWTResourceManager.getImage(AdministratorShell.class, "/com/hms/icon/hms-cancel-icon.png"));
    btnHy.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    btnHy.setBounds(500, 10, 110, 30);
    btnHy.setText(Messages.getString("HMS.AdministratorShell.button.cancel"));

    Button btnThmMi = new Button(composite, SWT.NONE);
    btnThmMi.setImage(
        SWTResourceManager.getImage(AdministratorShell.class, "/com/hms/icon/hms-add-icon.png"));
    btnThmMi.setEnabled(false);
    btnThmMi.setFont(SWTResourceManager.getFont("Times New Roman", 12, SWT.BOLD));
    btnThmMi.setText(Messages.getString("HMS.AdministratorShell.button.add"));
    btnThmMi.setBounds(200, 10, 110, 30);
    createContents();
  }
Ejemplo n.º 8
0
 /**
  * Create the shell.
  *
  * @param display
  */
 public Waiter(Display display) {
   super(display, SWT.BORDER | SWT.TITLE | SWT.PRIMARY_MODAL);
   setImage(
       SWTResourceManager.getImage(Waiter.class, "/org/eclipse/jface/action/images/stop.gif"));
   createContents();
 }