@Override
  protected Control createDialogArea(final Composite parent) {
    // parent has GridLayout with 1 column

    ScrolledComposite scrolledComposite =
        new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrolledComposite.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));

    Composite mainArea = new Composite(scrolledComposite, SWT.NONE);

    scrolledComposite.setContent(mainArea);

    GridLayout gridLayout = new GridLayout(1, false);
    gridLayout.verticalSpacing = 10;
    mainArea.setLayout(gridLayout);

    /*
     * createViewer(mainArea);
     */
    createWidgetRows(mainArea);

    // 1)
    // mainArea.setSize(mainArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    // 2)
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setMinSize(mainArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    return scrolledComposite;
  }
  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
  /** 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);
  }
Пример #4
0
  public static void main(String[] args) {
    Display display = new Display();
    Shell shell = new Shell(display);
    shell.setLayout(new GridLayout());
    final ScrolledComposite sc =
        new ScrolledComposite(shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    sc.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    Composite c = new Composite(sc, SWT.NONE);
    c.setLayout(new GridLayout(10, true));
    for (int i = 0; i < 300; i++) {
      Button b = new Button(c, SWT.PUSH);
      b.setText("Button " + i);
    }
    sc.setContent(c);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    sc.setMinSize(c.computeSize(SWT.DEFAULT, SWT.DEFAULT));
    sc.setShowFocusedControl(true);

    shell.setSize(300, 500);
    shell.open();
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) display.sleep();
    }
    display.dispose();
  }
  /**
   * Set the major UI features of this basic view composite
   *
   * @param textEditor
   * @param parentComposite
   * @param styleBit
   */
  public Transition(final XMLEditor textEditor, final Composite parentComposite, int styleBit) {
    super(parentComposite, SWT.BORDER);
    setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_MAGENTA));
    this.textEditor = textEditor;
    addDisposeListener(
        new DisposeListener() {
          @Override
          public void widgetDisposed(DisposeEvent e) {
            toolkit.dispose();
          }
        });
    toolkit.adapt(this);
    toolkit.paintBordersFor(this);
    setLayout(new FormLayout());
    setLayoutData(new GridData(GridData.FILL_BOTH));

    final ScrolledComposite parentScrolledComposite =
        new ScrolledComposite(this, SWT.BORDER | SWT.V_SCROLL);
    parentScrolledComposite.setAlwaysShowScrollBars(true);
    parentScrolledComposite.setExpandHorizontal(true);
    parentScrolledComposite.setExpandVertical(true);
    FormData parentScrolledCompositeFormLayoutData = new FormData();
    parentScrolledCompositeFormLayoutData.right = new FormAttachment(100);
    parentScrolledCompositeFormLayoutData.bottom = new FormAttachment(100);
    parentScrolledCompositeFormLayoutData.top = new FormAttachment(0, 5);
    parentScrolledCompositeFormLayoutData.left = new FormAttachment(0, 5);
    parentScrolledComposite.setLayoutData(parentScrolledCompositeFormLayoutData);
    this.setData(parentScrolledComposite);

    baseContainer = new Composite(parentScrolledComposite, SWT.NONE);
    baseContainer.setBackground(SWTResourceManager.getColor(204, 153, 255));
    parentScrolledComposite.setContent(baseContainer);

    baseContainer.setLayout(new GridLayout(1, true));
    try {
      CentralUtils centralUtils = CentralUtils.getCentralUtils(textEditor);
      centralUtils.setBasicUI(parentScrolledComposite, baseContainer);
      centralUtils.unmarshal(textEditor);
    } catch (JAXBException e) {
      LOG.info(e.getMessage());
    }

    // create a THumanInteractions object if humanInteractions variable is
    // null
    if (textEditor.getRootElement() == null) {
      humanInteractions = new THumanInteractions();
      textEditor.setRootElement(humanInteractions);
    }
    try {
      // create the biggest xml element- UI section
      humanInteractionsUI =
          new THumanInteractionsUI(
              textEditor, baseContainer, this, SWT.NONE, textEditor.getRootElement(), 0, 0);
    } catch (JAXBException e1) {
      LOG.info(e1.getMessage());
    }
  }
  /**
   * DOC ocarbone Comment method "addTreeNavigator".
   *
   * @param parent
   * @param width
   * @param height
   */
  private void addTreeNavigator(Composite parent, int width, int height) {
    // Group
    Group group =
        Form.createGroup(
            parent,
            1,
            Messages.getString("DatabaseTableForm.navigatorTree"),
            height); //$NON-NLS-1$

    // ScrolledComposite
    ScrolledComposite scrolledCompositeFileViewer =
        new ScrolledComposite(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.NONE);
    scrolledCompositeFileViewer.setExpandHorizontal(true);
    scrolledCompositeFileViewer.setExpandVertical(true);
    GridData gridData1 = new GridData(GridData.FILL_BOTH);
    gridData1.widthHint = width + 12;
    gridData1.heightHint = height;
    gridData1.horizontalSpan = 2;
    scrolledCompositeFileViewer.setLayoutData(gridData1);

    tableViewerCreator = new TableViewerCreator(scrolledCompositeFileViewer);
    tableViewerCreator.setHeaderVisible(false);
    tableViewerCreator.setColumnsResizableByDefault(false);
    tableViewerCreator.setBorderVisible(false);
    tableViewerCreator.setLinesVisible(false);
    tableViewerCreator.setLayoutMode(LAYOUT_MODE.NONE);
    tableViewerCreator.setCheckboxInFirstColumn(false);
    tableViewerCreator.setFirstColumnMasked(false);

    tableNavigator = tableViewerCreator.createTable();
    tableNavigator.setLayoutData(new GridData(GridData.FILL_BOTH));

    TableColumn tableColumn = new TableColumn(tableNavigator, SWT.NONE);
    tableColumn.setText(
        Messages.getString("DatabaseTableForm.tableColumnText.talbe")); // $NON-NLS-1$
    tableColumn.setWidth(width + 120);

    scrolledCompositeFileViewer.setContent(tableNavigator);
    scrolledCompositeFileViewer.setSize(width + 12, height);

    // // Button Add metadata Table
    Composite button =
        Form.startNewGridLayout(group, HEIGHT_BUTTON_PIXEL, false, SWT.CENTER, SWT.CENTER);
    addTableButton =
        new UtilsButton(
            button,
            Messages.getString("DatabaseTableForm.AddTable"),
            width - 30,
            HEIGHT_BUTTON_PIXEL); //$NON-NLS-1$

    Composite rmButton =
        Form.startNewGridLayout(group, HEIGHT_BUTTON_PIXEL, false, SWT.CENTER, SWT.CENTER);
    removeTableButton =
        new UtilsButton(rmButton, "Remove Schema", width - 30, HEIGHT_BUTTON_PIXEL); // $NON-NLS-1$
  }
Пример #7
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);
          }
        });
  }
Пример #8
0
  @Override
  protected Control createDialogArea(Composite parent) {
    updateTitle();
    final Composite composite = (Composite) super.createDialogArea(parent);
    composite.setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_WHITE));
    final ScrolledComposite scrolledComposite =
        new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setBackground(composite.getBackground());
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    scrolledComposite.setExpandVertical(true);
    scrolledComposite.setExpandHorizontal(true);

    final Composite content = new Composite(scrolledComposite, SWT.NONE);
    content.setBackground(composite.getBackground());
    GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(content);
    GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.FILL).applyTo(content);

    try {
      if (view == null) {
        ECPSWTViewRenderer.INSTANCE.render(content, selection);
      } else {
        ECPSWTViewRenderer.INSTANCE.render(content, selection, view);
      }
    } catch (final ECPRendererException ex) {
      Activator.log(ex);
    }

    scrolledComposite.setContent(content);
    final Point point = content.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    content.setSize(point);
    scrolledComposite.setMinSize(point);

    objectChangeAdapter =
        new AdapterImpl() {

          /**
           * {@inheritDoc}
           *
           * @see
           *     org.eclipse.emf.common.notify.impl.AdapterImpl#notifyChanged(org.eclipse.emf.common.notify.Notification)
           */
          @Override
          public void notifyChanged(Notification msg) {
            super.notifyChanged(msg);
            updateTitle();
          }
        };
    selection.eAdapters().add(objectChangeAdapter);

    return composite;
  }
  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;
  }
Пример #10
0
  /**
   * Create contents of the dialog.
   *
   * @param parent
   */
  @Override
  protected Control createDialogArea(Composite parent) {
    setMessage("Icon Selection");
    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(1, false));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    ScrolledComposite scrolledComposite =
        new ScrolledComposite(container, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);

    Composite composite = new Composite(scrolledComposite, SWT.NONE);
    composite.setLayout(new GridLayout(9, true));

    for (Descriptor i : IconRegistry.getRegisteredImages()) {
      Button btnCheckButton = new Button(composite, SWT.RADIO);
      btnCheckButton.setImage(IconRegistry.getImage(i.id));
      btnCheckButton.setData(i);

      btnCheckButton.addSelectionListener(
          new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
              Object source = e.getSource();
              if (source instanceof Button) {
                Button btn = (Button) source;
                Object data = btn.getData();
                if (data instanceof Descriptor) {
                  Descriptor desc = (Descriptor) data;
                  imageSelected = desc.id;
                }
              }
            }
          });
    }

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

    return area;
  }
Пример #11
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);
  }
Пример #12
0
  protected void initGui(Composite parent) {
    final int gdMinimumWidth = 550;
    final int gdHeightHint = 200;

    createFilterPanel(parent);

    group = new Group(parent, SWT.NONE);
    if (getTitle() != null) {
      group.setText(getTitle());
    }
    GridLayout groupOrganizationLayout = new GridLayout(1, true);
    group.setLayout(groupOrganizationLayout);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.minimumWidth = gdMinimumWidth;
    gd.heightHint = gdHeightHint;
    group.setLayoutData(gd);

    scrolledComposite = new ScrolledComposite(group, SWT.V_SCROLL);
    scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    scrolledComposite.setExpandHorizontal(true);

    innerComposite = new Composite(scrolledComposite, SWT.NONE);
    scrolledComposite.setContent(innerComposite);
    innerComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    innerComposite.setLayout(new GridLayout(1, false));

    if (selection != null && !selection.isEmpty()) {
      Iterator<T> iter = selection.iterator();
      while (iter.hasNext()) {
        preSelectedElements.add(iter.next());
      }
    } else if (selectedElement != null) {
      preSelectedElements.add(selectedElement);
    }

    checkboxMap = new HashMap<T, Button>();

    addCheckboxes();
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    GridData grData = null;

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

    scrolledContainer.setExpandHorizontal(true);
    scrolledContainer.setExpandVertical(true);
    scrolledContainer.setAlwaysShowScrollBars(true);
    scrolledContainer.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    final Composite container = new Composite(scrolledContainer, SWT.NONE);
    scrolledContainer.setContent(container);

    GridLayout layout = new GridLayout();
    layout.numColumns = 3;

    container.setLayout(layout);
    Label lbPrefix = new Label(container, SWT.NULL);
    lbPrefix.setText("Name");
    txtName = new Text(container, SWT.BORDER | SWT.SINGLE);
    grData = new GridData(GridData.FILL_HORIZONTAL);
    grData.horizontalSpan = 2;
    txtName.setLayoutData(grData);
    txtName.setText(name);
    Label lbNamespace = new Label(container, SWT.NULL);
    lbNamespace.setText("Value");
    txtValue = new Text(container, SWT.BORDER | SWT.SINGLE);
    grData = new GridData(GridData.FILL_HORIZONTAL);
    grData.horizontalSpan = 2;

    txtValue.setLayoutData(grData);
    txtValue.setText(value);

    container.layout();
    scrolledContainer.setSize(100, 80);
    container.layout();
    return super.createDialogArea(scrolledContainer);
  }
  /**
   * Creates the inner page container.
   *
   * @param parent
   * @return Composite
   */
  protected Composite createPageContainer(Composite parent) {

    Composite outer = new Composite(parent, SWT.NONE);

    GridData outerData =
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    outerData.horizontalIndent = IDialogConstants.HORIZONTAL_MARGIN;

    outer.setLayout(new GridLayout());
    outer.setLayoutData(outerData);

    // Create an outer composite for spacing
    scrolled = new ScrolledComposite(outer, SWT.V_SCROLL | SWT.H_SCROLL);

    // always show the focus control
    scrolled.setShowFocusedControl(true);
    scrolled.setExpandHorizontal(true);
    scrolled.setExpandVertical(true);

    GridData scrolledData =
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);

    scrolled.setLayoutData(scrolledData);

    Composite result = new Composite(scrolled, SWT.NONE);

    GridData resultData =
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);

    result.setLayout(getPageLayout());
    result.setLayoutData(resultData);

    scrolled.setContent(result);

    return result;
  }
Пример #15
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();
  }
