public void focusLost(final FocusEvent e) {
    if (myPanel.getProject().isDisposed()) {
      myPanel.setContextComponent(null);
      myPanel.hideHint();
      return;
    }
    final DialogWrapper dialog = DialogWrapper.findInstance(e.getOppositeComponent());
    shouldFocusEditor = dialog != null;
    if (dialog != null) {
      Disposer.register(
          dialog.getDisposable(),
          new Disposable() {
            @Override
            public void dispose() {
              if (dialog.getExitCode() == DialogWrapper.CANCEL_EXIT_CODE) {
                shouldFocusEditor = false;
              }
            }
          });
    }

    // required invokeLater since in current call sequence KeyboardFocusManager is not initialized
    // yet
    // but future focused component
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(
        new Runnable() {
          public void run() {
            processFocusLost(e);
          }
        });
  }
Ejemplo n.º 2
0
    public void focusLost(FocusEvent e) {
      Object objFocus = e.getSource();
      boolean bSaveCmd = false;
      if (objFocus instanceof DataField) {
        DataField compFocus = (DataField) objFocus;
        Component comp = e.getOppositeComponent();
        if (comp instanceof JButton) {
          String strTxt = ((JButton) comp).getText();
          if (strTxt != null && strTxt.equals(WGlobal.SAVEUSER)) bSaveCmd = true;
        }

        // if the focus is not in the panel then write the file.
        /*if ((comp == null || !m_pnlDisplay.equals(comp.getParent()))
                && !bSaveCmd)
        {
            String strPrevValue = compFocus.getValue();
            String strTxt = compFocus.getText();
            if (!strPrevValue.equals(strTxt))
            {
                // save the data by writing it to the file
                AppIF appIf = Util.getAppIF();
                if (appIf instanceof VAdminIF)
                    ((VAdminIF)appIf).getUserToolBar().doSave();
                compFocus.setValue(strTxt);
            }
        }*/
      }
    }
        @Override
        public void focusGained(FocusEvent e) {
          if (e.getOppositeComponent() != null) {
            JTextField valueTextField = editorComponent.getTextField();
            DataEditorSettings settings = cell.getRow().getModel().getSettings();
            if (settings.getGeneralSettings().getSelectContentOnCellEdit().value()) {
              valueTextField.selectAll();
            }

            Rectangle rectangle = new Rectangle(mainPanel.getLocation(), mainPanel.getSize());
            parentForm.getColumnsPanel().scrollRectToVisible(rectangle);
          }
        }
Ejemplo n.º 4
0
 void canvasFocusLost(FocusEvent e) {
   if (isXEmbedActive() && !e.isTemporary()) {
     xembedLog.fine("Forwarding FOCUS_LOST");
     int num = 0;
     if (AccessController.doPrivileged(new GetBooleanAction("sun.awt.xembed.testing"))) {
       Component opp = e.getOppositeComponent();
       try {
         num = Integer.parseInt(opp.getName());
       } catch (NumberFormatException nfe) {
       }
     }
     xembed.sendMessage(xembed.handle, XEMBED_FOCUS_OUT, num, 0, 0);
   }
 }
 @Override
 public void focusLost(FocusEvent e) {
   // Only dispose of tip if it wasn't the TipWindow that was clicked
   // "c" can be null, at least on OS X, so we must check that before
   // calling SwingUtilities.getWindowAncestor() to guard against an
   // NPE.
   Component c = e.getOppositeComponent();
   boolean tipClicked =
       (c instanceof TipWindow)
           || (c != null && SwingUtilities.getWindowAncestor(c) instanceof TipWindow);
   if (!tipClicked) {
     possiblyDisposeOfTipWindow();
   }
 }
 public void focusGained(final FocusEvent e) {
   if (e.getOppositeComponent() == null && shouldFocusEditor) {
     shouldFocusEditor = false;
     ToolWindowManager.getInstance(myPanel.getProject()).activateEditorComponent();
     return;
   }
   myPanel.updateItems();
   final List<NavBarItem> items = myPanel.getItems();
   if (!myPanel.isInFloatingMode() && items.size() > 0) {
     myPanel.setContextComponent(items.get(items.size() - 1));
   } else {
     myPanel.setContextComponent(null);
   }
 }
Ejemplo n.º 7
0
 @Override
 public void focusLost(final FocusEvent e) {
   if (!e.isTemporary() || e.getOppositeComponent() == null) {
     /*
      * we check for temporary , because a rightclick menu will cause focus lost but editing should not stop
      *
      * we also check for oppositeComponent to stopEditing when we click outside the window
      */
     ExtTextColumn.this.noset = true;
     try {
       ExtTextColumn.this.stopCellEditing();
     } finally {
       ExtTextColumn.this.noset = false;
     }
   }
 }
Ejemplo n.º 8
0
  public void txtComponentFocusGained(FocusEvent e) {
    target = (JTextComponent) e.getSource();

    if (!(e.getOppositeComponent()
        instanceof AbstractButton)) { // Sonst blinkt das die ganze Zeit bei der Eingabe

      final Timeline timeline1 = new Timeline(target);

      timeline1.addPropertyToInterpolate("background", target.getBackground(), Color.red);
      timeline1.setDuration(140);
      timeline1.playLoop(2, Timeline.RepeatBehavior.REVERSE);

      // Tools.flash(target, 2);
    }

    target.selectAll();
  }
    public void eventDispatched(AWTEvent event) {
      if (event instanceof FocusEvent) {
        FocusEvent focusEvent = (FocusEvent) event;
        Component fromComponent = focusEvent.getComponent();
        Component oppositeComponent = focusEvent.getOppositeComponent();

        paintFocusBorders(true);

        switch (event.getID()) {
          case FocusEvent.FOCUS_GAINED:
            myCurrent = fromComponent;
            myPrevious = oppositeComponent;
            myTemporary = focusEvent.isTemporary();
            break;
          case FocusEvent.FOCUS_LOST:
            myTemporary = focusEvent.isTemporary();
          default:
            break;
        }
      }
    }
  private void processFocusLost(FocusEvent e) {
    final Component opposite = e.getOppositeComponent();

    if (myPanel.isInFloatingMode()
        && opposite != null
        && DialogWrapper.findInstance(opposite) != null) {
      myPanel.hideHint();
      return;
    }

    final boolean nodePopupInactive = !myPanel.isNodePopupActive();
    boolean childPopupInactive = !JBPopupFactory.getInstance().isChildPopupFocused(myPanel);
    if (nodePopupInactive && childPopupInactive) {
      if (opposite != null
          && opposite != myPanel
          && !myPanel.isAncestorOf(opposite)
          && !e.isTemporary()) {
        myPanel.setContextComponent(null);
        myPanel.hideHint();
      }
    }

    myPanel.updateItems();
  }
Ejemplo n.º 11
0
 void forwardFocusLost(FocusEvent e) {
   isFocused = false;
   FocusEvent fe =
       new FocusEvent(this, e.getID(), e.isTemporary(), e.getOppositeComponent(), e.getCause());
   super.processFocusEvent(fe);
 }
Ejemplo n.º 12
0
 public void focusGained(final FocusEvent arg0) {
     if (arg0 != null && arg0.getOppositeComponent() instanceof JRootPane) return;
     super.focusGained(arg0);
 }