예제 #1
0
  protected void createControl(Composite parent, int treeStyle) {
    super.createControl(parent, treeStyle);

    // add 2px margin around filter text

    FormLayout layout = new FormLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    setLayout(layout);

    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, 0);
    if (showFilterControls) {
      FormData filterData = new FormData();
      filterData.top = new FormAttachment(0, 2);
      filterData.left = new FormAttachment(0, 2);
      filterData.right = new FormAttachment(100, -2);
      filterComposite.setLayoutData(filterData);
      data.top = new FormAttachment(filterComposite, 2);
    } else {
      data.top = new FormAttachment(0, 0);
    }
    treeComposite.setLayoutData(data);
  }
예제 #2
0
  /** Creates content Composite. */
  Composite eswtConstructContent(int style) {
    Composite comp = super.eswtConstructContent(SWT.VERTICAL);

    FormLayout layout = new FormLayout();
    layout.marginBottom = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTBOTTOMMARGIN);
    layout.marginTop = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTTOPMARGIN);
    layout.marginLeft = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTLEFTMARGIN);
    layout.marginRight = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTRIGHTMARGIN);
    layout.spacing = Style.pixelMetric(Style.QSTYLE_PM_LAYOUTVERTICALSPACING);
    comp.setLayout(layout);

    eswtScrolledText = new ScrolledTextComposite(comp, comp.getVerticalBar());
    eswtImgLabel = new LabelExtension(comp, SWT.NONE);

    FormData imageLD = new FormData();
    imageLD.right = new FormAttachment(100);
    imageLD.top = new FormAttachment(0);
    eswtImgLabel.setLayoutData(imageLD);

    FormData scrolledTextLD = new FormData();
    scrolledTextLD.left = new FormAttachment(0);
    scrolledTextLD.top = new FormAttachment(0);
    scrolledTextLD.right = new FormAttachment(eswtImgLabel);
    eswtScrolledText.setLayoutData(scrolledTextLD);

    eswtProgbarLD = new FormData();
    eswtProgbarLD.left = new FormAttachment(0);
    eswtProgbarLD.right = new FormAttachment(100);
    eswtProgbarLD.bottom = new FormAttachment(100);

    eswtUpdateProgressbar(comp, false, false);

    return comp;
  }
  @Override
  public Control contribute(Composite parent) {
    Composite result = new Composite(parent, SWT.INHERIT_DEFAULT);
    result.setLayout(new FormLayout());

    Label separator = new Label(result, SWT.NONE);
    separator.setData(WidgetUtil.CUSTOM_VARIANT, "footer_separator");
    FormData separatorData = new FormData();
    separator.setLayoutData(separatorData);
    separatorData.top = new FormAttachment(0, 0);
    separatorData.left = new FormAttachment(0, 0);
    separatorData.right = new FormAttachment(100, 0);
    separatorData.height = SEPARATOR_HEIGHT;

    Label versionInfo = new Label(result, SWT.NONE);
    versionInfo.setText(getVersionInfo());
    versionInfo.pack();
    FormData versionInfoData = new FormData();
    versionInfo.setLayoutData(versionInfoData);
    Point size = versionInfo.getSize();
    versionInfoData.top = new FormAttachment(50, -(size.y / 2) + (SEPARATOR_HEIGHT / 2));
    versionInfoData.left = new FormAttachment(50, -(size.x / 2));
    return result;
  }
