当前位置: 首页>>代码示例>>Java>>正文


Java DesignMode类代码示例

本文整理汇总了Java中java.beans.DesignMode的典型用法代码示例。如果您正苦于以下问题:Java DesignMode类的具体用法?Java DesignMode怎么用?Java DesignMode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DesignMode类属于java.beans包,在下文中一共展示了DesignMode类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: transform

import java.beans.DesignMode; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:45,代码来源:ComponentInfoFromBeanContext.java


注:本文中的java.beans.DesignMode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。