本文整理汇总了Java中com.haulmont.cuba.gui.components.Component.Wrapper方法的典型用法代码示例。如果您正苦于以下问题:Java Component.Wrapper方法的具体用法?Java Component.Wrapper怎么用?Java Component.Wrapper使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.haulmont.cuba.gui.components.Component
的用法示例。
在下文中一共展示了Component.Wrapper方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTopLevelFrame
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
/**
* Returns {@link TopLevelFrame} of frame.
*
* @param frame
* @return {@link TopLevelFrame} of component
*/
public static TopLevelFrame getTopLevelFrame(Frame frame) {
if (frame instanceof DesktopWindow) {
return ((DesktopWindow) frame).getWindowManager().getFrame();
} else if (frame instanceof DesktopFrame) {
return getTopLevelFrame((frame).getFrame());
} else if (frame instanceof AbstractFrame) {
Component.Wrapper wrapper = (Component.Wrapper) ((AbstractFrame) frame).getComposition();
if (wrapper instanceof DesktopWindow) {
return ((DesktopWindow) wrapper).getWindowManager().getFrame();
} else if (wrapper instanceof DesktopFrame) {
return getTopLevelFrame(((DesktopFrame) wrapper).getFrame());
} else {
return getTopLevelFrame((Container) wrapper.getComposition());
}
} else {
throw new IllegalArgumentException("Can not get top level frame for " + frame);
}
}
示例2: assignContainer
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
public static void assignContainer(Component component, DesktopContainer container) {
if (component instanceof DesktopComponent) {
((DesktopComponent) component).setContainer(container);
} else if (component instanceof Component.Wrapper) { // for frame wrappers
Object wrapped = ((Component.Wrapper) component).getComposition();
if (wrapped instanceof DesktopComponent) {
((DesktopComponent) wrapped).setContainer(container);
}
}
}
示例3: unwrap
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
/**
* Returns underlying Swing component implementation.
*
* @param component GUI component
* @return Swing component
* @see #getComposition(com.haulmont.cuba.gui.components.Component)
*/
public static JComponent unwrap(Component component) {
Object comp = component;
while (comp instanceof Component.Wrapper) {
comp = ((Component.Wrapper) comp).getComponent();
}
return (JComponent) comp;
}
示例4: getComposition
import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
/**
* Returns underlying Swing component, which serves as the outermost container for the supplied GUI component.
* For simple components like {@link com.haulmont.cuba.gui.components.Button} this method returns the same
* result as {@link #unwrap(com.haulmont.cuba.gui.components.Component)}.
*
* @param component GUI component
* @return Swing component
* @see #unwrap(com.haulmont.cuba.gui.components.Component)
*/
public static JComponent getComposition(Component component) {
Object comp = component;
while (comp instanceof Component.Wrapper) {
comp = ((Component.Wrapper) comp).getComposition();
}
return (JComponent) comp;
}