java.beans.DesignMode Java Examples
The following examples show how to use
java.beans.DesignMode.
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: ComponentInfoFromBeanContext.java From netbeans with Apache License 2.0 | 4 votes |
static List<ComponentInfo> transform(List<? extends BeanContextChildComponentProxy> componentProxies) { try { Class.forName(ComponentInfo.class.getName(), true, ComponentInfo.class.getClassLoader()); // Initializes TRANSFORM } catch (ClassNotFoundException cnfex) {} List<ComponentInfo> cinfos = new ArrayList<ComponentInfo>(componentProxies.size()); for (final BeanContextChildComponentProxy cp : componentProxies) { final Component[] c = new Component[] { null }; final boolean[] doOpen = new boolean[] { false }; try { SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { c[0] = cp.getComponent(); doOpen[0] = (cp instanceof DesignMode) ? ((DesignMode) cp).isDesignTime() : true; } }); if (c[0] == null) { //throw new NullPointerException("No component from "+cp); continue; } } catch (Exception ex) { Exceptions.printStackTrace(ex); continue; } //cs.add(c[0]); boolean open = doOpen[0]; boolean minimized = false; if (c[0] instanceof TopComponent) { final TopComponent tc = (TopComponent) c[0]; boolean wasClosed = Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()). getProperties(PROPERTY_CLOSED_TC).getBoolean(tc.getName(), false); boolean wasOpened = !Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()). getProperties(PROPERTY_CLOSED_TC).getBoolean(tc.getName(), true); open = (doOpen[0] && !wasClosed || !doOpen[0] && wasOpened); boolean wasMinimized = Properties.getDefault().getProperties(DebuggerManagerListener.class.getName()). getProperties(PROPERTY_MINIMIZED_TC).getBoolean(tc.getName(), false); minimized = wasMinimized; } ComponentInfo ci = TRANSFORM.transform(c[0], open, minimized); cinfos.add(ci); } return cinfos; }