Java 类javax.swing.event.DocumentListener 实例源码

项目:incubator-netbeans    文件:SuiteCustomizerBasicBranding.java   
/**
 * Creates new form SuiteCustomizerLibraries
 */
public SuiteCustomizerBasicBranding(final SuiteProperties suiteProps, ProjectCustomizer.Category cat, 
        BasicCustomizer.SubCategoryProvider prov) {
    super(suiteProps, SuiteCustomizerBasicBranding.class, cat);
    initComponents();        
    this.prov = prov;
    refresh(); 
    checkValidity();
    DocumentListener textFieldChangeListener = new UIUtil.DocumentAdapter() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            checkValidity();
        }
    };
    nameValue.getDocument().addDocumentListener(textFieldChangeListener);
}
项目:incubator-netbeans    文件:BasicBrandingPanel.java   
public BasicBrandingPanel(BrandingModel model) {
    super(NbBundle.getMessage(BasicBrandingPanel.class, "LBL_BasicTab"), model); //NOI18N
    initComponents();        
    refresh(); 
    checkValidity();
    DocumentListener textFieldChangeListener = new UIUtil.DocumentAdapter() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            checkValidity();
            setModified();
            titleValueModified = true;
        }
    };
    titleValue.getDocument().addDocumentListener(textFieldChangeListener);
    titleValueModified = false;
}
项目:incubator-netbeans    文件:ViewUpdates.java   
public ViewUpdates(DocumentView docView) {
    this.docView = docView;
    incomingModificationListener = new IncomingModificationListener();
    Document doc = docView.getDocument();
    // View hierarchy uses a pair of its own document listeners and DocumentView ignores
    // document change notifications sent from BasicTextUI.RootView.
    // First listener - incomingModificationListener at DocumentListenerPriority.FIRST notifies the hierarchy
    // about incoming document modification.
    // Second listener is "this" at DocumentListenerPriority.VIEW updates the view hierarchy structure
    // according to the document modification.
    // These two listeners avoid situation when a document modification modifies line structure
    // and so the view hierarchy (which uses swing Positions for line view statrts) is inconsistent
    // since e.g. with insert there may be gaps between views and with removal there may be overlapping views
    // but the document listeners that are just being notified include a highlighting layer's document listener
    // BEFORE the BasicTextUI.RootView listener. At that point the highlighting layer would fire a highlighting
    // change and the view hierarchy would attempt to rebuild itself but that would fail.
    listenerPriorityAwareDoc = DocumentUtilities.addPriorityDocumentListener(doc, 
            WeakListeners.create(DocumentListener.class, incomingModificationListener, null),
            DocumentListenerPriority.FIRST);
    // Add the second listener in all cases.
    DocumentUtilities.addDocumentListener(doc,
            WeakListeners.create(DocumentListener.class, this, doc),
            DocumentListenerPriority.VIEW);
}
项目:incubator-netbeans    文件:OutputDocument.java   
public void addDocumentListener(DocumentListener listener) {
    if (listener == null) {
        return;
    }

    if (docListeners == null) {
        docListeners = new DocumentListener[1];
        docListeners[0] = listener;
    } else {
        DocumentListener[] oldArr = docListeners;
        docListeners = new DocumentListener[oldArr.length + 1];
        System.arraycopy(oldArr, 0,
                         docListeners, 0,
                         oldArr.length);
        docListeners[oldArr.length] = listener;
    }
}
项目:incubator-netbeans    文件:NameAndLocationPanel.java   
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final NewLibraryDescriptor.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title",// NOI18N
            NbBundle.getMessage(NameAndLocationPanel.class,"LBL_LibraryWizardTitle")); // NOI18N

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            NewLibraryDescriptor.DataModel _data = getTemporaryDataModel();                
            setEnabledForFilesInfo(checkValidity(_data));
            setFilesInfoIntoTextAreas(_data);
        }
    };
    libraryNameVale.getDocument().addDocumentListener(dListener);
    libraryDisplayNameValue.getDocument().addDocumentListener(dListener);        
}
项目:incubator-netbeans    文件:NameIconLocationPanel.java   
/** Creates new NameIconLocationPanel */
public NameIconLocationPanel(final WizardDescriptor setting, final DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_WizardWizardTitle"));
    DocumentListener updateListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            updateData();
        }
    };
    classNamePrefix.getDocument().addDocumentListener(updateListener);
    displayName.getDocument().addDocumentListener(updateListener);
    icon.getDocument().addDocumentListener(updateListener);        
    Component editorComp = packageName.getEditor().getEditorComponent();
    if (editorComp instanceof JTextComponent) {
        ((JTextComponent) editorComp).getDocument().addDocumentListener(updateListener);
    }
    if (category.getEditor().getEditorComponent() instanceof JTextField) {
        JTextComponent txt = (JTextComponent) category.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(updateListener);
    }
}
项目:incubator-netbeans    文件:NameAndLocationPanel.java   
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final HTMLIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);

    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }
}
项目:incubator-netbeans    文件:NameAndLocationPanel.java   
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);

    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }
}
项目:incubator-netbeans    文件:Repository.java   
private void initPanel() {
    repositoryPanel = new RepositoryPanel();

    urlComboEditor = (JTextComponent) repositoryPanel.urlComboBox
                                      .getEditor().getEditorComponent();
    urlDoc = urlComboEditor.getDocument();
    usernameDoc = repositoryPanel.userTextField.getDocument();
    passwordDoc = repositoryPanel.userPasswordField.getDocument();
    tunnelCmdDoc = repositoryPanel.tunnelCommandTextField.getDocument();

    DocumentListener documentListener = new DocumentChangeHandler();
    urlDoc.addDocumentListener(documentListener);
    passwordDoc.addDocumentListener(documentListener);
    usernameDoc.addDocumentListener(documentListener);
    tunnelCmdDoc.addDocumentListener(documentListener);

    repositoryPanel.savePasswordCheckBox.addItemListener(this);
    repositoryPanel.urlComboBox.addItemListener(this);

    repositoryPanel.proxySettingsButton.addActionListener(this);

    repositoryPanel.userPasswordField.addFocusListener(this);

    tweakComboBoxEditor();
}
项目:educational-plugin    文件:StudyTwitterUtils.java   
/**
 * Listener updates label indicating remaining symbols number like in twitter.
 */
