예제 #1
0
  protected void createButtonComponent(ApplicationFactory factory) {
    Composite buttonComposite = new Composite(this, SWT.NONE);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    buttonComposite.setLayoutData(gridData);
    factory.setComposite(buttonComposite);

    GridLayout gridLayout = new GridLayout(3, false);
    gridLayout.marginHeight = 0;
    gridLayout.horizontalSpacing = 15;
    gridLayout.verticalSpacing = 0;
    gridLayout.marginWidth = 10;
    buttonComposite.setLayout(gridLayout);

    Composite removeComposite = new Composite(buttonComposite, SWT.NONE);
    buttonComposite.setBackground(getBackground());
    removeComposite.setLayout(new GridLayout(2, false));
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    removeComposite.setLayoutData(gridData);

    factory.setComposite(removeComposite);

    /* butRemoveAll = factory.createButton(SWT.PUSH);
    butRemoveAll.setText(factory.getResources().getLabel("menuRemoveAll"));
    butRemoveAll.addSelectionListener(new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        MessageBox msg = new MessageBox (getShell(), SWT.APPLICATION_MODAL | SWT.YES | SWT.NO);
        ClientRM clientRM = new ClientRM("HTMLExplorer");
        msg.setMessage(clientRM.getLabel("remove.all.message"));
        if(msg.open() != SWT.YES) return ;
        box.removeAll();
      }
    });
    //    butRemoveAll.setVisible(false);
    butRemoveAll.setFont(UIDATA.FONT_9);

    butUp = factory.createButton(SWT.PUSH);
    butUp.setText(factory.getResources().getLabel("menuUp"));
    butUp.addSelectionListener(new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        box.up();
      }
    });
    butUp.setVisible(false);
    butUp.setFont(UIDATA.FONT_9);

    butDown = factory.createButton(SWT.PUSH);
    butDown.setText(factory.getResources().getLabel("menuDown"));
    butDown.addSelectionListener(new SelectionAdapter(){
      @SuppressWarnings("unused")
      public void widgetSelected(SelectionEvent evt) {
        box.down();
      }
    });
    butDown.setVisible(false);
    butDown.setFont(UIDATA.FONT_9);*/

    lblStatus = factory.createLabel(SWT.NONE);
    lblStatus.setBackground(getBackground());
    gridData = new GridData();
    gridData.minimumWidth = 180;
    lblStatus.setLayoutData(gridData);
    lblStatus.setFont(UIDATA.FONT_10B);
    lblStatus.setForeground(getDisplay().getSystemColor(SWT.COLOR_RED));

    butRemovePath = factory.createButton(SWT.PUSH);
    butRemovePath.setText(factory.getResources().getLabel("remove.path.yes"));
    butRemovePath.addSelectionListener(
        new SelectionAdapter() {
          @SuppressWarnings("unused")
          public void widgetSelected(SelectionEvent evt) {
            if (errorPath != null) {
              box.removePath(errorPath);
              clearInformation();
            }
            showErrorPath(null);
          }
        });
    butRemovePath.setVisible(false);
    butRemovePath.setFont(UIDATA.FONT_9);

    //    Label lblSuggest = factory.createLabel(SWT.NONE);
    //    lblSuggest.setBackground(getBackground());
    //    gridData = new GridData(GridData.FILL_HORIZONTAL);
    //    //    gridData.widthHint = 305;
    //    lblSuggest.setLayoutData(gridData);
    //    lblSuggest.setFont(UIDATA.FONT_10B);
    ////    lblSuggest.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLUE));
    //    lblSuggest.setText(factory.getLabel("suggest.tip"));

    factory.setComposite(buttonComposite);

    String butTip = factory.getLabel("butOk");
    final ToolbarResource resources = ToolbarResource.getInstance();
    butOk =
        resources.createIcon(
            factory.getComposite(),
            resources.getImageGo(),
            butTip,
            new HyperlinkAdapter() {
              @SuppressWarnings("unused")
              public void linkActivated(HyperlinkEvent e) {
                butOk.setImage(resources.getImageGo());
              }

              @SuppressWarnings("unused")
              public void linkExited(HyperlinkEvent e) {
                butOk.setImage(resources.getImageGo());
              }

              @SuppressWarnings("unused")
              public void linkEntered(HyperlinkEvent e) {
                butOk.setImage(resources.getImageGo());
              }
            });
    butOk.addMouseListener(
        new MouseAdapter() {
          @SuppressWarnings("unused")
          public void mouseUp(MouseEvent e) {
            invisibleComponent();
            clickOk();
          }

          @SuppressWarnings("unused")
          public void mouseDown(MouseEvent e) {
            butOk.setImage(resources.getImageGo1());
            butOk.redraw();
          }
        });

    butTip = factory.getLabel("butCancel");
    butCancel =
        resources.createIcon(
            factory.getComposite(),
            resources.getImageCancel(),
            butTip,
            new HyperlinkAdapter() {
              @SuppressWarnings("unused")
              public void linkActivated(HyperlinkEvent e) {
                butCancel.setImage(resources.getImageCancel());
              }

              @SuppressWarnings("unused")
              public void linkExited(HyperlinkEvent e) {
                butCancel.setImage(resources.getImageCancel());
              }

              @SuppressWarnings("unused")
              public void linkEntered(HyperlinkEvent e) {
                butCancel.setImage(resources.getImageCancel());
              }
            });
    butCancel.addMouseListener(
        new MouseAdapter() {
          @SuppressWarnings("unused")
          public void mouseUp(MouseEvent e) {
            invisibleComponent();
            clickCancel();
          }

          @SuppressWarnings("unused")
          public void mouseDown(MouseEvent e) {
            butCancel.setImage(resources.getImageCancel1());
            butCancel.redraw();
          }
        });

    //    factory.setComposite(bottom);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);

    /*  String url = "";
    try {
      Preferences prefs = Preferences.userNodeForPackage(HTMLExplorer.class);
      url  = prefs.get("url.address", "");
    } catch (Exception e) {
      url = "";
    }*/
    //    toolbar.setText(url);

    //    treeAddButton = new TreeAddButton(this);
    //    viewFunctions();
  }