java类java.beans.PropertyVetoException的实例源码

AbstractBatchJdbcTemplateBenchmark.java 文件源码 项目:buffer-slayer 阅读 20 收藏 0 点赞 0 评论 0
@Setup
public void setup() throws PropertyVetoException {
  dataSource = new DriverManagerDataSource();
  dataSource.setDriverClassName("com.mysql.jdbc.Driver");
  dataSource.setUrl(propertyOr("jdbcUrl", "jdbc:mysql://127.0.0.1:3306?useSSL=false"));
  dataSource.setUsername(propertyOr("username", "root"));
  dataSource.setPassword(propertyOr("password", "root"));

  JdbcTemplate delegate = new JdbcTemplate(dataSource);
  delegate.setDataSource(dataSource);

  proxy = new SenderProxy(new JdbcTemplateSender(delegate));
  proxy.onMessages(updated -> counter.addAndGet(updated.size()));

  reporter = reporter(proxy);
  batch = new BatchJdbcTemplate(delegate, reporter);
  batch.setDataSource(dataSource);

  unbatch = new JdbcTemplate(dataSource);
  unbatch.setDataSource(dataSource);
  unbatch.update(CREATE_DATABASE);
  unbatch.update(DROP_TABLE);
  unbatch.update(CREATE_TABLE);
}
BaseCaretTest.java 文件源码 项目:incubator-netbeans 阅读 21 收藏 0 点赞 0 评论 0
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException {
    Collection<URL> allUrls = new ArrayList<URL>();
    for (String u : additionalLayers) {
        if (u.charAt(0) == '/') {
            u = u.substring(1);
        }
        for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(u); en.hasMoreElements(); ) {
            allUrls.add(en.nextElement());
        }
    }
    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(allUrls.toArray(new URL[allUrls.size()]));

    Repository repository = new Repository(system);
    Object[] lookupContent = new Object[additionalLookupContent.length + 1];

    System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length);

    lookupContent[0] = repository;

    setLookup(lookupContent, BaseCaretTest.class.getClassLoader());
}
GuardedSectionManagerTest.java 文件源码 项目:incubator-netbeans 阅读 29 收藏 0 点赞 0 评论 0
public void testRenameInteriorSection() throws BadLocationException, PropertyVetoException {
    System.out.println("-- testRenameInteriorSection -------------");

    editor.doc.insertString(0, "aaa", null);
    InteriorSection is1 = guards.createInteriorSection(editor.doc.createPosition(1), "is1");
    assertEquals("name", "is1", is1.getName());
    is1.setName("isNewName");
    assertTrue("valid", is1.isValid());
    assertEquals("new name", "isNewName", is1.getName());
    // set the same name
    is1.setName("isNewName");

    InteriorSection is2 = guards.createInteriorSection(
            editor.doc.createPosition(is1.getEndPosition().getOffset() + 1),
            "is2");

    // rename to existing name
    try {
        is1.setName("is2");
        fail("accepted already existing name");
    } catch (PropertyVetoException ex) {
        assertTrue("valid", is1.isValid());
        assertEquals("name", "isNewName", is1.getName());
    }
}
KeyboardFocusManager.java 文件源码 项目:openjdk-jdk10 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Sets the active Window. Only a Frame or a Dialog can be the active
 * Window. The native windowing system may denote the active Window or its
 * children with special decorations, such as a highlighted title bar. The
 * active Window is always either the focused Window, or the first Frame or
 * Dialog that is an owner of the focused Window.
 * <p>
 * This method does not actually change the active Window as far as the
 * native windowing system is concerned. It merely stores the value to be
 * subsequently returned by {@code getActiveWindow()}. Use
 * {@code Component.requestFocus()} or
 * {@code Component.requestFocusInWindow()} to change the active
 * Window, subject to platform limitations.
 *
 * @param activeWindow the active Window
 * @see #getActiveWindow
 * @see #getGlobalActiveWindow
 * @see Component#requestFocus()
 * @see Component#requestFocusInWindow()
 * @throws SecurityException if this KeyboardFocusManager is not the
 *         current KeyboardFocusManager for the calling thread's context
 *         and if the calling thread does not have "replaceKeyboardFocusManager"
 *         permission
 */