예제 #4
0
  public void createComposites(Composite composite) {
    this.sashComposite = new Composite(composite, SWT.NONE);
    this.sashComposite.setLayout(new FormLayout());
    FormData data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(getItemManager().getCoolbar(), MARGIN_WIDTH);
    data.bottom = new FormAttachment(100, 0);
    this.sashComposite.setLayoutData(data);

    this.sash = new Sash(this.sashComposite, SWT.HORIZONTAL);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.bottom = new FormAttachment(100, -150);

    this.sash.setLayoutData(data);

    getTablatureEditor().showTablature(this.sashComposite);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(0, 0);
    data.bottom = new FormAttachment(this.sash, 0);
    getTablatureEditor().getTablature().setLayoutData(data);

    getTable().init(this.sashComposite);
    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(this.sash, 10);
    data.bottom = new FormAttachment(100, 0);
    getTable().getComposite().setLayoutData(data);

    this.sash.addMouseListener(
        new MouseAdapter() {
          public void mouseUp(MouseEvent e) {
            TuxGuitar.this.sashComposite.layout(true, true);
          }
        });
    this.sash.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent event) {
            int maximumHeight =
                (TuxGuitar.this.sashComposite.getBounds().height
                    - TuxGuitar.this.sash.getBounds().height);
            int height = (maximumHeight - event.y);
            height = Math.max(height, 0);
            height = Math.min(height, maximumHeight);
            ((FormData) TuxGuitar.this.sash.getLayoutData()).bottom =
                new FormAttachment(100, -height);
          }
        });
    this.sashComposite.addListener(
        SWT.Resize,
        new Listener() {
          public void handleEvent(Event arg0) {
            FormData data = ((FormData) TuxGuitar.this.sash.getLayoutData());
            int height = -data.bottom.offset;
            int maximumHeight =
                (TuxGuitar.this.sashComposite.getBounds().height
                    - TuxGuitar.this.sash.getBounds().height);
            if (height > maximumHeight) {
              data.bottom = new FormAttachment(100, -maximumHeight);
            }
          }
        });

    data = new FormData();
    data.left = new FormAttachment(0, 0);
    data.right = new FormAttachment(100, 0);
    data.top = new FormAttachment(this.sashComposite, 0);
    data.bottom = new FormAttachment(100, 0);

    Composite footer = new Composite(composite, SWT.NONE);
    footer.setLayout(new FormLayout());
    footer.setLayoutData(data);
    getFretBoardEditor().showFretBoard(footer);
  }
