Exemplo n.º 1
0
  /** Leert die Anzeige. Wird beim Wechsel von einem Dialog auf den naechsten aufgerufen. */
  protected void cleanContent() {
    if (content != null && !content.isDisposed()) content.dispose();

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

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

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

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

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

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

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

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

    // General
    createGeneralGroup(container);

    // SSL
    createSSLGroup(container);

    // HA
    createHAGroup(container);

    // LWT
    createLWTGroup(container);

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

    setControl(scrolledContainer);
  }
  private void createControlsPanel(Composite theParent) {
    ScrolledComposite scroller =
        new ScrolledComposite(theParent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);

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

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

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

    createResolveAttributePanel(controlsGroup);
    createResolveSqlPanel(controlsGroup);

    scroller.setContent(controlsGroup);
  }
Exemplo n.º 4
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);
  }
  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;
  }
  @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);
  }
Exemplo n.º 7
0
  @PostConstruct
  public void createComposite(final Composite parent) {

    final ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrollBox.setLocation(0, 0);
    scrollBox.setMinHeight(300);
    scrollBox.setMinWidth(700);

    scrollBox.setExpandHorizontal(true);
    scrollBox.setExpandVertical(true);

    mParent = new Composite(scrollBox, SWT.NONE);
    mParent.getShell().setSize(760, 360);

    m_RiskModel = DataFromServer.listRiskASKTableModel;
    m_Model = DataFromServer.listControlRiskASKTableModel;
    m_Row = NewASKTable1.clickedRiskRow;
    dB = new DataFromDatabase();

    m_RiskId = m_RiskModel.getContentAt(1, m_Row).toString();

    riskName = dB.getDesiredColumnFromDB("view_risk", "name", "WHERE risk_id='" + m_RiskId + "'");

    m_AssetId =
        dB.getDesiredColumnFromDB("view_risk", "asset_id", "WHERE risk_id='" + m_RiskId + "'");
    m_VulnerabilityId =
        dB.getDesiredColumnFromDB(
            "view_risk", "vulnerability_id", "WHERE risk_id='" + m_RiskId + "'");
    m_ThreatId =
        dB.getDesiredColumnFromDB("view_risk", "threat_id", "WHERE risk_id='" + m_RiskId + "'");

    mParent.getShell().setText("Analiza mjera(kontrola) za rizik: " + riskName.toUpperCase() + "");
    mParent.setLayout(new GridLayout(1, false));

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

    Label lblKontrola_ = new Label(composite, SWT.NONE);
    lblKontrola_.setText("Kontrola:");

    comboKontrola_ = new Combo(composite, SWT.READ_ONLY);
    comboKontrola_.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Label lblPrijedlog_ = new Label(composite, SWT.NONE);
    lblPrijedlog_.setText("Prijedlog:");
    new Label(composite, SWT.NONE);

    textPrimjena_ = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
    GridData gd_Primjena_ = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 2);
    gd_Primjena_.heightHint = 50;
    textPrimjena_.setLayoutData(gd_Primjena_);

    Composite compositeASKTtable = new Composite(mParent, SWT.NONE);
    compositeASKTtable.setLayout(new FillLayout(SWT.HORIZONTAL));
    GridData gd_compositeASKTtable = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd_compositeASKTtable.minimumHeight = 150;
    gd_compositeASKTtable.heightHint = 107;
    compositeASKTtable.setLayoutData(gd_compositeASKTtable);

    table =
        new NewASKTable1(
            this, compositeASKTtable, new ListControlRiskASKTableModel(m_RiskId), 717, 200);
    //		new ASKTable(compositeASKTtable, new ControlsAnalysisASKTableModel(),
    // 717,compositeASKTtable.getBounds().height );

    Composite compositeButtons_ = new Composite(mParent, SWT.NONE);
    GridData gd_compositeButtons_ = new GridData(SWT.RIGHT, SWT.FILL, true, false, 2, 1);
    gd_compositeButtons_.heightHint = 42;
    gd_compositeButtons_.horizontalIndent = 10;
    gd_compositeButtons_.widthHint = 530;
    compositeButtons_.setLayoutData(gd_compositeButtons_);
    compositeButtons_.setLayout(new GridLayout(5, false));

    Button btnSpremi_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnSpremi_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnSpremi_.widthHint = 100;
    btnSpremi_.setLayoutData(gd_btnSpremi_);
    btnSpremi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            saveAction();
            // action=1;
          }
        });
    btnSpremi_.setText("Spremi");

    Button btnEvidKontrola_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnEvidKontrola_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnEvidKontrola_.widthHint = 100;
    btnEvidKontrola_.setLayoutData(gd_btnEvidKontrola_);
    btnEvidKontrola_.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            final MWindow window = MBasicFactory.INSTANCE.createWindow();
            MPart part = MBasicFactory.INSTANCE.createPart();
            part.setContributionURI("bundleclass://hr.ante.isms/hr.ante.isms.parts.Controls");
            part.setCloseable(true);
            window.getChildren().add(part);

            app.getChildren().add(window);
          }
        });
    btnEvidKontrola_.setText("Evid. Kontrola");

    btnNovo_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnNovo_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnNovo_.widthHint = 100;
    btnNovo_.setLayoutData(gd_btnNovo_);
    btnNovo_.addSelectionListener(
        new SelectionAdapter() {
          @Override
          public void widgetSelected(SelectionEvent e) {
            m_ControlRiskId = null;
            fillForm();
          }
        });
    btnNovo_.setText("Novo");

    btnBrisi_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnBrisi_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnBrisi_.widthHint = 100;
    btnBrisi_.setLayoutData(gd_btnBrisi_);
    btnBrisi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            boolean confirm =
                Dialog.isConfirmed(
                    "Je ste li sigurni da želite obrisati podatak?", "Podatak æe biti obrisan");

            if (confirm) {
              try {
                dB.deleteDataFromDB("as_control_risk", "ascontrolrisk_id", m_ControlRiskId);
                fillForm();
                refreshTable();

              } catch (Exception e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              }
            }
          }
        });
    btnBrisi_.setText("Briši");

    Button btnIzlaz_ = new Button(compositeButtons_, SWT.NONE);
    GridData gd_btnIzlaz_ = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_btnIzlaz_.widthHint = 100;
    btnIzlaz_.setLayoutData(gd_btnIzlaz_);
    btnIzlaz_.setText("Izlaz");
    btnIzlaz_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            mParent.getShell().close();
          }
        });

    fillForm();
    scrollBox.setContent(mParent);
    mParent.getShell().setDefaultButton(btnSpremi_);
  }