protected void setGlobalActiveWindow(Window activeWindow)
    throws SecurityException
{
    Window oldActiveWindow;
    synchronized (KeyboardFocusManager.class) {
        checkKFMSecurity();

        oldActiveWindow = getActiveWindow();
        if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
            focusLog.finer("Setting global active window to " + activeWindow + ", old active " + oldActiveWindow);
        }

        try {
            fireVetoableChange("activeWindow", oldActiveWindow,
                               activeWindow);
        } catch (PropertyVetoException e) {
            // rejected
            return;
        }

        KeyboardFocusManager.activeWindow = activeWindow;
    }

    firePropertyChange("activeWindow", oldActiveWindow, activeWindow);
}
OutlineView.java 文件源码 项目:incubator-netbeans 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Called when selection in tree is changed.
 */
private void callSelectionChanged (Node[] nodes) {
    manager.removePropertyChangeListener (wlpc);
    manager.removeVetoableChangeListener (wlvc);
    try {
        manager.setSelectedNodes(nodes);
    } catch (PropertyVetoException e) {
        synchronizeSelectedNodes(false);
    } finally {
        // to be sure not to add them twice!
        manager.removePropertyChangeListener (wlpc);
        manager.removeVetoableChangeListener (wlvc);
        manager.addPropertyChangeListener (wlpc);
        manager.addVetoableChangeListener (wlvc);
    }
}
PhadhailViews.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
private static Component nodeBasedView(Node root) {
    Node root2;
    if (Children.MUTEX == Mutex.EVENT) {
        // #35833 branch.
        root2 = root;
    } else {
        root2 = new EQReplannedNode(root);
    }
    ExpPanel p = new ExpPanel();
    p.setLayout(new BorderLayout());
    JComponent tree = new BeanTreeView();
    p.add(tree, BorderLayout.CENTER);
    p.getExplorerManager().setRootContext(root2);
    try {
        p.getExplorerManager().setSelectedNodes(new Node[] {root2});
    } catch (PropertyVetoException pve) {
        pve.printStackTrace();
    }
    Object key = "org.openide.actions.PopupAction";
    KeyStroke ks = KeyStroke.getKeyStroke("shift F10");
    tree.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(ks, key);
    return p;
}
WindowBuilders.java 文件源码 项目:incubator-netbeans 阅读 28 收藏 0 点赞 0 评论 0
protected JInternalFrame createInstanceImpl() {
    JInternalFrame frame = new JInternalFrame(title, resizable, closable, maximizable, iconable) {
        protected JRootPane createRootPane() {
            return _rootPane == null ? null : _rootPane.createInstance();
        }
        public void addNotify() {
            try {
                // Doesn't seem to work correctly
                setClosed(_isClosed);
                setMaximum(_isMaximum);
                setIcon(_isIcon);
                setSelected(_isSelected);
            } catch (PropertyVetoException ex) {}
        }
    };
    return frame;
}
XMLFileSystem.java 文件源码 项目:incubator-netbeans 阅读 23 收藏 0 点赞 0 评论 0
/** Initializes the root of FS.
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    //ois.defaultReadObject ();
    ObjectInputStream.GetField fields = ois.readFields();
    URL[] urls = (URL[]) fields.get("urlsToXml", null); // NOI18N

    if (urls == null) {
        urls = new URL[1];
        urls[0] = (URL) fields.get("uriId", null); // NOI18N
        if (urls[0] == null) {
            throw new IOException("missing uriId"); // NOI18N
        }
    }

    try {
        setXmlUrls(urls);
    } catch (PropertyVetoException ex) {
        IOException x = new IOException(ex.getMessage());
        ExternalUtil.copyAnnotation(x, ex);
        throw x;
    }
}
JInternalFrame.java 文件源码 项目:jdk8u-jdk 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Iconifies or de-iconifies this internal frame,
 * if the look and feel supports iconification.
 * If the internal frame's state changes to iconified,
 * this method fires an <code>INTERNAL_FRAME_ICONIFIED</code> event.
 * If the state changes to de-iconified,
 * an <code>INTERNAL_FRAME_DEICONIFIED</code> event is fired.
 *
 * @param b a boolean, where <code>true</code> means to iconify this internal frame and
 *          <code>false</code> means to de-iconify it
 * @exception PropertyVetoException when the attempt to set the
 *            property is vetoed by the <code>JInternalFrame</code>
 *
 * @see InternalFrameEvent#INTERNAL_FRAME_ICONIFIED
 * @see InternalFrameEvent#INTERNAL_FRAME_DEICONIFIED
 *
 * @beaninfo
 *           bound: true
 *     constrained: true
 *     description: The image displayed when this internal frame is minimized.
 */
