Exemplo n.º 1
0
  /** @param tabFolder */
  private void createControl(CTabFolder tabFolder) {
    // Create Container
    ScrolledComposite scrolledContainer =
        new ScrolledComposite(tabFolder, SWT.BORDER | SWT.V_SCROLL);

    Composite container = new Composite(scrolledContainer, SWT.NONE);
    GridLayout glayout = new GridLayout();
    glayout.numColumns = 1;
    glayout.marginTop = 0;
    glayout.marginBottom = 0;
    glayout.marginRight = 4;
    glayout.verticalSpacing = 20;
    container.setLayout(glayout);

    // General
    createGeneralGroup(container);

    // SSL
    createSSLGroup(container);

    // HA
    createHAGroup(container);

    // LWT
    createLWTGroup(container);

    scrolledContainer.setContent(container);
    scrolledContainer.setExpandHorizontal(true);
    scrolledContainer.setExpandVertical(true);
    // scrolledContainer.setMinWidth( 1600 );
    scrolledContainer.setMinHeight(900);

    setControl(scrolledContainer);
  }
Exemplo n.º 2
0
  public void createPartControl(Composite parent) {

    final ScrolledComposite scomposite =
        new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);

    swtDisplay = (SWTRemoteDisplay) RemoteDisplayFactory.getDisplay(SWTDISPLAY, scomposite);
    running = true;

    scomposite.setContent(swtDisplay);
    scomposite.setExpandHorizontal(true);
    scomposite.setExpandVertical(true);

    swtDisplay
        .getCanvas()
        .addControlListener(
            new ControlListener() {
              public void controlMoved(ControlEvent e) {}

              public void controlResized(ControlEvent e) {
                Point size = swtDisplay.getCanvas().getSize();
                scomposite.setMinSize(swtDisplay.getParent().computeSize(size.x, size.y));
              }
            });

    swtDisplay.getCanvas().setSize(0, 0);

    if (VNCViewerView.protocolHandle != null) {
      try {
        swtDisplay.start(protocolHandle);
      } catch (Exception e) {
        // TODO handle properly
        e.printStackTrace();
      }
    }
  }
  @Override
  public void setActiveTab(ILaunchConfigurationTab tab) {
    if (activeTab != null) {
      activeTab.deactivated(workingCopy);
      activeTab.getControl().dispose();
    }

    activeTab = tab;

    if (activeTab != null) {
      launchConfigArea.setRedraw(false);

      configNameText.setVisible(true);

      activeTab.createControl(launchConfigArea);
      //      GridDataFactory.swtDefaults().grab(true, false).align(SWT.FILL,
      // SWT.BEGINNING).applyTo(
      //          activeTab.getControl());
      launchConfigArea.setContent(activeTab.getControl());
      activeTab.getControl().setSize(activeTab.getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT));
      configUI.layout(true);

      activeTab.activated(workingCopy);

      launchConfigArea.setRedraw(true);
    } else {
      configNameText.setVisible(false);
    }

    updateButtons();
    updateMessage();
  }
