Пример #1
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);
  }
  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);
  }
Пример #3
0
  private void initialize(Composite composite) {
    panel = new Composite(composite, SWT.NULL);
    panel.setLayout(new GridLayout(2, false));

    legend_panel_sc = new ScrolledComposite(panel, SWT.V_SCROLL);
    legend_panel_sc.setExpandHorizontal(true);
    legend_panel_sc.setExpandVertical(true);
    GridLayout layout = new GridLayout();
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    legend_panel_sc.setLayout(layout);
    GridData gridData = new GridData(GridData.FILL_VERTICAL);
    legend_panel_sc.setLayoutData(gridData);

    legend_panel = new Group(legend_panel_sc, SWT.NULL);
    legend_panel.setText(MessageText.getString("label.tags"));

    legend_panel.setLayout(new GridLayout());

    legend_panel_sc.setContent(legend_panel);
    legend_panel_sc.addControlListener(
        new ControlAdapter() {
          public void controlResized(ControlEvent e) {
            legend_panel_sc.setMinSize(legend_panel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
          }
        });

    speed_panel = new Composite(panel, SWT.NULL);
    speed_panel.setLayout(new GridLayout());
    gridData = new GridData(GridData.FILL_BOTH);
    speed_panel.setLayoutData(gridData);

    build();

    TagManager tm = TagManagerFactory.getTagManager();

    tm.addTagManagerListener(this, false);

    for (TagType tt : tm.getTagTypes()) {

      tt.addTagTypeListener(this, false);
    }

    panel.addListener(
        SWT.Activate,
        new Listener() {
          public void handleEvent(Event event) {
            refresh(true);
          }
        });
  }
  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);
  }
  /**
   * Creates the composite holding the details.
   *
   * @param parent the parent
   * @return the right panel/detail composite
   */
  protected ScrolledComposite createRightPanelContent(Composite parent) {
    rightPanel = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    rightPanel.setShowFocusedControl(true);
    rightPanel.setExpandVertical(true);
    rightPanel.setExpandHorizontal(true);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(rightPanel);
    rightPanel.setLayout(GridLayoutFactory.fillDefaults().create());
    rightPanel.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));

    container = new Composite(rightPanel, SWT.FILL);
    container.setLayout(GridLayoutFactory.fillDefaults().create());
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(container);
    container.setBackground(rightPanel.getBackground());

    /* The header */
    final Composite header = new Composite(container, SWT.FILL);
    final GridLayout headerLayout = GridLayoutFactory.fillDefaults().create();
    headerLayout.marginWidth = 5;
    header.setLayout(headerLayout);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(header);
    header.setBackground(rightPanel.getBackground());

    final Label label = new Label(header, SWT.WRAP);
    label.setText("Details"); // $NON-NLS-1$
    detailsFont = new Font(label.getDisplay(), getDefaultFontName(label), 10, SWT.BOLD);
    label.setFont(detailsFont);
    label.setForeground(getTitleColor(parent));
    label.setBackground(header.getBackground());

    rightPanelContainerComposite = new Composite(container, SWT.FILL);
    rightPanelContainerComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    GridDataFactory.fillDefaults()
        .align(SWT.FILL, SWT.FILL)
        .grab(true, true)
        .applyTo(rightPanelContainerComposite);
    rightPanelContainerComposite.setBackground(rightPanel.getBackground());

    rightPanel.setContent(container);

    rightPanel.layout();
    container.layout();

    final Point point = container.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    rightPanel.setMinSize(point);

    return rightPanel;
  }
  /**
   * Creates and associates the required composites to present the parameters and the demo image for
   * the spatial operation.
   *
   * @param builder
   */
  @Override
  protected void createContents() {

    assert this.presenterFactory != null : "builder cannot not be null";

    GridLayout gridLayout = new GridLayout();
    setLayout(gridLayout);

    this.sash = new SashForm(this, SWT.NONE);
    GridData gridData = new GridData();
    gridData.horizontalAlignment = GridData.FILL;
    gridData.grabExcessVerticalSpace = true;
    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    this.sash.setLayoutData(gridData);

    this.dataScrollComposite = new ScrolledComposite(this.sash, SWT.BORDER | SWT.H_SCROLL);
    this.dataScrollComposite.setLayout(new FillLayout());

    this.dataComposite =
        (Composite) this.presenterFactory.createDataComposite(this.dataScrollComposite, SWT.BORDER);

    dataComposite.setLayoutData(gridData);

    this.dataScrollComposite.setContent(dataComposite);
    this.dataScrollComposite.setExpandHorizontal(true);
    this.dataScrollComposite.setExpandVertical(true);
    this.dataScrollComposite.setMinSize(dataComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    ScrolledComposite demoScrollComposite = new ScrolledComposite(sash, SWT.BORDER | SWT.H_SCROLL);
    demoScrollComposite.setLayout(new FillLayout());

    IImageOperation demoImages = this.presenterFactory.createDemoImages();

    this.demoComposite = new DemoComposite(demoScrollComposite, SWT.BORDER, demoImages);

    this.demoComposite.setLayoutData(gridData);

    demoScrollComposite.setContent(this.demoComposite);
    demoScrollComposite.setExpandHorizontal(true);
    demoScrollComposite.setExpandVertical(true);
    demoScrollComposite.setMinSize(demoComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    sash.setWeights(new int[] {70, 30});

    super.addPresenter((AggregatedPresenter) dataComposite);
  }
Пример #7
0
  @Override
  public void createPartControl(Composite parent) {
    Composite mainComposite = new Composite(parent, SWT.None);
    mainComposite.setLayout(new GridLayout(1, false));
    mainComposite.setLayoutData(
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));

    Group connectionsGroup = new Group(mainComposite, SWT.BORDER | SWT.SHADOW_ETCHED_IN);
    connectionsGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    connectionsGroup.setLayout(new GridLayout(3, true));
    connectionsGroup.setText(Messages.DatabaseView__connections);

    Composite connectionsListComposite = new Composite(connectionsGroup, SWT.NONE);
    connectionsListComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    connectionsListComposite.setLayout(new GridLayout(2, false));

    connectionsViewer = createTableViewer(connectionsListComposite);
    connectionsViewer.setInput(availableDatabaseConnectionProperties);
    addFilterButtons(connectionsListComposite, connectionsViewer);

    ScrolledComposite scrolledComposite =
        new ScrolledComposite(connectionsGroup, SWT.BORDER | SWT.V_SCROLL);
    scrolledComposite.setLayout(new GridLayout(1, false));

    propertiesComposite = new Composite(scrolledComposite, SWT.NONE);
    propertiesStackLayout = new StackLayout();
    propertiesComposite.setLayout(propertiesStackLayout);
    GridData propertiesCompositeGD = new GridData(SWT.FILL, SWT.FILL, true, true);
    // propertiesCompositeGD.horizontalSpan = 2;
    propertiesComposite.setLayoutData(propertiesCompositeGD);
    Label l = new Label(propertiesComposite, SWT.SHADOW_ETCHED_IN);
    l.setText(Messages.DatabaseView__no_item_selected);
    propertiesStackLayout.topControl = l;

    scrolledComposite.setContent(propertiesComposite);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    // scrolledComposite.setMinWidth(400);
    scrolledComposite.setMinHeight(300);
    GridData scrolledCompositeGD = new GridData(SWT.FILL, SWT.FILL, true, true);
    scrolledCompositeGD.horizontalSpan = 2;
    scrolledComposite.setLayoutData(scrolledCompositeGD);
  }
  /**
   * @param composite
   * @return
   */
  private Composite createLiteralsConfigurationComposite(final Composite composite) {

    final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL);
    scrolledComposite.setLayout(new FillLayout());

    final Composite typeComposite = new Composite(scrolledComposite, SWT.NONE);
    typeComposite.setLayout(new GridLayout(1, false));
    DynamicAddRemoveLineComposite literalsComposite =
        new DynamicAddRemoveLineComposite(typeComposite, SWT.NONE) {
          @Override
          protected void lineRemoved(int i) {
            literals.remove(i);

            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);

            getContainer().updateButtons();
          }

          @Override
          protected void lineAdded(int i) {

            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);
            if (getContainer().getCurrentPage() != null) {
              getContainer().updateButtons();
            }
          }

          @Override
          protected Button createAddButton(Composite parent) {
            Button button = new Button(parent, SWT.FLAT);
            button.setText(Messages.addALiteral);
            return button;
          }

          @Override
          protected TabbedPropertySheetWidgetFactory getWidgetFactory() {
            return null;
          }

          @Override
          protected Composite getTopComposite() {
            return scrolledComposite;
          }

          @SuppressWarnings("restriction")
          @Override
          protected Control createLineComposite(Composite parent, Object object) {
            SimulationLiteral literal;
            if (object == null) {
              literal = SimulationFactory.eINSTANCE.createSimulationLiteral();
              literals.add(literal);
            } else {
              literal = (SimulationLiteral) object;
            }
            Composite composite = new Composite(parent, SWT.NONE);
            composite.setLayout(new GridLayout(4, false));
            Label literalLabel = new Label(composite, SWT.NONE);
            literalLabel.setText(Messages.dataNameLabel);
            Text literalText = new Text(composite, SWT.BORDER);
            literalText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .grab(false, false)
                    .hint(200, SWT.DEFAULT)
                    .create());
            // literalText.addModifyListener(updateButtonModifyListener) ;
            Label probaLabel = new Label(composite, SWT.NONE);
            probaLabel.setText(Messages.AddSimulationDataWizardPage_probability);
            Text probaText = new Text(composite, SWT.BORDER);
            probaText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .grab(false, false)
                    .hint(60, SWT.DEFAULT)
                    .create());
            //                ControlDecoration controlDecoration = new ControlDecoration(probaText,
            // SWT.LEFT|SWT.TOP);
            //                FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault()
            //                        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            //                controlDecoration.setImage(fieldDecoration.getImage());
            //                controlDecoration.setDescriptionText(Messages.mustBeAPercentage);
            context.bindValue(
                SWTObservables.observeText(literalText, SWT.Modify),
                EMFObservables.observeValue(
                    literal, SimulationPackage.Literals.SIMULATION_LITERAL__VALUE));
            UpdateValueStrategy targetToModel = new UpdateValueStrategy();
            targetToModel.setConverter(
                StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), true));
            targetToModel.setAfterGetValidator(
                new ProbabilityValidator(
                    new StringToDoubleValidator(
                        StringToNumberConverter.toDouble(
                            BonitaNumberFormat.getPercentInstance(), false))));
            Binding provider =
                context.bindValue(
                    SWTObservables.observeText(probaText, SWT.Modify),
                    EMFObservables.observeValue(
                        literal, SimulationPackage.Literals.SIMULATION_LITERAL__PROBABILITY),
                    targetToModel,
                    new UpdateValueStrategy()
                        .setConverter(
                            NumberToStringConverter.fromDouble(
                                BonitaNumberFormat.getPercentInstance(), false)));

            ControlDecorationSupport.create(provider, SWT.TOP | SWT.LEFT);
            probaText.addModifyListener(
                new ModifyListener() {

                  @Override
                  public void modifyText(ModifyEvent e) {
                    if (getContainer().getCurrentPage() != null) {
                      getContainer().updateButtons();
                    }
                  }
                });
            return composite;
          }
        };
    for (SimulationLiteral literal : literals) {
      literalsComposite.addLine(literal);
    }
    literalsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setContent(typeComposite);
    return scrolledComposite;
  }
  /**
   * @param composite
   * @return
   */
  private Composite createNumberConfigurationComposite(final Composite composite) {

    final ScrolledComposite scrolledComposite = new ScrolledComposite(composite, SWT.V_SCROLL);
    scrolledComposite.setLayout(new FillLayout());
    final Composite typeComposite = new Composite(scrolledComposite, SWT.NONE);
    typeComposite.setLayout(new GridLayout(1, false));
    DynamicAddRemoveLineComposite literalsComposite =
        new DynamicAddRemoveLineComposite(typeComposite, SWT.NONE) {
          @Override
          protected void lineRemoved(int i) {
            ranges.remove(i);

            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);
            if (getContainer().getCurrentPage() != null) {
              getContainer().updateButtons();
            }
          }

          @Override
          protected void lineAdded(int i) {
            getShell().pack(true);
            getShell().layout(true, true);

            scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
            scrolledComposite.setAlwaysShowScrollBars(false);
            scrolledComposite.setExpandHorizontal(true);
            scrolledComposite.setExpandVertical(true);
            scrolledComposite.setContent(typeComposite);
            if (getContainer().getCurrentPage() != null) {
              getContainer().updateButtons();
            }
          }

          @Override
          protected Button createAddButton(Composite parent) {
            Button button = new Button(parent, SWT.FLAT);
            button.setText(Messages.addARange);
            return button;
          }

          @Override
          protected TabbedPropertySheetWidgetFactory getWidgetFactory() {
            return null;
          }

          @Override
          protected Composite getTopComposite() {
            return scrolledComposite;
          }

          @Override
          protected Control createLineComposite(Composite parent, Object object) {
            SimulationNumberRange range;
            if (object == null) {
              range = SimulationFactory.eINSTANCE.createSimulationNumberRange();
              ranges.add(range);
            } else {
              range = (SimulationNumberRange) object;
            }
            Composite composite = new Composite(parent, SWT.NONE);
            composite.setLayout(new GridLayout(6, false));
            // min
            Label minLabel = new Label(composite, SWT.NONE);
            minLabel.setText(Messages.AddSimulationDataWizardPage_min);
            Text minText = new Text(composite, SWT.BORDER);
            minText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .hint(100, SWT.DEFAULT)
                    .create());
            ControlDecoration minControlDecoration =
                new ControlDecoration(minText, SWT.LEFT | SWT.TOP);
            FieldDecoration fieldDecoration =
                FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            minControlDecoration.setImage(fieldDecoration.getImage());
            minControlDecoration.setDescriptionText(Messages.mustBeANumber);
            // max
            Label maxLiteral = new Label(composite, SWT.NONE);
            maxLiteral.setText(Messages.AddSimulationDataWizardPage_max);
            Text maxText = new Text(composite, SWT.BORDER);
            maxText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .hint(100, SWT.DEFAULT)
                    .create());
            ControlDecoration maxControlDecoration =
                new ControlDecoration(maxText, SWT.LEFT | SWT.TOP);
            fieldDecoration =
                FieldDecorationRegistry.getDefault()
                    .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            maxControlDecoration.setImage(fieldDecoration.getImage());
            maxControlDecoration.setDescriptionText(Messages.mustBeANumber);
            // proba
            Label probaLabel = new Label(composite, SWT.NONE);
            probaLabel.setText(Messages.AddSimulationDataWizardPage_probability);
            Text probaText = new Text(composite, SWT.BORDER);
            probaText.setLayoutData(
                GridDataFactory.swtDefaults()
                    .align(SWT.FILL, SWT.CENTER)
                    .hint(40, SWT.DEFAULT)
                    .create());
            //                ControlDecoration controlDecoration = new ControlDecoration(probaText,
            // SWT.LEFT|SWT.TOP);
            //                fieldDecoration = FieldDecorationRegistry.getDefault()
            //                        .getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
            //                controlDecoration.setImage(fieldDecoration.getImage());
            //                controlDecoration.setDescriptionText(Messages.mustBeAPercentage);
            // repartitionType

            //				Label repartitionLabel = new Label(composite, SWT.NONE);
            //				repartitionLabel.setText(Messages.AddSimulationDataWizardPage_repartition);
            //				ComboViewer comboViewer = new ComboViewer(new Combo(composite, SWT.READ_ONLY));
            //				comboViewer.setContentProvider(ArrayContentProvider.getInstance());
            //				comboViewer.setLabelProvider(new LabelProvider(){
            //					@Override
            //					public String getText(Object element) {
            //						return ((RepartitionType)element).getName();
            //					}
            //				});
            //				comboViewer.setInput(RepartitionType.VALUES);

            context.bindValue(
                SWTObservables.observeText(minText, SWT.Modify),
                EMFObservables.observeValue(
                    range, SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__MIN),
                new UpdateValueStrategy()
                    .setConverter(StringToNumberConverter.toLong(false))
                    .setAfterGetValidator(
                        new WrappingValidator(
                            minControlDecoration,
                            new StringToLongValidator(StringToNumberConverter.toLong(false)))),
                new UpdateValueStrategy().setConverter(NumberToStringConverter.fromLong(false)));
            context.bindValue(
                SWTObservables.observeText(maxText, SWT.Modify),
                EMFObservables.observeValue(
                    range, SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__MAX),
                new UpdateValueStrategy()
                    .setConverter(StringToNumberConverter.toLong(false))
                    .setAfterGetValidator(
                        new WrappingValidator(
                            maxControlDecoration,
                            new StringToLongValidator(StringToNumberConverter.toLong(false)))),
                new UpdateValueStrategy().setConverter(NumberToStringConverter.fromLong(false)));
            UpdateValueStrategy targetToModel = new UpdateValueStrategy();
            targetToModel.setConverter(
                StringToNumberConverter.toDouble(BonitaNumberFormat.getPercentInstance(), true));
            targetToModel.setAfterGetValidator(
                new ProbabilityValidator(
                    new StringToDoubleValidator(
                        StringToNumberConverter.toDouble(
                            BonitaNumberFormat.getPercentInstance(), false))));
            Binding provider =
                context.bindValue(
                    SWTObservables.observeText(probaText, SWT.Modify),
                    EMFObservables.observeValue(
                        range, SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__PROBABILITY),
                    targetToModel,
                    new UpdateValueStrategy()
                        .setConverter(
                            NumberToStringConverter.fromDouble(
                                BonitaNumberFormat.getPercentInstance(), false)));
            // context.bindValue(ViewersObservables.observeSingleSelection(comboViewer),
            // EMFObservables.observeValue(range,
            // SimulationPackage.Literals.SIMULATION_NUMBER_RANGE__REPARTITION_TYPE));

            //				minText.addModifyListener(updateButtonModifyListener);
            //				maxText.addModifyListener(updateButtonModifyListener) ;
            //				probaText.addModifyListener(updateButtonModifyListener) ;
            ControlDecorationSupport.create(provider, SWT.TOP | SWT.LEFT);

            return composite;
          }
        };
    for (SimulationNumberRange range : ranges) {
      literalsComposite.addLine(range);
    }
    literalsComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    scrolledComposite.setMinSize(typeComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setContent(typeComposite);
    return scrolledComposite;
  }