public void setIcon(boolean b) throws PropertyVetoException {
    if (isIcon == b) {
        return;
    }

    /* If an internal frame is being iconified before it has a
       parent, (e.g., client wants it to start iconic), create the
       parent if possible so that we can place the icon in its
       proper place on the desktop. I am not sure the call to
       validate() is necessary, since we are not going to display
       this frame yet */
    firePropertyChange("ancestor", null, getParent());

    Boolean oldValue = isIcon ? Boolean.TRUE : Boolean.FALSE;
    Boolean newValue = b ? Boolean.TRUE : Boolean.FALSE;
    fireVetoableChange(IS_ICON_PROPERTY, oldValue, newValue);
    isIcon = b;
    firePropertyChange(IS_ICON_PROPERTY, oldValue, newValue);
    if (b)
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_ICONIFIED);
    else
      fireInternalFrameEvent(InternalFrameEvent.INTERNAL_FRAME_DEICONIFIED);
}
TelaInicial.java 文件源码 项目:lembredio 阅读 17 收藏 0 点赞 0 评论 0
/**
 * Creates new form TelaInicial
 */


public TelaInicial() throws PropertyVetoException, IOException {
    initComponents();
    this.setLocationRelativeTo(null);
    jDesktopPane3.add(obj);
    obj.setMaximizable(true);
    obj.setMaximum(true);
    obj.setVisible(true);
    getContentPane().setBackground(Color.WHITE);

    File file = new File("CADASTRADOS.txt");
   if(!file.exists()){
    file.createNewFile();// TODO code application logic here
   }
   File dir = new File("CadastroRemedios");
   if(!dir.exists()){
       dir.mkdir();
   }
    //this.setExtendedState(MAXIMIZED_BOTH);
    //jDesktopPane3.setExtendedState(MAXIMIZED_BOTH);
   //obj.setLocation(jDesktopPane3.getSize().width/2 - obj.getSize().width/2,jDesktopPane3.getSize().height/2 - obj.getSize().height/2);

}
SdksCustomizer.java 文件源码 项目:NBANDROID-V2 阅读 18 收藏 0 点赞 0 评论 0
private static void expandAllNodes(BeanTreeView btv, Node node, ExplorerManager mgr, AndroidSdk platform) {
    btv.expandNode(node);
    Children ch = node.getChildren();
    if (ch == Children.LEAF) {
        if (platform != null && platform.equals(node.getLookup().lookup(AndroidSdk.class))) {
            try {
                mgr.setSelectedNodes(new Node[]{node});
            } catch (PropertyVetoException e) {
                //Ignore it
            }
        }
        return;
    }
    Node nodes[] = ch.getNodes(true);
    for (int i = 0; i < nodes.length; i++) {
        expandAllNodes(btv, nodes[i], mgr, platform);
    }

}
Main.java 文件源码 项目:otus_java_2017_06 阅读 18 收藏 0 点赞 0 评论 0
public static void main(String[] args) throws PropertyVetoException, SQLException, InterruptedException {
    //DataSourceFactory factory = new C3P0DataSourceFactory();
    //DataSourceFactory factory = new DBCPDataSourceFactory();
    DataSourceFactory factory = new HikariCPDataSourceFactory();

    Connection connection = factory.get().getConnection();
    System.out.println("DatabaseProductName: " + connection.getMetaData().getDatabaseProductName());

    Connection connection2 = factory.get().getConnection();
    System.out.println("DriverName: " + connection2.getMetaData().getDriverName());

    Connection connection3 = factory.get().getConnection();
    System.out.println("URL: " + connection3.getMetaData().getURL());

    hold();
}
JarFileSystem.java 文件源码 项目:incubator-netbeans 阅读 23 收藏 0 点赞 0 评论 0
/** Initializes the root of FS.
*/
private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
    ois.defaultReadObject();
    closeSync = new Object();
    strongCache = null;
    softCache = new SoftReference<Cache>(null);
    aliveCount = 0;

    try {
        setJarFile(root);
    } catch (PropertyVetoException ex) {
        throw new IOException(ex.getMessage());
    } catch (IOException iex) {
        ExternalUtil.log(iex.getLocalizedMessage());
    }
}
URLMapperTest.java 文件源码 项目:incubator-netbeans 阅读 21 收藏 0 点赞 0 评论 0
public void testPlusInName() throws IOException, PropertyVetoException {
    clearWorkDir();
    File plus = new File(getWorkDir(), "plus+plus");
    plus.createNewFile();
    LocalFileSystem lfs = new LocalFileSystem();
    lfs.setRootDirectory(getWorkDir());
    Repository.getDefault().addFileSystem(lfs);

    URL uPlus = BaseUtilities.toURI(plus).toURL();
    FileObject fo = URLMapper.findFileObject(uPlus);
    assertNotNull("File object found", fo);
    assertEquals("plus+plus", fo.getNameExt());

    URL back = URLMapper.findURL(fo, URLMapper.EXTERNAL);
    assertTrue("plus+plus is there", back.getPath().endsWith("plus+plus"));
}
MineC3P0DataSource.java 文件源码 项目:JavaStudy 阅读 22 收藏 0 点赞 0 评论 0
public MineC3P0DataSource(boolean autoregister) {
    super(autoregister);
    this.dmds = new DriverManagerDataSource();
    this.wcpds = new WrapperConnectionPoolDataSource();
    this.wcpds.setNestedDataSource(this.dmds);

    try {
        this.setConnectionPoolDataSource(this.wcpds);
    } catch (PropertyVetoException var3) {
        logger.log(MLevel.WARNING, "Hunh??? This can\'t happen. We haven\'t set up any listeners to veto the property change yet!", var3);
        throw new RuntimeException("Hunh??? This can\'t happen. We haven\'t set up any listeners to veto the property change yet! " + var3);
    }

    this.setUpPropertyEvents();
}
CloudSpannerIT.java 文件源码 项目:spanner-jdbc 阅读 18 收藏 0 点赞 0 评论 0
private void performJdbcTests() throws Exception
{
    // Get a JDBC connection
    try (Connection connection = createConnection())
    {
        connection.setAutoCommit(false);
        // Test connection pooling
        ConnectionPoolingTester poolingTester = new ConnectionPoolingTester();
        poolingTester.testPooling((CloudSpannerConnection) connection);

        // Test Table DDL statements
        TableDDLTester tableDDLTester = new TableDDLTester(connection);
        tableDDLTester.runCreateTests();
        // Test DML statements
        DMLTester dmlTester = new DMLTester(connection);
        dmlTester.runDMLTests();
        // Test meta data functions
        MetaDataTester metaDataTester = new MetaDataTester(connection);
        metaDataTester.runMetaDataTests();
        // Test transaction functions
        TransactionTester txTester = new TransactionTester(connection);
        txTester.runTransactionTests();
        // Test select statements
        SelectStatementsTester selectTester = new SelectStatementsTester(connection);
        selectTester.runSelectTests();
        // Test XA transactions
        XATester xaTester = new XATester();
        xaTester.testXA(projectId, instanceId, DATABASE_ID, credentialsPath);

        // Test drop statements
        tableDDLTester.runDropTests();
    }
    catch (SQLException | PropertyVetoException e)
    {
        log.log(Level.WARNING, "Error during JDBC tests", e);
        throw e;
    }
}
KeyboardFocusManager.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
/**
 * Sets the focused Window. The focused Window is the Window that is or
 * contains the focus owner. The operation will be cancelled if the
 * specified Window to focus is not a focusable Window.
 * <p>
 * This method does not actually change the focused Window as far as the
 * native windowing system is concerned. It merely stores the value to be
 * subsequently returned by <code>getFocusedWindow()</code>. Use
 * <code>Component.requestFocus()</code> or
 * <code>Component.requestFocusInWindow()</code> to change the focused
 * Window, subject to platform limitations.
 *
 * @param focusedWindow the focused Window
 * @see #getFocusedWindow
 * @see #getGlobalFocusedWindow
 * @see Component#requestFocus()
 * @see Component#requestFocusInWindow()
 * @see Window#isFocusableWindow
 * @throws SecurityException if this KeyboardFocusManager is not the
 *         current KeyboardFocusManager for the calling thread's context
 *         and if the calling thread does not have "replaceKeyboardFocusManager"
 *         permission
 * @beaninfo
 *       bound: true
 */