Exemplo n.º 4
0
  @Override
  public void createPartControl(Composite parent) {
    // Creates toolkit and form
    toolkit = createFormBodySection(parent, "Senate Crawler");
    Section section = toolkit.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
    GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(section);
    section.setExpanded(true);

    // Create a composite to hold the other widgets
    ScrolledComposite sc = new ScrolledComposite(section, SWT.H_SCROLL | SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    GridLayoutFactory.fillDefaults().numColumns(3).equalWidth(false).applyTo(sc);

    // Creates an empty to create a empty space
    TacitFormComposite.createEmptyRow(toolkit, sc);

    // Create a composite that can hold the other widgets
    Composite client = toolkit.createComposite(form.getBody());
    GridLayoutFactory.fillDefaults()
        .equalWidth(true)
        .numColumns(1)
        .applyTo(client); // Align the composite section to one column
    GridDataFactory.fillDefaults().grab(true, false).span(1, 1).applyTo(client);
    GridLayout layout = new GridLayout(); // Layout creation
    layout.numColumns = 2;

    createSenateInputParameters(client);
    TacitFormComposite.createEmptyRow(toolkit, client);
    outputLayout =
        TacitFormComposite.createOutputSection(toolkit, client, form.getMessageManager());
    // Add run and help button on the toolbar
    addButtonsToToolBar();
  }
  /**
   * Because this <code>Section</code> must alter the layout behavior of the containing Eclipse RCP
   * View in order to properly lay out the {@link #tableViewer} and related <code>Controls</code>,
   * this method must store any layout properties for parent <code>Composites</code> (e.g., {@link
   * #scrollComposite} and {@link #scrollCompositeClient}) that will be changed in {@link
   * #resizePropertyView()}. These layout properties must be restored in {@link #aboutToBeHidden()}.
   */
  @Override
  public void aboutToBeShown() {
    super.aboutToBeShown();

    // Store some of the default properties of the ScrolledComposite.
    scrollMinWidth = scrollComposite.getMinWidth();
    scrollMinHeight = scrollComposite.getMinHeight();

    return;
  }
Exemplo n.º 6
0
 @Before
 public void setUp() {
   Fixture.setUp();
   display = new Display();
   shell = new Shell(display);
   sc = new ScrolledComposite(shell, SWT.H_SCROLL | SWT.V_SCROLL);
   hScroll = sc.getHorizontalBar();
   vScroll = sc.getVerticalBar();
   lca = new ScrolledCompositeLCA();
 }
Exemplo n.º 7
0
 private void dealParentLayout(Composite container) {
   if (container == null) return;
   if (!(container instanceof ScrolledComposite)) {
     dealParentLayout(container.getParent());
     return;
   }
   ScrolledComposite composite = (ScrolledComposite) container;
   Composite control = (Composite) composite.getContent();
   composite.setMinSize(control.computeSize(SWT.DEFAULT, SWT.DEFAULT));
   control.layout();
 }
 private static void writeBarSelection(final ScrolledComposite composite) throws IOException {
   JSWriter writer = JSWriter.getWriterFor(composite);
   Integer hBarSelection = getBarSelection(composite.getHorizontalBar());
   if (hBarSelection != null) {
     writer.set(PROP_H_BAR_SELECTION, "hBarSelection", hBarSelection, ZERO);
   }
   Integer vBarSelection = getBarSelection(composite.getVerticalBar());
   if (vBarSelection != null) {
     writer.set(PROP_V_BAR_SELECTION, "vBarSelection", vBarSelection, ZERO);
   }
 }
Exemplo n.º 9
0
  @Test
  public void testRenderOrigin() throws IOException {
    Composite content = new Composite(sc, SWT.NONE);
    sc.setContent(content);

    sc.setOrigin(1, 2);
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    JsonArray expected = JsonArray.readFrom("[ 1, 2 ]");
    assertEquals(expected, message.findSetProperty(sc, "origin"));
  }
 private static boolean hasSelectionListener(final ScrolledComposite composite) {
   boolean result = false;
   ScrollBar horizontalBar = composite.getHorizontalBar();
   if (horizontalBar != null) {
     result = result || SelectionEvent.hasListener(horizontalBar);
   }
   ScrollBar verticalBar = composite.getVerticalBar();
   if (verticalBar != null) {
     result = result || SelectionEvent.hasListener(verticalBar);
   }
   return result;
 }
 public void preserveValues(final Widget widget) {
   ScrolledComposite composite = (ScrolledComposite) widget;
   ControlLCAUtil.preserveValues(composite);
   IWidgetAdapter adapter = WidgetUtil.getAdapter(composite);
   adapter.preserve(PROP_BOUNDS, composite.getBounds());
   adapter.preserve(PROP_OVERFLOW, getOverflow(composite));
   adapter.preserve(PROP_H_BAR_SELECTION, getBarSelection(composite.getHorizontalBar()));
   adapter.preserve(PROP_V_BAR_SELECTION, getBarSelection(composite.getVerticalBar()));
   adapter.preserve(Props.SELECTION_LISTENERS, Boolean.valueOf(hasSelectionListener(composite)));
   adapter.preserve(PROP_SHOW_FOCUSED_CONTROL, Boolean.valueOf(composite.getShowFocusedControl()));
   WidgetLCAUtil.preserveCustomVariant(composite);
 }
Exemplo n.º 12
0
  private void createEditArea(Composite parent) {
    containerSC = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    containerSC.setExpandHorizontal(true);
    containerSC.setExpandVertical(true);

    // Add a container for the build settings page
    settingsPageContainer = new Composite(containerSC, SWT.NONE);
    settingsPageContainer.setLayout(new PageLayout());

    containerSC.setContent(settingsPageContainer);
    //		containerSC.setMinSize(settingsPageContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    settingsPageContainer.layout();
  }
  private void createControlsPanel(Composite theParent) {
    ScrolledComposite scroller =
        new ScrolledComposite(theParent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);

    GridLayout scrolledLayout = new GridLayout();
    scrolledLayout.marginLeft = 5;
    scrolledLayout.marginRight = 5;
    scroller.setLayout(scrolledLayout);

    scroller.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    scroller.setExpandHorizontal(true);
    scroller.setExpandVertical(true);
    scroller.setMinWidth(900);
    scroller.setMinHeight(270);

    Group controlsGroup = WidgetFactory.createGroup(scroller, EDIT_TXT);
    GridLayout controlsLayout = new GridLayout();
    controlsLayout.marginLeft = 0;
    controlsLayout.marginRight = 0;
    controlsGroup.setLayout(controlsLayout);
    controlsGroup.setLayoutData(new GridData(GridData.FILL_BOTH));

    createResolveAttributePanel(controlsGroup);
    createResolveSqlPanel(controlsGroup);

    scroller.setContent(controlsGroup);
  }
Exemplo n.º 14
0
 private void updatePreviewSize() {
   Point minSize;
   Rectangle bounds = scroll.getClientArea();
   if (preview.isFitHorizontal()) {
     if (preview.isFitVertical()) minSize = new Point(0, 0); // Best fit
     else minSize = new Point(0, preview.computeSize(bounds.width, SWT.DEFAULT).y); // Fit to width
   } else {
     if (preview.isFitVertical())
       minSize = new Point(preview.computeSize(SWT.DEFAULT, bounds.height).x, 0); // Fit to height
     else minSize = preview.computeSize(SWT.DEFAULT, SWT.DEFAULT); // Custom
     // scale
   }
   scroll.setMinSize(minSize);
 }
Exemplo n.º 15
0
  /** Leert die Anzeige. Wird beim Wechsel von einem Dialog auf den naechsten aufgerufen. */
  protected void cleanContent() {
    if (content != null && !content.isDisposed()) content.dispose();

    if (scroll != null && !scroll.isDisposed()) scroll.dispose();

    if (Customizing.SETTINGS.getBoolean("application.scrollview", false)) {
      scroll = new ScrolledComposite(view, SWT.V_SCROLL | SWT.H_SCROLL);
      scroll.setLayoutData(new GridData(GridData.FILL_BOTH));
      scroll.setLayout(SWTUtil.createGrid(1, true));
      scroll.setExpandHorizontal(true);
      scroll.setExpandVertical(true);
      scroll.setMinHeight(Customizing.SETTINGS.getInt("application.scrollview.minheight", 580));

      content = new Composite(scroll, SWT.NONE);
      scroll.setContent(content);
    } else {
      content = new Composite(view, SWT.NONE);
    }

    content.setLayoutData(new GridData(GridData.FILL_BOTH));
    GridLayout l = new GridLayout();
    l.marginHeight = 6;
    l.marginWidth = 6;
    content.setLayout(l);

    if (this.titlePart != null) {
      this.titlePart.clearButtons();
      this.titlePart.addButton(new PanelButtonBack()); // Zurueckbutton ist immer dabei
    }

    if (notifications != null) notifications.reset();

    setTitle(null);
  }
Exemplo n.º 16
0
  @Test
  public void testRenderOriginUnchanged() throws IOException {
    Composite content = new Composite(sc, SWT.NONE);
    sc.setContent(content);
    Fixture.markInitialized(display);
    Fixture.markInitialized(sc);

    sc.setOrigin(1, 2);
    Fixture.preserveWidgets();
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertNull(message.findSetOperation(hScroll, "selection"));
    assertNull(message.findSetOperation(vScroll, "selection"));
  }
Exemplo n.º 17
0
 private void drawEQImage(GC gc) {
   if (ibuffer != null) {
     synchronized (ibuffer) {
       if (AXIS_PADDING + (MINIMUM_UNIT_HEIGHT * size) > winYSize) {
         scroll.setMinSize(
             canvas.computeSize(SWT.DEFAULT, AXIS_PADDING + (MINIMUM_UNIT_HEIGHT * size)));
       } else {
         scroll.setMinSize(canvas.computeSize(SWT.DEFAULT, winYSize));
       }
       if (ibuffer.isDisposed() == false) {
         gc.drawImage(ibuffer, 0, 0);
       }
     }
   }
 }
  protected Composite createScrolledComposite(Composite parent) {
    // create scrollbars for this parent when needed
    final ScrolledComposite sc1 = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    sc1.setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite composite = createComposite(sc1, 1);
    sc1.setContent(composite);

    // not calling setSize for composite will result in a blank composite,
    // so calling it here initially
    // setSize actually needs to be called after all controls are created,
    // so scrolledComposite
    // has correct minSize
    setSize(composite);
    return composite;
  }
Exemplo n.º 19
0
 @Test
 public void testPreserveValues() {
   RemoteAdapter adapter = WidgetUtil.getAdapter(sc);
   assertEquals(null, adapter.getPreserved(PROP_SHOW_FOCUSED_CONTROL));
   hScroll.setSelection(23);
   vScroll.setSelection(42);
   sc.setShowFocusedControl(true);
   assertEquals(23, hScroll.getSelection());
   assertEquals(42, vScroll.getSelection());
   Rectangle rectangle = new Rectangle(12, 30, 20, 40);
   sc.setBounds(rectangle);
   Fixture.markInitialized(display);
   Fixture.preserveWidgets();
   assertEquals(Boolean.TRUE, adapter.getPreserved(PROP_SHOW_FOCUSED_CONTROL));
 }
Exemplo n.º 20
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));
  }