Пример #10
0
  /** Creates the display area for this form */
  private void createDisplayArea() {
    // create the top level layout for the form
    GridLayout layout = new GridLayout();
    layout.marginHeight = MARGIN_HEIGHT;
    layout.marginWidth = MARGIN_WIDTH;
    layout.verticalSpacing = VERTICAL_SPACING;
    layout.horizontalSpacing = HORIZONTAL_SPACING;
    GridData data = new GridData(GridData.FILL_BOTH);
    setLayout(layout);
    setLayoutData(data);
    // set the background color to white
    Color white = getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND);
    setBackground(white);

    // add an alerts and actions section
    AlertsActionsSection alerts = new AlertsActionsSection(this, SWT.NONE, context);

    alerts.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // add a two column contianer for the form sections. The first
    // column will display the DeviceHierarchy section and the second
    // column will display the primary and secondary pattern sections.
    Composite formContainer = new Composite(this, SWT.NONE);
    GridLayout formLayout = new GridLayout(2, false);
    formLayout.marginWidth = 0;
    formLayout.marginHeight = 0;
    formLayout.horizontalSpacing = HORIZONTAL_SPACING;
    GridData formData = new GridData(GridData.FILL_BOTH);
    formContainer.setLayout(formLayout);
    formContainer.setLayoutData(formData);
    formContainer.setBackground(white);

    // add the hierarchy section to the formContainer
    deviceHierarchySection = new DeviceHierarchySection(formContainer, SWT.NONE, context);
    GridData hierarchyData = new GridData(GridData.FILL_VERTICAL);
    deviceHierarchySection.setLayoutData(hierarchyData);

    // add a scroll area for the patterns sections
    ScrolledComposite controlsScroller =
        new ScrolledComposite(formContainer, SWT.H_SCROLL | SWT.V_SCROLL);
    controlsScroller.setLayout(new FillLayout());
    controlsScroller.setLayoutData(new GridData(GridData.FILL_BOTH));
    controlsScroller.setExpandHorizontal(true);
    controlsScroller.setExpandVertical(true);
    controlsScroller.setAlwaysShowScrollBars(false);
    controlsScroller.setBackground(white);

    // add the container for the patterns sections
    Composite patternContainer = new Composite(controlsScroller, SWT.NONE);
    GridLayout patternLayout = new GridLayout();
    patternLayout.marginHeight = 0;
    patternLayout.marginWidth = 0;
    patternLayout.verticalSpacing = VERTICAL_SPACING;
    GridData patternData = new GridData(GridData.FILL_BOTH);
    patternContainer.setLayout(patternLayout);
    patternContainer.setLayoutData(patternData);
    patternContainer.setBackground(white);

    // Add the primary patterns section
    PrimaryPatternsSection primaryPatterns =
        new PrimaryPatternsSection(patternContainer, SWT.NONE, context);
    primaryPatterns.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Add the secondary patterns section
    SecondaryPatternsSection secondaryPatterns =
        new SecondaryPatternsSection(patternContainer, SWT.NONE, context);
    secondaryPatterns.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    createRestoreMechanism(patternContainer);

    TACPatternsSection TACPatterns = new TACPatternsSection(patternContainer, SWT.NONE, context);
    TACPatterns.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    patternContainer.setSize(patternContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    patternContainer.layout();
    controlsScroller.setMinSize(patternContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    controlsScroller.setContent(patternContainer);

    layout();
  }
Пример #11
0
  public TrendChart(Composite parent, int style) {
    super(parent, style);
    initCharts();

    setLayout(new FillLayout());

    SashForm sashForm = new SashForm(this, SWT.VERTICAL);

    timeChart = new TimeChartControlPanel<SelectedChart>(sashForm, SWT.BORDER);
    timeChart.addChartSelectionEntry("Trend View", SelectedChart.LINE);
    timeChart.addChartSelectionEntry("Bar View", SelectedChart.BAR);
    timeChart.addChartSelectionEntry("Both", SelectedChart.BOTH);

    JFreeChart chart = createChart(SelectedChart.LINE);
    setChart(chart);

    scrolledComposite = new ScrolledComposite(sashForm, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setLayout(new FillLayout());

    optionComposite = new Composite(scrolledComposite, SWT.NONE);
    optionComposite.setLayout(new GridLayout(3, false));

    scrolledComposite.setContent(optionComposite);
    scrolledComposite.setMinSize(optionComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setAlwaysShowScrollBars(false);

    // Signals:
    boxListener =
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            Button button = (Button) e.getSource();
            ChartIdentifier boxData = (ChartIdentifier) button.getData();
            assert (boxData != null);

            boolean checked = button.getSelection();

            if (boxData.paint == null) {
              boxData.paint = drawingSupplier.getNextPaint();
            }

            if (checked) {
              java.awt.Color paintColor = (java.awt.Color) boxData.paint;
              Color color =
                  new Color(null, paintColor.getRed(), paintColor.getGreen(), paintColor.getBlue());
              button.setBackground(color);
            } else {
              button.setBackground(null);
            }

            for (TrendChartListener listener : listeners) {
              listener.optionSelected(boxData, checked);
            }
          }

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

    comboListener =
        new SelectionListener() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            Combo combo = (Combo) e.getSource();
            DropDownData data = (DropDownData) combo.getData();
            assert (data != null);
            DropDownConfig config = data.getConfig();

            for (TrendChartListener listener : listeners) {
              listener.comboChanged(config);
            }
          }

          @Override
          public void widgetDefaultSelected(SelectionEvent e) {}
        };
  }