Пример #16
0
  public void createPartControl(Composite parent) {
    GridLayout gl_parent = new GridLayout(1, false);
    gl_parent.verticalSpacing = 0;
    gl_parent.marginWidth = 0;
    gl_parent.marginHeight = 0;
    parent.setLayout(gl_parent);

    pvFomulaInputBar =
        new PVFormulaInputBar(
            parent, SWT.None, Activator.getDefault().getDialogSettings(), MEMENTO_PVFORMULA_LIST);
    pvFomulaInputBar.addPropertyChangeListener(
        new PropertyChangeListener() {

          @Override
          public void propertyChange(PropertyChangeEvent event) {
            if ("pvFormula".equals(event.getPropertyName())) { // $NON-NLS-1$
              setPVFormula((String) event.getNewValue());
            }
          }
        });

    GridData gd = new GridData();
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalAlignment = SWT.FILL;
    pvFomulaInputBar.setLayoutData(gd);

    errorBar = new ErrorBar(parent, SWT.NONE);
    errorBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    errorBar.setMarginRight(5);
    errorBar.setMarginLeft(5);
    errorBar.setMarginBottom(5);

    ScrolledComposite mainScroll = new ScrolledComposite(parent, SWT.V_SCROLL);
    mainScroll.setExpandHorizontal(true);
    mainScroll.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    mainPanel =
        new Composite(mainScroll, SWT.NONE) {
          @Override
          public void layout() {
            // TODO Auto-generated method stub
            super.layout();
            mainPanel.setSize(mainPanel.computeSize(SWT.DEFAULT, SWT.DEFAULT));
          }
        };
    GridLayout gl_mainPanel = new GridLayout();
    mainPanel.setLayout(gl_mainPanel);
    mainScroll.setContent(mainPanel);

    viewerPanel = new ViewerPanel(mainPanel, SWT.BORDER);
    viewerPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
    viewerPanel.setEnabled(false);

    valuePanel = new ValuePanel(mainPanel, SWT.BORDER);
    valuePanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    changeValuePanel = new ChangeValuePanel(mainPanel, SWT.BORDER);
    changeValuePanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    metadataPanel = new MetadataPanel(mainPanel, SWT.BORDER);
    metadataPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    detailsPanel = new DetailsPanel(mainPanel, SWT.BORDER);
    detailsPanel.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));

    // Status bar
    statusBarPanel = new Composite(parent, SWT.NONE);
    GridLayout gl_statusBarPanel = new GridLayout(1, false);
    gl_statusBarPanel.verticalSpacing = 0;
    gl_statusBarPanel.marginWidth = 0;
    gl_statusBarPanel.marginHeight = 0;
    statusBarPanel.setLayout(gl_statusBarPanel);
    statusBarPanel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label label = new Label(statusBarPanel, SWT.SEPARATOR | SWT.HORIZONTAL);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    label.setSize(64, 2);

    statusBar = new Composite(statusBarPanel, SWT.NONE);
    statusBar.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    statusBar.setLayout(new GridLayout(2, false));

    statusLabel = new Label(statusBar, 0);
    statusLabel.setSize(43, 20);
    statusLabel.setText(Messages.Probe_statusLabelText);

    statusField = new Label(statusBar, SWT.BORDER);
    statusField.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    statusField.setSize(326, 22);
    statusField.setText(Messages.Probe_statusWaitingForPV);

    createActions();
    initializeToolBar();

    // Determine initial state
    String initialPVFormula = null;
    boolean showViewer = false;
    boolean showValue = true;
    boolean showChangeValue = true;
    boolean showMetadata = false;
    boolean showDetails = false;

    if (memento != null) {
      initialPVFormula = memento.getString(MEMENTO_PVFORMULA);
      showViewer = nullDefault(memento.getBoolean(MEMENTO_SHOW_VIEWER), showViewer);
      showValue = nullDefault(memento.getBoolean(MEMENTO_SHOW_VALUE), showValue);
      showChangeValue = nullDefault(memento.getBoolean(MEMENTO_SHOW_CHANGE_VALUE), showChangeValue);
      showMetadata = nullDefault(memento.getBoolean(MEMENTO_SHOW_METADATA), showMetadata);
      showDetails = nullDefault(memento.getBoolean(MEMENTO_SHOW_DETAILS), showDetails);
    }
    setPVFormula(initialPVFormula);
    initSection(viewerPanel, showViewer);
    initSection(valuePanel, showValue);
    initSection(changeValuePanel, showChangeValue);
    initSection(metadataPanel, showMetadata);
    initSection(detailsPanel, showDetails);

    parent.layout();
    mainPanel.layout();
  }
Пример #17
0
  public void createPartControl(final Composite parent) {
    parent.setBackground(ColorUtil.getInstance().getColor(SWT.COLOR_WHITE));
    parent.setBackgroundMode(SWT.INHERIT_FORCE);
    parent.setLayout(UIUtil.formLayout(0, 0));
    GridLayout layout = new GridLayout(1, true);
    layout.marginHeight = MARGIN;
    layout.marginWidth = MARGIN;
    scroll = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
    scroll.setLayoutData(UIUtil.formData(0, 0, 0, 0, 100, 0, 100, 0));
    canvas = new Canvas(scroll, SWT.DOUBLE_BUFFERED);
    canvas.setLayout(layout);
    canvas.addPaintListener(
        new PaintListener() {
          public void paintControl(PaintEvent e) {
            try {
              area = canvas.getClientArea();
              winYSize = parent.getSize().y;
              drawEQImage(e.gc);
            } catch (Throwable t) {
            }
          }
        });
    canvas.addMouseListener(
        new MouseAdapter() {
          public void mouseDoubleClick(MouseEvent e) {
            if (unitHeight == 0 || datas == null) {
              return;
            }
            if (e.y <= AXIS_PADDING) {
              return;
            }
            int index = (e.y - AXIS_PADDING) / unitHeight;
            if (datas.length < index + 1 || datas[index].isAlive == false) {
              return;
            }
            AgentObject agent = AgentModelThread.getInstance().getAgentObject(datas[index].objHash);
            new OpenCxtmenuActiveServiceListAction(
                    getSite().getWorkbenchWindow(),
                    MenuStr.ACTIVE_SERVICE_LIST,
                    datas[index].objHash,
                    agent.getObjType(),
                    agent.getServerId())
                .run();
          }
        });

    scroll.setContent(canvas);
    scroll.setExpandVertical(true);
    scroll.setExpandHorizontal(true);

    scroll.addListener(
        SWT.MouseWheel,
        new Listener() {
          public void handleEvent(Event event) {
            Point origin = scroll.getOrigin();
            origin.y += (event.count * -1) * 10;
            scroll.setOrigin(origin);
          }
        });

    // canvas.setToolTipText("Double click to list active services");
    thread = new RefreshThread(this, REFRESH_INTERVAL);
    thread.start();
  }
  @SuppressWarnings("nls")
  public void createControl(Composite parent) {
    this.parent = parent;
    parent.setLayout(new GridLayout());
    ScrolledComposite scrollComposite = new ScrolledComposite(parent, SWT.V_SCROLL);
    scrollComposite.setMinHeight(100);
    scrollComposite.setLayoutData(
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
    Composite c = new Composite(scrollComposite, SWT.None);
    c.setLayout(new GridLayout());
    c.setLayoutData(
        new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));

    // choose mapset
    Group chooseMapsetGroup = new Group(c, SWT.BORDER);
    GridLayout layout1 = new GridLayout(3, false);
    chooseMapsetGroup.setLayout(layout1);
    chooseMapsetGroup.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    chooseMapsetGroup.setText("Ruling / Affected mapset");

    Label mapsetLabel = new Label(chooseMapsetGroup, SWT.NONE);
    mapsetLabel.setText("wind file for active region:  ");
    windPathText = new Text(chooseMapsetGroup, SWT.BORDER);
    GridData gd = new GridData();
    gd.widthHint = 100;
    windPathText.setLayoutData(gd);
    windPathText.setEditable(false);

    final Button mapsetButton = new Button(chooseMapsetGroup, SWT.BORDER | SWT.PUSH);
    GridData gd2 = new GridData();
    gd2.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
    mapsetButton.setLayoutData(gd2);
    mapsetButton.setText("Browse");
    mapsetButton.addSelectionListener(
        new SelectionAdapter() {

          public void widgetSelected(SelectionEvent e) {
            CatalogJGrassMapsetTreeViewerDialog cDialog = new CatalogJGrassMapsetTreeViewerDialog();
            cDialog.open(mapsetButton.getShell());
            List<JGrassMapsetGeoResource> selectedLayers = cDialog.getSelectedLayers();
            if (selectedLayers == null || selectedLayers.size() == 0) {
              return;
            }
            jGrassMapsetGeoResource = selectedLayers.get(0);
            String windPath = jGrassMapsetGeoResource.getActiveRegionWindowPath();
            windPathText.setText(windPath);

            JGrassRegion jgR = jGrassMapsetGeoResource.getActiveRegionWindow();
            CoordinateReferenceSystem crs = jGrassMapsetGeoResource.getLocationCrs();

            commitToBlackboards(jgR, crs, windPath);
          }
        });

    // the group for the region
    Group regionGroup = new Group(c, SWT.BORDER);
    GridLayout layout2 = new GridLayout(2, true);
    regionGroup.setLayout(layout2);
    regionGroup.setText("Region settings");
    regionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    northLabel = new Label(regionGroup, SWT.NONE);
    northLabel.setText("north");
    northLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    northText = new Text(regionGroup, SWT.BORDER);
    northText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    southLabel = new Label(regionGroup, SWT.NONE);
    southLabel.setText("south");
    southLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    southText = new Text(regionGroup, SWT.BORDER);
    southText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    westLabel = new Label(regionGroup, SWT.NONE);
    westLabel.setText("west");
    westLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    westText = new Text(regionGroup, SWT.BORDER);
    westText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    eastLabel = new Label(regionGroup, SWT.NONE);
    eastLabel.setText("east");
    eastLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    eastText = new Text(regionGroup, SWT.BORDER);
    eastText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    rowsLabel = new Label(regionGroup, SWT.NONE);
    rowsLabel.setText("rows");
    rowsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    rowsText = new Text(regionGroup, SWT.BORDER);
    rowsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    colsLabel = new Label(regionGroup, SWT.NONE);
    colsLabel.setText("cols");
    colsLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    colsText = new Text(regionGroup, SWT.BORDER);
    colsText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    xresLabel = new Label(regionGroup, SWT.NONE);
    xresLabel.setText("xres");
    xresLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    xresText = new Text(regionGroup, SWT.BORDER);
    xresText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    yresLabel = new Label(regionGroup, SWT.NONE);
    yresLabel.setText("yres");
    yresLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    yresText = new Text(regionGroup, SWT.BORDER);
    yresText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    // the group for the style
    Group styleGroup = new Group(c, SWT.BORDER);
    GridLayout layout3 = new GridLayout(2, true);
    styleGroup.setLayout(layout3);
    styleGroup.setText("Style properties");
    styleGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    gridButton = new Button(styleGroup, SWT.BORDER | SWT.CHECK);
    gridButton.setText("visualize active region grid");
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gridButton.setLayoutData(gridData);

    Label backgroundColourLabel = new Label(styleGroup, SWT.NONE);
    backgroundColourLabel.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    backgroundColourLabel.setText("background color");
    backgroundColour = new ColorEditor(styleGroup);
    backgroundColour
        .getButton()
        .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    Label backgroundAlphaLabel = new Label(styleGroup, SWT.NONE);
    backgroundAlphaLabel.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    backgroundAlphaLabel.setText("background alpha (0-1)");
    backgroundAlphaText = new Text(styleGroup, SWT.BORDER);
    backgroundAlphaText.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    Label foregroundColourLabel = new Label(styleGroup, SWT.NONE);
    foregroundColourLabel.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    foregroundColourLabel.setText("foreground color");
    foregroundColor = new ColorEditor(styleGroup);
    foregroundColor
        .getButton()
        .setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    Label forgroundAlphaLabel = new Label(styleGroup, SWT.NONE);
    forgroundAlphaLabel.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    forgroundAlphaLabel.setText("foreground alpha (0-1)");
    forgroundAlphaText = new Text(styleGroup, SWT.BORDER);
    forgroundAlphaText.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    // the group for the set region to map
    final Group settoGroup = new Group(c, SWT.BORDER);
    GridLayout layout4 = new GridLayout(1, true);
    settoGroup.setLayout(layout4);
    settoGroup.setText("Set region to...");
    settoGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    rasterMapSetButton = new Button(settoGroup, SWT.NONE);
    rasterMapSetButton.setText("set region to raster map");
    rasterMapSetButton.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    rasterMapSetButton.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            JGRasterChooserDialog tree = new JGRasterChooserDialog(null);
            tree.open(settoGroup.getShell(), SWT.SINGLE);

            update(tree.getSelectedResources());
          }
        });
    featuresMapSetButton = new Button(settoGroup, SWT.NONE);
    featuresMapSetButton.setText("set region to vector map");
    featuresMapSetButton.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    featuresMapSetButton.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            FeatureChooserDialog tree = new FeatureChooserDialog();
            tree.open(settoGroup.getShell(), SWT.SINGLE);

            update(tree.getSelectedResources());
          }
        });
    resetToActiveButton = new Button(settoGroup, SWT.NONE);
    resetToActiveButton.setText("reset back to actual region");
    resetToActiveButton.setLayoutData(
        new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    resetToActiveButton.addSelectionListener(
        new org.eclipse.swt.events.SelectionAdapter() {
          public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            String windPath = windPathText.getText();
            try {
              JGrassRegion jgR = new JGrassRegion(windPath);
              setWidgetsToWindow(jgR);
            } catch (IOException e1) {
              e1.printStackTrace();
            }
          }
        });

    northText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {

          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(bound_type);
          }
        });
    southText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(bound_type);
          }
        });
    rowsText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(row_type);
          }
        });
    colsText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(row_type);
          }
        });
    westText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(bound_type);
          }
        });
    xresText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(res_type);
          }
        });
    eastText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(bound_type);
          }
        });
    yresText.addModifyListener(
        new org.eclipse.swt.events.ModifyListener() {
          public void modifyText(org.eclipse.swt.events.ModifyEvent e) {
            if (isWorking) return;
            textModified(res_type);
          }
        });
    foregroundColor.addSelectionListener(this);
    backgroundColour.addSelectionListener(this);

    /*
     * layout
     */
    c.layout();
    Point size = c.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    c.setSize(size);
    scrollComposite.setContent(c);
  }