Exemplo n.º 8
0
  @PostConstruct
  public void createComposite(final Composite parent, IEclipseContext context) {

    final ScrolledComposite scrollBox = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
    scrollBox.setMinHeight(349);
    scrollBox.setMinWidth(650);

    scrollBox.setExpandHorizontal(true);
    scrollBox.setExpandVertical(true);

    mParent = new Composite(scrollBox, SWT.NONE);
    parent.getShell().setSize(759, 389);

    FormLayout layout = new FormLayout();
    layout.marginWidth = 5;
    layout.marginHeight = 5;
    mParent.setLayout(layout);

    parent.getShell().setText("Unesi novu imovinu");

    m_Table = NewASKTable1.m_TableAsset;
    m_Model = DataFromServer.listAssetASKTableModel;
    m_Row = NewASKTable1.clickedAssetRow;
    dB = new DataFromDatabase();

    Composite compositeLeft = new Composite(mParent, SWT.NONE);
    compositeLeft.setLayout(new FormLayout());
    compositeLeft.setBounds(5, 10, 392, 299);

    Label lblNaziv_ = new Label(compositeLeft, SWT.NONE);
    lblNaziv_.setText("Naziv:");

    textNaziv_ = new Text(compositeLeft, SWT.BORDER);

    Label lblKategorija_ = new Label(compositeLeft, SWT.NONE);
    lblKategorija_.setText("Kategorija:");

    comboKateg_ = new Combo(compositeLeft, SWT.READ_ONLY);
    comboPodkateg_ = new Combo(compositeLeft, SWT.READ_ONLY);
    comboPodkateg_.setEnabled(false);

    Label lblPodkateg_ = new Label(compositeLeft, SWT.NONE);
    lblPodkateg_.setText("Podkategorija:");

    Label lblNoisteljorgjed_ = new Label(compositeLeft, SWT.NONE);
    lblNoisteljorgjed_.setText("Nositelj (org.jed.):");

    comboNoisteljorgjed_ = new Combo(compositeLeft, SWT.NONE);

    textOpis_ = new Text(compositeLeft, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);

    Label lblOpis_ = new Label(compositeLeft, SWT.NONE);
    lblOpis_.setText("Opis:");

    Group grpVanostImovine = new Group(mParent, SWT.NONE);
    grpVanostImovine.setText("Va\u017Enost Imovine");
    grpVanostImovine.setLocation(413, 10);
    grpVanostImovine.setSize(328, 253);

    Label lblPovjerljivost_ = new Label(grpVanostImovine, SWT.NONE);
    lblPovjerljivost_.setLocation(15, 43);
    lblPovjerljivost_.setSize(73, 13);
    lblPovjerljivost_.setText("Povjerljivost:");

    comboPovjerljivost_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboPovjerljivost_.setLocation(90, 40);
    comboPovjerljivost_.setSize(180, 21);

    Label lblCjelovitost = new Label(grpVanostImovine, SWT.NONE);
    lblCjelovitost.setLocation(15, 73);
    lblCjelovitost.setSize(65, 13);
    lblCjelovitost.setText("Cjelovitost:");

    comboCjelovitost_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboCjelovitost_.setLocation(90, 70);
    comboCjelovitost_.setSize(180, 21);

    Label lblRaspoloivost_ = new Label(grpVanostImovine, SWT.NONE);
    lblRaspoloivost_.setLocation(15, 103);
    lblRaspoloivost_.setSize(73, 13);
    lblRaspoloivost_.setText("Raspolo\u017Eivost:");

    comboRaspolozivost_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboRaspolozivost_.setLocation(90, 100);
    comboRaspolozivost_.setSize(180, 21);

    Label lblBi_ = new Label(grpVanostImovine, SWT.NONE);
    lblBi_.setLocation(15, 133);
    lblBi_.setSize(65, 13);
    lblBi_.setText("P. Utjecaj:");

    comboBi_ = new Combo(grpVanostImovine, SWT.READ_ONLY);
    comboBi_.setLocation(90, 130);
    comboBi_.setSize(180, 21);

    Label lblObjanjenjeostalo_ = new Label(grpVanostImovine, SWT.NONE);
    lblObjanjenjeostalo_.setText("Obja\u0161njenje (Poslovni utjecaj):");
    lblObjanjenjeostalo_.setBounds(15, 163, 165, 13);

    textObjanjenjeostalo_ = new Text(grpVanostImovine, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
    textObjanjenjeostalo_.setBounds(10, 180, 308, 92);

    Button btnDescriptionPov_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionPov_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionPov_.setBounds(276, 40, 42, 23);
    btnDescriptionPov_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 1);
          }
        });

    Button btnDescriptionCje_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionCje_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionCje_.setBounds(276, 70, 42, 23);
    btnDescriptionCje_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 2);
          }
        });

    Button btnDescriptionRas_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionRas_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionRas_.setBounds(276, 100, 42, 23);
    btnDescriptionRas_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 3);
          }
        });

    Button btnDescriptionBi_ = new Button(grpVanostImovine, SWT.NONE);
    btnDescriptionBi_.setImage(
        ResourceManager.getPluginImage("hr.ante.isms", "src/icons/gnome_dialog_question (1).png"));
    btnDescriptionBi_.setBounds(276, 130, 42, 23);
    btnDescriptionBi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            new HelpDialog(mParent.getShell(), 4);
          }
        });

    Composite compositeButtons_ = new Composite(mParent, SWT.NONE);
    compositeButtons_.setBounds(506, 315, 235, 33);
    compositeButtons_.setLayout(new GridLayout(2, false));

    Button btnSpremi_ = new Button(compositeButtons_, SWT.NONE);
    btnSpremi_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            // TODO Auto-generated method stub
            //				dirty.setDirty(true);
            saveAction();
            if (m_Row != 0) mParent.getShell().close();
            action = 1;
          }
        });
    GridData gd_btnSpremi_ = new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1);
    gd_btnSpremi_.widthHint = 100;
    btnSpremi_.setText("Spremi");
    btnSpremi_.setLayoutData(gd_btnSpremi_);

    Button btnIzlaz_ = new Button(compositeButtons_, SWT.CENTER);
    GridData gd_btnIzlaz_ = new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1);
    gd_btnIzlaz_.widthHint = 100;
    btnIzlaz_.setLayoutData(gd_btnIzlaz_);
    btnIzlaz_.setLayoutData(gd_btnIzlaz_);
    btnIzlaz_.setText("Izlaz");
    btnIzlaz_.addSelectionListener(
        new SelectionAdapter() {

          @Override
          public void widgetSelected(SelectionEvent e) {
            mParent.getShell().close();
          }
        });

    // **********compositeLeft layout
    FormData co_compositeLeft = new FormData();
    co_compositeLeft.right = new FormAttachment(grpVanostImovine, -15);
    co_compositeLeft.left = new FormAttachment(0);
    co_compositeLeft.bottom = new FormAttachment(90, 0);
    co_compositeLeft.top = new FormAttachment(0);
    compositeLeft.setLayoutData(co_compositeLeft);

    // **********lblNaziv_ layout
    FormData data = new FormData();
    data.right = new FormAttachment(0, 50);
    data.top = new FormAttachment(0, 13);
    data.left = new FormAttachment(0, 15);
    lblNaziv_.setLayoutData(data);

    // ************textNaziv_ layout
    FormData data1 = new FormData();
    data1.right = new FormAttachment(100, -5);
    data1.top = new FormAttachment(0, 10);
    data1.left = new FormAttachment(0, 125);
    textNaziv_.setLayoutData(data1);

    // **********lblKategorija_ layout
    FormData data2 = new FormData();
    data2.right = new FormAttachment(0, 73);
    data2.top = new FormAttachment(0, 43);
    data2.left = new FormAttachment(0, 15);
    lblKategorija_.setLayoutData(data2);

    // **********comboKateg_ layout
    FormData fd_comboKateg_ = new FormData();
    fd_comboKateg_.right = new FormAttachment(100, -70);
    fd_comboKateg_.top = new FormAttachment(0, 40);
    fd_comboKateg_.left = new FormAttachment(0, 125);
    comboKateg_.setLayoutData(fd_comboKateg_);

    // **********lblPodkateg_ layout
    FormData fd_lblPodkateg_ = new FormData();
    fd_lblPodkateg_.right = new FormAttachment(0, 88);
    fd_lblPodkateg_.top = new FormAttachment(0, 73);
    fd_lblPodkateg_.left = new FormAttachment(0, 15);
    lblPodkateg_.setLayoutData(fd_lblPodkateg_);

    // **********comboPodkateg_ layout
    FormData fd_comboPodkateg_ = new FormData();
    fd_comboPodkateg_.right = new FormAttachment(100, -50);
    fd_comboPodkateg_.top = new FormAttachment(0, 70);
    fd_comboPodkateg_.left = new FormAttachment(0, 125);
    comboPodkateg_.setLayoutData(fd_comboPodkateg_);

    // **********lblNoisteljorgjed_ layout
    FormData fd_lblNoisteljorgjed_ = new FormData();
    fd_lblNoisteljorgjed_.right = new FormAttachment(0, 110);
    fd_lblNoisteljorgjed_.top = new FormAttachment(0, 103);
    fd_lblNoisteljorgjed_.left = new FormAttachment(0, 15);
    lblNoisteljorgjed_.setLayoutData(fd_lblNoisteljorgjed_);

    // **********comboNoisteljorgjed_ layout
    FormData fd_comboNoisteljorgjed_ = new FormData();
    fd_comboNoisteljorgjed_.right = new FormAttachment(100, -5);
    fd_comboNoisteljorgjed_.top = new FormAttachment(0, 100);
    fd_comboNoisteljorgjed_.left = new FormAttachment(0, 125);
    comboNoisteljorgjed_.setLayoutData(fd_comboNoisteljorgjed_);

    // **********lblOpis_ layout
    FormData fd_lblOpis_ = new FormData();
    fd_lblOpis_.bottom = new FormAttachment(textOpis_, -6);
    fd_lblOpis_.left = new FormAttachment(lblNaziv_, 0, SWT.LEFT);
    fd_lblOpis_.right = new FormAttachment(0, 50);
    lblOpis_.setLayoutData(fd_lblOpis_);

    // **********textOpis_ layout
    FormData fd_textOpis_ = new FormData();
    fd_textOpis_.bottom = new FormAttachment(100, 0);
    fd_textOpis_.right = new FormAttachment(100, -5);
    fd_textOpis_.top = new FormAttachment(0, 180);
    fd_textOpis_.left = new FormAttachment(0, 15);
    textOpis_.setLayoutData(fd_textOpis_);

    // **********grpVanostImovine layout
    FormData fd_grpVanostImovine = new FormData();
    fd_grpVanostImovine.top = new FormAttachment(0);
    // fd_grpVanostImovine.bottom = new FormAttachment(100, -72);
    // fd_grpVanostImovine.left = new FormAttachment(compositeLeft, 5);
    fd_grpVanostImovine.right = new FormAttachment(100, 0);
    grpVanostImovine.setLayoutData(fd_grpVanostImovine);

    // **********textObjanjenjeostalo_ layout
    FormData fd_textObjanjenjeostalo = new FormData();
    fd_textObjanjenjeostalo.top = new FormAttachment(comboBi_, 0);
    fd_textObjanjenjeostalo.bottom = new FormAttachment(100, 0);
    fd_textObjanjenjeostalo.right = new FormAttachment(100, 0);
    textObjanjenjeostalo_.setLayoutData(fd_textObjanjenjeostalo);

    // **********compositeButtons_ layout
    FormData data6 = new FormData();
    data6.top = new FormAttachment(grpVanostImovine, 34);
    data6.right = new FormAttachment(100, 0);
    // data6.bottom = new FormAttachment(100, 0);
    compositeButtons_.setLayoutData(data6);

    fillForm();

    scrollBox.setContent(mParent);
    mParent.getShell().setDefaultButton(btnSpremi_);
  }