Package lupos.gui.operatorgraph.visualeditor.util

Examples of lupos.gui.operatorgraph.visualeditor.util.JCheckBoxOwnIcon


    this.add(this.textField, this.gbc);
    this.gbc.gridy++;
    this.gbc.gridx = 0;

    if(this.getParentQG() == ((RuleEditorPane) this.getParentQG().visualEditor).getVisualGraphs().get(0)) {
      this.cB_subClasses = new JCheckBoxOwnIcon("also Subclasses", alsoSubClasses, this.parent.getFONT());
      this.cB_subClasses.addMouseListener(new RuleMouseListener(this, this.cB_subClasses));
      this.cB_subClasses.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent ie) {
          // get new state...
          boolean selected = (ie.getStateChange() == ItemEvent.SELECTED);
View Full Code Here


    // 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);
View Full Code Here

    // determine initial state of from CheckBox...
    boolean from = this.operator.getFromList().size() > 0;

    // create from CheckBox...
    JCheckBoxOwnIcon fromCB = new JCheckBoxOwnIcon("From", from, this.parent.getFONT());
    fromCB.setOpaque(false);

    elementStatus.put("from", from);

    fromPanel.add(fromCB); // add from CheckBox to row panel

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

    // walk through from elements of the select operator...
    for(int i = 0; i < this.operator.getFromList().size(); ++i) {
      String fromString = this.operator.getFromList().get(i);

      // create new from element panel for the current from element and
      // set the initial state...
      JPanel fromElement = this.createFromElement(from, i, ((VisualGraphOperatorWithPrefix) this.parent).prefix.add(fromString));

      fromElementsPanel.add(fromElement); // add from element panel to row
      // panel
    }

    fromPanel.add(fromElementsPanel); // add panel for from elements to row
    // panel

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

    if(this.operator.getFromList().size() == 0) {
      // create new from element panel...
      JPanel fromElement = createFromElement(true, this.operator.getFromList().size(), "");
      fromElement.setVisible(from);

      fromElementsPanel.add(fromElement); // add from element panel to row
      // panel

      needsEnableList.add(fromElement);
    }

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

        fromElementsPanel.add(fromElement); // add from element panel to
        // row panel

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

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

    needsEnableList.add(addLabel);

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

        elementStatus.put("from", selected);
View Full Code Here

    // determine initial state of fromNamed CheckBox...
    boolean fromNamed = this.operator.getFromNamedList().size() > 0;

    // create fromNamed CheckBox...
    JCheckBoxOwnIcon fromNamedCB = new JCheckBoxOwnIcon("From Named", fromNamed, this.parent.getFONT());
    fromNamedCB.setOpaque(false);

    elementStatus.put("fromNamed", fromNamed);

    fromNamedPanel.add(fromNamedCB); // add fromNamed CheckBox to row panel

    // create panel for fromNamed elements...
    final JPanel fromNamedElementsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    fromNamedElementsPanel.setOpaque(false);

    // walk through fromNamed elements of the select operator...
    for(int i = 0; i < this.operator.getFromNamedList().size(); ++i) {
      String fromNamedString = this.operator.getFromNamedList().get(i);

      // create new fromNamed element panel for the current fromNamed
      // element and set the initial state...
      JPanel fromNamedElement = this.createFromNamedElement(fromNamed, i, ((VisualGraphOperatorWithPrefix) this.parent).prefix.add(((VisualGraphOperatorWithPrefix) this.parent).prefix.add(fromNamedString)));

      fromNamedElementsPanel.add(fromNamedElement); // add fromNamed
      // element panel to
      // row panel
    }

    fromNamedPanel.add(fromNamedElementsPanel); // add panel for fromNamed
    // elements to row panel

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

    if(this.operator.getFromNamedList().size() == 0) {
      // create new JTextField...
      JPanel fromNamedElement = createFromNamedElement(true, operator.getFromNamedList().size(), "");
      fromNamedElement.setVisible(fromNamed);

      fromNamedElementsPanel.add(fromNamedElement); // add fromNamed
      // element panel to
      // row panel

      needsEnableList.add(fromNamedElement);
    }

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

        fromNamedElementsPanel.add(fromNamedElement); // add fromNamed
        // element panel
        // to row panel

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

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

    needsEnableList.add(addLabel);

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

        elementStatus.put("fromNamed", selected);
View Full Code Here

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

    // create orderBy CheckBox...
    JCheckBoxOwnIcon orderByCB = new JCheckBoxOwnIcon("Order By", orderBy, this.parent.getFONT());
    orderByCB.setOpaque(false);

    elementStatus.put("orderBy", orderBy);

    orderByPanel.add(orderByCB); // add orderBy CheckBox to row panel

    // create panel for orderBy elements...
    final JPanel orderByElementsPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
    orderByElementsPanel.setOpaque(false);

    // walk through orderBy elements of the select operator...
    for(int i = 0; i < operator.getOrderByList().size(); ++i) {
      SortContainer sortContainer = operator.getOrderByList().get(i);

      // add spacer if this is not the first element...
      if(this.orderByElementsList.size() > 0) {
        orderByElementsPanel.add(Box.createRigidArea(new Dimension(10, 3)));
      }

      // determine right selectedIndex for ComboBox...
      int selectedIndex = (sortContainer.isDesc()) ? 1 : 0;

      // create new orderBy element panel and set the initial state...
      JPanel orderByElement = this.createOrderByElement(orderBy, i, sortContainer, selectedIndex, sortContainer.getSortString());

      orderByElementsPanel.add(orderByElement); // add orderBy element
      // panel to row panel
    }

    orderByPanel.add(orderByElementsPanel); // add panel for orderBy
    // elements to row panel

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

    if(operator.getOrderByList().size() == 0) {
      SortContainer sortContainer = null;

      try {
        sortContainer = new SortContainer(((VisualGraphOperatorWithPrefix) this.parent).prefix, false, "");
        sortContainer.setOperator(operator);
      }
      catch(ModificationException me) {
        me.printStackTrace();
      }

      // create new orderBy element panel and set the initial state...
      JPanel orderByElement = this.createOrderByElement(true, operator.getOrderByList().size(), sortContainer, 0, "");
      orderByElement.setVisible(orderBy);

      orderByElementsPanel.add(orderByElement); // add orderBy element
      // panel to row panel

      needsEnableList.add(orderByElement);
    }

    // create add button...
    final JLabel addLabel = new JLabel(this.parent.addIcon);
    addLabel.setVisible(orderBy);
    addLabel.addMouseListener(new MouseAdapter() {
      public void mouseClicked(MouseEvent me) {
        // add spacer if this is not the first element...
        if(orderByElementsList.size() > 0) {
          orderByElementsPanel.add(Box.createRigidArea(new Dimension(10, 3)));
        }

        SortContainer sortContainer = null;

        try {
          sortContainer = new SortContainer(((VisualGraphOperatorWithPrefix) parent).prefix, false, "");
          sortContainer.setOperator(operator);
        }
        catch(ModificationException mex) {
          mex.printStackTrace();
        }

        operator.addOrderByElement(sortContainer);

        // create new orderBy element panel and set the initial state...
        JPanel orderByElement = createOrderByElement(true, operator.getOrderByList().size(), sortContainer, 0, "");

        orderByElementsPanel.add(orderByElement); // add orderBy element
        // panel to row
        // panel

        updateSize(); // update the size of the RetrieveDataPanel
      }
    });

    orderByPanel.add(addLabel); // add add button to row panel

    needsEnableList.add(addLabel);

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

        elementStatus.put("orderBy", selected);
View Full Code Here

    final RetrieveDataWithSolutionModifier operator = (RetrieveDataWithSolutionModifier) this.operator;

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

    // create limit CheckBox...
    JCheckBoxOwnIcon limitCB = new JCheckBoxOwnIcon("Limit", (operator.getLimitValue() > -1), this.parent.getFONT());
    limitCB.setOpaque(false);

    elementStatus.put("limit", (operator.getLimitValue() > -1));

    limitOffsetPanel.add(limitCB); // add limit CheckBox to row panel

    this.limitTF.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent fe) {
        String content = limitTF.getText();

        if(!content.equals("")) {
          try {
            operator.setLimitValue(content);
          }
          catch(ModificationException me) {
            int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());

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

    if(operator.getLimitValue() > -1) { // if there is a limit value...
      this.limitTF.setText("" + operator.getLimitValue()); // set it
    }
    else { // if there is no limit value...
      this.limitTF.setText("-1"); // set "0" as default value
      this.limitTF.setEnabled(false); // disable the limit TextField
    }

    // set new preferred size of the limit TextField...
    this.limitTF.setPreferredSize(new Dimension(this.limitTF.getPreferredSize().width + 20, this.limitTF.getPreferredSize().height));

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

        elementStatus.put("limit", selected);

        limitTF.setEnabled(selected); // enable or disable limit
        // TextField according to new
        // state

        // set limit value in selectOP...
        try {
          if(!selected) {
            operator.setLimitValue("-1");
          }
          else if(selected) {
            operator.setLimitValue(limitTF.getText());
          }
        }
        catch(ModificationException me) {
          int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());

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

    limitOffsetPanel.add(this.limitTF); // add limit TextField to row panel

    limitOffsetPanel.add(Box.createRigidArea(new Dimension(10, 3))); // spacer

    // create offset CheckBox...
    JCheckBoxOwnIcon offsetCB = new JCheckBoxOwnIcon("Offset", (operator.getOffsetValue() > -1), this.parent.getFONT());
    offsetCB.setOpaque(false);

    elementStatus.put("offset", (operator.getOffsetValue() > -1));

    limitOffsetPanel.add(offsetCB); // add offset CheckBox to row panel

    this.offsetTF.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent fe) {
        String content = offsetTF.getText();

        if(!content.equals("")) {
          try {
            operator.setOffsetValue(content);
          }
          catch(ModificationException me) {
            int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());

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

    if(operator.getOffsetValue() > -1) { // if there is an offset value...
      this.offsetTF.setText("" + operator.getOffsetValue()); // set it
    }
    else { // if there is no offset value...
      this.offsetTF.setText("0"); // set "0" as default value
      this.offsetTF.setEnabled(false); // disable the offset TextField
    }

    // set new preferred size of the offset TextField...
    this.offsetTF.setPreferredSize(new Dimension(this.offsetTF.getPreferredSize().width + 20, this.offsetTF.getPreferredSize().height));

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

        elementStatus.put("offset", selected);
View Full Code Here

          }
        }
      }
    });

    this.jCB_activate = new JCheckBoxOwnIcon("activate", active, parent.getFONT());
    this.jCB_activate.addItemListener(new ItemListener() {
      public void itemStateChanged(ItemEvent ie) {
        // get new state...
        boolean selected = (ie.getStateChange() == ItemEvent.SELECTED);
View Full Code Here

TOP

Related Classes of lupos.gui.operatorgraph.visualeditor.util.JCheckBoxOwnIcon

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.