Пример #19
0
  /**
   * Create the composite
   *
   * @param parent
   * @param style
   * @param equations
   * @param chineseRemainderView
   */
  public CRTGroup(Composite parent, int style, final ChineseRemainderTheoremView view) {
    super(parent, style);
    this.view = view;
    // setText(MESSAGE_GROUP_NAME);
    setLayout(new FillLayout());

    equations = new Equations();
    inverseEquationSet = new Vector<Control>();
    verifyEquationSet = new Vector<Control>();

    final ScrolledComposite scrolledGroup =
        new ScrolledComposite(this, SWT.V_SCROLL | SWT.H_SCROLL);
    scrolledGroup.setExpandHorizontal(true);
    scrolledGroup.setExpandVertical(true);

    content = new Composite(scrolledGroup, SWT.NONE);
    content.setBounds(0, 0, 763, 554);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    content.setLayout(gridLayout);
    scrolledGroup.setMinSize(content.computeSize(740, 600));

    compositeTitleArea = new Composite(content, SWT.NONE);
    compositeTitleArea.setLayout(new GridLayout(1, false));
    compositeTitleArea.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    compositeTitleArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

    lblHeader = new Label(compositeTitleArea, SWT.NONE);
    lblHeader.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
    lblHeader.setFont(FontService.getHeaderFont());
    lblHeader.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    lblHeader.setBounds(10, 0, 666, 24);
    lblHeader.setText(Messages.CRTGroup_Header);

    lblHeaderInfoText = new Text(compositeTitleArea, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
    lblHeaderInfoText.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
    lblHeaderInfoText.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
    lblHeaderInfoText.setBounds(10, 30, 666, 45);
    lblHeaderInfoText.setText(Messages.CRTGroup_HeaderInfoText);

    step1Group = new Group(content, SWT.NONE);
    final GridLayout gridLayout_step1Group = new GridLayout();
    gridLayout_step1Group.numColumns = 2;
    step1Group.setLayout(gridLayout_step1Group);
    final GridData gd_step1Group = new GridData(SWT.FILL, SWT.FILL, false, false);
    gd_step1Group.widthHint = 380;
    step1Group.setLayoutData(gd_step1Group);
    step1Group.setText(MESSAGE_STEP_1_GROUP);

    step1Text = new Text(step1Group, SWT.MULTI);
    step1Text.setEditable(false);
    final GridData gd_step1Text = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 2);
    gd_step1Text.minimumWidth = 250;
    gd_step1Text.minimumHeight = 300;
    gd_step1Text.widthHint = 290;
    step1Text.setLayoutData(gd_step1Text);
    step1Text.setText(MESSAGE_STEP1);
    step1Text.setFont(FontService.getSmallBoldFont());
    new Label(step1Group, SWT.NONE);

    step1nextButton = new Button(step1Group, SWT.NONE);
    step1nextButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            /*
             * checks whether all fields are filled
             */
            Vector<Equation> data = equations.getEquationSet();
            inverseEquationSet.clear();
            verifyEquationSet.clear();
            numberOfEquations = data.size();

            String[] tmpATextfield = new String[numberOfEquations];
            String[] tmpMTextfield = new String[numberOfEquations];

            /*
             * the modul always have to be bigger than the parameter a
             */
            BigInteger tmpA = BigInteger.ZERO, tmpM = BigInteger.ONE;
            try {
              for (int i = 0; i < numberOfEquations; i++) {
                tmpA = new BigInteger(data.get(i).getTextfieldA());
                tmpM = new BigInteger(data.get(i).getTextfieldM());
                tmpA = tmpA.mod(tmpM);

                /*
                 * Zero is not allowed. we change the value to one if the remainder is zero
                 */
                if (tmpA == BigInteger.ZERO) {
                  tmpA = BigInteger.ONE;
                }

                data.get(i).setTextfieldA(tmpA.toString());
              }
            } catch (NumberFormatException e1) {
              MessageBox mb =
                  new MessageBox(Display.getDefault().getActiveShell(), SWT.ICON_ERROR | SWT.OK);
              mb.setText(Messages.CRTGroup_error_no_equations_title);
              mb.setMessage(Messages.CRTGroup_error_no_equations_text);
              mb.open();
              return;
            }

            /*
             * in the array "marking" we store the id of the not paired coprime equations
             */
            int[] marking = new int[numberOfEquations];
            for (int i = 0; i < marking.length; i++) {
              marking[i] = 0;
            }
            boolean notFilled = false;
            for (int i = 0; i < numberOfEquations; i++) {
              tmpATextfield[i] = data.get(i).getTextfieldA();
              tmpMTextfield[i] = data.get(i).getTextfieldM();
              if (data.get(i).getTextfieldA().length() == 0
                  || data.get(i).getTextfieldM().length() == 0) notFilled = true;
            }
            if (notFilled) return;

            /*
             * it is paired compared, whether the "moduli" are paired coprime. if this is not the case, then the
             * position of the equation is marked.
             */
            for (int i = 0; i < tmpMTextfield.length; i++) {
              BigInteger a = new BigInteger(tmpMTextfield[i]);
              for (int j = i + 1; j < tmpMTextfield.length; j++) {
                XEuclid gcd = new XEuclid();
                BigInteger tmpValue = gcd.xeuclid(a, new BigInteger(tmpMTextfield[j]));
                if (tmpValue.compareTo(BigInteger.ONE) != 0) {
                  marking[j] = -1;
                }
              }
            }

            /*
             * if no equation is marked, then the VerifyDialog not displayed. Otherwise, the
             * "CheckingEquationDialog" is displayed for corrections.
             */
            for (int i = 0; i < marking.length; i++) {
              if (marking[i] == -1) {
                showDialog = true;
              }
            }
            int dialogStatus = 0;

            /*
             * open the Dialog to correct the input
             */
            if (showDialog) {
              CheckingEquationDialog ced =
                  new CheckingEquationDialog(getShell(), equations.getEquationSet(), marking);
              dialogStatus = ced.open();
            }

            /*
             * if you closes the "CheckingEquationDialog" by the cancel button, then the ChineseReaminder is not
             * computed.
             */
            if (dialogStatus == 0) {
              /*
               * GUI functionality. Disable or enable widgets
               */
              step1Text.setFont(FontService.getSmallFont());
              step2Text.setFont(FontService.getSmallBoldFont());
              execute = true;
              step1nextButton.setEnabled(false);
              step1Group.setEnabled(false);
              step2Group.setEnabled(true);
              step2Text.setEnabled(true);
              step2nextButton.setEnabled(true);
              crt = new ChineseRemainderTheorem();
              BigInteger[] a = new BigInteger[numberOfEquations];
              BigInteger[] moduli = new BigInteger[numberOfEquations];
              for (int i = 0; i < numberOfEquations; i++) {
                a[i] = new BigInteger(data.get(i).getTextfieldA());
                moduli[i] = new BigInteger(data.get(i).getTextfieldM());
              }
              /*
               * create the equations
               */
              for (Equation equation : equations.getEquationSet()) {
                equation.setEquationEnable(false);
              }

              /*
               * store the result
               */
              result = crt.crt(moduli, a);
            }
          }
        });
    final GridData gd_step1nextButton = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
    gd_step1nextButton.widthHint = 60;
    step1nextButton.setLayoutData(gd_step1nextButton);
    step1nextButton.setText(MESSAGE_STEP_2_GROUP);

    scrolledEquation = new Group(content, SWT.V_SCROLL);
    scrolledEquation.setLayout(new GridLayout(1, false));
    scrolledEquation.setText(MESSAGE_GROUP_EQUATION);
    scrolledEquation.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 2));

    ScrolledComposite scrolledComposite =
        new ScrolledComposite(scrolledEquation, SWT.H_SCROLL | SWT.V_SCROLL);

    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gridData.heightHint = 62;
    scrolledComposite.setLayoutData(gridData);

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

    equationGroup = new Composite(scrolledComposite, SWT.NONE);
    final GridLayout gridLayout_equationGroup = new GridLayout();
    gridLayout_equationGroup.numColumns = 7;
    equationGroup.setLayout(gridLayout_equationGroup);
    equations.createEquation(0, equationGroup, this);
    equations.createEquation(1, equationGroup, this);
    scrolledComposite.setContent(equationGroup);

    step2Group = new Group(content, SWT.NONE);
    step2Group.setEnabled(false);
    final GridLayout gridLayout_step2Group = new GridLayout();
    gridLayout_step2Group.numColumns = 2;
    step2Group.setLayout(gridLayout_step2Group);
    step2Group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
    step2Group.setText(MESSAGE_STEP_2_GROUP);

    step2Text = new Text(step2Group, SWT.MULTI);
    step2Text.setEnabled(false);
    step2Text.setEditable(false);
    final GridData gd_step2Text = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 2);
    gd_step2Text.widthHint = 290;
    step2Text.setLayoutData(gd_step2Text);
    step2Text.setText(MESSAGE_STEP2);
    new Label(step2Group, SWT.NONE);

    step2nextButton = new Button(step2Group, SWT.NONE);
    step2nextButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            /*
             * GUI functionality disable or enable widgets
             */
            step2Text.setFont(FontService.getSmallFont());
            step3Text.setFont(FontService.getSmallBoldFont());
            step2nextButton.setEnabled(false);
            step2Group.setEnabled(false);
            step3Group.setEnabled(true);
            step3Text.setEnabled(true);
            step3nextButton.setEnabled(true);

            /*
             * create the inverse-group
             */
            BigInteger[] bigM = crt.getBigM();

            for (int i = -1; i < bigM.length; i++) {
              if (i == -1) {
                Label mLabel = new Label(inverseGroup, SWT.NONE);
                mLabel.setText("m"); // $NON-NLS-1$
                mLabel.setVisible(false);

                Label equivalenzLabel = new Label(inverseGroup, SWT.NONE);
                equivalenzLabel.setText("="); // $NON-NLS-1$
                equivalenzLabel.setVisible(false);

                Text mText = new Text(inverseGroup, SWT.READ_ONLY | SWT.BORDER);
                mText.setText(crt.getModulus().toString());
                final GridData gd_mText = new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1);
                gd_mText.widthHint = 267;
                mText.setLayoutData(gd_mText);
                mText.setVisible(false);

                inverseEquationSet.add(mLabel);
                inverseEquationSet.add(equivalenzLabel);
                inverseEquationSet.add(mText);

              } else {

                Label mLabel = new Label(inverseGroup, SWT.NONE);
                mLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
                mLabel.setText("M" + convertToSubset(i)); // $NON-NLS-1$
                mLabel.setVisible(false);

                Label equivalenzLabelFront = new Label(inverseGroup, SWT.NONE);
                equivalenzLabelFront.setLayoutData(
                    new GridData(SWT.FILL, SWT.CENTER, false, false));
                equivalenzLabelFront.setText("="); // $NON-NLS-1$
                equivalenzLabelFront.setVisible(false);

                Text mText = new Text(inverseGroup, SWT.READ_ONLY | SWT.BORDER);
                mText.setEditable(false);
                final GridData gd_mText = new GridData(SWT.FILL, SWT.CENTER, false, false);
                gd_mText.widthHint = 140;
                mText.setLayoutData(gd_mText);
                mText.setText(crt.getBigM()[i].toString());
                mText.setVisible(false);

                Label yLabel = new Label(inverseGroup, SWT.NONE);
                yLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));
                yLabel.setText("y" + convertToSubset(i)); // $NON-NLS-1$
                yLabel.setVisible(false);

                Label equivalenzLabelBack = new Label(inverseGroup, SWT.NONE);
                equivalenzLabelBack.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
                equivalenzLabelBack.setText("="); // $NON-NLS-1$
                equivalenzLabelBack.setVisible(false);

                Text yText = new Text(inverseGroup, SWT.READ_ONLY | SWT.BORDER);
                yText.setEditable(false);
                yText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
                yText.setText(crt.getInverse()[i].toString());
                yText.setVisible(false);

                inverseEquationSet.add(mLabel);
                inverseEquationSet.add(equivalenzLabelFront);
                inverseEquationSet.add(mText);
                inverseEquationSet.add(yLabel);
                inverseEquationSet.add(equivalenzLabelBack);
                inverseEquationSet.add(yText);
              }
            }
            /*
             * expand the scolledComposite for better look
             */
            // inverseGroup.pack();
            if (numberOfEquations <= 4) {
              scrolledComposite_1.setExpandVertical(true);
            } else {
              scrolledComposite_1.setExpandVertical(false);
            }
            inverseGroup.pack();

            /*
             * make the widgets visible. the first three widgets always have to be visible
             */
            for (int i = 0; i < inverseEquationSet.size(); i++) {
              /*
               * make only the left side visible
               */
              if (i == 0 || i == 1 || i == 2 || i % 6 == 3 || i % 6 == 4 || i % 6 == 5) {
                inverseEquationSet.get(i).setVisible(true);
              }
            }
          }
        });
    step2nextButton.setEnabled(false);
    final GridData gd_step2nextButton = new GridData(SWT.FILL, SWT.BOTTOM, true, true);
    gd_step2nextButton.widthHint = 60;
    step2nextButton.setLayoutData(gd_step2nextButton);
    step2nextButton.setText(MESSAGE_STEP_3_GROUP);

    step3Group = new Group(content, SWT.NONE);
    step3Group.setEnabled(false);
    final GridData gd_step3Group = new GridData(SWT.FILL, SWT.FILL, false, false);
    gd_step3Group.widthHint = 280;
    step3Group.setLayoutData(gd_step3Group);
    step3Group.setText(MESSAGE_STEP_3_GROUP);
    final GridLayout gridLayout_step3Group = new GridLayout();
    gridLayout_step3Group.numColumns = 2;
    step3Group.setLayout(gridLayout_step3Group);

    step3Text = new Text(step3Group, SWT.MULTI);
    step3Text.setEnabled(false);
    step3Text.setEditable(false);
    final GridData gd_step3Text = new GridData(SWT.FILL, SWT.TOP, false, false, 1, 2);
    gd_step3Text.widthHint = 290;
    step3Text.setLayoutData(gd_step3Text);
    step3Text.setText(MESSAGE_STEP3);
    new Label(step3Group, SWT.NONE);

    step3nextButton = new Button(step3Group, SWT.NONE);
    step3nextButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            /*
             * GUI functionality. Disable or enable widgets
             */
            step3Text.setFont(FontService.getSmallFont());
            step4Text.setFont(FontService.getSmallBoldFont());
            step3nextButton.setEnabled(false);
            step3Group.setEnabled(false);
            step4Group.setEnabled(true);
            step4Text.setEnabled(true);
            step4nextButton.setEnabled(true);
            nextButton.setVisible(true);

            /*
             * make the widgets visible.
             */
            for (int i = 3; i < inverseEquationSet.size(); i++) {
              /*
               * make only the left side visible
               */
              if (i % 6 == 0 || i % 6 == 1 || i % 6 == 2) {
                inverseEquationSet.get(i).setVisible(true);
              }
            }
          }
        });
    step3nextButton.setEnabled(false);
    final GridData gd_step3nextButton = new GridData(SWT.FILL, SWT.BOTTOM, true, true);
    gd_step3nextButton.widthHint = 60;
    step3nextButton.setLayoutData(gd_step3nextButton);
    step3nextButton.setText(MESSAGE_STEP_4_GROUP);

    scrolledInverse = new Group(content, SWT.V_SCROLL);
    scrolledInverse.setLayout(new GridLayout(1, false));
    scrolledInverse.setText("Inverse"); // $NON-NLS-1$

    GridData gridData_1 = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 2);
    gridData_1.heightHint = 170;
    gridData_1.widthHint = 177;
    scrolledInverse.setLayoutData(gridData_1);

    scrolledComposite_1 = new ScrolledComposite(scrolledInverse, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite_1.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    scrolledComposite_1.setExpandHorizontal(true);
    scrolledComposite_1.setExpandVertical(true);

    inverseGroup = new Composite(scrolledComposite_1, SWT.NONE);
    final GridLayout gridLayout_1 = new GridLayout();
    gridLayout_1.numColumns = 6;
    inverseGroup.setLayout(gridLayout_1);
    scrolledComposite_1.setContent(inverseGroup);
    scrolledComposite_1.setMinSize(inverseGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    step4Group = new Group(content, SWT.NONE);
    step4Group.setEnabled(false);
    final GridData gd_step4Group = new GridData(SWT.FILL, SWT.FILL, false, false);
    gd_step4Group.heightHint = 82;
    step4Group.setLayoutData(gd_step4Group);
    step4Group.setText(MESSAGE_STEP_4_GROUP);
    final GridLayout gridLayout_step4Group = new GridLayout();
    gridLayout_step4Group.numColumns = 2;
    step4Group.setLayout(gridLayout_step4Group);

    step4Text = new Text(step4Group, SWT.MULTI);
    step4Text.setEnabled(false);
    step4Text.setEditable(false);
    final GridData gd_step4Text = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 2);
    gd_step4Text.widthHint = 290;
    step4Text.setLayoutData(gd_step4Text);
    step4Text.setText(MESSAGE_STEP4);
    new Label(step4Group, SWT.NONE);

    step4nextButton = new Button(step4Group, SWT.NONE);
    step4nextButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            /*
             * GUI functionality. Disable or enable widgets
             */
            step4Text.setFont(FontService.getSmallFont());
            resultXText.setFont(FontService.getSmallBoldFont());
            resultText.setFont(FontService.getSmallBoldFont());
            resultValueText.setFont(FontService.getSmallBoldFont());
            resultMoreText.setFont(FontService.getSmallBoldFont());
            step4nextButton.setEnabled(false);
            step4Group.setEnabled(false);
            resultGroup.setEnabled(true);
            resultXText.setEnabled(true);
            resultText.setEnabled(true);
            resultValueText.setEnabled(true);
            resultMoreText.setEnabled(true);
            nextButton.setEnabled(true);
            previousButton.setEnabled(false);

            /*
             * create the verify-group
             */
            resultValueText.setText(result.toString());

            Vector<Equation> equationSet = equations.getEquationSet();
            for (Equation equation : equationSet) {
              Text resultText = new Text(verifyGroup, SWT.READ_ONLY | SWT.BORDER);
              final GridData gd_resultText = new GridData(SWT.FILL, SWT.CENTER, true, false);
              gd_resultText.widthHint = 121;
              resultText.setLayoutData(gd_resultText);
              resultText.setText(result.toString());

              Label cLabel = new Label(verifyGroup, SWT.NONE);
              cLabel.setText(uCongruence);

              Text aText = new Text(verifyGroup, SWT.READ_ONLY | SWT.BORDER);
              final GridData gd_aText = new GridData(SWT.FILL, SWT.CENTER, false, false);
              gd_aText.widthHint = 51;
              aText.setLayoutData(gd_aText);
              aText.setText(equation.getTextfieldA());

              Label modLabel = new Label(verifyGroup, SWT.NONE);
              modLabel.setText("mod"); // $NON-NLS-1$

              Text mText = new Text(verifyGroup, SWT.READ_ONLY | SWT.BORDER);
              final GridData gd_mText = new GridData(SWT.FILL, SWT.CENTER, false, false);
              gd_mText.widthHint = 51;
              mText.setLayoutData(gd_mText);
              mText.setText(equation.getTextfieldM());

              verifyEquationSet.add(resultText);
              verifyEquationSet.add(cLabel);
              verifyEquationSet.add(aText);
              verifyEquationSet.add(modLabel);
              verifyEquationSet.add(mText);
            }
            // verifyGroup.pack();
            if (numberOfEquations <= 4) {
              scrolledComposite_2.setExpandVertical(true);
            } else {
              scrolledComposite_2.setExpandVertical(false);
            }
            verifyGroup.pack();

            /*
             * enable the export menu
             */
            view.enableMenu(true);
          }
        });
    step4nextButton.setEnabled(false);
    final GridData gd_step4nextButton = new GridData(SWT.FILL, SWT.BOTTOM, true, true);
    gd_step4nextButton.widthHint = 60;
    step4nextButton.setLayoutData(gd_step4nextButton);
    step4nextButton.setText(MESSAGE_RESULT_GROUP);

    resultGroup = new Group(content, SWT.NONE);
    resultGroup.setEnabled(false);
    final GridData gd_resultGroup = new GridData(SWT.FILL, SWT.FILL, false, false);
    gd_resultGroup.heightHint = 115;
    resultGroup.setLayoutData(gd_resultGroup);
    resultGroup.setText(MESSAGE_RESULT_GROUP);
    final GridLayout gridLayout_resultGroup = new GridLayout();
    gridLayout_resultGroup.numColumns = 4;
    resultGroup.setLayout(gridLayout_resultGroup);

    resultText = new Text(resultGroup, SWT.NONE);
    resultText.setEnabled(false);
    resultText.setEditable(false);
    resultText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 4, 1));
    resultText.setText(MESSAGE_RESULT);

    resultXText = new Text(resultGroup, SWT.READ_ONLY);
    resultXText.setEditable(false);
    resultXText.setEnabled(false);
    resultXText.setText(Messages.CRTGroup_0);
    final GridData gd_resultXText = new GridData(SWT.FILL, SWT.CENTER, false, false);
    gd_resultXText.widthHint = 25;
    gd_resultXText.heightHint = 18;
    resultXText.setLayoutData(gd_resultXText);

    resultValueText = new Text(resultGroup, SWT.READ_ONLY | SWT.BORDER);
    resultValueText.setEditable(false);
    resultValueText.setEnabled(false);
    resultValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    resultMoreText = new Text(resultGroup, SWT.NONE);
    resultMoreText.setEnabled(false);
    resultMoreText.setEditable(false);
    resultMoreText.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, true, 2, 1));
    resultMoreText.setText(MESSAGE_MORE_SOLUTION);

    nextButton = new Button(resultGroup, SWT.NONE);
    nextButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            /*
             * change the result value in the verify-group
             */
            BigInteger tmpValue = new BigInteger(resultValueText.getText());
            tmpValue = tmpValue.add(crt.getModulus());
            resultValueText.setText(tmpValue.toString());

            for (int i = 0; i < verifyEquationSet.size(); i++) {
              if (i % 5 == 0) {
                Text tmpText = (Text) verifyEquationSet.get(i);
                tmpText.setText(tmpValue.toString());
              }
            }
            previousButton.setEnabled(true);
          }
        });
    nextButton.setEnabled(false);
    nextButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, true));
    nextButton.setText(MESSAGE_NEXT);

    previousButton = new Button(resultGroup, SWT.NONE);
    previousButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(final SelectionEvent e) {
            /*
             * change the result value in the verify-group
             */
            BigInteger tmpValue = new BigInteger(resultValueText.getText());
            tmpValue = tmpValue.subtract(crt.getModulus());

            if (tmpValue.subtract(crt.getModulus()).compareTo(BigInteger.ZERO) < 0) {
              previousButton.setEnabled(false);
            }

            resultValueText.setText(tmpValue.toString());

            for (int i = 0; i < verifyEquationSet.size(); i++) {
              if (i % 5 == 0) {
                Text tmpText = (Text) verifyEquationSet.get(i);
                tmpText.setText(tmpValue.toString());
              }
            }
          }
        });
    previousButton.setEnabled(false);
    previousButton.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, false, true));
    previousButton.setText(MESSAGE_PREVIOUS);

    scrolledVerify = new Group(content, SWT.V_SCROLL);
    scrolledVerify.setText(MESSAGE_VERIFY_GROUP);
    scrolledVerify.setLayout(new GridLayout(1, false));
    final GridData gd_scrolledVerify = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 2);
    gd_scrolledVerify.heightHint = 102;
    scrolledVerify.setLayoutData(gd_scrolledVerify);

    scrolledComposite_2 = new ScrolledComposite(scrolledVerify, SWT.H_SCROLL | SWT.V_SCROLL);
    scrolledComposite_2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    scrolledComposite_2.setExpandHorizontal(true);
    scrolledComposite_2.setExpandVertical(true);

    verifyGroup = new Composite(scrolledComposite_2, SWT.NONE);
    final GridLayout gridLayout_verifyGroup = new GridLayout();
    gridLayout_verifyGroup.numColumns = 5;
    verifyGroup.setLayout(gridLayout_verifyGroup);
    scrolledComposite_2.setContent(verifyGroup);

    // step1Text.setFont(FontService.getNormalFont());
    step2Text.setFont(FontService.getSmallFont());
    step3Text.setFont(FontService.getSmallFont());
    step4Text.setFont(FontService.getSmallFont());
    new Label(content, SWT.NONE);

    scrolledGroup.setContent(content);
    //
  }
