本文整理汇总了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;
}