protected void setGlobalFocusedWindow(Window focusedWindow)
    throws SecurityException
{
    Window oldFocusedWindow = null;
    boolean shouldFire = false;

    if (focusedWindow == null || focusedWindow.isFocusableWindow()) {
        synchronized (KeyboardFocusManager.class) {
            checkKFMSecurity();

            oldFocusedWindow = getFocusedWindow();

            try {
                fireVetoableChange("focusedWindow", oldFocusedWindow,
                                   focusedWindow);
            } catch (PropertyVetoException e) {
                // rejected
                return;
            }

            KeyboardFocusManager.focusedWindow = focusedWindow;
            shouldFire = true;
        }
    }

    if (shouldFire) {
        firePropertyChange("focusedWindow", oldFocusedWindow,
                           focusedWindow);
    }
}
C3p0DataSourceConfig.java 文件源码 项目:adept 阅读 16 收藏 0 点赞 0 评论 0
/**
 * 通过基础配置信息构建DBCP数据源信息.
 * @param driver 数据库连接的JDBC驱动
 * @param url 数据库连接的url
 * @param user 数据库连接的用户名
 * @param password 数据库连接的密码
 */
public ComboPooledDataSource buildDataSource(String driver, String url, String user, String password) {
    ComboPooledDataSource dataSource = new ComboPooledDataSource();
    try {
        dataSource.setDriverClass(driver);
    } catch (PropertyVetoException e) {
        log.error("设置C3P0数据源的DriverClass出错!", e);
    }
    dataSource.setJdbcUrl(url);
    dataSource.setUser(user);
    dataSource.setPassword(password);
    return dataSource;
}
AbstractSearchResultsPanel.java 文件源码 项目:incubator-netbeans 阅读 21 收藏 0 点赞 0 评论 0
private void shift(int direction) {

        Node next = findShiftNode(direction, getOutlineView(), true);
        if (next != null) {
            try {
                getExplorerManager().setSelectedNodes(new Node[]{next});
                onDetailShift(next);
            } catch (PropertyVetoException pve) {
                Exceptions.printStackTrace(pve);
            }
        }
    }