Пример #20
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;
  }
  private void createControls() {
    /*
     * Sets up the shell
     */

    int shellStyle = SWT.DIALOG_TRIM | SWT.RESIZE;
    if ((style & MODAL) != 0) {
      shellStyle |= SWT.APPLICATION_MODAL;
    }

    shell = ShellFactory.createMainShell(shellStyle);
    shell.setText(MessageText.getString("progress.window.title"));

    Utils.setShellIcon(shell);

    GridLayout gLayout = new GridLayout();
    gLayout.marginHeight = 0;
    gLayout.marginWidth = 0;
    shell.setLayout(gLayout);

    /*
     * Using ScrolledComposite with only vertical scroll
     */
    scrollable = new ScrolledComposite(shell, SWT.V_SCROLL);
    scrollable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    /*
     * Main content composite where panels will be created
     */
    scrollChild = new Composite(scrollable, SWT.NONE);

    GridLayout gLayoutChild = new GridLayout();
    gLayoutChild.marginHeight = 0;
    gLayoutChild.marginWidth = 0;
    gLayoutChild.verticalSpacing = 0;
    scrollChild.setLayout(gLayoutChild);
    scrollable.setContent(scrollChild);
    scrollable.setExpandVertical(true);
    scrollable.setExpandHorizontal(true);

    /*
     * Re-adjust scrollbar setting when the window resizes
     */
    scrollable.addControlListener(
        new ControlAdapter() {
          public void controlResized(ControlEvent e) {
            Rectangle r = scrollable.getClientArea();
            scrollable.setMinSize(scrollChild.computeSize(r.width, SWT.DEFAULT));
          }
        });

    /*
     * On closing remove all reporters that was handled by this instance of the window from the registry
     */
    shell.addListener(
        SWT.Close,
        new Listener() {
          public void handleEvent(Event event) {

            /*
             * Remove this class as a listener to the disposal event for the panels or else
             * as the shell is closing the panels would be disposed one-by-one and each one would
             * force a re-layouting of the shell.
             */
            Control[] controls = scrollChild.getChildren();
            for (int i = 0; i < controls.length; i++) {
              if (controls[i] instanceof ProgressReporterPanel) {
                ((ProgressReporterPanel) controls[i])
                    .removeDisposeListener(ProgressReporterWindow.this);
              }
            }

            /*
             * Removes all the reporters that is still handled by this window
             */
            for (int i = 0; i < pReporters.length; i++) {
              reportersRegistry.remove(pReporters[i]);
            }

            isShowingEmpty = false;
          }
        });

    if (pReporters.length == 0) {
      createEmptyPanel();
    } else {
      createPanels();
    }

    /*
     * Shows the toolbar if specified
     */
    if ((style & SHOW_TOOLBAR) != 0) {
      createToolbar();
    }
    isAutoRemove = COConfigurationManager.getBooleanParameter("auto_remove_inactive_items");
  }