예제 #5
0
  // --------------------------------------------------------------------------------
  public void init2() {
    parent.setLayout(new FormLayout());

    sashForm = new SashForm(parent, SWT.SMOOTH | SWT.VERTICAL);
    FormData fd_sashForm1 = new FormData();
    fd_sashForm1.top = new FormAttachment(0, 1);
    fd_sashForm1.left = new FormAttachment(0, 1);
    fd_sashForm1.right = new FormAttachment(100, -1);
    fd_sashForm1.bottom = new FormAttachment(100, -1);
    sashForm.setLayoutData(fd_sashForm1);

    tree = new Tree(sashForm, SWT.BORDER | SWT.FULL_SELECTION);
    tree.setHeaderVisible(true);

    FormData d1 = new FormData();
    d1.top = new FormAttachment(0, 1);
    d1.left = new FormAttachment(0, 1);
    d1.right = new FormAttachment(100, -1);
    d1.bottom = new FormAttachment(100, -1);
    tree.setLayoutData(d1);

    TreeColumn column1 = new TreeColumn(tree, SWT.LEFT);
    TreeColumn column2 = new TreeColumn(tree, SWT.LEFT);
    column2.setText("Data Type");

    editorComposite = new Composite(sashForm, SWT.BORDER);
    editorComposite.addControlListener(
        new ControlAdapter() {
          public void controlResized(ControlEvent e) {
            onSashResize();
          }
        });

    FormData fd_composite1 = new FormData();
    fd_composite1.top = new FormAttachment(0, 1);
    fd_composite1.bottom = new FormAttachment(0, 35);
    fd_composite1.right = new FormAttachment(100, -1);
    fd_composite1.left = new FormAttachment(0, 1);
    editorComposite.setLayoutData(fd_composite1);
    editorComposite.setLayout(new FormLayout());
    Label nameLabel = new Label(editorComposite, SWT.NONE);
    FormData fd_nameLabel = new FormData();
    fd_nameLabel.right = new FormAttachment(0, 66);
    fd_nameLabel.bottom = new FormAttachment(0, 32);
    fd_nameLabel.top = new FormAttachment(0, 12);
    fd_nameLabel.left = new FormAttachment(0, 10);
    nameLabel.setLayoutData(fd_nameLabel);
    nameLabel.setText("Name :");
    Label valueLabel = new Label(editorComposite, SWT.NONE);
    FormData fd_valueLabel = new FormData();
    fd_valueLabel.top = new FormAttachment(nameLabel, 15);
    fd_valueLabel.left = new FormAttachment(0, 10);
    fd_valueLabel.bottom = new FormAttachment(nameLabel, 34, SWT.BOTTOM);
    fd_valueLabel.right = new FormAttachment(nameLabel, 0, SWT.RIGHT);
    valueLabel.setLayoutData(fd_valueLabel);
    valueLabel.setText("Value :");

    valueText =
        new Text(
            editorComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    valueText.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            verifyData();
          }
        });
    valueText.setEnabled(false);
    valueText.setEditable(false);
    FormData fd_valueText = new FormData();
    fd_valueText.top = new FormAttachment(nameLabel, 5);
    fd_valueText.bottom = new FormAttachment(100, -80);
    fd_valueText.right = new FormAttachment(100, -20);
    fd_valueText.left = new FormAttachment(valueLabel, 0, SWT.RIGHT);
    valueText.setLayoutData(fd_valueText);

    updateButton = new Button(editorComposite, SWT.NONE);
    updateButton.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            onUpdateButtonSelect();
          }
        });
    updateButton.setEnabled(false);
    FormData fd_updateButton = new FormData();
    fd_updateButton.left = new FormAttachment(100, -120);
    fd_updateButton.right = new FormAttachment(valueText, 0, SWT.RIGHT);
    updateButton.setLayoutData(fd_updateButton);
    updateButton.setText("Update");

    typeCombo = new Combo(editorComposite, SWT.READ_ONLY);
    fd_updateButton.top = new FormAttachment(typeCombo, 10);
    typeCombo.setEnabled(false);
    FormData fd_typeList = new FormData();
    fd_typeList.left = new FormAttachment(valueText, 0, SWT.LEFT);
    fd_typeList.top = new FormAttachment(valueText, 5, SWT.BOTTOM);
    // fd_typeList.bottom = new FormAttachment(valueText, 30, SWT.BOTTOM);
    fd_typeList.right = new FormAttachment(valueText, 170, SWT.LEFT);
    typeCombo.setLayoutData(fd_typeList);

    typeCombo.add("Double");
    typeCombo.add("Integer");
    typeCombo.add("Long");
    typeCombo.add("String");
    typeCombo.add("List (BasicDBList)");
    typeCombo.add("Map (BasicDBObject)");
    typeCombo.add("Date");
    typeCombo.add("ObjectId");
    typeCombo.add("JavaScript code");
    typeCombo.add("Binary data");
    typeCombo.add("Boolean");
    typeCombo.add("Null");
    typeCombo.add("Regular expression");
    typeCombo.add("Symbol");
    typeCombo.add("JavaScript code with scope");
    typeCombo.add("Timestamp");
    typeCombo.add("Min key");
    typeCombo.add("Max key");

    typeCombo.addListener(SWT.Selection, this);

    typeComboIndexMap.put(Double.class, new Integer(0));
    typeComboIndexMap.put(Integer.class, new Integer(1));
    typeComboIndexMap.put(Long.class, new Integer(2));
    typeComboIndexMap.put(String.class, new Integer(3));
    typeComboIndexMap.put(com.mongodb.BasicDBList.class, new Integer(4));
    typeComboIndexMap.put(com.mongodb.BasicDBObject.class, new Integer(5));
    typeComboIndexMap.put(java.util.Date.class, new Integer(6));
    typeComboIndexMap.put(org.bson.types.ObjectId.class, new Integer(7));
    typeComboIndexMap.put(org.bson.types.Code.class, new Integer(8));
    typeComboIndexMap.put(byte[].class, new Integer(9));
    typeComboIndexMap.put(Boolean.class, new Integer(10));
    typeComboIndexMap.put(java.util.regex.Pattern.class, new Integer(12));
    typeComboIndexMap.put(org.bson.types.Symbol.class, new Integer(13));
    typeComboIndexMap.put(org.bson.types.CodeWScope.class, new Integer(14));
    typeComboIndexMap.put(org.bson.types.BSONTimestamp.class, new Integer(15));
    typeComboIndexMap.put(org.bson.types.MinKey.class, new Integer(16));
    typeComboIndexMap.put(org.bson.types.MaxKey.class, new Integer(17));

    Label typeLabel = new Label(editorComposite, SWT.NONE);
    FormData fd_typeLabel = new FormData();
    fd_typeLabel.top = new FormAttachment(typeCombo, 3, SWT.TOP);
    fd_typeLabel.left = new FormAttachment(nameLabel, 0, SWT.LEFT);
    typeLabel.setLayoutData(fd_typeLabel);
    typeLabel.setText("Type :");

    nameText = new Text(editorComposite, SWT.READ_ONLY);
    nameText.setBackground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND));
    FormData fd_nameText = new FormData();
    fd_nameText.top = new FormAttachment(nameLabel, -2, SWT.TOP);
    fd_nameText.left = new FormAttachment(valueText, 0, SWT.LEFT);
    fd_nameText.right = new FormAttachment(valueText, 0, SWT.RIGHT);
    nameText.setLayoutData(fd_nameText);

    MSwtUtil.getTreeColumnWidthFromProperties("documentTree", tree, prop, new int[] {150, 150});

    // listeners
    tree.addListener(SWT.MouseDoubleClick, this);
    tree.addListener(SWT.Selection, this);
    tree.addListener(SWT.KeyDown, this);
    MSwtUtil.addListenerToTreeColumns2(tree, this);

    documentImage = MUtil.getImage(parent.getShell().getDisplay(), "table.png");
    oidImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_star.png");
    intImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_blue.png");
    longImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_red.png");
    doubleImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_orange.png");
    stringImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_green.png");
    dateImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_white.png");
    boolImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_yellow.png");
    listImage = MUtil.getImage(parent.getShell().getDisplay(), "stop_blue.png");
    mapImage = MUtil.getImage(parent.getShell().getDisplay(), "stop_green.png");
    nullImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_black.png");
    jsImage = MUtil.getImage(parent.getShell().getDisplay(), "bullet_right.png");

    if (prop.containsKey(DOCUMENT_COMPOSITE_WEIGHT)) {

      (new Thread() {
            public void run() {
              // System.out.println( "e" );
              MSystemUtil.sleep(0);
              // System.out.println( "a" );
              shell
                  .getDisplay()
                  .asyncExec(
                      new Runnable() {
                        public void run() { // ----
                          // debug( "--" + prop.getIntArrayProperty( DOCUMENT_COMPOSITE_WEIGHT )[ 0
                          // ] );
                          sashForm.setWeights(prop.getIntArrayProperty(DOCUMENT_COMPOSITE_WEIGHT));
                        }
                      }); // ----
            }
          })
          .start();

    } else {
      sashForm.setWeights(new int[] {70, 30});
    }
    initializedTime = System.currentTimeMillis();
  }
  public MyIndexForm(Composite parent, MyApplicationWindow w) {
    super(parent, SWT.BORDER);

    Display display = Display.getCurrent();
    //   Shell	 myShell =display.getActiveShell();
    //	Color gray = display.getSystemColor(SWT.COLOR_GRAY);
    Color red = display.getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
    window = w;
    window.setStatus("");
    this.setBackground(red);
    Font font = new Font(display, "Courier New", 9, SWT.NORMAL);

    this.setLayout(new FormLayout());
    Text instructionsLabel =
        new Text(this, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.CENTER);
    instructionsLabel.setText(
        "This utility will index HTML, HTM, "
            + "  TXT and PDF files "
            + "and will store the index in the 'MyDocumentsIndex' directory on your computer. "
            + "\n"
            + " If the index already exists the program will update it."
            + "\n "
            + "Example (Windows)  -  "
            + "C:\\MyDocuments"
            + "\n"
            + "Example (Mac OS)  -  "
            + "/users/myName/Documents");
    instructionsLabel.setBackground(red);
    instructionsLabel.setFont(font);
    FormData myFormData = new FormData();
    myFormData.left = new FormAttachment(0, 5);
    myFormData.right = new FormAttachment(100, -5);
    myFormData.top = new FormAttachment(0, 5);
    instructionsLabel.setLayoutData(myFormData);

    Label pleaseLabel = new Label(this, SWT.WRAP | SWT.CENTER);
    pleaseLabel.setText("Enter the directory to index:");
    pleaseLabel.setBackground(red);
    pleaseLabel.setFont(font);

    myFormData = new FormData();
    myFormData.left = new FormAttachment(3, 5);
    myFormData.right = new FormAttachment(24, -5);
    myFormData.top = new FormAttachment(instructionsLabel, 5);
    pleaseLabel.setLayoutData(myFormData);

    textDirectoryToIndex = new Text(this, SWT.SINGLE | SWT.BORDER);
    textDirectoryToIndex.setText("/MyDocuments");

    myFormData = new FormData();
    myFormData.left = new FormAttachment(25, 5);
    myFormData.right = new FormAttachment(75, -5);
    myFormData.top = new FormAttachment(instructionsLabel, 5);
    textDirectoryToIndex.setLayoutData(myFormData);

    Button myIndexButton = new Button(this, SWT.PUSH);
    myIndexButton.setText("Index");

    myFormData = new FormData();
    myFormData.left = new FormAttachment(80, 5);
    myFormData.right = new FormAttachment(97, -5);
    myFormData.top = new FormAttachment(instructionsLabel, 5);
    myIndexButton.setLayoutData(myFormData);
    myIndexButton.addSelectionListener(this);

    indexOutcome = new Text(this, SWT.MULTI | SWT.BORDER);
    myFormData = new FormData();
    myFormData.top = new FormAttachment(myIndexButton, 5);
    myFormData.bottom = new FormAttachment(100, -5);
    myFormData.left = new FormAttachment(0, 5);
    myFormData.right = new FormAttachment(100, -5);
    indexOutcome.setLayoutData(myFormData);
  }
  public Composite createSashForm(final Composite composite) {
    if (!tv.isTabViewsEnabled()) {
      tableComposite = tv.createMainPanel(composite);
      return tableComposite;
    }

    ConfigurationManager configMan = ConfigurationManager.getInstance();

    int iNumViews = 0;

    UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
    UISWTViewEventListenerWrapper[] pluginViews = null;
    if (uiFunctions != null) {
      UISWTInstance pluginUI = uiFunctions.getUISWTInstance();

      if (pluginUI != null) {
        pluginViews = pluginUI.getViewListeners(tv.getTableID());
        iNumViews += pluginViews.length;
      }
    }

    if (iNumViews == 0) {
      tableComposite = tv.createMainPanel(composite);
      return tableComposite;
    }

    FormData formData;

    final Composite form = new Composite(composite, SWT.NONE);
    FormLayout flayout = new FormLayout();
    flayout.marginHeight = 0;
    flayout.marginWidth = 0;
    form.setLayout(flayout);
    GridData gridData;
    gridData = new GridData(GridData.FILL_BOTH);
    form.setLayoutData(gridData);

    // Create them in reverse order, so we can have the table auto-grow, and
    // set the tabFolder's height manually

    final int TABHEIGHT = 20;
    tabFolder = new CTabFolder(form, SWT.TOP | SWT.BORDER);
    tabFolder.setMinimizeVisible(true);
    tabFolder.setTabHeight(TABHEIGHT);
    final int iFolderHeightAdj = tabFolder.computeSize(SWT.DEFAULT, 0).y;

    final Sash sash = new Sash(form, SWT.HORIZONTAL);

    tableComposite = tv.createMainPanel(form);
    Composite cFixLayout = tableComposite;
    while (cFixLayout != null && cFixLayout.getParent() != form) {
      cFixLayout = cFixLayout.getParent();
    }
    if (cFixLayout == null) {
      cFixLayout = tableComposite;
    }
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cFixLayout.setLayout(layout);

    // FormData for Folder
    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(100, 0);
    int iSplitAt = configMan.getIntParameter(tv.getPropertiesPrefix() + ".SplitAt", 3000);
    // Was stored at whole
    if (iSplitAt < 100) {
      iSplitAt *= 100;
    }

    double pct = iSplitAt / 10000.0;
    if (pct < 0.03) {
      pct = 0.03;
    } else if (pct > 0.97) {
      pct = 0.97;
    }

    // height will be set on first resize call
    sash.setData("PCT", new Double(pct));
    tabFolder.setLayoutData(formData);
    final FormData tabFolderData = formData;

    // FormData for Sash
    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(tabFolder);
    formData.height = 5;
    sash.setLayoutData(formData);

    // FormData for table Composite
    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.top = new FormAttachment(0, 0);
    formData.bottom = new FormAttachment(sash);
    cFixLayout.setLayoutData(formData);

    // Listeners to size the folder
    sash.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            final boolean FASTDRAG = true;

            if (FASTDRAG && e.detail == SWT.DRAG) {
              return;
            }

            if (tabFolder.getMinimized()) {
              tabFolder.setMinimized(false);
              refreshSelectedSubView();
              ConfigurationManager configMan = ConfigurationManager.getInstance();
              configMan.setParameter(tv.getPropertiesPrefix() + ".subViews.minimized", false);
            }

            Rectangle area = form.getClientArea();
            tabFolderData.height = area.height - e.y - e.height - iFolderHeightAdj;
            form.layout();

            Double l = new Double((double) tabFolder.getBounds().height / form.getBounds().height);
            sash.setData("PCT", l);
            if (e.detail != SWT.DRAG) {
              ConfigurationManager configMan = ConfigurationManager.getInstance();
              configMan.setParameter(
                  tv.getPropertiesPrefix() + ".SplitAt", (int) (l.doubleValue() * 10000));
            }
          }
        });

    final CTabFolder2Adapter folderListener =
        new CTabFolder2Adapter() {
          public void minimize(CTabFolderEvent event) {
            tabFolder.setMinimized(true);
            tabFolderData.height = iFolderHeightAdj;
            CTabItem[] items = tabFolder.getItems();
            for (int i = 0; i < items.length; i++) {
              CTabItem tabItem = items[i];
              tabItem.getControl().setVisible(false);
            }
            form.layout();

            UISWTViewCore view = getActiveSubView();
            if (view != null) {
              view.triggerEvent(UISWTViewEvent.TYPE_FOCUSLOST, null);
            }

            ConfigurationManager configMan = ConfigurationManager.getInstance();
            configMan.setParameter(tv.getPropertiesPrefix() + ".subViews.minimized", true);
          }

          public void restore(CTabFolderEvent event) {
            tabFolder.setMinimized(false);
            CTabItem selection = tabFolder.getSelection();
            if (selection != null) {
              selection.getControl().setVisible(true);
            }
            form.notifyListeners(SWT.Resize, null);

            UISWTViewCore view = getActiveSubView();
            if (view != null) {
              view.triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null);
            }
            refreshSelectedSubView();

            ConfigurationManager configMan = ConfigurationManager.getInstance();
            configMan.setParameter(tv.getPropertiesPrefix() + ".subViews.minimized", false);
          }
        };
    tabFolder.addCTabFolder2Listener(folderListener);

    tabFolder.addSelectionListener(
        new SelectionListener() {
          public void widgetSelected(SelectionEvent e) {
            // make sure its above
            try {
              ((CTabItem) e.item).getControl().setVisible(true);
              ((CTabItem) e.item).getControl().moveAbove(null);

              // TODO: Need to viewDeactivated old one
              UISWTViewCore view = getActiveSubView();
              if (view != null) {
                view.triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null);
              }

            } catch (Exception t) {
            }
          }

          public void widgetDefaultSelected(SelectionEvent e) {}
        });

    tabFolder.addMouseListener(
        new MouseAdapter() {
          public void mouseDown(MouseEvent e) {
            if (tabFolder.getMinimized()) {
              folderListener.restore(null);
              // If the user clicked down on the restore button, and we restore
              // before the CTabFolder does, CTabFolder will minimize us again
              // There's no way that I know of to determine if the mouse is
              // on that button!

              // one of these will tell tabFolder to cancel
              e.button = 0;
              tabFolder.notifyListeners(SWT.MouseExit, null);
            }
          }
        });

    form.addListener(
        SWT.Resize,
        new Listener() {
          public void handleEvent(Event e) {
            if (tabFolder.getMinimized()) {
              return;
            }

            Double l = (Double) sash.getData("PCT");
            if (l != null) {
              tabFolderData.height =
                  (int) (form.getBounds().height * l.doubleValue()) - iFolderHeightAdj;
              form.layout();
            }
          }
        });

    // Call plugin listeners
    if (pluginViews != null) {
      for (UISWTViewEventListenerWrapper l : pluginViews) {
        if (l != null) {
          try {
            UISWTViewImpl view = new UISWTViewImpl(tv.getTableID(), l.getViewID(), l, null);
            addTabView(view);
          } catch (Exception e) {
            // skip, plugin probably specifically asked to not be added
          }
        }
      }
    }

    if (configMan.getBooleanParameter(tv.getPropertiesPrefix() + ".subViews.minimized", false)) {
      tabFolder.setMinimized(true);
      tabFolderData.height = iFolderHeightAdj;
    } else {
      tabFolder.setMinimized(false);
    }

    tabFolder.setSelection(0);

    return form;
  }