WindowsDesktopManager.java 文件源码 项目:jdk8u-jdk 阅读 22 收藏 0 点赞 0 评论 0
public void activateFrame(JInternalFrame f) {
    JInternalFrame currentFrame = currentFrameRef != null ?
        currentFrameRef.get() : null;
    try {
        super.activateFrame(f);
        if (currentFrame != null && f != currentFrame) {
            // If the current frame is maximized, transfer that
            // attribute to the frame being activated.
            if (currentFrame.isMaximum() &&
                (f.getClientProperty("JInternalFrame.frameType") !=
                "optionDialog") ) {
                //Special case.  If key binding was used to select next
                //frame instead of minimizing the icon via the minimize
                //icon.
                if (!currentFrame.isIcon()) {
                    currentFrame.setMaximum(false);
                    if (f.isMaximizable()) {
                        if (!f.isMaximum()) {
                            f.setMaximum(true);
                        } else if (f.isMaximum() && f.isIcon()) {
                            f.setIcon(false);
                        } else {
                            f.setMaximum(false);
                        }
                    }
                }
            }
            if (currentFrame.isSelected()) {
                currentFrame.setSelected(false);
            }
        }

        if (!f.isSelected()) {
            f.setSelected(true);
        }
    } catch (PropertyVetoException e) {}
    if (f != currentFrame) {
        currentFrameRef = new WeakReference<JInternalFrame>(f);
    }
}
WindowsDesktopManager.java 文件源码 项目:openjdk-jdk10 阅读 18 收藏 0 点赞 0 评论 0
public void activateFrame(JInternalFrame f) {
    JInternalFrame currentFrame = currentFrameRef != null ?
        currentFrameRef.get() : null;
    try {
        super.activateFrame(f);
        if (currentFrame != null && f != currentFrame) {
            // If the current frame is maximized, transfer that
            // attribute to the frame being activated.
            if (!currentFrame.isClosed() && currentFrame.isMaximum() &&
                (f.getClientProperty("JInternalFrame.frameType") !=
                "optionDialog") ) {
                //Special case.  If key binding was used to select next
                //frame instead of minimizing the icon via the minimize
                //icon.
                if (!currentFrame.isIcon()) {
                    currentFrame.setMaximum(false);
                    if (f.isMaximizable()) {
                        if (!f.isMaximum()) {
                            f.setMaximum(true);
                        } else if (f.isMaximum() && f.isIcon()) {
                            f.setIcon(false);
                        } else {
                            f.setMaximum(false);
                        }
                    }
                }
            }
            if (currentFrame.isSelected()) {
                currentFrame.setSelected(false);
            }
        }

        if (!f.isSelected()) {
            f.setSelected(true);
        }
    } catch (PropertyVetoException e) {}
    if (f != currentFrame) {
        currentFrameRef = new WeakReference<JInternalFrame>(f);
    }
}
HistoryFileView.java 文件源码 项目:incubator-netbeans 阅读 22 收藏 0 点赞 0 评论 0
private void setSelection(final Node[] nodes) {
SwingUtilities.invokeLater(new Runnable() {
@Override
    public void run() {
        try {
            tablePanel.getExplorerManager().setSelectedNodes(nodes);
        } catch (PropertyVetoException ex) {
            // ignore
        }
    }
});                                             
}
IDEInitializer.java 文件源码 项目:incubator-netbeans 阅读 18 收藏 0 点赞 0 评论 0
public MyFileSystem (FileSystem[] fileSystems) {
    super (fileSystems);
    try {
        setSystemName ("TestFS");
    } catch (PropertyVetoException ex) {
        ex.printStackTrace();
    }
}
StringEditor.java 文件源码 项目:incubator-netbeans 阅读 21 收藏 0 点赞 0 评论 0
@Override
public void vetoableChange(PropertyChangeEvent ev) throws PropertyVetoException {
    super.vetoableChange(ev);
    if (PropertyEnv.PROP_STATE.equals(ev.getPropertyName())
        && resourcePanel == null && noI18nCheckbox  != null)
    {   // no resourcing, just internationalizing
        // mark the property excluded if the NOI18N checkbox is checked
        ResourceSupport.setExcludedProperty(property, noI18nCheckbox.isSelected());
    }
}
KeyboardFocusManager.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Sets the permanent focus owner. The operation will be cancelled if the
 * Component is not focusable. The permanent focus owner is defined as the
 * last Component in an application to receive a permanent FOCUS_GAINED
 * event. The focus owner and permanent focus owner are equivalent unless
 * a temporary focus change is currently in effect. In such a situation,
 * the permanent focus owner will again be the focus owner when the
 * temporary focus change ends.
 * <p>
 * This method does not actually set the focus to the specified Component.
 * It merely stores the value to be subsequently returned by
 * {@code getPermanentFocusOwner()}. Use
 * {@code Component.requestFocus()} or
 * {@code Component.requestFocusInWindow()} to change the focus owner,
 * subject to platform limitations.
 *
 * @param permanentFocusOwner the permanent focus owner
 * @see #getPermanentFocusOwner
 * @see #getGlobalPermanentFocusOwner
 * @see Component#requestFocus()
 * @see Component#requestFocusInWindow()
 * @see Component#isFocusable
 * @throws SecurityException if this KeyboardFocusManager is not the
 *         current KeyboardFocusManager for the calling thread's context
 *         and if the calling thread does not have "replaceKeyboardFocusManager"
 *         permission
 */
protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner)
    throws SecurityException
{
    Component oldPermanentFocusOwner = null;
    boolean shouldFire = false;

    if (permanentFocusOwner == null || permanentFocusOwner.isFocusable()) {
        synchronized (KeyboardFocusManager.class) {
            checkKFMSecurity();

            oldPermanentFocusOwner = getPermanentFocusOwner();

            try {
                fireVetoableChange("permanentFocusOwner",
                                   oldPermanentFocusOwner,
                                   permanentFocusOwner);
            } catch (PropertyVetoException e) {
                // rejected
                return;
            }

            KeyboardFocusManager.permanentFocusOwner = permanentFocusOwner;

            KeyboardFocusManager.
                setMostRecentFocusOwner(permanentFocusOwner);

            shouldFire = true;
        }
    }

    if (shouldFire) {
        firePropertyChange("permanentFocusOwner", oldPermanentFocusOwner,
                           permanentFocusOwner);
    }
}
AbstractBeanInvocationHandler.java 文件源码 项目:intellij-deps-ini4j 阅读 96 收藏 0 点赞 0 评论 0
protected synchronized void fireVetoableChange(String property, Object oldValue, Object newValue) throws PropertyVetoException
{
    if (_vcSupport != null)
    {
        _vcSupport.fireVetoableChange(property, oldValue, newValue);
    }
}
UnitUtilities.java 文件源码 项目:incubator-netbeans 阅读 22 收藏 0 点赞 0 评论 0
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException {
    URL[] layers = new URL[additionalLayers.length + 1];

    layers[0] = Utilities.class.getResource("/org/netbeans/modules/editor/errorstripe/resources/layer.xml");

    for (int cntr = 0; cntr < additionalLayers.length; cntr++) {
        layers[cntr + 1] = Utilities.class.getResource(additionalLayers[cntr]);
    }

    for (int cntr = 0; cntr < layers.length; cntr++) {
        if (layers[cntr] == null) {
            throw new IllegalStateException("layers[" + cntr + "]=null");
        }
    }

    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(layers);

    Repository repository = new Repository(system);
    Object[] lookupContent = new Object[additionalLookupContent.length + 1];

    System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length);

    lookupContent[0] = repository;

    DEFAULT_LOOKUP.setLookup(lookupContent, UnitUtilities.class.getClassLoader());
}
Guitilities.java 文件源码 项目:JDigitalSimulator 阅读 20 收藏 0 点赞 0 评论 0
public static void selectFrame(final JInternalFrame frame) {
    SwingUtilities.invokeLater(new Runnable(){
        @Override public void run() {
            frame.requestFocusInWindow();
            try { frame.setSelected(true); }    catch (PropertyVetoException e) {}
            frame.toFront();
        }
    });
}
JavaComponentInfo.java 文件源码 项目:incubator-netbeans 阅读 19 收藏 0 点赞 0 评论 0
@Override
public Object getValue() throws IllegalAccessException, InvocationTargetException {
    synchronized (valueLock) {
        if (value == null) {
            value = valueCalculating;
            debugger.getRequestProcessor().post(new Runnable() {
                @Override
                public void run() {
                    try {
                        RemoteServices.runOnStoppedThread(t, new Runnable() {
                            @Override
                            public void run() {
                                boolean[] isEditablePtr = new boolean[] { false };
                                Type[] typePtr = new Type[] { null };
                                String v = getValueLazy(isEditablePtr, typePtr);
                                synchronized (valueLock) {
                                    value = v;
                                    valueIsEditable = isEditablePtr[0];
                                    valueType = typePtr[0];
                                }
                                ci.firePropertyChange(propertyName, null, v);
                            }
                        }, sType);
                    } catch (PropertyVetoException ex) {
                        value = ex.getLocalizedMessage();
                    }
                }
            });
        }
        return value;
    }
}
DocumentViewPanel.java 文件源码 项目:incubator-netbeans 阅读 25 收藏 0 点赞 0 评论 0
/**
 * Select corresponding node in the document view tree upon change of the
 * rule editor's content.
 *
 * A. The RuleNode holds instances of Rule-s from the model instance which
 * was created as setContext(file) was called on the view panel. B. The
 * 'rule' argument here is from an up-to-date model.
 *
 */
private void setSelectedRule(RuleHandle handle) {
    try {
        Node foundRuleNode = findLocation(manager.getRootContext(), handle);
        Node[] toSelect = foundRuleNode != null ? new Node[]{foundRuleNode} : new Node[0];
        manager.setSelectedNodes(toSelect);
    } catch (PropertyVetoException ex) {
        //no-op
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号