private static DocumentListener createTextFieldLengthDocumentListener(@NotNull TwitterDialogWrapper builder, @NotNull final StudyTwitterUtils.TwitterDialogPanel panel) {
  return new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      int length = e.getDocument().getLength();
      if (length > 140 || length == 0) {
        builder.setOKActionEnabled(false);
        panel.getRemainSymbolsLabel().setText("<html><font color='red'>" + String.valueOf(140 - length) + "</font></html>");
      } else {
        builder.setOKActionEnabled(true);
        panel.getRemainSymbolsLabel().setText(String.valueOf(140 - length));
      }

    }
  };
}
项目:intellij-ce-playground    文件:AppEngineCloudConfigurable.java   
public AppEngineCloudConfigurable(@NotNull AppEngineServerConfiguration configuration,
                                  @Nullable Project project, boolean alwaysRememberPassword) {
  myConfiguration = configuration;
  myProject = project;
  ActionListener actionListener = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent event) {
      updateControls();
    }
  };
  myPasswordLoginButton.addActionListener(actionListener);
  myOAuthLoginButton.addActionListener(actionListener);
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateControls();
    }
  };
  myEmailField.getDocument().addDocumentListener(documentListener);
  myPasswordField.getDocument().addDocumentListener(documentListener);
  myAlwaysRememberPassword = alwaysRememberPassword;
  updateControls();
}
项目:intellij-ce-playground    文件:GithubRepositoryEditor.java   
public GithubRepositoryEditor(final Project project, final GithubRepository repository, Consumer<GithubRepository> changeListener) {
  super(project, repository, changeListener);
  myUrlLabel.setVisible(false);
  myUsernameLabel.setVisible(false);
  myUserNameText.setVisible(false);
  myPasswordLabel.setVisible(false);
  myPasswordText.setVisible(false);
  myUseHttpAuthenticationCheckBox.setVisible(false);

  myRepoAuthor.setText(repository.getRepoAuthor());
  myRepoName.setText(repository.getRepoName());
  myToken.setText(repository.getToken());
  myToken.setText(repository.getToken());
  myShowNotAssignedIssues.setSelected(!repository.isAssignedIssuesOnly());

  DocumentListener buttonUpdater = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateTokenButton();
    }
  };

  myURLText.getDocument().addDocumentListener(buttonUpdater);
  myRepoAuthor.getDocument().addDocumentListener(buttonUpdater);
  myRepoName.getDocument().addDocumentListener(buttonUpdater);
}
项目:intellij-ce-playground    文件:HgTagDialog.java   
public HgTagDialog(@NotNull Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo) {
  super(project, false);
  hgRepositorySelectorComponent.setTitle("Select repository to tag");
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      validateFields();
    }
  };

  tagTxt.getDocument().addDocumentListener(documentListener);

  setTitle("Tag");
  init();

  setRoots(repositories, selectedRepo);
}
项目:swingx    文件:AutoCompleteDocument.java   
/**
 * {@inheritDoc}
 */