Exemplo n.º 21
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));
  }
Exemplo n.º 22
0
  private void handleOptionSelection() {
    // Get the selection from the tree list
    if (fTree == null) return;
    IStructuredSelection selection = (IStructuredSelection) fTree.getSelection();
    ToolListElement element = (ToolListElement) selection.getFirstElement();
    if (element != null) {
      displayPageForElement(element);
    }

    ScrollBar sb = containerSC.getHorizontalBar();
    if (sb != null && sb.isVisible()) {
      settingsPageContainer.pack(true);
      containerSC.setMinSize(settingsPageContainer.getSize());
      ((AbstractPage) page).resize();
    }
  }
Exemplo n.º 23
0
 /**
  * Clean up when disposing the details viewer
  *
  * @see org.eclipse.swt.widgets.Widget#dispose()
  * @see era.foss.typeeditor.common.Ui#dispose()
  */
 @Override
 public void dispose() {
   super.dispose();
   this.disposeDetails();
   master.dispose();
   dataBindingContext.dispose();
 }
Exemplo n.º 24
0
  protected void addCheckboxes() {
    for (T item : itemList) {
      if (isItemVisible(item)) {
        boolean selected = preSelectedElements.contains(item);
        if (LOG.isDebugEnabled()) {
          LOG.debug(item.toString() + " is visible, select state is: " + selected);
        }
        Button checkbox = new Button(innerComposite, SWT.CHECK);
        checkbox.setText(getLabel(item));
        checkbox.setData(item);
        checkbox.addSelectionListener(organizationListener);
        if (selected) {
          checkbox.setSelection(true);
          selectedElement = item;
          selectedElementSet.add(item);
        }
        if (itemList.size() == 1) {
          checkbox.setSelection(true);
          selectedElement = item;
          selectedElementSet.add(item);
        }
        checkboxMap.put(item, checkbox);
      }
    }

    scrolledComposite.setVisible(true);
    Point size = innerComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    size.y += itemList.size() * 2;
    innerComposite.setSize(size);
    group.layout();
  }