Пример #12
0
  /** @see IDialogPage#createControl(Composite) */
  @Override
  public void createControl(Composite parent) {

    // Set up the composite to hold all the information
    sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    sc.setLayout(new FillLayout());

    final Composite composite = new Composite(sc, SWT.NULL);
    composite.setLocation(-708, 1);
    composite.setLayout(new GridLayout(2, false));

    // Specify the expansion Adapter
    expansionAdapter =
        new ExpansionAdapter() {
          @Override
          public void expansionStateChanged(ExpansionEvent e) {
            // advanced options expanded, resize
            composite.layout();
            sc.notifyListeners(SWT.Resize, null);

            // force shell resize
            Point size;
            if (e.getState()) size = getShell().computeSize(550, 920);
            else size = getShell().computeSize(550, 400);

            getShell().setSize(size);
          }
        };

    Label lblNewLabel = new Label(composite, SWT.NONE);
    lblNewLabel.setText("&ICAT site ID");

    icatIDCombo = new Combo(composite, SWT.BORDER | SWT.READ_ONLY);
    GridData gd_icatIDCombo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_icatIDCombo.widthHint = 269;
    icatIDCombo.setLayoutData(gd_icatIDCombo);
    icatIDCombo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            logger.debug("selection changed: " + icatIDCombo.getText());

            // change remaining parameters
            int index = icatIDCombo.getSelectionIndex();
            icatSiteNameText.setText(
                getToken(index, preferenceStore.getString("ICAT_NAME_PREF"), DELIMITER));
            txtSftpServer.setText(
                getToken(index, preferenceStore.getString("ICAT_SFTPSERVER_PREF"), DELIMITER));
            txtDirectory.setText(
                getToken(index, preferenceStore.getString("ICAT_DOWNLOADDIR_PREF"), DELIMITER));
          }
        });

    /*
     * populate wizard with current ICAT preferences
     */
    icatIDCombo.removeAll();

    String[] tokens = preferenceStore.getDefaultString("ICAT_ID_PREF").split(DELIMITER);

    for (int count = 0; count < tokens.length; count++) {
      icatIDCombo.add(tokens[count]);
    }
    icatIDCombo.select(0);

    int index = icatIDCombo.getSelectionIndex();

    Label lblicatDatabase = new Label(composite, SWT.NONE);
    lblicatDatabase.setText("&ICAT site name:");

    icatSiteNameText = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
    GridData gd_icatSiteNameText = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_icatSiteNameText.widthHint = 260;
    icatSiteNameText.setLayoutData(gd_icatSiteNameText);
    icatSiteNameText.setEditable(false);
    icatSiteNameText.setText(
        getToken(index, preferenceStore.getString("ICAT_NAME_PREF"), DELIMITER));
    icatSiteNameText.setBounds(113, 53, 212, 27);

    Label fedidLbl = new Label(composite, SWT.NONE);
    fedidLbl.setText("&FedId:");

    txtFedid = new Text(composite, SWT.BORDER);
    GridData gd_txtFedid = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtFedid.widthHint = 260;
    txtFedid.setLayoutData(gd_txtFedid);
    txtFedid.setText(initFedid);
    txtFedid.addKeyListener(this);

    Label passwordLbl = new Label(composite, SWT.NONE);
    passwordLbl.setBounds(4, 139, 64, 13);
    passwordLbl.setText("&Password:"******"&Project name:");
    txtProject = new Text(composite, SWT.BORDER);
    GridData gd_txtProject = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtProject.widthHint = 260;
    txtProject.setLayoutData(gd_txtProject);
    txtProject.setBounds(113, 173, 212, 27);
    txtProject.setText(initProject);
    txtProject.addKeyListener(this);
    sc.setContent(composite);
    sc.setExpandVertical(true);
    sc.setExpandHorizontal(true);

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);

    /** set-up advanced options GUI elements */
    advancedOptionsExpander = new ExpandableComposite(composite, SWT.NONE);
    GridData gd_advancedOptionsExpander = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_advancedOptionsExpander.widthHint = 242;
    advancedOptionsExpander.setLayoutData(gd_advancedOptionsExpander);
    advancedOptionsExpander.setLayout(new GridLayout(2, false));
    advancedOptionsExpander.setText("Advanced Options");
    advancedOptionsExpander.setExpanded(false);

    Composite optionsComposite = new Composite(advancedOptionsExpander, SWT.NONE);
    optionsComposite.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    optionsComposite.setLayout(new GridLayout(3, false));

    Label sftpServerLbl = new Label(optionsComposite, SWT.NONE);
    sftpServerLbl.setText("&SFTP server:");

    txtSftpServer = new Text(optionsComposite, SWT.BORDER);
    GridData gd_txtSftpServer = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtSftpServer.widthHint = 193;
    txtSftpServer.setLayoutData(gd_txtSftpServer);
    txtSftpServer.setEditable(true);
    txtSftpServer.setText(
        getToken(index, preferenceStore.getString("ICAT_SFTPSERVER_PREF"), DELIMITER));

    final Button btnSftpTest = new Button(optionsComposite, SWT.NONE);
    GridData gd_btnSftpTest = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnSftpTest.widthHint = 100;
    btnSftpTest.setLayoutData(gd_btnSftpTest);
    btnSftpTest.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            /*
             * test server using ping
             */
            if (NetworkUtils.isReachable(txtSftpServer.getText())) {
              Image okImage = (ResourceManager.getPluginImage(ICAT_PLUGIN_ID, "icons/ok.png"));
              ;
              btnSftpTest.setImage(okImage);
            } else {
              Image noImage = (ResourceManager.getPluginImage(ICAT_PLUGIN_ID, "icons/no.png"));
              ;
              btnSftpTest.setImage(noImage);
            }
          }
        });
    btnSftpTest.setText("Test");

    txtSftpServer.addModifyListener(
        new ModifyListener() {
          @Override
          public void modifyText(ModifyEvent e) {
            btnSftpTest.setImage(null);
          }
        });

    Label lbldownloadDirectory = new Label(optionsComposite, SWT.NULL);
    lbldownloadDirectory.setText("&Download directory:");

    txtDirectory = new Text(optionsComposite, SWT.BORDER);
    GridData gd_txtDirectory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtDirectory.widthHint = 193;
    txtDirectory.setLayoutData(gd_txtDirectory);
    txtDirectory.setEditable(true);
    txtDirectory.setEnabled(true);

    txtDirectory.setText(
        getToken(index, preferenceStore.getString("ICAT_DOWNLOADDIR_PREF"), DELIMITER));

    Button BtnBrowseDirectory = new Button(optionsComposite, SWT.PUSH);
    GridData gd_BtnBrowseDirectory = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_BtnBrowseDirectory.widthHint = 100;
    BtnBrowseDirectory.setLayoutData(gd_BtnBrowseDirectory);
    BtnBrowseDirectory.setText("Browse...");
    BtnBrowseDirectory.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleDownloadDirBrowse();
          }
        });

    Label lbltruststorePath = new Label(optionsComposite, SWT.NONE);
    lbltruststorePath.setBounds(10, 131, 103, 19);
    lbltruststorePath.setText("&Truststore path:");

    txtTruststore = new Text(optionsComposite, SWT.BORDER);
    txtTruststore.setText(
        getToken(index, preferenceStore.getString("ICAT_TRUSTSTORE_PATH_PREF"), DELIMITER));
    GridData gd_txtTruststore = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtTruststore.widthHint = 193;
    txtTruststore.setLayoutData(gd_txtTruststore);
    txtTruststore.setEnabled(true);
    txtTruststore.setEditable(true);

    Button BtnBrowseTruststore = new Button(optionsComposite, SWT.PUSH);
    GridData gd_BtnBrowseTruststore = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_BtnBrowseTruststore.widthHint = 100;
    BtnBrowseTruststore.setLayoutData(gd_BtnBrowseTruststore);
    BtnBrowseTruststore.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleTruststoreBrowse();
          }
        });
    BtnBrowseTruststore.setText("Browse...");

    Label lbltruststorePassword = new Label(optionsComposite, SWT.NONE);
    lbltruststorePassword.setText("&Truststore password:"******"ICAT_TRUSTSTORE_PASS_PREF"), DELIMITER));
    GridData gd_txtTruststorePassword = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_txtTruststorePassword.widthHint = 193;
    txtTruststorePassword.setLayoutData(gd_txtTruststorePassword);
    txtTruststorePassword.setEnabled(true);
    txtTruststorePassword.addKeyListener(this);

    final Button btnShowPassword = new Button(optionsComposite, SWT.CHECK);
    btnShowPassword.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (btnShowPassword.getSelection()) {
              txtTruststorePassword.setEchoChar((char) 0);
            } else {
              txtTruststorePassword.setEchoChar('*');
            }
          }
        });
    btnShowPassword.setText("Show password");

    // set default FROM date to current date
    Calendar calA = Calendar.getInstance();

    Label lblFrom = new Label(optionsComposite, SWT.TOP);
    lblFrom.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblFrom.setText("Visit StartDate from:");
    dateFrom = new DateTime(optionsComposite, SWT.NONE | SWT.CALENDAR | SWT.DROP_DOWN);
    dateFrom.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));
    dateFrom.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    GridData gd_dateFrom = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateFrom.widthHint = 193;
    dateFrom.setLayoutData(gd_dateFrom);
    dateFrom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // set from date
            setSqlFromDate(dateFrom);
          }
        });

    dateFrom.setYear(2006); // calA.get(Calendar.YEAR));
    dateFrom.setMonth(calA.get(Calendar.MONTH));
    dateFrom.setDay(calA.get(Calendar.DAY_OF_YEAR));
    setSqlFromDate(dateFrom);

    Label lblTo = new Label(optionsComposite, SWT.TOP);
    lblTo.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1));
    lblTo.setText("Visit StartDate to:");
    dateTo = new DateTime(optionsComposite, SWT.NONE | SWT.CALENDAR | SWT.DROP_DOWN);
    dateTo.setBackground(SWTResourceManager.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT));
    dateTo.setForeground(SWTResourceManager.getColor(SWT.COLOR_WIDGET_FOREGROUND));
    GridData gd_dateTo = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dateTo.widthHint = 193;
    dateTo.setLayoutData(gd_dateTo);
    dateTo.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // set to date
            setSqlToDate(dateTo);
          }
        });
    // end with current date + 1 month
    dateTo.setYear(calA.get(Calendar.YEAR));
    dateTo.setMonth(calA.get(Calendar.MONTH) + 1);
    dateTo.setDay(calA.get(Calendar.DAY_OF_YEAR));
    setSqlToDate(dateTo);

    advancedOptionsExpander.setClient(optionsComposite);
    new Label(optionsComposite, SWT.NONE);
    new Label(optionsComposite, SWT.NONE);
    new Label(optionsComposite, SWT.NONE);
    advancedOptionsExpander.addExpansionListener(expansionAdapter);
    setControl(composite);

    dialogChanged();

    new Label(composite, SWT.NONE);
    new Label(composite, SWT.NONE);
  }
