Package lupos.gui.operatorgraph.visualeditor.util

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


            } );

    term.setNameComboBox(namedConstCombo);

    // TextField Name
    final JTextFieldResizing tfName = new HintTextFieldResizing("Name","Name", this.parent.getFONT(), this);
    tfName.addFocusListener(new FocusAdapter() {
      @Override
      public void focusLost(final FocusEvent fe) {
        term.setTfName(tfName);
        }});
View Full Code Here


            }
            } );
    term.setNameComboBox(namedConstCombo);

    // TextField Name
    final JTextFieldResizing tfName = new HintTextFieldResizing("Name", "Name", this.parent.getFONT(), this);
    tfName.addFocusListener(new FocusAdapter() {
      @Override
      public void focusLost(final FocusEvent fe) {
        term.setTfName(tfName);
        }});
View Full Code Here

            } );

    term.setNameComboBox(namedConstCombo);

    // TextField Name
    final JTextFieldResizing tfName = new HintTextFieldResizing("Name", "Name", this.parent.getFONT(), this);
    tfName.addFocusListener(new FocusAdapter() {
      @Override
      public void focusLost(final FocusEvent fe) {
        term.setTfName(tfName);
        }});
View Full Code Here

  private JPanel createProjectionElement(final RetrieveDataWithProjectionAndSolutionModifier operator, boolean active, final int tmpIndex, String projString) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);

    final JTextFieldResizing jtf = new JTextFieldResizing(projString, this.parent.getFONT(), this);
    jtf.setEnabled(active);
    jtf.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent fe) {
        String content = jtf.getText();

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

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

    if(projString.equals("")) {
      jtf.setPreferredSize(new Dimension(20, jtf.getPreferredSize().height));
    }

    this.projElementsList.add(jtf); // add TextField to projections
    // TextFields list
View Full Code Here

  private JPanel createFromElement(boolean active, final int tmpIndex, String fromString) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);

    final JTextFieldResizing jtf = new JTextFieldResizing(((VisualGraphOperatorWithPrefix) this.parent).prefix.add(fromString), this.parent.getFONT(), this);
    jtf.setEnabled(active);
    jtf.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent fe) {
        String content = jtf.getText();

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

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

    if(fromString.equals("")) {
      jtf.setPreferredSize(new Dimension(20, jtf.getPreferredSize().height));
    }

    this.textElements.add(jtf);
    this.fromElementsList.add(jtf); // add TextField to from TextFields list
View Full Code Here

  private JPanel createFromNamedElement(boolean active, final int tmpIndex, String fromNamedString) {
    final JPanel panel = new JPanel();
    panel.setOpaque(false);

    final JTextFieldResizing jtf = new JTextFieldResizing(((VisualGraphOperatorWithPrefix) this.parent).prefix.add(fromNamedString), this.parent.getFONT(), this);
    jtf.setEnabled(active);
    jtf.addFocusListener(new FocusAdapter() {
      public void focusLost(FocusEvent fe) {
        String content = jtf.getText();

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

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

    if(fromNamedString.equals("")) {
      jtf.setPreferredSize(new Dimension(20, jtf.getPreferredSize().height));
    }

    this.textElements.add(jtf);
    this.fromNamedElementsList.add(jtf); // add TextField to fromNamed
    // TextFields list
View Full Code Here

    });

    this.orderByComboBoxesList.add(orderByCoBo); // add ComboBox to orderBy
    // ComboBoxes list

    final JTextFieldResizing jtf = new JTextFieldResizing(orderByString, this.parent.getFONT(), this);
    jtf.setEnabled(active);
    jtf.addFocusListener(new FocusAdapter() {
      public void focusLost(final FocusEvent fe) {
        String content = jtf.getText();

        if(!content.equals("")) {
          try {
            // update sortContainer of current element...
            sortContainer.setSortString(jtf.getText());

            // add current element to orderBy list of SelectOP...
            operator.setOrderByElement(tmpIndex, sortContainer);
          }
          catch(ModificationException me) {
            int n = AbstractGuiComponent.showCorrectIgnoreOptionDialog(parent, me.getMessage());

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

    if(orderByString.equals("")) {
      jtf.setPreferredSize(new Dimension(20, jtf.getPreferredSize().height));
    }

    this.textElements.add(jtf);
    this.orderByElementsList.add(jtf); // add TextField to orderBy
    // TextFields list
View Full Code Here

    TitledBorder titled;
    final Font font = new Font(Font.SANS_SERIF, Font.ROMAN_BASELINE, 11);
    titled = BorderFactory.createTitledBorder(raisedbevel," Constant ", 0, 0, font, Color.BLACK);
    this.setBorder(titled);

    final JTextFieldResizing textField = new JTextFieldResizing("", this.parent.getFONT(), this);

    textField.setPreferredSize(new Dimension(50 , 20));
    textField.setMinimumSize(new Dimension(50 ,20));

    textField.addFocusListener((new FocusAdapter() {
      @Override
      public void focusGained(final FocusEvent fe){
        ConstantPanel.this.updateSize();
      }

      @Override
      public void focusLost(final FocusEvent fe) {
        ConstantPanel.this.constantOperator.setConstant(textField.getText());
        ConstantPanel.this.updateSize();
      }
    }));

    textField.addKeyListener( new KeyListener()
    {
        @Override
      public void keyTyped( final KeyEvent e ) {
        }
        @Override
      public void keyPressed( final KeyEvent e ) {
        }
        @Override
      public void keyReleased( final KeyEvent e ) {
           ConstantPanel.this.updateSize();
        }
      });

    textField.setText(this.constantOperator.getConstant());

    // FocusListener
    final FocusListener FL = new FocusListener() {
      @Override
      public void focusGained(final FocusEvent arg0) {
View Full Code Here

        final String namespaceString) {
 
      this.gbc.gridx = 0;
      this.gbc.gridy++;

      final JTextFieldResizing prefixTF = new JTextFieldResizing(
          prefixString, this.parent.getFONT(), this);


      final JTextFieldResizing namespaceTF = new JTextFieldResizing(
          namespaceString, this.parent.getFONT(), this);
     
      namespaceTF.setPreferredSize(new Dimension(prefixTF
          .getPreferredSize().width + 10, prefixTF
          .getPreferredSize().height));

     
      prefixTF.setPreferredSize(new Dimension(prefixTF
          .getPreferredSize().width + 150, prefixTF
          .getPreferredSize().height));
 
   
      if(!namespaceString.equals("")){
        namespaceTF.setFocusable(false);
        prefixTF.setFocusable(false);
      }
   
     
    prefixTF.addFocusListener(new FocusAdapter() {
      private String oldValue = prefixString;

      public void focusLost(final FocusEvent fe) {

       
     
        }});
     
     
    namespaceTF.addFocusListener(new FocusAdapter() {
        private String oldValue = namespaceString;
       
       
        public void focusGained(final FocusEvent fe){
     
        }
       

        public void focusLost(final FocusEvent fe) {
         
        }
      });

    namespaceTF.addKeyListener( new KeyListener()
    {
        public void keyTyped( KeyEvent e ) {

        }
        public void keyPressed( KeyEvent e ) {

        }
        public void keyReleased( KeyEvent e ) {
      
         if(e.getKeyCode()==10){
          

         int i =   checkTheCase(prefixTF.getText(),namespaceTF.getText());
          
         
          switch(i){
         
          case 0: break;
         
          case 1: addEntry(prefixTF.getText(),namespaceTF.getText());
                prefixTF.setEditable(false);
                namespaceTF.setEditable(false);
                namespaceTF.setFocusable(false);
                prefixTF.setFocusable(false);
                prefix.setPrefixRowCnt(prefix.getPrefixRowCnt()+1);
                break;
         
          case 2: prefixTF.selectAll();
              prefixTF.grabFocus();
                showPrefixAlreadyExistsDialog();
                break;
               
          case 3: prefixTF.selectAll();
                prefixTF.grabFocus();
                showNamespaceIsAlreadyInUseDialog();
                break;
               
          case 4: prefixTF.selectAll();
              prefixTF.grabFocus();
                showNoNamespaceDialog();
                break;
           
          default: break;
         
         
          }
         
//          System.out.println(prefix.getPrefixCount()+" "+prefix.getPrefixRowCnt());
         
         }
       
        }
      });
     
     
      final JLabel prefixLabel = new JLabel("Prefix:");
      prefixLabel.setFont(parent.getFONT());
     
      final JLabel iriLabel = new JLabel("IRI:");
      iriLabel.setFont(parent.getFONT());
     
     
      // Button
      Dimension buttonDimension = new Dimension();
      buttonDimension.setSize(30d, 24d);
     
      final JIconButton deleteButton = new JIconButton("icons/001_02.png");
      deleteButton.setPreferredSize(buttonDimension);
      deleteButton.setMaximumSize(buttonDimension);
      deleteButton.setMinimumSize(buttonDimension);
      deleteButton.setFont(parent.getFONT());
      deleteButton.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e) {
          if (!namespaceTF.getText().equals("")) {
            final int choice = showPrefixRemovedOptionDialog();

            if (choice == JOptionPane.YES_OPTION) { // remove prefix and
              // notify
              // operators...
              prefix.removeEntry(namespaceTF.getText(), true);

              removeRow(prefixLabel, prefixTF, iriLabel, namespaceTF, deleteButton);
            } else if (choice == JOptionPane.NO_OPTION) { // remove
              // prefix
              // but don't
              // notify
              // operators
              // ...
              prefix.removeEntry(namespaceTF.getText(), false);

              removeRow(prefixLabel, prefixTF, iriLabel, namespaceTF, deleteButton);
            }
          } else {
            removeRow(prefixLabel, prefixTF, iriLabel, namespaceTF, deleteButton);
View Full Code Here

  public void createPrefixRow(final String prefixString,
      final String namespaceString) {
    this.gbc.gridx = 0;
    this.gbc.gridy++;

    final JTextFieldResizing prefixTF = new JTextFieldResizing(
        prefixString, this.parent.getFONT(), this);

    final JTextFieldResizing namespaceTF = new JTextFieldResizing(
        namespaceString, this.parent.getFONT(), this);

    prefixTF.addFocusListener(new FocusAdapter() {
      private String oldValue = prefixString;

      public void focusLost(final FocusEvent fe) {
        final String newPrefix = prefixTF.getText();

        if (!namespaceTF.getText().equals("")
            && !newPrefix.equals(this.oldValue)) {
          final int choice = showPrefixNameChangedOptionDialog();

          if (choice == JOptionPane.YES_OPTION) { // change prefix
            // name and notify
            // operators...
            prefix.changeEntryName(this.oldValue, newPrefix, true);
            this.oldValue = newPrefix;
          } else if (choice == JOptionPane.NO_OPTION) { // change
            // prefix
            // name but
            // don't
            // notify
            // operators
            // ...
            prefix.changeEntryName(this.oldValue, newPrefix, false);
            this.oldValue = newPrefix;
          } else if (choice == JOptionPane.CANCEL_OPTION) { // don't
            // change
            // prefix
            // name
            // ...
            prefixTF.setText(this.oldValue);
            prefixTF.grabFocus();
          }
        }
      }
    });

    namespaceTF.addFocusListener(new FocusAdapter() {
      private String oldValue = namespaceString;

      public void focusLost(final FocusEvent fe) {
        String newNamespace = namespaceTF.getText();

        if (this.oldValue.equals("") && !newNamespace.equals("")) {
          final int choice = showPrefixAddedOptionDialog();

          if (choice == JOptionPane.YES_OPTION) { // add prefix and
            // notify
            // operators...
            prefix.addEntry(prefixTF.getText(), newNamespace, true);
          } else if (choice == JOptionPane.NO_OPTION) { // add prefix
            // but don't
            // notify
            // operators
            // ...
            prefix
            .addEntry(prefixTF.getText(), newNamespace,
                false);
          } else if (choice == JOptionPane.CANCEL_OPTION) { // don't
            // add
            // prefix
            // ...
            prefixTF.setText("");
            namespaceTF.setText("");
            namespaceTF.grabFocus();
            newNamespace = "";
          }
        } else if (!this.oldValue.equals("") && newNamespace.equals("")) {
          final int choice = showPrefixRemovedOptionDialog();

          if (choice == JOptionPane.YES_OPTION) { // remove prefix and
            // notify
            // operators...
            prefixTF.setText("");
            prefix.removeEntry(this.oldValue, true);
          } else if (choice == JOptionPane.NO_OPTION) { // remove
            // prefix
            // but don't
            // notify
            // operators
            // ...
            prefixTF.setText("");
            prefix.removeEntry(this.oldValue, false);
          } else if (choice == JOptionPane.CANCEL_OPTION) { // don't
            // remove
            // prefix
            // ...
            namespaceTF.setText(this.oldValue);
            namespaceTF.grabFocus();
            newNamespace = this.oldValue;
          }
        }

        this.oldValue = newNamespace;
      }
    });

    final JLabel deleteLabel = new JLabel(this.parent.delIcon);
    deleteLabel.addMouseListener(new MouseAdapter() {
      public void mouseClicked(final MouseEvent me) {
        if (!namespaceTF.getText().equals("")) {
          final int choice = showPrefixRemovedOptionDialog();

          if (choice == JOptionPane.YES_OPTION) { // remove prefix and
            // notify
            // operators...
            prefix.removeEntry(namespaceTF.getText(), true);

            removeRow(prefixTF, namespaceTF, deleteLabel);
          } else if (choice == JOptionPane.NO_OPTION) { // remove
            // prefix
            // but don't
            // notify
            // operators
            // ...
            prefix.removeEntry(namespaceTF.getText(), false);

            removeRow(prefixTF, namespaceTF, deleteLabel);
          }
        } else {
          removeRow(prefixTF, namespaceTF, deleteLabel);
View Full Code Here

TOP

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

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.