Exemplo n.º 25
0
  /** This is a callback that will allow us to create the viewer and initialize it. */
  public void createPartControl(Composite parent) {
    this.parent = parent;
    final ScrolledComposite sc = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    CrtVerViewComposite c = new CrtVerViewComposite(sc, SWT.NONE, this);
    sc.setContent(c);
    sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    c.setText();

    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(
            parent.getShell(),
            "org.jcryptool.visual.crtverification.views.CrtVerView"); //$NON-NLS-1$
  }
  private void createJFreeChartComposite() {

    final ScrolledComposite scrollComp =
        new ScrolledComposite(this, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
    scrollComp.setLayout(new GridLayout());

    Composite innerComp = new Composite(scrollComp, SWT.NONE);
    GridData innerGD = new GridData();
    innerGD.grabExcessVerticalSpace = true;
    innerComp.setLayoutData(innerGD);
    innerComp.setLayout(new FillLayout());
    scrollComp.setContent(innerComp);
    scrollComp.setExpandVertical(true);
    scrollComp.setExpandHorizontal(true);
    jfreeChartComp = new ChartComposite(innerComp, SWT.NONE, computeChart(), true);
  }
Exemplo n.º 27
0
  @Test
  public void testRenderParent() throws IOException {
    lca.renderInitialization(sc);

    TestMessage message = Fixture.getProtocolMessage();
    CreateOperation operation = message.findCreateOperation(sc);
    assertEquals(getId(sc.getParent()), getParent(operation));
  }
 private static String getOverflow(final ScrolledComposite composite) {
   String result;
   ScrollBar horizontalBar = composite.getHorizontalBar();
   boolean scrollX = horizontalBar != null && horizontalBar.getVisible();
   ScrollBar verticalBar = composite.getVerticalBar();
   boolean scrollY = verticalBar != null && verticalBar.getVisible();
   if (scrollX && scrollY) {
     result = "scroll";
   } else if (scrollX) {
     result = "scrollX";
   } else if (scrollY) {
     result = "scrollY";
   } else {
     result = "hidden";
   }
   return result;
 }
Exemplo n.º 29
0
 private void restoreScrollingPosition() {
   if (scrollingPosition != null) {
     Point size = preview.getSize();
     scroll.setOrigin(
         (int) Math.round(scrollingPosition[0] * size.x),
         (int) Math.round(scrollingPosition[1] * size.y));
   }
 }
Exemplo n.º 30
0
  @Test
  public void testRenderShowFocusedControl() throws IOException {
    sc.setShowFocusedControl(true);
    lca.renderChanges(sc);

    TestMessage message = Fixture.getProtocolMessage();
    assertEquals(JsonValue.TRUE, message.findSetProperty(sc, "showFocusedControl"));
  }