Пример #13
0
  @Override
  public Composite createUI(Composite parent) {
    this.display = WorkPart.display();
    Shell shell = new Shell(this.display);
    shell.setSize(50, 100);
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    shell.setLayout(gridLayout);
    ProgressBar pb = new ProgressBar(shell, SWT.HORIZONTAL | SWT.INDETERMINATE);
    pb.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label searching = new Label(shell, SWT.NONE);
    searching.setText("Searching...");
    shell.open();
    this.isSearching = true;
    new Thread() {
      public void run() {
        testTm_cz = RetrieveData.testTm_czConnection();
        testTm_lz = RetrieveData.testTm_lzConnection();
        testDeapp = RetrieveData.testDeappConnection();
        root = new TreeNode("Dataset explorer", null, false);
        studyTree = new StudyTree(root);
        topNodeController = new TopNodeController(root, dataType, studyTree);
        root = topNodeController.buildTree();
        topNode = dataType.getStudy().getTopNode();
        isSearching = false;
      }
    }.start();
    this.display = WorkPart.display();
    while (this.isSearching) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    shell.close();
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gd = new GridLayout();
    gd.numColumns = 1;
    gd.horizontalSpacing = 0;
    gd.verticalSpacing = 0;
    composite.setLayout(gd);
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    ScrolledComposite scroller = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
    scroller.setLayoutData(new GridData(GridData.FILL_BOTH));
    gd = new GridLayout();
    gd.numColumns = 1;
    gd.horizontalSpacing = 0;
    gd.verticalSpacing = 0;
    scroller.setLayout(gd);
    scroller.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite scrolledComposite = new Composite(scroller, SWT.NONE);
    scroller.setContent(scrolledComposite);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.verticalSpacing = 10;
    scrolledComposite.setLayout(layout);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));

    this.topNode = this.dataType.getStudy().getTopNode();
    if (topNode != null && topNode.compareTo("") != 0) {
      viewer = new TreeViewer(scrolledComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
      viewer.setContentProvider(new StudyContentProvider());
      viewer.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);

      viewer.setInput(this.studyTree);
      GridData gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalAlignment = SWT.FILL;
      gridData.verticalAlignment = SWT.FILL;
      gridData.grabExcessHorizontalSpace = true;
      gridData.grabExcessVerticalSpace = true;
      gridData.heightHint = 300;
      gridData.widthHint = 250;
      this.viewer.getControl().setLayoutData(gridData);
      viewer.setLabelProvider(
          new ColumnLabelProvider() {
            @Override
            public String getText(Object element) {
              return element.toString();
            }

            @Override
            public Color getBackground(Object element) {
              if (((TreeNode) element).isStudyRoot()) {
                return new Color(Display.getCurrent(), 237, 91, 67);
              }
              if (((TreeNode) element).isLabel()) {
                return new Color(Display.getCurrent(), 212, 212, 212);
              }
              return null;
            }
          });

      securityButton = new Button(scrolledComposite, SWT.CHECK);
      securityButton.setText("Security required");
      securityButton.addListener(
          SWT.Selection,
          new Listener() {

            @Override
            public void handleEvent(Event event) {
              security = securityButton.getSelection();
            }
          });

      /*indexesButton=new Button(scrolledComposite, SWT.CHECK);
      indexesButton.setText("Turn off the indexes during loaded (only for large datasets)");
      indexesButton.addListener(SWT.Selection, new Listener(){

      	@Override
      	public void handleEvent(Event event) {
      		indexes=indexesButton.getSelection();
      	}
      })*/ ;
    } else {
      Label label = new Label(scrolledComposite, SWT.NONE);
      label.setText("Please first choose a study node in the description data type");
    }

    Button button = new Button(scrolledComposite, SWT.PUSH);
    button.setText("Load");

    if (topNode != null && topNode.compareTo("") != 0) {
      if (this.testTm_cz && this.testTm_lz && this.testDeapp) {
        button.addListener(SWT.Selection, new LoadGeneExpressionDataListener(this, this.dataType));
        Label dbLabel = new Label(scrolledComposite, SWT.NONE);
        dbLabel.setText("You are connected to database '" + PreferencesHandler.getDb() + "'");
      } else {
        button.setEnabled(false);
        Label warn = new Label(scrolledComposite, SWT.NONE);
        warn.setText("Warning: connection to database is not possible");
      }
    } else {
      button.setEnabled(false);
    }
    scrolledComposite.setSize(scrolledComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    return composite;
  }
