java.beans.PropertyVetoException Java Examples
The following examples show how to use
java.beans.PropertyVetoException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PropertyDescriptorAdapter.java From CodenameOne with GNU General Public License v2.0 | 6 votes |
public void writeToObject(Object object) { try { Method method = descriptor.getWriteMethod(); if (method != null) { method.invoke(object, new Object[]{getValue()}); } } catch (Exception e) { // let PropertyVetoException go to the upper level without logging if (e instanceof InvocationTargetException && ((InvocationTargetException)e).getTargetException() instanceof PropertyVetoException) { throw new RuntimeException(((InvocationTargetException)e).getTargetException()); } String message = "Got exception when writing property " + getName(); if (object == null) { message += ", object was 'null'"; } else { message += ", object was " + String.valueOf(object); } throw new RuntimeException(message, e); } }
Example #2
Source File: ShowDriverWebsiteAction.java From bigtable-sql with Apache License 2.0 | 6 votes |
/** * Perform this action. Execute the create driver command. * * @param evt The current event. */ public void actionPerformed(ActionEvent evt) { IApplication app = getApplication(); DriversListInternalFrame tw = app.getWindowManager().getDriversListInternalFrame(); tw.moveToFront(); try { tw.setSelected(true); } catch (PropertyVetoException ex) { //i18n[CreateDriverAction.error.selectingwindow=Error selecting window] s_log.error(s_stringMgr.getString("CreateDriverAction.error.selectingwindow"), ex); } ISQLDriver driver = _drivers.getSelectedDriver(); if (driver != null) { new ShowDriverWebsiteCommand(app, driver).execute(); } }
Example #3
Source File: TimeSeriesCollection.java From SIMVA-SoS with Apache License 2.0 | 6 votes |
/** * Receives notification that the key for one of the series in the * collection has changed, and vetos it if the key is already present in * the collection. * * @param e the event. * * @since 1.0.17 */ @Override public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { // if it is not the series name, then we have no interest if (!"Key".equals(e.getPropertyName())) { return; } // to be defensive, let's check that the source series does in fact // belong to this collection Series s = (Series) e.getSource(); if (getSeriesIndex(s.getKey()) == -1) { throw new IllegalStateException("Receiving events from a series " + "that does not belong to this collection."); } // check if the new series name already exists for another series Comparable key = (Comparable) e.getNewValue(); if (getSeriesIndex(key) >= 0) { throw new PropertyVetoException("Duplicate key2", e); } }
Example #4
Source File: AquaInternalFrameDockIconUI.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public void mouseReleased(final MouseEvent e) {// only when it's actually in the image if (fFrame.isIconifiable() && fFrame.isIcon()) { if (fTrackingIcon) { fTrackingIcon = false; if (fIconPane.mouseInIcon(e)) { if (fDockLabel != null) fDockLabel.hide(); try { fFrame.setIcon(false); } catch(final PropertyVetoException e2) {} } else { fIconPane.repaint(); } } } // if the mouse was completely outside fIconPane, hide the label if (fDockLabel != null && !fIconPane.getBounds().contains(e.getX(), e.getY())) fDockLabel.hide(); }
Example #5
Source File: WindowBuilders.java From netbeans with Apache License 2.0 | 6 votes |
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; }
Example #6
Source File: DomPanel.java From netbeans with Apache License 2.0 | 6 votes |
/** * Updates the set of selected nodes. */ private void updateSelection() { if (EventQueue.isDispatchThread()) { List<? extends Node> nodes = pageModel.getSelectedNodes(); Node[] selection = nodes.toArray(new Node[nodes.size()]); updatingView = true; try { manager.setSelectedNodes(selection); } catch (PropertyVetoException pvex) { Logger.getLogger(DomPanel.class.getName()).log(Level.INFO, null, pvex); } finally { updatingView = false; } } else { EventQueue.invokeLater(new Runnable() { @Override public void run() { updateSelection(); } }); } }
Example #7
Source File: JInternalFrame.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * 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); }
Example #8
Source File: JDesktopPane.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * Selects the next <code>JInternalFrame</code> in this desktop pane. * * @param forward a boolean indicating which direction to select in; * <code>true</code> for forward, <code>false</code> for * backward * @return the JInternalFrame that was selected or <code>null</code> * if nothing was selected * @since 1.6 */ public JInternalFrame selectFrame(boolean forward) { JInternalFrame selectedFrame = getSelectedFrame(); JInternalFrame frameToSelect = getNextFrame(selectedFrame, forward); if (frameToSelect == null) { return null; } // Maintain navigation traversal order until an // external stack change, such as a click on a frame. setComponentOrderCheckingEnabled(false); if (forward && selectedFrame != null) { selectedFrame.moveToBack(); // For Windows MDI fidelity. } try { frameToSelect.setSelected(true); } catch (PropertyVetoException pve) {} setComponentOrderCheckingEnabled(true); return frameToSelect; }
Example #9
Source File: C3P0DataSource.java From maven-framework-project with MIT License | 6 votes |
private C3P0DataSource() throws IOException, SQLException, PropertyVetoException { cpds = new ComboPooledDataSource(); cpds.setDriverClass("org.h2.Driver"); // loads the jdbc driver cpds.setJdbcUrl("jdbc:h2:./target/test;AUTO_SERVER=TRUE"); cpds.setUser("sa"); cpds.setPassword(""); // the settings below are optional -- c3p0 can work with defaults cpds.setMinPoolSize(5); cpds.setAcquireIncrement(5); cpds.setMaxPoolSize(20); cpds.setMaxStatements(180); this.setDataSource(cpds); }
Example #10
Source File: AquaInternalFrameDockIconUI.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
public void mouseReleased(final MouseEvent e) {// only when it's actually in the image if (fFrame.isIconifiable() && fFrame.isIcon()) { if (fTrackingIcon) { fTrackingIcon = false; if (fIconPane.mouseInIcon(e)) { if (fDockLabel != null) fDockLabel.hide(); try { fFrame.setIcon(false); } catch(final PropertyVetoException e2) {} } else { fIconPane.repaint(); } } } // if the mouse was completely outside fIconPane, hide the label if (fDockLabel != null && !fIconPane.getBounds().contains(e.getX(), e.getY())) fDockLabel.hide(); }
Example #11
Source File: JInternalFrame.java From Java8CN with Apache License 2.0 | 6 votes |
/** * 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); }
Example #12
Source File: LayerCacheManager.java From netbeans with Apache License 2.0 | 6 votes |
@Override public FileSystem load(FileSystem previous, ByteBuffer bb) throws IOException { byte[] arr = new byte[bb.limit()]; bb.get(arr); DataInputStream is = new DataInputStream(new ByteArrayInputStream(arr)); List<URL> urls = new ArrayList<URL>(); while (is.available() > 0) { String u = is.readUTF(); urls.add(new URL(u)); } try { XMLFileSystem fs = (XMLFileSystem)previous; fs.setXmlUrls(urls.toArray(new URL[urls.size()])); return fs; } catch (PropertyVetoException pve) { throw (IOException) new IOException(pve.toString()).initCause(pve); } }
Example #13
Source File: AquaInternalFrameManager.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public void activateFrame(final JInternalFrame f) { try { if (f != null) super.activateFrame(f); // If this is the first activation, add to child list. if (fChildFrames.indexOf(f) == -1) { fChildFrames.addElement(f); } if (fCurrentFrame != null && f != fCurrentFrame) { if (fCurrentFrame.isSelected()) { fCurrentFrame.setSelected(false); } } if (f != null && !f.isSelected()) { f.setSelected(true); } fCurrentFrame = f; } catch(final PropertyVetoException e) {} }
Example #14
Source File: JInternalFrame.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * 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); }
Example #15
Source File: CachingPreventsFileTouchesTest.java From netbeans with Apache License 2.0 | 5 votes |
private static void assertFileDoesNotContain(File file, String text) throws IOException, PropertyVetoException { LocalFileSystem lfs = new LocalFileSystem(); lfs.setRootDirectory(file.getParentFile()); FileObject fo = lfs.findResource(file.getName()); assertNotNull("file object for " + file + " found", fo); String content = fo.asText(); if (content.contains(text)) { fail("File " + file + " seems to contain '" + text + "'!"); } }
Example #16
Source File: KeyboardFocusManager.java From jdk-1.7-annotated with Apache License 2.0 | 5 votes |
/** * 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()</code>. Use * <code>Component.requestFocus()</code> or * <code>Component.requestFocusInWindow()</code> 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 * @beaninfo * bound: true */ protected void setGlobalPermanentFocusOwner(Component permanentFocusOwner) { 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); } }
Example #17
Source File: KeyboardFocusManager.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * 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()}. Use * {@code Component.requestFocus()} or * {@code Component.requestFocusInWindow()} 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 */ 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); } }
Example #18
Source File: TestEquals.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws PropertyVetoException { TestEquals one = new TestEquals(1); TestEquals two = new TestEquals(2); Object source = TestEquals.class; VetoableChangeSupport vcs = new VetoableChangeSupport(source); vcs.addVetoableChangeListener(PROPERTY, one); vcs.addVetoableChangeListener(PROPERTY, two); PropertyChangeEvent event = new PropertyChangeEvent(source, PROPERTY, one, two); vcs.fireVetoableChange(event); test(one, two, 1); // only one check vcs.fireVetoableChange(PROPERTY, one, two); test(one, two, 2); // because it invokes fireVetoableChange(PropertyChangeEvent) }
Example #19
Source File: MotifInternalFrameTitlePane.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected void assembleSystemMenu() { systemMenu = new JPopupMenu(); JMenuItem mi = systemMenu.add(restoreAction); mi.setMnemonic(getButtonMnemonic("restore")); mi = systemMenu.add(moveAction); mi.setMnemonic(getButtonMnemonic("move")); mi = systemMenu.add(sizeAction); mi.setMnemonic(getButtonMnemonic("size")); mi = systemMenu.add(iconifyAction); mi.setMnemonic(getButtonMnemonic("minimize")); mi = systemMenu.add(maximizeAction); mi.setMnemonic(getButtonMnemonic("maximize")); systemMenu.add(new JSeparator()); mi = systemMenu.add(closeAction); mi.setMnemonic(getButtonMnemonic("close")); systemButton = new SystemButton(); systemButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { systemMenu.show(systemButton, 0, BUTTON_SIZE); } }); systemButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent evt) { try { frame.setSelected(true); } catch (PropertyVetoException pve) { } if ((evt.getClickCount() == 2)) { closeAction.actionPerformed(new ActionEvent(evt.getSource(), ActionEvent.ACTION_PERFORMED, null, evt.getWhen(), 0)); systemMenu.setVisible(false); } } }); }
Example #20
Source File: BasicDatePickerUI.java From microba with BSD 3-Clause "New" or "Revised" License | 5 votes |
private void peerDateChanged(Date newValue) { try { calendarPane.removePropertyChangeListener(componentListener); calendarPane.setDate(newValue); calendarPane.addPropertyChangeListener(componentListener); } catch (PropertyVetoException e) { // Ignore. CalendarPane has no VetoModel here. } field.removePropertyChangeListener(componentListener); field.setValue(newValue); field.addPropertyChangeListener(componentListener); }
Example #21
Source File: MainConfigofProfile.java From code with Apache License 2.0 | 5 votes |
@Profile("dev") @Bean("devDataSource") public DataSource dataSourceDev(@Value("${db.password}") String pwd) throws PropertyVetoException { ComboPooledDataSource dataSource = new ComboPooledDataSource(); dataSource.setUser(user); dataSource.setPassword(pwd); dataSource.setDriverClass(driverClass); dataSource.setJdbcUrl("jdbc:mysql://localhost:3306/dev"); return dataSource; }
Example #22
Source File: KeyboardFocusManager.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * 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); } }
Example #23
Source File: bug8075314.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public static void main(String[] args) throws Exception { for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager .getInstalledLookAndFeels()) { UIManager.setLookAndFeel(lookAndFeelInfo.getClassName()); try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { frame = new JFrame(); frame.setUndecorated(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setup(frame); } }); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { try { frame1.setMaximum(true); frame1.setClosed(true); if (frame2.isMaximum()) { throw new RuntimeException( "Frame2 is maximized!"); } } catch (PropertyVetoException e) { throw new RuntimeException(e); } } }); } finally { frame.dispose(); } } System.out.println("ok"); }
Example #24
Source File: SynthInternalFrameTitlePane.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
protected void assembleSystemMenu() { systemPopupMenu = new JPopupMenuUIResource(); addSystemMenuItems(systemPopupMenu); enableActions(); menuButton = createNoFocusButton(); updateMenuIcon(); menuButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent e) { try { frame.setSelected(true); } catch(PropertyVetoException pve) { } showSystemMenu(); } }); JPopupMenu p = frame.getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.setComponentPopupMenu(systemPopupMenu); } if (frame.getDesktopIcon() != null) { p = frame.getDesktopIcon().getComponentPopupMenu(); if (p == null || p instanceof UIResource) { frame.getDesktopIcon().setComponentPopupMenu(systemPopupMenu); } } setInheritsPopupMenu(true); }
Example #25
Source File: AutoUpgrade.java From netbeans with Apache License 2.0 | 5 votes |
private static void copyToUserdir(File source) throws IOException, PropertyVetoException { File userdir = new File(System.getProperty("netbeans.user", "")); // NOI18N File netBeansDir = InstalledFileLocator.getDefault().locate("modules", null, false).getParentFile().getParentFile(); //NOI18N File importFile = new File(netBeansDir, "etc/netbeans.import"); //NOI18N LOGGER.fine("Import file: " + importFile); LOGGER.info("Importing from " + source + " to " + userdir); // NOI18N CopyFiles.copyDeep(source, userdir, importFile); }
Example #26
Source File: NewPropertyPanelTest.java From netbeans with Apache License 2.0 | 5 votes |
public void vetoableChange(PropertyChangeEvent e) throws PropertyVetoException { System.err.println("GOT A VETOABLE CHANGE IN BASIC EDITOR"); PropertyEnv env = (PropertyEnv) e.getSource(); if ((vetoNextChange || "Dont allow validate".equals(getAsText())) && PropertyEnv.STATE_NEEDS_VALIDATION.equals(env.getState())) { System.err.println(" VETOING"); PropertyVetoException pve = new PropertyVetoException("NoNoNoNoNo", e); ErrorManager.getDefault().annotate(pve, ErrorManager.USER, null, "You can't do that!", null, null); vetoNextChange=false; throw pve; } }
Example #27
Source File: AquaInternalFramePaneUI.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public void deiconifyFrame(final JInternalFrame f) { final JInternalFrame.JDesktopIcon desktopIcon = f.getDesktopIcon(); final Container dock = desktopIcon.getParent(); if (dock == null) return; if (dock.getParent() != null) dock.getParent().add(f); removeIconFor(f); // <rdar://problem/3712485> removed f.show(). show() is now deprecated and // it wasn't sending our frame to front nor selecting it. Now, we move it // to front and select it manualy. (vm) f.moveToFront(); try { f.setSelected(true); } catch(final PropertyVetoException pve) { /* do nothing */ } }
Example #28
Source File: EventListenerSupportTest.java From astor with GNU General Public License v2.0 | 5 votes |
@Test public void testSerialization() throws IOException, ClassNotFoundException, PropertyVetoException { EventListenerSupport<VetoableChangeListener> listenerSupport = EventListenerSupport.create(VetoableChangeListener.class); listenerSupport.addListener(new VetoableChangeListener() { @Override public void vetoableChange(PropertyChangeEvent e) { } }); listenerSupport.addListener(EasyMock.createNiceMock(VetoableChangeListener.class)); //serialize: ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream); objectOutputStream.writeObject(listenerSupport); objectOutputStream.close(); //deserialize: @SuppressWarnings("unchecked") EventListenerSupport<VetoableChangeListener> deserializedListenerSupport = (EventListenerSupport<VetoableChangeListener>) new ObjectInputStream( new ByteArrayInputStream(outputStream.toByteArray())).readObject(); //make sure we get a listener array back, of the correct component type, and that it contains only the serializable mock VetoableChangeListener[] listeners = deserializedListenerSupport.getListeners(); assertEquals(VetoableChangeListener.class, listeners.getClass().getComponentType()); assertEquals(1, listeners.length); //now verify that the mock still receives events; we can infer that the proxy was correctly reconstituted VetoableChangeListener listener = listeners[0]; PropertyChangeEvent evt = new PropertyChangeEvent(new Date(), "Day", 7, 9); listener.vetoableChange(evt); EasyMock.replay(listener); deserializedListenerSupport.fire().vetoableChange(evt); EasyMock.verify(listener); //remove listener and verify we get an empty array of listeners deserializedListenerSupport.removeListener(listener); assertEquals(0, deserializedListenerSupport.getListeners().length); }
Example #29
Source File: KeyboardFocusManager.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * 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()</code>. Use * <code>Component.requestFocus()</code> or * <code>Component.requestFocusInWindow()</code> 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 * @beaninfo * bound: true */ 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); } }
Example #30
Source File: DefaultDesktopManager.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Restores the frame back to its size and position prior * to a <code>maximizeFrame</code> call. * @param f the <code>JInternalFrame</code> to be restored */ public void minimizeFrame(JInternalFrame f) { // If the frame was an icon restore it back to an icon. if (f.isIcon()) { iconifyFrame(f); return; } if ((f.getNormalBounds()) != null) { Rectangle r = f.getNormalBounds(); f.setNormalBounds(null); try { f.setSelected(true); } catch (PropertyVetoException e2) { } setBoundsForFrame(f, r.x, r.y, r.width, r.height); } }