Пример #22
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);
  }
  @Override
  protected Control createDialogArea(Composite parent) {
    gray = parent.getDisplay().getSystemColor(SWT.COLOR_GRAY);
    black = parent.getDisplay().getSystemColor(SWT.COLOR_BLACK);
    tParent = (Composite) super.createDialogArea(parent);
    tParent.setLayout(new GridLayout(2, false));
    tParent.setLayoutData(new GridData(720, 410));

    Composite c = new Composite(tParent, SWT.BORDER);
    c.setLayout(new GridLayout(2, false));
    c.setLayoutData(new GridData(200, 388));
    Composite c1 = new Composite(c, SWT.NONE);
    c1.setLayout(new GridLayout(1, true));
    c1.setLayoutData(new GridData(150, 380));
    new Label(c1, SWT.NONE).setText("自定义过滤器:");
    initCustomFilterList(c1);

    Composite c2 = new Composite(c, SWT.NONE);
    RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
    rowLayout.marginLeft = 0;
    rowLayout.marginTop = 150;
    rowLayout.spacing = 5;
    c2.setLayout(rowLayout);
    c2.setLayoutData(new GridData(50, 380));
    Button addCustom = new Button(c2, SWT.PUSH);
    addCustom.setText("新增");
    addCustom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // 新增自定义过滤器方法
            if (isChange()) {
              if (!MessageDialog.openConfirm(getShell(), "", "不保存当前内容吗?")) {
                return;
              }
            }
            refresh();
          }
        });
    Button delCustom = new Button(c2, SWT.PUSH);
    delCustom.setText("删除");
    delCustom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // 删除已保存的自定义过滤器方法
            String[] filters = customFilterList.getSelection();
            if (filters != null && filters.length > 0) {
              if (MessageDialog.openConfirm(getShell(), "", "确定要删除选中的自定义过滤器吗?")) {
                deletePreference(filters);
              }
            } else {
              MessageDialog.openInformation(getShell(), "", "请选择要删除的自定义过滤器。");
            }
          }
        });

    Button editCustom = new Button(c2, SWT.PUSH);
    editCustom.setText("编辑");
    editCustom.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            // 编辑已有的自定义过滤器方法
            edit();
          }
        });

    Composite c3 = new Composite(tParent, SWT.NONE);
    c3.setLayout(new GridLayout(1, true));
    c3.setLayoutData(new GridData(500, 400));

    Composite top = new Composite(c3, SWT.NONE);
    top.setLayout(new GridLayout(2, false));
    new Label(top, SWT.NONE).setText("过滤器名称:");
    filterNameTxt = new Text(top, SWT.BORDER);
    filterNameTxt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    andBtn = new Button(top, SWT.RADIO);
    andBtn.setText("满足所有条件");
    andBtn.setSelection(true);
    orBtn = new Button(top, SWT.RADIO);
    orBtn.setText("满足以下任一条件");
    scroll = new ScrolledComposite(c3, SWT.V_SCROLL | SWT.BORDER);
    scroll.setAlwaysShowScrollBars(true);
    scroll.setLayoutData(new GridData(470, 250));
    scroll.setExpandHorizontal(true);
    scroll.setExpandVertical(true);
    dynaComp = new Composite(scroll, SWT.BORDER);
    scroll.setContent(dynaComp);
    dynaComp.setLayout(new GridLayout(1, true));
    new DynaComposite(dynaComp, SWT.NONE);

    Composite c4 = new Composite(c3, SWT.BORDER);
    c4.setLayout(new GridLayout(2, true));
    c4.setLayoutData(new GridData(470, 60));

    btnIsTagged = new Button(c4, SWT.CHECK);
    btnIsTagged.setText("标记的匹配");
    btnQT = new Button(c4, SWT.CHECK);
    btnQT.setText("快速翻译匹配");
    btnPT = new Button(c4, SWT.CHECK); // propagate translation
    btnPT.setText("自动繁殖翻译匹配");
    if (isTEInstalled()) {
      btnIsRemoveFromSrc = new Button(c4, SWT.CHECK);
      btnIsRemoveFromSrc.setText("从来源中删除");
    }

    return parent;
  }
Пример #24
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;
  }
  private Composite createButtonArea(Composite parent) {
    ScrolledComposite comp = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    GridLayout layout = new GridLayout();
    layout.marginWidth = layout.marginHeight = 0;
    comp.setLayoutData(new GridData(GridData.FILL_VERTICAL));
    Composite container = new Composite(comp, SWT.NONE);
    layout = new GridLayout();
    layout.marginWidth = 0;
    container.setLayout(layout);
    GridData gd = new GridData(GridData.FILL_VERTICAL);
    gd.verticalIndent = 15;
    container.setLayoutData(gd);

    Button button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_existing);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleExistingProjects();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_existingUnshared);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleExistingUnshared();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    fAddButton = new Button(container, SWT.PUSH);
    fAddButton.setText(PDEUIMessages.ImportWizard_DetailedPage_add);
    fAddButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAdd();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddButton);

    fAddAllButton = new Button(container, SWT.PUSH);
    fAddAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addAll);
    fAddAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAddAll();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddAllButton);

    fRemoveButton = new Button(container, SWT.PUSH);
    fRemoveButton.setText(PDEUIMessages.ImportWizard_DetailedPage_remove);
    fRemoveButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fRemoveButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleRemove();
          }
        });
    SWTUtil.setButtonDimensionHint(fRemoveButton);

    fRemoveAllButton = new Button(container, SWT.PUSH);
    fRemoveAllButton.setText(PDEUIMessages.ImportWizard_DetailedPage_removeAll);
    fRemoveAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fRemoveAllButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleRemoveAll();
          }
        });
    SWTUtil.setButtonDimensionHint(fRemoveAllButton);

    button = new Button(container, SWT.PUSH);
    button.setText(PDEUIMessages.ImportWizard_DetailedPage_swap);
    button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    button.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleSwap();
          }
        });
    SWTUtil.setButtonDimensionHint(button);

    fAddRequiredButton = new Button(container, SWT.PUSH);
    fAddRequiredButton.setText(PDEUIMessages.ImportWizard_DetailedPage_addRequired);
    fAddRequiredButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fAddRequiredButton.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            handleAddRequiredPlugins();
          }
        });
    SWTUtil.setButtonDimensionHint(fAddRequiredButton);

    fCountLabel = new Label(container, SWT.NONE);
    fCountLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_CENTER));
    comp.setContent(container);
    comp.setMinHeight(250);
    comp.setExpandHorizontal(true);
    comp.setExpandVertical(true);
    return container;
  }