Пример #14
0
  /** Create the contents in the main composite. */
  protected void createMainContents() {
    if (displayTitle) {
      title = new TabbedPropertyTitle(mainComposite, factory);

      FormData data = new FormData();
      data.left = new FormAttachment(0, 0);
      if (displayCompactToolbar) {
        data.right = new FormAttachment(90, 0);
      } else {
        data.right = new FormAttachment(100, 0);
      }
      data.top = new FormAttachment(0, 0);
      title.setLayoutData(data);

      if (displayCompactToolbar) {
        toolBarComposite = new Composite(mainComposite, SWT.NONE);
        compactButton = new Button(toolBarComposite, SWT.PUSH);
        compactButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        compactButton.setToolTipText(
            Messages.getString(
                "TalendTabbedPropertyComposite.compactButton.toolTip")); //$NON-NLS-1$

        tableButton = new Button(toolBarComposite, SWT.PUSH);
        tableButton.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
        tableButton.setToolTipText(
            Messages.getString("TalendTabbedPropertyComposite.tableButton.toolTip")); // $NON-NLS-1$

        if (isCompactView()) {
          compactButton.setImage(ImageProvider.getImage(EImage.COMPACT_VIEW));
          tableButton.setImage(ImageProvider.getImage(EImage.NO_TABLE_VIEW));
        } else {
          compactButton.setImage(ImageProvider.getImage(EImage.NO_COMPACT_VIEW));
          tableButton.setImage(ImageProvider.getImage(EImage.TABLE_VIEW));
        }

        Rectangle compactRectangle = compactButton.getBounds();
        tableButton.setBounds(compactRectangle);

        compactButton.setVisible(false);
        tableButton.setVisible(false);

        data = new FormData();
        data.left = new FormAttachment(title, 0);
        data.top = new FormAttachment(0, -5);
        toolBarComposite.setLayoutData(data);
        GridData gridData = new GridData();
        gridData.horizontalAlignment = SWT.RIGHT;
        gridData.verticalAlignment = SWT.TOP;
        compactButton.setData(gridData);
        tableButton.setData(gridData);

        GridLayout layout = new GridLayout();
        layout.numColumns = 2;
        layout.horizontalSpacing = 0;
        layout.verticalSpacing = 0;
        layout.makeColumnsEqualWidth = true;
        toolBarComposite.setLayout(layout);
        toolBarComposite.setBackground(title.getBackground());
      }
    }

    leftComposite = factory.createComposite(mainComposite, SWT.NO_FOCUS);
    leftComposite.setLayout(new FormLayout());

    scrolledComposite =
        factory.createScrolledComposite(mainComposite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NO_FOCUS);
    scrolledComposite.setLayout(new FormLayout());

    FormData formData = new FormData();
    formData.left = new FormAttachment(leftComposite, 0);
    formData.right = new FormAttachment(100, 0);
    if (displayTitle) {
      formData.top = new FormAttachment(title, 0);
    } else {
      formData.top = new FormAttachment(0, 0);
    }
    formData.bottom = new FormAttachment(100, 0);
    scrolledComposite.setLayoutData(formData);

    formData = new FormData();
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(scrolledComposite, 0);
    if (displayTitle) {
      formData.top = new FormAttachment(title, 0);
    } else {
      formData.top = new FormAttachment(0, 0);
    }
    formData.bottom = new FormAttachment(100, 0);
    leftComposite.setLayoutData(formData);

    tabComposite = factory.createComposite(scrolledComposite, SWT.NO_FOCUS);
    tabComposite.setLayout(new FormLayout());
    tabComposite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

    scrolledComposite.setContent(tabComposite);
    scrolledComposite.setAlwaysShowScrollBars(false);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);

    listComposite = new TalendTabbedPropertyList(leftComposite, factory);
    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(100, 0);
    listComposite.setLayoutData(formData);

    FormData 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(100, 0);
    tabComposite.setLayoutData(data);
  }
