Package lupos.gui.operatorgraph.visualeditor.queryeditor.operators

Examples of lupos.gui.operatorgraph.visualeditor.queryeditor.operators.RetrieveDataWithProjectionAndSolutionModifier


    this.add(nameLabel);
    this.add(Box.createRigidArea(new Dimension(10, 3)));
  }

  public void addProjections(boolean distinct) {
    final RetrieveDataWithProjectionAndSolutionModifier operator = (RetrieveDataWithProjectionAndSolutionModifier) this.operator;

    JPanel projectionPanel = this.getRowPanel(); // get panel for row

    if(distinct == true) {
      // add ComboBox to panel row...
      projectionPanel.add(this.createDistinctCoBo(operator));
      projectionPanel.add(Box.createRigidArea(new Dimension(10, 3))); // spacer
    }

    // determine initial state of projection CheckBox...
    boolean projection = operator.getProjectionElements().size() > 0;

    // create projection CheckBox...
    final JCheckBoxOwnIcon projCB = new JCheckBoxOwnIcon("Projection", projection, this.parent.getFONT());
    projCB.setOpaque(false);

    elementStatus.put("projection", projection);

    projectionPanel.add(projCB); // add projection CheckBox to row panel

    final JPanel projElementsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    projElementsPanel.setOpaque(false);

    // walk through projection elements of the SELECT-Operator...
    for(int i = 0; i < operator.getProjectionElements().size(); ++i) {
      // get current projection element...
      String projString = operator.getProjectionElements().get(i);

      // create new projection element panel for the current projection
      // element and set the initial state...
      JPanel projectionElement = this.createProjectionElement(operator, projection, i, projString);

      // add projection element panel to the right panel...
      projElementsPanel.add(projectionElement);
    }

    projectionPanel.add(projElementsPanel); // add panel for projection
    // elements to row panel

    final LinkedList<JComponent> needsEnableList = new LinkedList<JComponent>();

    if(operator.getProjectionElements().size() == 0) {
      // create new projection element panel...
      JPanel projectionElement = createProjectionElement(operator, true, operator.getProjectionElements().size(), "");
      projectionElement.setVisible(projection);

      projElementsPanel.add(projectionElement); // add projection element
      // panel to the right
      // panel

      needsEnableList.add(projectionElement);
    }

    // create add button...
    final JLabel addLabel = new JLabel(this.parent.addIcon);
    addLabel.setVisible(projection);
    addLabel.addMouseListener(new MouseAdapter() {
      public void mouseClicked(final MouseEvent me) {
        // create new projection element panel...
        JPanel projectionElement = createProjectionElement(operator, true, operator.getProjectionElements().size(), "");

        // add projection element panel to the right panel...
        projElementsPanel.add(projectionElement);

        updateSize(); // update the width of the SelectPanel
      }
    });

    projectionPanel.add(addLabel); // add add-button to row panel

    needsEnableList.add(addLabel);

    // define listener for projection CheckBox...
    projCB.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent ie) {
        // get new state...
        boolean selected = (ie.getStateChange() == ItemEvent.SELECTED);

        elementStatus.put("projection", selected);

        // walk through projection TextFields...
        for(JTextField jtf : projElementsList) {
          jtf.setEnabled(selected); // set new state to current
          // TextField

          if(selected) { // if state is selected and field is not
            // empty...
            try {
              if(!jtf.getText().equals("")) {
                // add current element to projection list of SelectOP...
                operator.addProjectionElement(jtf.getText());
              }
            }
            catch(ModificationException me) {
              final int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());

              if(n == JOptionPane.YES_OPTION) {
                (new FocusThread(jtf)).start();
              }
            }
          }
        }

        // walk through Delete-Labels...
        for(JLabel delLabel : projElementsDelLabelsList) {
          delLabel.setEnabled(selected); // set new state of current
          // Delete-Label
        }

        if(!selected) { // if state is not selected...
          operator.clearProjectionList(); // clear projection list of
          // SelectOP
          addLabel.setVisible(false);
        }
        else {
          // if state is selected...
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.visualeditor.queryeditor.operators.RetrieveDataWithProjectionAndSolutionModifier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.