@Override
public void changedUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).changedUpdate(e);
        }
    }
}
项目:swingx    文件:AutoCompleteDocument.java   
/**
 * {@inheritDoc}
 */
@Override
public void insertUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).insertUpdate(e);
        }
    }
}
项目:swingx    文件:AutoCompleteDocument.java   
/**
 * {@inheritDoc}
 */
@Override
public void removeUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).removeUpdate(e);
        }
    }
}
项目:aibench-project    文件:AutoCompleteDocument.java   
/**
 * {@inheritDoc}
 */
public void changedUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).changedUpdate(e);
        }          
    }
}
项目:aibench-project    文件:AutoCompleteDocument.java   
/**
 * {@inheritDoc}
 */
public void insertUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).insertUpdate(e);
        }          
    }
}
项目:aibench-project    文件:AutoCompleteDocument.java   
/**
 * {@inheritDoc}
 */
public void removeUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).removeUpdate(e);
        }          
    }
}
项目:LoboBrowser    文件:TextViewerWindow.java   
public TextViewerWindow() {
  super("LoboBrowser Console");
  final UserAgentContext uaContext = null; // TODO
  this.setIconImage(DefaultWindowFactory.getInstance().getDefaultImageIcon(uaContext).getImage());
  final JMenuBar menuBar = this.createMenuBar();
  this.setJMenuBar(menuBar);
  final Container contentPane = this.getContentPane();
  final JTextArea textArea = createTextArea();
  this.textArea = textArea;
  contentPane.setLayout(WrapperLayout.getInstance());
  contentPane.add(new JScrollPane(textArea));
  this.addWindowListener(new java.awt.event.WindowAdapter() {
    @Override
    public void windowClosed(final WindowEvent e) {
      final DocumentListener cl = cachedListener;
      if (cl != null) {
        final Document prevDocument = textArea.getDocument();
        if (prevDocument != null) {
          prevDocument.removeDocumentListener(cl);
        }
      }
    }
  });
}
项目:intelij-hippo-groovy    文件:PluginConfiguration.java   
public PluginConfiguration() {

        final DocumentListener listener = new DocumentAdapter() {
            @Override
            protected void textChanged(DocumentEvent documentEvent) {
                groovyDirectory.getText();
            }
        };
        groovyDirectory.getChildComponent().getDocument().addDocumentListener(listener);
        groovyDirectory.setTextFieldPreferredWidth(50);
        groovyDirectory.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                chooseFolder(groovyDirectory, false);
            }
        });


    }