Пример #26
0
  /**
   * Create contents of the wizard.
   *
   * @param parent the parent widget
   */
  @Override
  @SuppressWarnings("unused") // Don't warn about unassigned "new Label(.)": has side-effect
  public void createControl(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);

    setControl(container);
    GridLayout glContainer = new GridLayout(2, false);
    glContainer.marginWidth = 0;
    glContainer.horizontalSpacing = 0;
    glContainer.marginHeight = 0;
    glContainer.verticalSpacing = 0;
    container.setLayout(glContainer);

    ScrolledComposite configurationScrollArea = new ScrolledComposite(container, SWT.V_SCROLL);
    configurationScrollArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 2));
    configurationScrollArea.setExpandHorizontal(true);
    configurationScrollArea.setExpandVertical(true);

    mConfigurationArea = new Composite(configurationScrollArea, SWT.NONE);
    GridLayout glConfigurationArea = new GridLayout(3, false);
    glConfigurationArea.horizontalSpacing = 0;
    glConfigurationArea.marginRight = 15;
    glConfigurationArea.marginWidth = 0;
    glConfigurationArea.marginHeight = 0;
    mConfigurationArea.setLayout(glConfigurationArea);

    Label foregroundLabel = new Label(mConfigurationArea, SWT.NONE);
    foregroundLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    foregroundLabel.setText("Foreground:");

    Composite foregroundComposite = new Composite(mConfigurationArea, SWT.NONE);
    foregroundComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout glForegroundComposite = new GridLayout(5, false);
    glForegroundComposite.horizontalSpacing = 0;
    foregroundComposite.setLayout(glForegroundComposite);

    mImageRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mImageRadio.setSelection(false);
    mImageRadio.addSelectionListener(this);
    mImageRadio.setText("Image");

    mClipartRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mClipartRadio.setText("Clipart");
    mClipartRadio.addSelectionListener(this);

    mTextRadio = new Button(foregroundComposite, SWT.FLAT | SWT.TOGGLE);
    mTextRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
    mTextRadio.setText("Text");
    mTextRadio.addSelectionListener(this);
    new Label(mConfigurationArea, SWT.NONE);

    mForegroundArea = new Composite(mConfigurationArea, SWT.NONE);
    mForegroundArea.setLayout(new StackLayout());
    mForegroundArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));

    mImageForm = new Composite(mForegroundArea, SWT.NONE);
    mImageForm.setLayout(new GridLayout(3, false));

    Label fileLabel = new Label(mImageForm, SWT.NONE);
    fileLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    fileLabel.setText("Image File:");

    mImagePathText = new Text(mImageForm, SWT.BORDER);
    GridData pathLayoutData = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    pathLayoutData.widthHint = 200;
    mImagePathText.setLayoutData(pathLayoutData);
    mImagePathText.addSelectionListener(this);
    mImagePathText.addModifyListener(this);

    mPickImageButton = new Button(mImageForm, SWT.FLAT);
    mPickImageButton.setText("Browse...");
    mPickImageButton.addSelectionListener(this);

    mClipartForm = new Composite(mForegroundArea, SWT.NONE);
    mClipartForm.setLayout(new GridLayout(2, false));

    mChooseClipart = new Button(mClipartForm, SWT.FLAT);
    mChooseClipart.setText("Choose...");
    mChooseClipart.addSelectionListener(this);

    mClipartPreviewPanel = new Composite(mClipartForm, SWT.NONE);
    RowLayout rlClipartPreviewPanel = new RowLayout(SWT.HORIZONTAL);
    rlClipartPreviewPanel.marginBottom = 0;
    rlClipartPreviewPanel.marginTop = 0;
    rlClipartPreviewPanel.center = true;
    mClipartPreviewPanel.setLayout(rlClipartPreviewPanel);
    mClipartPreviewPanel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    mTextForm = new Composite(mForegroundArea, SWT.NONE);
    mTextForm.setLayout(new GridLayout(2, false));

    Label textLabel = new Label(mTextForm, SWT.NONE);
    textLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    textLabel.setText("Text:");

    mText = new Text(mTextForm, SWT.BORDER);
    mText.setText("Aa");
    mText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    mText.addModifyListener(this);

    Label fontLabel = new Label(mTextForm, SWT.NONE);
    fontLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    fontLabel.setText("Font:");

    mFontButton = new Button(mTextForm, SWT.FLAT);
    mFontButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
    mFontButton.addSelectionListener(this);
    mFontButton.setText("Choose Font...");
    new Label(mConfigurationArea, SWT.NONE);

    mTrimCheckBox = new Button(mConfigurationArea, SWT.CHECK);
    mTrimCheckBox.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mTrimCheckBox.setSelection(false);
    mTrimCheckBox.setText("Trim Surrounding Blank Space");
    mTrimCheckBox.addSelectionListener(this);
    new Label(mConfigurationArea, SWT.NONE);

    Label paddingLabel = new Label(mConfigurationArea, SWT.NONE);
    paddingLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    paddingLabel.setText("Additional Padding:");
    new Label(mConfigurationArea, SWT.NONE);

    mPaddingSlider = new Slider(mConfigurationArea, SWT.NONE);
    mPaddingSlider.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    // This doesn't work right -- not sure why. For now just use a plain slider
    // and subtract 10 from it to get the real range.
    // mPaddingSlider.setValues(0, -10, 50, 0, 1, 10);
    mPaddingSlider.setSelection(10 + 15);
    mPaddingSlider.addSelectionListener(this);

    mPercentLabel = new Label(mConfigurationArea, SWT.NONE);
    mPercentLabel.setText("  15%"); // Enough available space for -10%

    mScalingLabel = new Label(mConfigurationArea, SWT.NONE);
    mScalingLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mScalingLabel.setText("Foreground Scaling:");

    mScalingComposite = new Composite(mConfigurationArea, SWT.NONE);
    mScalingComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout gl_mScalingComposite = new GridLayout(5, false);
    gl_mScalingComposite.horizontalSpacing = 0;
    mScalingComposite.setLayout(gl_mScalingComposite);

    mCropRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE);
    mCropRadio.setSelection(true);
    mCropRadio.setText("Crop");
    mCropRadio.addSelectionListener(this);

    mCenterRadio = new Button(mScalingComposite, SWT.FLAT | SWT.TOGGLE);
    mCenterRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
    mCenterRadio.setText("Center");
    mCenterRadio.addSelectionListener(this);

    mShapeLabel = new Label(mConfigurationArea, SWT.NONE);
    mShapeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mShapeLabel.setText("Shape");

    mShapeComposite = new Composite(mConfigurationArea, SWT.NONE);
    mShapeComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    GridLayout gl_mShapeComposite = new GridLayout(5, false);
    gl_mShapeComposite.horizontalSpacing = 0;
    mShapeComposite.setLayout(gl_mShapeComposite);

    mSquareRadio = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE);
    mSquareRadio.setSelection(true);
    mSquareRadio.setText("Square");
    mSquareRadio.addSelectionListener(this);

    mCircleButton = new Button(mShapeComposite, SWT.FLAT | SWT.TOGGLE);
    mCircleButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 4, 1));
    mCircleButton.setText("Circle");
    mCircleButton.addSelectionListener(this);

    mThemeLabel = new Label(mConfigurationArea, SWT.NONE);
    mThemeLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mThemeLabel.setText("Theme");

    mThemeComposite = new Composite(mConfigurationArea, SWT.NONE);
    mThemeComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
    GridLayout gl_mThemeComposite = new GridLayout(2, false);
    gl_mThemeComposite.horizontalSpacing = 0;
    mThemeComposite.setLayout(gl_mThemeComposite);

    mHoloLightRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE);
    mHoloLightRadio.setText("Holo Light");
    mHoloLightRadio.setSelection(true);
    mHoloLightRadio.addSelectionListener(this);

    mHoloDarkRadio = new Button(mThemeComposite, SWT.FLAT | SWT.TOGGLE);
    mHoloDarkRadio.setText("Holo Dark");
    mHoloDarkRadio.addSelectionListener(this);

    mBgColorLabel = new Label(mConfigurationArea, SWT.NONE);
    mBgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mBgColorLabel.setText("Background Color:");

    mBgButton = new Button(mConfigurationArea, SWT.FLAT);
    mBgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mBgButton.addSelectionListener(this);
    mBgButton.setAlignment(SWT.CENTER);

    mFgColorLabel = new Label(mConfigurationArea, SWT.NONE);
    mFgColorLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    mFgColorLabel.setText("Foreground Color:");

    mFgButton = new Button(mConfigurationArea, SWT.FLAT);
    mFgButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    mFgButton.setAlignment(SWT.CENTER);
    mFgButton.addSelectionListener(this);

    if (SUPPORT_LAUNCHER_ICON_TYPES) {
      mEffectsLabel = new Label(mConfigurationArea, SWT.NONE);
      mEffectsLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
      mEffectsLabel.setText("Foreground Effects:");

      mEffectsComposite = new Composite(mConfigurationArea, SWT.NONE);
      mEffectsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
      GridLayout gl_mEffectsComposite = new GridLayout(5, false);
      gl_mEffectsComposite.horizontalSpacing = 0;
      mEffectsComposite.setLayout(gl_mEffectsComposite);

      mSimpleRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mSimpleRadio.setSelection(true);
      mSimpleRadio.setText("Simple");
      mSimpleRadio.addSelectionListener(this);

      mFancyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mFancyRadio.setText("Fancy");
      mFancyRadio.addSelectionListener(this);

      mGlossyRadio = new Button(mEffectsComposite, SWT.FLAT | SWT.TOGGLE);
      mGlossyRadio.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
      mGlossyRadio.setText("Glossy");
      mGlossyRadio.addSelectionListener(this);
    }

    configurationScrollArea.setContent(mConfigurationArea);
    configurationScrollArea.setMinSize(mConfigurationArea.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    Label previewLabel = new Label(container, SWT.NONE);
    previewLabel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false, 1, 1));
    previewLabel.setText("Preview:");

    mPreviewArea = new Composite(container, SWT.BORDER);

    RowLayout rlPreviewAreaPreviewArea = new RowLayout(SWT.HORIZONTAL);
    rlPreviewAreaPreviewArea.wrap = true;
    rlPreviewAreaPreviewArea.pack = true;
    rlPreviewAreaPreviewArea.center = true;
    rlPreviewAreaPreviewArea.spacing = 0;
    rlPreviewAreaPreviewArea.marginBottom = 0;
    rlPreviewAreaPreviewArea.marginTop = 0;
    rlPreviewAreaPreviewArea.marginRight = 0;
    rlPreviewAreaPreviewArea.marginLeft = 0;
    mPreviewArea.setLayout(rlPreviewAreaPreviewArea);
    GridData gdMPreviewArea = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
    gdMPreviewArea.widthHint = PREVIEW_AREA_WIDTH;
    mPreviewArea.setLayoutData(gdMPreviewArea);

    // Initial color
    Display display = parent.getDisplay();
    // updateColor(display, new RGB(0xa4, 0xc6, 0x39), true /*background*/);
    updateColor(display, new RGB(0xff, 0x00, 0x00), true /*background*/);
    updateColor(display, new RGB(0x00, 0x00, 0x00), false /*background*/);

    // Start out showing the image form
    // mImageRadio.setSelection(true);
    // chooseForegroundTab(mImageRadio, mImageForm);
    // No, start out showing the text, since the user doesn't have to enter anything
    // initially and we still get images
    mTextRadio.setSelection(true);
    chooseForegroundTab(mTextRadio, mTextForm);
    new Label(mConfigurationArea, SWT.NONE);
    new Label(mConfigurationArea, SWT.NONE);
    new Label(mConfigurationArea, SWT.NONE);

    validatePage();
  }
Пример #27
0
  /**
   * Create the composite.
   *
   * @param parent
   * @param style
   */
  public RecoverData(Composite parent, int style) {
    super(parent, style);
    setLayout(new GridLayout(3, false));

    tree = new Tree(this, SWT.BORDER);
    GridData gd_tree = new GridData(SWT.FILL, SWT.FILL, false, true, 1, 2);
    gd_tree.widthHint = 150;
    tree.setLayoutData(gd_tree);
    tree.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            table.removeAll();
            table.setItemCount(0);

            Display.getDefault()
                .syncExec(
                    new Runnable() {

                      @Override
                      public void run() {
                        populateTable(tree);
                      }
                    });
          }
        });

    ScrolledComposite scrolledComposite =
        new ScrolledComposite(this, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
    GridData gd_scrolledComposite = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
    gd_scrolledComposite.widthHint = 140;
    gd_scrolledComposite.heightHint = 56;
    scrolledComposite.setLayoutData(gd_scrolledComposite);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);

    table = new Table(scrolledComposite, SWT.BORDER | SWT.FULL_SELECTION);
    table.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent arg0) {
            TableItem row = table.getItem(table.getSelectionIndex());
            final String path = row.getText(2);
            Display.getDefault()
                .syncExec(
                    new Runnable() {

                      @Override
                      public void run() {
                        // hex.ViewHexDump(path);
                        showHexDump(path);
                        showPic(path);
                      }
                    });
          }
        });

    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn tblclmnFileName = new TableColumn(table, SWT.NONE);
    tblclmnFileName.setWidth(100);
    tblclmnFileName.setText("File Name");

    TableColumn tblclmnSize = new TableColumn(table, SWT.NONE);
    tblclmnSize.setWidth(50);
    tblclmnSize.setText("Size");

    TableColumn tblclmnPath = new TableColumn(table, SWT.NONE);
    tblclmnPath.setWidth(-245);
    tblclmnPath.setText("Path");

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

    canvas = new Canvas(this, SWT.BORDER);
    canvas.setLayout(new GridLayout(1, false));
    GridData gd_scrolledComposite_1 = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_scrolledComposite_1.widthHint = 119;
    canvas.setLayoutData(gd_scrolledComposite_1);

    label = new Label(canvas, SWT.BORDER);
    label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    hexview = new HexViewer(this, SWT.NONE);
    hexview.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 2, 1));
  }
Пример #28
0
  public BackBoard(Composite parent, int style, Point minScrollBack) {
    super(parent, SWT.NONE);
    this.display = parent.getDisplay();

    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    super.setLayout(layout);

    ScrolledComposite scrollBack =
        new ScrolledComposite(this, SWT.NONE | SWT.V_SCROLL | SWT.H_SCROLL);

    scrollBack.setExpandHorizontal(true);
    scrollBack.setExpandVertical(true);
    scrollBack.getVerticalBar().setIncrement(5);
    scrollBack.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));

    Composite back = new Composite(scrollBack, SWT.NONE);
    back.setBackground(display.getSystemColor(SWT.COLOR_WHITE));

    scrollBack.setContent(back);
    scrollBack.setMinSize(minScrollBack);

    GridLayout backLayout = new GridLayout();
    backLayout.numColumns = 1;
    backLayout.verticalSpacing = 10;
    backLayout.marginWidth = 0;
    backLayout.marginHeight = 0;
    back.setLayout(backLayout);

    GridData titleBarGridData = new GridData(GridData.FILL, GridData.FILL, true, false);
    titleBarGridData.heightHint = 33;

    titleBar = new Canvas(back, SWT.NONE);
    titleBar.setLayoutData(titleBarGridData);
    titleBar.setBackgroundImage(
        Activator.getImageDescriptor("/icons/titleback.gif").createImage(display));

    backLayout = new GridLayout();
    backLayout.horizontalSpacing = 10;
    backLayout.marginWidth = 0;
    backLayout.marginHeight = 3;
    backLayout.marginRight = 10;
    titleBar.setLayout(backLayout);

    paintListener =
        new PaintListener() {
          public void paintControl(PaintEvent e) {
            if (e.widget == titleBar) {
              drawTitle(e);
            }
          }
        };

    titleBar.addPaintListener(paintListener);

    contents = new Composite(back, SWT.NONE);
    GridData contentsGridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    contents.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    contents.setLayoutData(contentsGridData);

    GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    gridData.horizontalAlignment = SWT.RIGHT;

    toolBar = new ToolBar(titleBar, SWT.FLAT);
    toolBar.setLayoutData(gridData);
    toolBar.setBackgroundImage(
        Activator.getImageDescriptor("/icons/titleback.gif").createImage(display));
  }