Пример #15
0
  @Override
  protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);

    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 5;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    composite.setLayout(gridLayout);

    Composite repoPart = new Composite(composite, SWT.NONE);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 5;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 5;
    repoPart.setLayout(gridLayout);
    GridData gd = new GridData();
    repoPart.setLayoutData(gd);

    Label label = new Label(repoPart, SWT.NONE);
    label.setText(Messages.releaseToRepo);

    String[] items = ReleaseHelper.getReleaseRepositories();
    String defaultRepo = project.getProperty(Constants.RELEASEREPO);
    int idx = 0;
    for (int i = 0; i < items.length; i++) {
      if (defaultRepo != null) {
        if (items[i].equals(defaultRepo)) {
          idx = i;
          break;
        }
      }
    }

    releaseRepoCombo = new Combo(repoPart, SWT.READ_ONLY);
    // combo.setLayout(gridLayout);
    releaseRepoCombo.setItems(items);
    releaseRepoCombo.setSize(200, 200);
    if (items.length > 0) {
      releaseRepoCombo.setText(items[idx]);
    } else {
      releaseRepoCombo.setText("");
    }

    Composite diffPart = new Composite(composite, SWT.NONE);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 5;
    gridLayout.marginWidth = 0;
    gridLayout.marginHeight = 0;
    diffPart.setLayout(gridLayout);
    diffPart.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    ScrolledComposite scrolled = new ScrolledComposite(diffPart, SWT.H_SCROLL | SWT.V_SCROLL);
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    gridLayout.horizontalSpacing = 0;
    gridLayout.verticalSpacing = 5;
    gridLayout.marginWidth = 10;
    gridLayout.marginHeight = 10;

    scrolled.setLayout(gridLayout);
    scrolled.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    release.createControl(scrolled);

    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);
    scrolled.setContent(release.getControl());
    scrolled.setMinSize(300, 300);
    scrolled.layout(true);

    return composite;
  }