项目:breakout    文件:AnnotatingJTables.java   
public static DocumentListener createFilterFieldListener(
        final AnnotatingJTable table, final JTextComponent filterField,
        final RowFilterFactory<String, TableModel, Integer> filterFactory) {
    return new EasyDocumentListener() {
        @Override
        public void documentChanged(DocumentEvent e) {
            if (table.getAnnotatingRowSorter() == null) {
                return;
            }
            if (filterField.getText() != null && filterField.getText().length() > 0) {
                RowFilter<TableModel, Integer> filter = null;
                try {
                    filter = filterFactory.createFilter(filterField.getText());
                    filterField.setForeground(Color.BLACK);
                } catch (Exception ex) {
                    filterField.setForeground(Color.RED);
                }
                table.getAnnotatingRowSorter().setRowFilter(filter);
            } else {
                filterField.setForeground(Color.BLACK);

                table.getAnnotatingRowSorter().setRowFilter(null);
            }
        }
    };
}
项目:intellij-xquery    文件:ConnectionParametersPanel.java   
private void setUpChangeListeners(final DataSourceConfigurationAggregatingPanel
                                          aggregatingPanel,
                                  final ConfigurationChangeListener listener) {
    DocumentListener textFieldListener = new DocumentAdapter() {
        @Override
        protected void textChanged(DocumentEvent e) {
            listener.changeApplied(aggregatingPanel
                    .getCurrentConfigurationState());
        }
    };
    host.getComponent().getDocument().addDocumentListener(textFieldListener);
    port.getComponent().getDocument().addDocumentListener(textFieldListener);
    username.getComponent().getDocument().addDocumentListener(textFieldListener);
    password.getComponent().getDocument().addDocumentListener(textFieldListener);
    databaseName.getComponent().getDocument().addDocumentListener(textFieldListener);
}
项目:incubator-netbeans    文件:BaseDocument.java   
void firePreRemoveUpdate(DefaultDocumentEvent chng) {
    // Notify the remove update listeners - before the actual remove happens
    // so that it adheres to removeUpdate() logic; also the listeners can check
    // positions' offsets before the actual removal happens.
    for (DocumentListener listener: updateDocumentListenerList.getListeners()) {
        listener.removeUpdate(chng);
    }
}
项目:incubator-netbeans    文件:BaseDocument.java   
@Override
   public void addDocumentListener(DocumentListener listener) {
       if (LOG_LISTENER.isLoggable(Level.FINE)) {
           LOG_LISTENER.fine("ADD DocumentListener of class " + listener.getClass() + " to existing " +
                   org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentListenerCount(this) +
                   " listeners. Listener: " + listener + '\n'
           );
           if (LOG_LISTENER.isLoggable(Level.FINER)) {
               LOG_LISTENER.log(Level.FINER, "    StackTrace:\n", new Exception());
           }
       }
if (!org.netbeans.lib.editor.util.swing.DocumentUtilities.addPriorityDocumentListener(
               this, listener, DocumentListenerPriority.DEFAULT))
           super.addDocumentListener(listener);
   }
项目:incubator-netbeans    文件:BaseDocument.java   
@Override
   public void removeDocumentListener(DocumentListener listener) {
       if (LOG_LISTENER.isLoggable(Level.FINE)) {
           LOG_LISTENER.fine("REMOVE DocumentListener of class " + listener.getClass() + " from existing " +
                   org.netbeans.lib.editor.util.swing.DocumentUtilities.getDocumentListenerCount(this) +
                   " listeners. Listener: " + listener + '\n'
           );
           if (LOG_LISTENER.isLoggable(Level.FINER)) {
               LOG_LISTENER.log(Level.FINER, "    StackTrace:\n", new Exception());
           }
       }
if (!org.netbeans.lib.editor.util.swing.DocumentUtilities.removePriorityDocumentListener(
               this, listener, DocumentListenerPriority.DEFAULT))
           super.removeDocumentListener(listener);
   }