Пример #29
0
package net.heartsome.cat.te.tmxeditor.editor;
  @Override
  public void createPartControl(Composite parent) {
    Activator.getDefault()
        .getPreferenceStore()
        .addPropertyChangeListener(
            new IPropertyChangeListener() {

              @Override
              public void propertyChange(PropertyChangeEvent event) {
                if (event.getProperty() == "selectedfont") {
                  FontData[] fonts = (FontData[]) event.getNewValue();

                  Font font = new Font(Display.getDefault(), fonts[0]);

                  setFont(newPatientVisitComposite, font);
                }
              }
            });

    final Composite composite = new Composite(parent, SWT.NONE);
    GridLayout compositeGL = new GridLayout(1, true);
    composite.setLayout(compositeGL);
    GridData compositeGD = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
    composite.setLayoutData(compositeGD);
    composite.setSize(composite.computeSize(parent.getSize().x, SWT.DEFAULT));

    scrolledComposite = new ScrolledComposite(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    scrolledComposite.setExpandHorizontal(true);
    scrolledComposite.setExpandVertical(true);
    GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH);
    scrolledComposite.setLayoutData(data);
    scrolledComposite.setSize(scrolledComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

    newPatientVisitComposite = new Composite(scrolledComposite, SWT.NULL);
    GridLayout newPatientVisitCompositeGL = new GridLayout(1, false);
    newPatientVisitComposite.setLayout(newPatientVisitCompositeGL);
    GridData newPatientVisitCompositeGD = new GridData(GridData.FILL_BOTH);
    newPatientVisitComposite.setLayoutData(newPatientVisitCompositeGD);

    Group newPatientGroup = new Group(newPatientVisitComposite, SWT.NULL);
    newPatientGroup.setText("New / Search patient");
    GridLayout newPatientGroupGL = new GridLayout(4, true);
    newPatientGroup.setLayout(newPatientGroupGL);
    GridData newPatientGroupGD = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    newPatientGroupGD.verticalIndent = 0;
    newPatientGroup.setLayoutData(newPatientGroupGD);

    // new patient / search components
    Button radioButtonNewPatient = new Button(newPatientGroup, SWT.RADIO);
    radioButtonNewPatient.setText("New Patient");
    GridData radioBtnNewPatientGD = new GridData();
    radioBtnNewPatientGD.horizontalSpan = 2;
    radioButtonNewPatient.setLayoutData(radioBtnNewPatientGD);

    Button radioButtonSearch = new Button(newPatientGroup, SWT.RADIO);
    radioButtonSearch.setText("Search");
    GridData radioBtnSearchGD = new GridData();
    radioBtnSearchGD.horizontalSpan = 2;
    radioButtonSearch.setLayoutData(radioBtnSearchGD);

    Label lblName = new Label(newPatientGroup, SWT.NONE);
    lblName.setText("Name");
    GridData lblNameGD = new GridData();
    lblNameGD.horizontalSpan = 3;
    lblNameGD.verticalIndent = 5;
    lblName.setLayoutData(lblNameGD);

    Label lblId = new Label(newPatientGroup, SWT.NONE);
    lblId.setText("ID");
    GridData lblIdGD = new GridData();
    lblIdGD.horizontalSpan = 1;
    lblIdGD.verticalIndent = 5;
    lblId.setLayoutData(lblIdGD);

    textName = new Text(newPatientGroup, SWT.BORDER);
    GridData txtNameGD = new GridData(GridData.FILL_HORIZONTAL);
    txtNameGD.horizontalSpan = 3;
    txtNameGD.grabExcessHorizontalSpace = true;
    textName.setLayoutData(txtNameGD);

    textID = new Text(newPatientGroup, SWT.BORDER);
    GridData txtIDGD = new GridData(GridData.FILL_HORIZONTAL);
    txtIDGD.grabExcessHorizontalSpace = true;
    textID.setLayoutData(txtIDGD);

    Label lblStudyType = new Label(newPatientGroup, SWT.NONE);
    lblStudyType.setText("Study Type:");
    GridData lblStudyTypeGD = new GridData();
    lblStudyTypeGD.verticalIndent = 5;
    lblStudyType.setLayoutData(lblStudyTypeGD);

    final Combo selectStudyTypeForSearchingCombo = new Combo(newPatientGroup, SWT.READ_ONLY);
    GridData selectStudyTypeForSearchingComboGD = new GridData(GridData.FILL_HORIZONTAL);
    selectStudyTypeForSearchingComboGD.horizontalSpan = 2;
    selectStudyTypeForSearchingComboGD.verticalIndent = 5;
    selectStudyTypeForSearchingComboGD.grabExcessHorizontalSpace = true;
    selectStudyTypeForSearchingCombo.setLayoutData(selectStudyTypeForSearchingComboGD);

    final Button buttonSaveSearch = new Button(newPatientGroup, SWT.NONE);
    GridData buttonSaveSearchGD = new GridData(GridData.FILL_HORIZONTAL);
    buttonSaveSearchGD.horizontalSpan = 1;
    buttonSaveSearchGD.verticalIndent = 5;
    buttonSaveSearchGD.grabExcessHorizontalSpace = true;
    buttonSaveSearch.setLayoutData(buttonSaveSearchGD);
    buttonSaveSearch.setText("Save");

    // search result components
    final TableViewer tableViewer =
        new TableViewer(newPatientGroup, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewer.setColumnProperties(new String[] {"Name", "ID"});
    Table table = tableViewer.getTable();
    GridData tableGD = new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    tableGD.grabExcessHorizontalSpace = true;
    tableGD.horizontalSpan = 4;
    tableGD.verticalIndent = 10;
    tableGD.heightHint = 125;
    table.setLayoutData(tableGD);

    // select study combo
    Label lblSelectStudy = new Label(newPatientGroup, SWT.NONE);
    lblSelectStudy.setText("Select Study");
    GridData lblSelectStudyGD = new GridData();
    lblSelectStudyGD.verticalIndent = 5;
    lblSelectStudy.setLayoutData(lblSelectStudyGD);

    final ComboViewer selectStudyFromSearchResultsComboViewer =
        new ComboViewer(newPatientGroup, SWT.READ_ONLY);
    GridData selectStudyFromSearchResultsComboViewerGD = new GridData(GridData.FILL_HORIZONTAL);
    selectStudyFromSearchResultsComboViewerGD.horizontalSpan = 3;
    selectStudyFromSearchResultsComboViewerGD.verticalIndent = 5;
    selectStudyFromSearchResultsComboViewerGD.grabExcessHorizontalSpace = true;
    selectStudyFromSearchResultsComboViewer
        .getControl()
        .setLayoutData(selectStudyFromSearchResultsComboViewerGD);

    // select series combo
    Label lblSelectSeries = new Label(newPatientGroup, SWT.NONE);
    lblSelectSeries.setText("Select Series");
    GridData lblSelectSeriesGD = new GridData();
    lblSelectSeriesGD.verticalIndent = 5;
    lblSelectSeries.setLayoutData(lblSelectSeriesGD);

    final ComboViewer selectSeriesComboViewer = new ComboViewer(newPatientGroup, SWT.READ_ONLY);
    GridData selectSeriesComboViewerGD = new GridData(GridData.FILL_HORIZONTAL);
    selectSeriesComboViewerGD.horizontalSpan = 3;
    selectSeriesComboViewerGD.verticalIndent = 5;
    selectSeriesComboViewerGD.grabExcessHorizontalSpace = true;
    selectSeriesComboViewer.getCombo().setLayoutData(selectSeriesComboViewerGD);

    // new study controls
    Group newStudyGroup = new Group(newPatientVisitComposite, SWT.NULL);
    newStudyGroup.setText("New Study");
    GridLayout newStudyGroupGL = new GridLayout(4, true);
    newStudyGroup.setLayout(newStudyGroupGL);
    GridData newStudyGroupGD = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    newStudyGroupGD.verticalIndent = 10;
    newStudyGroup.setLayoutData(newStudyGroupGD);

    Label lblNewStudyName = new Label(newStudyGroup, SWT.NONE);
    lblNewStudyName.setText("Study Name");
    GridData lblNewStudyNameGD = new GridData();
    lblNewStudyNameGD.verticalIndent = 5;
    lblNewStudyName.setLayoutData(lblNewStudyNameGD);

    final Text newStudyNameText = new Text(newStudyGroup, SWT.BORDER);
    GridData newStudyNameTextGD = new GridData(GridData.FILL_HORIZONTAL);
    newStudyNameTextGD.horizontalSpan = 3;
    newStudyNameTextGD.verticalIndent = 5;
    newStudyNameTextGD.grabExcessHorizontalSpace = true;
    newStudyNameText.setLayoutData(newStudyNameTextGD);

    Label lblNewStudyType = new Label(newStudyGroup, SWT.NONE);
    lblNewStudyType.setText("Study Type:");
    GridData lblNewStudyTypeGD = new GridData();
    lblNewStudyTypeGD.verticalIndent = 5;
    lblNewStudyType.setLayoutData(lblNewStudyTypeGD);

    final Combo selectNewStudyTypeCombo = new Combo(newStudyGroup, SWT.READ_ONLY);
    GridData selectNewStudyTypeComboGD = new GridData(GridData.FILL_HORIZONTAL);
    selectNewStudyTypeComboGD.horizontalSpan = 2;
    selectNewStudyTypeComboGD.verticalIndent = 5;
    selectNewStudyTypeComboGD.grabExcessHorizontalSpace = true;
    selectNewStudyTypeCombo.setLayoutData(selectNewStudyTypeComboGD);

    final DateTime newStudyDateTimeDate =
        new DateTime(newStudyGroup, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN);
    GridData dateTimeDateGD = new GridData(GridData.FILL_HORIZONTAL);
    dateTimeDateGD.grabExcessHorizontalSpace = true;
    dateTimeDateGD.verticalIndent = 5;
    newStudyDateTimeDate.setLayoutData(dateTimeDateGD);

    final Button btnSaveStudy = new Button(newStudyGroup, SWT.NONE);
    GridData btnSaveStudyGD = new GridData(GridData.FILL_HORIZONTAL);
    btnSaveStudyGD.horizontalSpan = 1;
    btnSaveStudyGD.verticalIndent = 5;
    btnSaveStudyGD.grabExcessHorizontalSpace = true;
    btnSaveStudy.setLayoutData(btnSaveStudyGD);
    btnSaveStudy.setText("Save Study");

    // new series controls
    Group newSeriesGroup = new Group(newPatientVisitComposite, SWT.NULL);
    newSeriesGroup.setText("New Series");
    GridLayout newSeriesGroupGL = new GridLayout(4, true);
    newSeriesGroup.setLayout(newSeriesGroupGL);
    GridData newSeriesGroupGD = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
    newSeriesGroupGD.verticalIndent = 10;
    newSeriesGroup.setLayoutData(newSeriesGroupGD);

    Label lblNewSeriesName = new Label(newSeriesGroup, SWT.NONE);
    lblNewSeriesName.setText("Series Name");
    GridData lblNewSeriesNameGD = new GridData();
    lblNewSeriesNameGD.verticalIndent = 5;
    lblNewSeriesName.setLayoutData(lblNewSeriesNameGD);

    final Text newSeriesNameText = new Text(newSeriesGroup, SWT.BORDER);
    GridData newSeriesNameTextGD = new GridData(GridData.FILL_HORIZONTAL);
    newSeriesNameTextGD.horizontalSpan = 3;
    newSeriesNameTextGD.verticalIndent = 5;
    newSeriesNameTextGD.grabExcessHorizontalSpace = true;
    newSeriesNameText.setLayoutData(newSeriesNameTextGD);

    Label lblNewSeriesTime = new Label(newSeriesGroup, SWT.NONE);
    lblNewSeriesTime.setText("Series Date Time");
    GridData lblNewSeriesTimeGD = new GridData();
    lblNewSeriesTimeGD.verticalIndent = 5;
    lblNewSeriesTime.setLayoutData(lblNewSeriesTimeGD);

    final DateTime newSeriesDateTimeDate =
        new DateTime(newSeriesGroup, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN);
    GridData seriesDateGD = new GridData();
    seriesDateGD.horizontalSpan = 1;
    //		seriesDateGD.grabExcessHorizontalSpace = true;
    seriesDateGD.verticalIndent = 5;
    newSeriesDateTimeDate.setLayoutData(seriesDateGD);

    final DateTime newSeriesDateTimeTime =
        new DateTime(newSeriesGroup, SWT.BORDER | SWT.TIME | SWT.DROP_DOWN);
    GridData seriesTimeGD = new GridData();
    seriesTimeGD.horizontalSpan = 1;
    //		seriesTimeGD.grabExcessHorizontalSpace = true;
    seriesTimeGD.verticalIndent = 5;
    newSeriesDateTimeTime.setLayoutData(seriesTimeGD);

    Label placeHolder = new Label(newSeriesGroup, SWT.NONE);
    GridData placeHolderGD = new GridData(GridData.FILL_HORIZONTAL);
    placeHolderGD.horizontalSpan = 1;
    placeHolderGD.grabExcessHorizontalSpace = true;
    placeHolder.setLayoutData(placeHolderGD);

    Label lblNewSeriesDescription = new Label(newSeriesGroup, SWT.NONE);
    lblNewSeriesDescription.setText("Series Description");
    GridData lblNewSeriesDescriptionGD = new GridData();
    lblNewSeriesDescriptionGD.grabExcessVerticalSpace = true;
    lblNewSeriesDescriptionGD.verticalSpan = 15;
    lblNewSeriesDescriptionGD.verticalAlignment = SWT.BEGINNING;
    lblNewSeriesDescriptionGD.verticalIndent = 5;
    lblNewSeriesDescription.setLayoutData(lblNewSeriesDescriptionGD);

    final Text newSeriesNameDescription =
        new Text(newSeriesGroup, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
    GridData newSeriesNameDescriptionGD =
        new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL);
    newSeriesNameDescriptionGD.horizontalSpan = 3;
    newSeriesNameDescriptionGD.verticalIndent = 5;
    newSeriesNameDescriptionGD.verticalSpan = 15;
    newSeriesNameDescriptionGD.grabExcessHorizontalSpace = true;
    newSeriesNameDescription.setLayoutData(newSeriesNameDescriptionGD);

    Label lblPhotosLocation = new Label(newSeriesGroup, SWT.NONE);
    lblPhotosLocation.setText("Photos Location");
    GridData lblPhotosLocationGD = new GridData();
    lblPhotosLocationGD.horizontalSpan = 1;
    lblPhotosLocationGD.verticalIndent = 5;
    lblPhotosLocation.setLayoutData(lblPhotosLocationGD);

    final Text textPhotosLocation = new Text(newSeriesGroup, SWT.BORDER);
    GridData textPhotosLocationGD = new GridData(GridData.FILL_HORIZONTAL);
    textPhotosLocationGD.horizontalSpan = 1;
    textPhotosLocationGD.verticalIndent = 5;
    textPhotosLocationGD.grabExcessHorizontalSpace = true;
    textPhotosLocation.setLayoutData(textPhotosLocationGD);

    final Button buttonBrowse = new Button(newSeriesGroup, SWT.NONE);
    GridData btnBrowseGD = new GridData(GridData.FILL_HORIZONTAL);
    btnBrowseGD.horizontalSpan = 1;
    btnBrowseGD.verticalIndent = 5;
    btnBrowseGD.grabExcessHorizontalSpace = true;
    buttonBrowse.setLayoutData(btnBrowseGD);
    buttonBrowse.setText("Browse");

    final Button buttonLoad = new Button(newSeriesGroup, SWT.NONE);
    GridData btnLoadGD = new GridData(GridData.FILL_HORIZONTAL);
    btnLoadGD.horizontalSpan = 1;
    btnLoadGD.verticalIndent = 5;
    btnLoadGD.grabExcessHorizontalSpace = true;
    buttonLoad.setLayoutData(btnLoadGD);
    buttonLoad.setText("Load");

    final Button buttnoSaveSeries = new Button(newSeriesGroup, SWT.NONE);
    GridData btnSaveSeriesGD = new GridData(GridData.FILL_HORIZONTAL);
    btnSaveSeriesGD.horizontalSpan = 1;
    btnSaveSeriesGD.verticalIndent = 5;
    btnSaveSeriesGD.grabExcessHorizontalSpace = true;
    buttnoSaveSeries.setLayoutData(btnSaveSeriesGD);
    buttnoSaveSeries.setText("Save Series");

    // set defaults
    radioButtonNewPatient.setSelection(true);
    selectStudyTypeForSearchingCombo.setEnabled(false);
    tableViewer.getTable().setEnabled(false);
    selectStudyFromSearchResultsComboViewer.getControl().setEnabled(false);
    selectSeriesComboViewer.getControl().setEnabled(false);

    // set size
    Point size = newPatientVisitComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    scrolledComposite.setMinSize(size);
    scrolledComposite.setContent(newPatientVisitComposite);
    scrolledComposite.layout(true);

    scrolledComposite.addListener(
        SWT.Activate,
        new Listener() {
          public void handleEvent(Event e) {
            scrolledComposite.setFocus();
          }
        });

    final IPatientService pService =
        (IPatientService) PlatformUI.getWorkbench().getService(IPatientService.class);

    // browse button clicked
    buttonBrowse.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final FileDialog dialog = new FileDialog(getSite().getShell(), SWT.OPEN | SWT.MULTI);
            final String lastSelectedFilePath = dialog.open();
            // create the structure for files
            Display.getDefault()
                .asyncExec(
                    new Runnable() {
                      @Override
                      public void run() {
                        String[] selectedFileNames = dialog.getFileNames();
                        if (selectedFileNames != null && selectedFileNames.length > 0) {
                          textPhotosLocation.setText(lastSelectedFilePath);
                          String dirName =
                              lastSelectedFilePath.substring(
                                  0, lastSelectedFilePath.lastIndexOf(File.separator) + 1);
                          if (loadedPhotosList != null) {
                            loadedPhotosList.clear();
                          } else {
                            loadedPhotosList = new ArrayList<String>();
                          }
                          for (String selectedFileName : selectedFileNames) {
                            loadedPhotosList.add(dirName.concat(selectedFileName));
                          }
                        }
                      }
                    });
          }
        });

    // load button clicked
    buttonLoad.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            loadPhotos();
          }
        });

    // save radio selected
    radioButtonNewPatient.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            selectStudyTypeForSearchingCombo.setEnabled(false);
            tableViewer.getTable().setEnabled(false);
            selectStudyFromSearchResultsComboViewer.getControl().setEnabled(false);
            selectSeriesComboViewer.getControl().setEnabled(false);
            buttonSaveSearch.setText("Save");
          }
        });

    // search radio selected
    radioButtonSearch.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            selectStudyTypeForSearchingCombo.setEnabled(true);
            tableViewer.getTable().setEnabled(true);
            selectStudyFromSearchResultsComboViewer.getControl().setEnabled(true);
            selectSeriesComboViewer.getControl().setEnabled(true);
            buttonSaveSearch.setText("Search");
          }
        });

    buttonSaveSearch.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            if (buttonSaveSearch.getText().equals("Save")) {
              String newPatientName = textName.getText();
              String ID = textID.getText();

              if (newPatientName == null || "".equals(newPatientName)) {
                Util.showMessage("Name can't be empty!");
                return;
              }

              if (ID == null || "".equals(ID)) {
                ID = String.valueOf(UUID.randomUUID().getMostSignificantBits());
              }

              IPatient newPatient = PatientFactory.getInstance().create(ID, newPatientName, null);

              //					IPatientService pservice = Activator.getDefault().getPatientService();
              if (pService != null) {
                IStatus status = null;
                try {
                  status = pService.saveNewPatient(newPatient);
                } catch (IOException e1) {
                  e1.printStackTrace();
                }

                if (status == Status.OK_STATUS) {
                  //							StatusLineContribution slc = (StatusLineContribution)
                  // Activator.getDefault().getStatusItem();
                  //							slc.setText("Active Patient : " + newPatient.getName());
                  //							slc.setVisible(true);
                  updateStatus("Active Patient : " + newPatient.getName());

                  activePatient = newPatient;

                  textName.setText("");
                  textID.setText("");

                } else {
                  // XXX log
                }
              } else {
                Util.showMessage("Patient service is null :-(");
              }
            } else {
              String searchName = textName.getText();
              String searchID = textID.getText();
              //					IPatientService pService = Activator.getDefault().getPatientService();

              try {
                List<IPatient> patientSearchResults = pService.searchPatients(searchName, searchID);

                if (patientSearchResults != null) {

                  tableViewer.setContentProvider(new ArrayContentProvider());
                  tableViewer.getTable().setLinesVisible(true);
                  tableViewer.getTable().setHeaderVisible(true);
                  // create columns
                  createPatientColumns(tableViewer);

                  // set input
                  tableViewer.setInput(patientSearchResults);

                  tableViewer.refresh();
                } else {
                  // XXX log and inform user null was returned
                }
              } catch (Exception e1) {
                //						StatusLineContribution slc = (StatusLineContribution)
                // Activator.getDefault().getStatusItem();
                //						slc.setText("Active Patient : " + e1.getMessage());
                //						slc.setVisible(true);
                updateStatus("Active Patient : " + e1.getMessage());
              }
            }
          }
        });

    btnSaveStudy.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            IStudy newStudy = StudyFactory.getInstance().create(null);
            newStudy.setStudyName(newStudyNameText.getText());

            // get selected date for new study
            Calendar calendar = Calendar.getInstance();
            calendar.set(Calendar.DAY_OF_MONTH, newStudyDateTimeDate.getDay());
            calendar.set(Calendar.MONTH, newStudyDateTimeDate.getMonth());
            calendar.set(Calendar.YEAR, newStudyDateTimeDate.getYear());

            Date studyDate = calendar.getTime();

            newStudy.setStudyDate(studyDate);
            newStudy.setStudyType(selectNewStudyTypeCombo.getText());
            newStudy.setPatientID(activePatient.getId());
            newStudy.setNumberOfSeries((Integer) 0);
            newStudy.setStudyID(String.valueOf(UUID.randomUUID().getLeastSignificantBits()));

            //				IPatientService pService = Activator.getDefault().getPatientService();
            IStatus status = null;
            try {
              status = pService.saveNewStudy(newStudy);
            } catch (IOException e1) {
              e1.printStackTrace();
            }

            if (status == Status.OK_STATUS) {
              activeStudy = newStudy;

              String statusLineText =
                  "Active Patient : "
                      + activePatient.getName()
                      + " Active Study : "
                      + activeStudy.toString();

              updateStatus(statusLineText);

              //					StatusLineContribution slc = (StatusLineContribution)
              // Activator.getDefault().getStatusItem();
              //					slc.setText(statusLineText);
              //					slc.setVisible(true);

              newStudyNameText.setText("");
              selectNewStudyTypeCombo.clearSelection();
            } else {
              // XXX log
            }
          }
        });

    buttnoSaveSeries.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {

            ISeries newSeries = SeriesFactory.getInstance().create(null);
            newSeries.setSeriesName(newSeriesNameText.getText());
            newSeries.setNotes(newSeriesNameDescription.getText());
            newSeries.setParentStudyID("");
            newSeries.setPhotos(selectedPhotosFilesList);
            newSeries.setSeriesID(String.valueOf(UUID.randomUUID().getMostSignificantBits()));
            newSeries.setParentStudyID(activeStudy.getStudyID());

            // get selected date for new study
            Calendar calendar = Calendar.getInstance();
            //				calendar.set(Calendar.DAY_OF_MONTH, newSeriesDateTimeTime.getDay());
            //				calendar.set(Calendar.MONTH, newSeriesDateTimeTime.getMonth());
            //				calendar.set(Calendar.YEAR, newSeriesDateTimeTime.getYear());

            calendar.set(Calendar.DAY_OF_MONTH, newSeriesDateTimeDate.getDay());
            calendar.set(Calendar.MONTH, newSeriesDateTimeDate.getMonth());
            calendar.set(Calendar.YEAR, newSeriesDateTimeDate.getYear());

            calendar.set(Calendar.HOUR_OF_DAY, newSeriesDateTimeTime.getHours());
            calendar.set(Calendar.MINUTE, newSeriesDateTimeTime.getMinutes());
            calendar.set(Calendar.SECOND, newSeriesDateTimeTime.getSeconds());

            newSeries.setSeriesTime(calendar.getTime());

            //				IPatientService pService = Activator.getDefault().getPatientService();
            IStatus status = null;
            try {
              status = pService.saveNewSeries(newSeries);
            } catch (IOException e1) {
              e1.printStackTrace();
            }

            if (status == Status.OK_STATUS) {
              // clear UI fileds
              newSeriesNameText.setText("");
              newSeriesNameDescription.setText("");
              textPhotosLocation.setText("");

            } else {
              // XXX log
            }
          };
        });

    tableViewer
        .getTable()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                StructuredSelection selection = (StructuredSelection) tableViewer.getSelection();
                if (selection.getFirstElement() instanceof IPatient) {
                  IPatient selectedPatient = (IPatient) selection.getFirstElement();

                  activePatient = selectedPatient;

                  //					StatusLineContribution slc = (StatusLineContribution)
                  // Activator.getDefault().getStatusItem();
                  //					slc.setText("Active Patient : " + activePatient.getName());
                  //					slc.setVisible(true);

                  updateStatus("Active Patient : " + activePatient.getName());

                  selectSeriesComboViewer.getCombo().clearSelection();
                  selectSeriesComboViewer.getCombo().removeAll();

                  // get all studies of this patient
                  //					IPatientService pService = Activator.getDefault().getPatientService();
                  try {
                    List<IStudy> studiesForSelectedpatient =
                        pService.getStudiesForPatient(selectedPatient);
                    selectStudyFromSearchResultsComboViewer.setContentProvider(
                        ArrayContentProvider.getInstance());
                    selectStudyFromSearchResultsComboViewer.setLabelProvider(
                        new LabelProvider() {
                          public String getText(Object element) {
                            return ((IStudy) element).toString();
                          };
                        });
                    selectStudyFromSearchResultsComboViewer.setInput(studiesForSelectedpatient);
                  } catch (Exception e1) {
                    updateStatus(e1.getMessage());
                    //						slc.setText(e1.getMessage());
                    //						slc.setVisible(true);
                  }
                }
              }
            });

    selectStudyFromSearchResultsComboViewer
        .getCombo()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                StructuredSelection selection =
                    (StructuredSelection) selectStudyFromSearchResultsComboViewer.getSelection();
                if (selection.getFirstElement() instanceof IStudy) {
                  IStudy selectedStudy = (IStudy) selection.getFirstElement();
                  activeStudy = selectedStudy;
                  //					StatusLineContribution slc = (StatusLineContribution)
                  // Activator.getDefault().getStatusItem();
                  //					slc.setText("Active Patient : " + activePatient.getName() +
                  //								  " Active Study : " + activeStudy.toString());
                  //					slc.setVisible(true);
                  updateStatus(
                      "Active Patient : "
                          + activePatient.getName()
                          + " Active Study : "
                          + activeStudy.toString());

                  // get all series for this study
                  //					IPatientService pService = Activator.getDefault().getPatientService();
                  try {
                    List<ISeries> seriesForSelectedStudy =
                        pService.getSeriesForStudy(selectedStudy);
                    selectSeriesComboViewer.setContentProvider(ArrayContentProvider.getInstance());
                    selectSeriesComboViewer.setLabelProvider(
                        new LabelProvider() {
                          public String getText(Object element) {
                            return ((ISeries) element).toString();
                          };
                        });
                    selectSeriesComboViewer.setInput(seriesForSelectedStudy);
                    selectSeriesComboViewer.refresh();
                  } catch (Exception e1) {
                    //						slc.setText(e1.getMessage());
                    updateStatus(e1.getMessage());
                  }
                }
              }
            });

    selectSeriesComboViewer
        .getCombo()
        .addSelectionListener(
            new SelectionAdapter() {
              @Override
              public void widgetSelected(SelectionEvent e) {
                StructuredSelection selection =
                    (StructuredSelection) selectSeriesComboViewer.getSelection();
                if (selection.getFirstElement() instanceof ISeries) {
                  ISeries selectedSeries = (ISeries) selection.getFirstElement();

                  if (loadedPhotosList != null) {
                    loadedPhotosList.clear();
                  } else {
                    loadedPhotosList = new ArrayList<String>();
                  }

                  // load photos for selected series
                  for (Object selectedFileName : selectedSeries.getPhotos()) {
                    loadedPhotosList.add(selectedFileName.toString());
                  }
                  loadPhotos();
                }
              }
            });
  }