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


Java Component.getParent方法代码示例

本文整理汇总了Java中com.haulmont.cuba.gui.components.Component.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Component.getParent方法的具体用法?Java Component.getParent怎么用?Java Component.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.haulmont.cuba.gui.components.Component的用法示例。


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

示例1: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component childComponent) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    com.vaadin.ui.Component vComponent = childComponent.unwrapComposition(com.vaadin.ui.Component.class);

    component.addComponent(vComponent);
    component.setComponentAlignment(vComponent, toVaadinAlignment(childComponent.getAlignment()));

    if (frame != null) {
        if (childComponent instanceof BelongToFrame
                && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            frame.registerComponent(childComponent);
        }
    }

    ownComponents.add(childComponent);

    childComponent.setParent(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:25,代码来源:WebGridLayout.java

示例2: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component childComponent, int index) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    if (ownComponents.contains(childComponent)) {
        com.vaadin.ui.Component composition = WebComponentsHelper.getComposition(childComponent);
        int existingIndex = ((AbstractOrderedLayout)getContainer()).getComponentIndex(composition);
        if (index > existingIndex) {
            index--;
        }

        remove(childComponent);
    }

    ComponentContainer container = getContainer();
    com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);
    ((AbstractOrderedLayout)container).addComponent(vComponent, index);

    com.vaadin.ui.Alignment alignment = WebWrapperUtils.toVaadinAlignment(childComponent.getAlignment());
    ((AbstractOrderedLayout) container).setComponentAlignment(vComponent, alignment);

    if (childComponent instanceof BelongToFrame
            && ((BelongToFrame) childComponent).getFrame() == null) {
        ((BelongToFrame) childComponent).setFrame(this);
    } else {
        registerComponent(childComponent);
    }

    if (index == ownComponents.size()) {
        ownComponents.add(childComponent);
    } else {
        ownComponents.add(index, childComponent);
    }

    childComponent.setParent(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:39,代码来源:WebWindow.java

示例3: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component childComponent) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    if (component == null) {
        createComponentImpl();
    }
    if (getId() != null) {
        component.setCubaId(getId());
    } else {
        component.setCubaId(getAlternativeDebugId());
    }

    final com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);

    component.addComponent(vComponent);

    if (frame != null) {
        if (childComponent instanceof BelongToFrame
                && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            frame.registerComponent(childComponent);
        }
    }

    ownComponents.add(childComponent);

    childComponent.setParent(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:33,代码来源:WebSplitPanel.java

示例4: addTab

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public Accordion.Tab addTab(String name, Component childComponent) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    final Tab tab = new Tab(name, childComponent);

    this.tabs.put(name, tab);

    final com.vaadin.ui.Component tabComponent = WebComponentsHelper.getComposition(childComponent);
    tabComponent.setSizeFull();

    tabMapping.put(tabComponent, new ComponentDescriptor(name, childComponent));
    com.vaadin.ui.Accordion.Tab tabControl = this.component.addTab(tabComponent);

    if (getDebugId() != null) {
        this.component.setTestId(tabControl,
                AppUI.getCurrent().getTestIdManager().getTestId(getDebugId() + "." + name));
    }
    if (AppUI.getCurrent().isTestMode()) {
        this.component.setCubaId(tabControl, name);
    }

    if (frame != null) {
        if (childComponent instanceof BelongToFrame
                && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            frame.registerComponent(childComponent);
        }
    }

    childComponent.setParent(this);

    return tab;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:38,代码来源:WebAccordion.java

示例5: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component childComponent, int index) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    if (ownComponents.contains(childComponent)) {
        int existingIndex = component.getComponentIndex(WebComponentsHelper.getComposition(childComponent));
        if (index > existingIndex) {
            index--;
        }

        remove(childComponent);
    }

    com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);
    component.addComponent(vComponent, index);

    if (frame != null) {
        if (childComponent instanceof BelongToFrame
                && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            frame.registerComponent(childComponent);
        }
    }

    if (index == ownComponents.size()) {
        ownComponents.add(childComponent);
    } else {
        ownComponents.add(index, childComponent);
    }

    childComponent.setParent(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:36,代码来源:WebAbstractOrderedLayout.java

示例6: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component childComponent) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    final com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);

    if (childComponent.getId() != null) {
        component.addComponent(vComponent, childComponent.getId());
    } else {
        component.addComponent(vComponent);
    }

    if (frame != null) {
        if (childComponent instanceof BelongToFrame
                && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            frame.registerComponent(childComponent);
        }
    }

    ownComponents.add(childComponent);

    childComponent.setParent(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:28,代码来源:WebHtmlBoxLayout.java

示例7: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component childComponent, int index) {
    if (childComponent.getParent() != null && childComponent.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    if (ownComponents.contains(childComponent)) {
        int existingIndex = component.getComponentIndex(WebComponentsHelper.getComposition(childComponent));
        if (index > existingIndex) {
            index--;
        }

        remove(childComponent);
    }

    com.vaadin.ui.Component vComponent = WebComponentsHelper.getComposition(childComponent);
    component.addComponent(vComponent, index);
    component.setComponentAlignment(vComponent, WebWrapperUtils.toVaadinAlignment(childComponent.getAlignment()));

    if (frame != null) {
        if (childComponent instanceof BelongToFrame
                && ((BelongToFrame) childComponent).getFrame() == null) {
            ((BelongToFrame) childComponent).setFrame(frame);
        } else {
            attachToFrame(childComponent);
        }
    }

    if (index == ownComponents.size()) {
        ownComponents.add(childComponent);
    } else {
        ownComponents.add(index, childComponent);
    }

    childComponent.setParent(this);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:37,代码来源:WebAbstractBox.java

示例8: addTab

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public Tab addTab(String name, Component component) {
    if (component.getParent() != null && component.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    TabImpl tab = new TabImpl(name, component, false);

    tabs.add(tab);
    components.put(component, name);

    DesktopContainerHelper.assignContainer(component, this);

    if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
        ((DesktopAbstractComponent) component).setParentEnabled(false);
    }

    JComponent comp = DesktopComponentsHelper.getComposition(component);

    impl.addTab("", comp);
    int tabIndex = impl.indexOfComponent(comp);
    tabContents.put(comp, tab);
    setTabComponent(tab, tabIndex);

    if (frame != null) {
        if (component instanceof BelongToFrame
                && ((BelongToFrame) component).getFrame() == null) {
            ((BelongToFrame) component).setFrame(frame);
        } else {
            frame.registerComponent(component);
        }
    }

    adjustTabSize(component);

    component.setParent(this);

    return tab;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:40,代码来源:DesktopTabSheet.java

示例9: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component component) {
    if (component.getParent() != null && component.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    // captions not added here
    final JComponent composition = DesktopComponentsHelper.getComposition(component);
    impl.add(composition, layoutAdapter.getConstraints(component));

    if (component.getId() != null) {
        componentByIds.put(component.getId(), component);
    }

    if (frame != null) {
        if (component instanceof BelongToFrame
                && ((BelongToFrame) component).getFrame() == null) {
            ((BelongToFrame) component).setFrame(frame);
        } else {
            frame.registerComponent(component);
        }
    }

    ownComponents.add(component);

    DesktopContainerHelper.assignContainer(component, this);

    if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
        ((DesktopAbstractComponent) component).setParentEnabled(false);
    }
    component.setParent(this);

    requestRepaint();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:35,代码来源:DesktopGridLayout.java

示例10: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component component, int index) {
    if (component.getParent() != null && component.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    if (ownComponents.contains(component)) {
        int existingIndex = new ArrayList<>(ownComponents).indexOf(component);
        if (index > existingIndex) {
            index--;
        }

        remove(component);
    }

    JComponent composition = DesktopComponentsHelper.getComposition(component);
    boolean hasExternalCaption = DesktopContainerHelper.hasExternalCaption(component);
    if (hasExternalCaption
            || DesktopContainerHelper.hasExternalContextHelp(component)) {
        ComponentCaption caption = new ComponentCaption(component);
        captions.put(component, caption);

        JPanel wrapper = new JPanel();
        BoxLayoutAdapter adapter = BoxLayoutAdapter.create(wrapper);
        adapter.setExpandLayout(true);
        adapter.setSpacing(false);
        adapter.setMargin(false);
        wrapper.add(composition);

        if (hasExternalCaption) {
            adapter.setFlowDirection(BoxLayoutAdapter.FlowDirection.Y);
            wrapper.add(caption, 0);
        } else {
            wrapper.add(caption, new CC().alignY("top"));
        }

        getContainer().add(wrapper, layoutAdapter.getConstraints(component), index);
        wrappers.put(component, new Pair<>(wrapper, adapter));
    } else {
        getContainer().add(composition, layoutAdapter.getConstraints(component), index);
    }

    if (component.getId() != null) {
        componentByIds.put(component.getId(), component);
    }

    if (component instanceof BelongToFrame
            && ((BelongToFrame) component).getFrame() == null) {
        ((BelongToFrame) component).setFrame(this);
    } else {
        registerComponent(component);
    }

    if (index == ownComponents.size()) {
        ownComponents.add(component);
    } else {
        List<Component> componentsTempList = new ArrayList<>(ownComponents);
        componentsTempList.add(index, component);

        ownComponents.clear();
        ownComponents.addAll(componentsTempList);
    }

    DesktopContainerHelper.assignContainer(component, this);

    if (component instanceof DesktopAbstractComponent && !isEnabled()) {
        ((DesktopAbstractComponent) component).setParentEnabled(false);
    }

    component.setParent(this);

    requestRepaint();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:74,代码来源:DesktopWindow.java

示例11: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component component, int index) {
    if (component.getParent() != null && component.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    DesktopAbstractBox newContent = null;
    if (orientation == Orientation.VERTICAL && !(content instanceof DesktopVBox)) {
        newContent = new DesktopVBox();
    } else if (orientation == Orientation.HORIZONTAL && !(content instanceof DesktopHBox)) {
        newContent = new DesktopHBox();
    }

    if (newContent != null) {
        content = newContent;

        DesktopVBox contentPane = new DesktopVBox();
        contentPane.add(content);
        contentPane.setContainer(this);

        impl.setViewportView(DesktopComponentsHelper.getComposition(contentPane));

        applyScrollBarPolicy(scrollBarPolicy);
    }

    content.add(component, index);

    if (frame != null) {
        if (component instanceof BelongToFrame
                && ((BelongToFrame) component).getFrame() == null) {
            ((BelongToFrame) component).setFrame(frame);
        } else {
            frame.registerComponent(component);
        }
    }

    if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
        ((DesktopAbstractComponent) component).setParentEnabled(false);
    }

    component.setParent(this);

    adjustViewPreferredSize();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:45,代码来源:DesktopScrollBoxLayout.java

示例12: add

import com.haulmont.cuba.gui.components.Component; //导入方法依赖的package包/类
@Override
public void add(Component component, int index) {
    if (component.getParent() != null && component.getParent() != this) {
        throw new IllegalStateException("Component already has parent");
    }

    if (ownComponents.contains(component)) {
        int existingIndex = new ArrayList<>(ownComponents).indexOf(component);
        if (index > existingIndex) {
            index--;
        }

        remove(component);
    }

    JComponent composition = DesktopComponentsHelper.getComposition(component);
    boolean hasExternalCaption = DesktopContainerHelper.hasExternalCaption(component);
    if (hasExternalCaption
            || DesktopContainerHelper.hasExternalContextHelp(component)) {
        ComponentCaption caption  = new ComponentCaption(component);
        captions.put(component, caption);

        JPanel wrapper = new LayoutSlot();
        BoxLayoutAdapter adapter = BoxLayoutAdapter.create(wrapper);
        adapter.setExpandLayout(true);
        adapter.setSpacing(false);
        adapter.setMargin(false);
        wrapper.add(composition);

        if (hasExternalCaption) {
            adapter.setFlowDirection(BoxLayoutAdapter.FlowDirection.Y);
            wrapper.add(caption, 0);
        } else {
            wrapper.add(caption, new CC().alignY("top"));
        }

        impl.add(wrapper, layoutAdapter.getConstraints(component), index);
        wrappers.put(component, new Pair<>(wrapper, adapter));
    } else {
        impl.add(composition, layoutAdapter.getConstraints(component), index);
    }

    if (component.getId() != null) {
        componentByIds.put(component.getId(), component);
    }

    if (frame != null) {
        if (component instanceof BelongToFrame
                && ((BelongToFrame) component).getFrame() == null) {
            ((BelongToFrame) component).setFrame(frame);
        } else {
            attachToFrame(component);
        }
    }

    if (index == ownComponents.size()) {
        ownComponents.add(component);
    } else {
        List<Component> componentsTempList = new ArrayList<>(ownComponents);
        componentsTempList.add(index, component);

        ownComponents.clear();
        ownComponents.addAll(componentsTempList);
    }

    DesktopContainerHelper.assignContainer(component, this);

    if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
        ((DesktopAbstractComponent) component).setParentEnabled(false);
    }

    component.setParent(this);

    requestContainerUpdate();

    requestRepaint();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:78,代码来源:DesktopAbstractBox.java


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