项目:incubator-netbeans    文件:XMLSyntaxSupport.java   
/** Creates new XMLSyntaxSupport */
public XMLSyntaxSupport(BaseDocument doc) {
    super(doc);

    // listener has same lifetime as this class
    documentMonitor = new DocumentMonitor();
    DocumentListener l = WeakListeners.document(documentMonitor, doc);
    doc.addDocumentListener(l);

}
项目:incubator-netbeans    文件:OutputDocument.java   
public void removeDocumentListener(DocumentListener listener) {
    if (listener == null) {
        return;
    }

    if (docListeners == null) {
        return;
    }

    int index = -1;
    for (int i = 0; i < docListeners.length; i++) {
        if (docListeners[i] == listener) {
            index = i;
            break;
        }
    }
    if (index != -1) {
        if (docListeners.length == 1) {
            docListeners = null;
        } else {
            DocumentListener[] oldArr = docListeners;
            docListeners = new DocumentListener[oldArr.length - 1];
            if (index != 0) {
                System.arraycopy(oldArr, 0,
                                 docListeners, 0,
                                 index);
            }
            if (index != oldArr.length - 1) {
                System.arraycopy(oldArr, index + 1,
                                 docListeners, index,
                                 oldArr.length - (index + 1));
            }
        }
    }
}
项目:incubator-netbeans    文件:XmlMultiViewEditorSupport.java   
public void run() {
    Document document = getDocument();
    DocumentListener listener = document == null ? null :
        (DocumentListener) document.getProperty(PROPERTY_MODIFICATION_LISTENER);
    if (listener != null) {
        document.removeDocumentListener(listener);
    }
    try {
        reloadModel();
    } finally {
        if (listener != null) {
            document.addDocumentListener(listener);
        }
    }
}
项目:incubator-netbeans    文件:PropertiesTableCellEditor.java   
/** Constructs a PropertiesTableCellEditor that uses a text field.
 * @param tf  a JTextField object ...
 * @param  commentComponent
 * @param valueComponent
 * @param valueLabel
 * @param listener 
 */
public PropertiesTableCellEditor(JTextField tf, final JTextComponent commentComponent,
    final JTextComponent valueComponent, final JLabel valueLabel, DocumentListener listener) {
    super(tf);
    // Number of clicks needed to edit an editable cell.
    this.clickCountToStart = 1;
    this.listener = listener;
    this.valueComponent = valueComponent;
    this.commentComponent = commentComponent;
    valueComponent.setDocument(tf.getDocument());
    this.delegate = new PropertiesEditorDelegate(commentComponent, valueComponent, valueLabel);
    ((JTextField)editorComponent).addActionListener(delegate);

    settings = TableViewSettings.getDefault();
}
项目:incubator-netbeans    文件:AbstractDocumentModel.java   
private DocumentListener getDelegate() {
    DocumentListener l = delegate.get();
    if (l == null) {
    source.removeDocumentListener(this);
    }

    return l;
}
项目:incubator-netbeans    文件:AbstractDocumentModel.java   
@Override
public void removeUpdate(DocumentEvent e) {
    DocumentListener l = getDelegate();
    if (l != null) {
    l.removeUpdate(e);
    }
}
项目:incubator-netbeans    文件:AbstractDocumentModel.java   
@Override
public void changedUpdate(DocumentEvent e) {
    DocumentListener l = getDelegate();
    if (l != null) {
    l.changedUpdate(e);
    }
}
项目:incubator-netbeans    文件:AbstractDocumentModel.java   
@Override
public void insertUpdate(DocumentEvent e) {
    DocumentListener l = getDelegate();
    if (l != null) {
    l.insertUpdate(e);
    }
}
项目:incubator-netbeans    文件:PriorityDocumentListenerList.java   
/**
 * Implementation of DocumentListener's method fires all the added
 * listeners according to their priority.
 */
public void insertUpdate(DocumentEvent evt) {
    logEvent(evt, "insertUpdate");
    // Fire the prioritized listeners
    EventListener[][] listenersArray = getListenersArray();
    // Attempt to fire to all listeners catching possible exception(s) and report first fired then
    RuntimeException runtimeException = null;
    for (int priority = listenersArray.length - 1; priority >= 0; priority--) {
        logPriority(priority);
        EventListener[] listeners = listenersArray[priority];
        for (int i = listeners.length - 1; i >= 0; i--) {
            DocumentListener l = (DocumentListener) listeners[i];
            logListener(l);
            try {
                l.insertUpdate(evt);
            } catch (RuntimeException ex) {
                if (runtimeException == null) { // Only record first thrown
                    runtimeException = ex;
                }
            }
        }
    }
    if (runtimeException != null) {
        throw runtimeException; // Re-throw remembered exception
    }
    logEventEnd("insertUpdate");
}
项目:incubator-netbeans    文件:PriorityDocumentListenerList.java   
/**
 * Implementation of DocumentListener's method fires all the added
 * listeners according to their priority.
 */