예제 #8
0
  public Object skinObjectInitialShow(SWTSkinObject skinObject, Object params) {
    skin = skinObject.getSkin();

    SWTSkinProperties properties = skin.getSkinProperties();
    colorFileDragBorder = properties.getColor("color.buddy.filedrag.bg.border");
    colorFileDragBG = properties.getColor("color.buddy.filedrag.bg");

    soNoBuddies = skin.getSkinObject("buddies-viewer-nobuddies-panel");

    SWTSkinObject viewer = skin.getSkinObject(SkinConstants.VIEWID_BUDDIES_VIEWER);

    if (null != viewer) {

      parent = (Composite) skinObject.getControl();
      parent.setBackgroundMode(SWT.INHERIT_FORCE);
      scrollable = new ScrolledComposite(parent, SWT.V_SCROLL);
      scrollable.setExpandHorizontal(true);
      scrollable.setExpandVertical(true);
      scrollable.setBackgroundMode(SWT.INHERIT_FORCE);
      scrollable.getVerticalBar().setIncrement(10);
      scrollable.getVerticalBar().setPageIncrement(65);

      FormData fd = new FormData();
      fd.top = new FormAttachment(0, 0);
      fd.bottom = new FormAttachment(100, 0);
      fd.left = new FormAttachment(0, 0);
      fd.right = new FormAttachment(100, 0);
      scrollable.setLayoutData(fd);

      avatarsPanel = new Composite(scrollable, SWT.NONE);
      avatarsPanel.setBackgroundMode(SWT.INHERIT_FORCE);
      scrollable.setContent(avatarsPanel);

      scrollable.addListener(
          SWT.Resize,
          new Listener() {

            public void handleEvent(Event event) {
              Rectangle r = scrollable.getClientArea();
              scrollable.setMinHeight(avatarsPanel.computeSize(r.width, SWT.DEFAULT).y);
            }
          });

      /*
       * Specify avatar dimensions and attributes before creating the avatars
       */
      textColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_FOREGROUND);
      selectedTextColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT);
      textLinkColor = properties.getColor("color.links.hover");
      imageBorderColor = properties.getColor("color.buddy.bg.border");
      selectedColor = parent.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION);
      highlightedColor = parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);

      avatarHightLightBorder = 0;
      avatarImageBorder = 1;
      hSpacing = 1;
      avatarImageSize = new Point(40, 40);
      avatarNameSize = new Point(60, 30);
      avatarSize = new Point(0, 0);
      avatarSize.x =
          Math.max(avatarNameSize.x, avatarImageSize.x)
              + (2 * (avatarHightLightBorder + avatarImageBorder));
      avatarSize.y =
          avatarNameSize.y
              + avatarImageSize.y
              + (2 * (avatarHightLightBorder + avatarImageBorder) + 6);

      fillBuddies(avatarsPanel);

      /* UNCOMMENT THIS SECTION TO REVERT TO A ROW LAYOUT*/
      //			RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
      //			rLayout.wrap = true;
      //			rLayout.spacing = hSpacing;
      //			avatarsPanel.setLayout(rLayout);

      // COMMENT THIS SECTION TO REVERT TO A ROW LAYOUT
      SimpleReorderableListLayout rLayout = new SimpleReorderableListLayout();
      rLayout.margin = hSpacing;
      rLayout.wrap = true;
      rLayout.center = true;
      avatarsPanel.setLayout(rLayout);

      avatarsPanel.pack();

      avatarsPanel.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent e) {
              select(null, false, false);
            }
          });

      avatarsPanel.addMouseListener(
          new MouseAdapter() {
            public void mouseDown(MouseEvent e) {
              select(null, false, false);
            }
          });

      parent.layout();

      hookFAQLink();

      hookImageAction();
    }

    return null;
  }