Package org.eclipse.swt.events

Examples of org.eclipse.swt.events.FocusListener


        }
        currentState.mouseExit();
      }     
    });   
   
    addFocusListener(new FocusListener(){
      public void focusGained(FocusEvent e) {
        focused = true;
        redraw();
      }
      public void focusLost(FocusEvent e) {
View Full Code Here


   * @since 3.2
   */
    private void addCommandSupport(final Control control) {
      final KeySequence commandSequence= fContentAssistant.getRepeatedInvocationKeySequence();
      if (commandSequence != null && !commandSequence.isEmpty() && fContentAssistant.isRepeatedInvocationMode()) {
        control.addFocusListener(new FocusListener() {
          private CommandKeyListener fCommandKeyListener;
          public void focusGained(FocusEvent e) {
            if (Helper.okToUse(control)) {
              if (fCommandKeyListener == null) {
                fCommandKeyListener= new CommandKeyListener(commandSequence);
                fProposalTable.addKeyListener(fCommandKeyListener);
              }
            }
          }
          public void focusLost(FocusEvent e) {
            if (fCommandKeyListener != null) {
              control.removeKeyListener(fCommandKeyListener);
              fCommandKeyListener= null;
            }
          }
        });
      }
      control.addFocusListener(new FocusListener() {
        private TraverseListener fTraverseListener;
        public void focusGained(FocusEvent e) {
          if (Helper.okToUse(control)) {
            if (fTraverseListener == null) {
              fTraverseListener= new TraverseListener() {
View Full Code Here

        DateFormatter dateFormatter = new DateFormatter("dd/MM/yyyy");
        birthdateText.setFormatter(dateFormatter);
        birthdateText.getControl().addFocusListener(new RequiredWhenLostFocus(birthdateText, RequiredWhenLostFocus.ERROR_REQUIRED_BIRTHDATE, screenMessageLabel));
        birthdateText.getControl().setText("");
       
        birthdateText.getControl().addFocusListener(new FocusListener(){
      public void focusLost(FocusEvent arg0) {
        if (birthdateText.getControl().getText().contains(" ")) {
          DateFormatter dateFormatter = new DateFormatter("dd/MM/yyyy");
              birthdateText.setFormatter(dateFormatter);
          birthdateText.getControl().setText("");
View Full Code Here

    }

    private void createRegisterDateText() {
        registerDateText = new DateText(mainComposite, SWT.BORDER);

        registerDateText.addFocusListener(new FocusListener(){
          public void focusLost(FocusEvent arg0) {
        if (registerDateText.getText().contains(" ")){
              registerDateText.setValue(null);
              screenMessageLabel.setVisible(false);
                    screenMessageLabel.setText("Data de registro inv�lida.");
View Full Code Here

    }

    private void createDismissedDateText() {
        dismissedDateText = new DateText(mainComposite, SWT.SINGLE | SWT.BORDER);

        dismissedDateText.addFocusListener(new FocusListener(){
          public void focusLost(FocusEvent arg0) {
        if (dismissedDateText.getText().contains(" ")){
          dismissedDateText.setValue(null);
           screenMessageLabel.setVisible(false);
                   screenMessageLabel.setText("Data de desligamento inv�lida.");
View Full Code Here

   *            the text control
   */
  public FormattedText(Text t) {
    this.text = t;

    text.addFocusListener(new FocusListener() {
      public void focusGained(FocusEvent e) {
        if (formatter != null && text.getEditable()) {
          formatter.setIgnore(true);
          // text.setText(formatter.getEditString());
          text.setSelection(caretPos);
View Full Code Here

        return (keyCode == 0 || keyCode == 8 || keyCode == 127 || keyCode == 16777219 || keyCode == 16777220) ? true : false ;
    }
   

    public static void validateTextOfMoneyValuesToAvoidEmptyStrings(final Text value) {
    value.addFocusListener(new FocusListener() {
      public void focusLost(FocusEvent arg0) {
        if ( value.getText().trim().equals("") )
                value.setText("0,00");
      }
View Full Code Here

                    text.setFocus();

                    text.setText(cursor.getRow().getText(cursor.getColumn()));
                    text.setFocus();

                    text.addFocusListener(new FocusListener() {
                        public void focusLost(FocusEvent event) {
                            cursor.getRow().setText(cursor.getColumn(), text.getText());
                            text.dispose();
                        }

                        public void focusGained(FocusEvent arg0) {
                        }
                    });

                    text.addKeyListener(new KeyAdapter() {
                        public void keyPressed(KeyEvent event) {
                            switch (event.keyCode) {
                                case SWT.CR:
                                    cursor.getRow().setText(cursor.getColumn(), text.getText());
                                case SWT.ESC:
                                    text.dispose();
                                    break;
                            }
                        }
                    });

                    editor.setEditor(text);
                }
            }
        });

        cursor.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                table.setSelection(new TableItem[] { cursor.getRow() });
            }

            public void widgetDefaultSelected(SelectionEvent event) {
                if (cursor.getColumn() == 1) {
                    final Text text = new Text(cursor, SWT.NONE);
                    text.setFocus();

                    text.setText(cursor.getRow().getText(cursor.getColumn()));
                    text.setFocus();

                    text.addKeyListener(new KeyAdapter() {
                        public void keyPressed(KeyEvent event) {
                            switch (event.keyCode) {
                                case SWT.CR:
                                    cursor.getRow().setText(cursor.getColumn(), text.getText());
                                case SWT.ESC:
                                    text.dispose();
                                    break;
                            }
                        }
                    });

                    text.addFocusListener(new FocusListener() {
                        public void focusLost(FocusEvent event) {
                            cursor.getRow().setText(cursor.getColumn(), text.getText());
                            text.dispose();
                        }
View Full Code Here

        };

    }

    private void createTableListeners() {
        tableFocusListener = new FocusListener() {
            public void focusLost(FocusEvent event) {
                hide();
            }

            public void focusGained(FocusEvent arg0) {
View Full Code Here

      fShellListener= new Listener() {

        public void handleEvent(Event event) {
          Object[] listeners= fFocusListeners.getListeners();
          for (int i= 0; i < listeners.length; i++) {
            FocusListener focusListener= (FocusListener)listeners[i];
            if (event.type == SWT.Activate) {
              focusListener.focusGained(new FocusEvent(event));
            } else {
              focusListener.focusLost(new FocusEvent(event));
            }
          }
        }
      };
      fShell.addListener(SWT.Deactivate, fShellListener);
View Full Code Here

TOP

Related Classes of org.eclipse.swt.events.FocusListener

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.