public void removeUpdate(DocumentEvent evt) {
    logEvent(evt, "removeUpdate");
    // Fire the prioritized listeners
    EventListener[][] listenersArray = getListenersArray();
    // Attempt to fire to all listeners catching possible exception(s) and report first fired then
    RuntimeException runtimeException = null;
    for (int priority = listenersArray.length - 1; priority >= 0; priority--) {
        logPriority(priority);
        EventListener[] listeners = listenersArray[priority];
        for (int i = listeners.length - 1; i >= 0; i--) {
            DocumentListener l = (DocumentListener) listeners[i];
            logListener(l);
            try {
                l.removeUpdate(evt);
            } catch (RuntimeException ex) {
                if (runtimeException == null) { // Only record first thrown
                    runtimeException = ex;
                }
            }
        }
    }
    if (runtimeException != null) {
        throw runtimeException; // Re-throw remembered exception
    }
    logEventEnd("removeUpdate");
}
项目:incubator-netbeans    文件:PriorityDocumentListenerList.java   
/**
 * Implementation of DocumentListener's method fires all the added
 * listeners according to their priority.
 */
public void changedUpdate(DocumentEvent evt) {
    logEvent(evt, "changedUpdate");
    // Fire the prioritized listeners
    EventListener[][] listenersArray = getListenersArray();
    // Attempt to fire to all listeners catching possible exception(s) and report first fired then
    RuntimeException runtimeException = null;
    for (int priority = listenersArray.length - 1; priority >= 0; priority--) {
        logPriority(priority);
        EventListener[] listeners = listenersArray[priority];
        for (int i = listeners.length - 1; i >= 0; i--) {
            DocumentListener l = (DocumentListener) listeners[i];
            logListener(l);
            try {
                l.changedUpdate(evt);
            } catch (RuntimeException ex) {
                if (runtimeException == null) { // Only record first thrown
                    runtimeException = ex;
                }
            }
        }
    }
    if (runtimeException != null) {
        throw runtimeException; // Re-throw remembered exception
    }
    logEventEnd("changedUpdate");
}
项目:incubator-netbeans    文件:QuickSearchPanel.java   
QuickSearchPanel(WizardDescriptor settings, DataModel data) {
    super(settings);
    this.data = data;
    initComponents();

    putClientProperty("NewFileWizard_Title", getMessage("LBL_QuickSearchPanel_Title"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {

        public void insertUpdate(DocumentEvent e) {
            checkValidity();
        }
    };

    if (data.getPackageName() != null) {
        packageCombo.setSelectedItem(data.getPackageName());
    }

    classNameTextField.getDocument().addDocumentListener(dListener);
    categoryNameTextField.getDocument().addDocumentListener(dListener);
    commandPrefixTextField.getDocument().addDocumentListener(dListener);
    positionTextField.getDocument().addDocumentListener(dListener);
    Component editorComp = packageCombo.getEditor().getEditorComponent();
    if (editorComp instanceof JTextComponent) {
        ((JTextComponent) editorComp).getDocument().addDocumentListener(dListener);
    }
}
项目:incubator-netbeans    文件:NameAndLocationPanel.java   
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final NewLoaderIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_LoaderWizardTitle"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);

    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }

    if (data.canUseMultiview()) {
        useMultiView.setEnabled(true);
        useMultiView.setSelected(true);
    } else {
        useMultiView.setEnabled(false);
        useMultiView.setSelected(false);
    }
}
项目:incubator-netbeans    文件:CodeGeneratorPanel.java   
/** Creates new form CodeGeneratorPanel */
CodeGeneratorPanel(WizardDescriptor settings, NewCodeGeneratorIterator.DataModel data) {
    super(settings);
    this.data = data;
    initComponents();

    putClientProperty("NewFileWizard_Title", getMessage("LBL_CodeGeneratorPanel_Title"));

    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            checkValidity();
        }
    };

    if (data.getPackageName() != null) {
        packageNameCombo.setSelectedItem(data.getPackageName());
    }

    fileNametextField.getDocument().addDocumentListener(dListener);
    cpFileNameField.getDocument().addDocumentListener(dListener);
    mimeTypeTextField.getDocument().addDocumentListener(dListener);
    Component editorComp = packageNameCombo.getEditor().getEditorComponent();
    if (editorComp instanceof JTextComponent) {
        ((JTextComponent) editorComp).getDocument().addDocumentListener(dListener);
    }

}