use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopTabSheet method removeAllTabs.
@Override
public void removeAllTabs() {
impl.removeAll();
List<Component> innerComponents = new ArrayList<>(components.keySet());
components.clear();
for (Component component : innerComponents) {
DesktopContainerHelper.assignContainer(component, null);
if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) component).setParentEnabled(true);
}
component.setParent(null);
}
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopTabSheet method updateEnabled.
@Override
public void updateEnabled() {
super.updateEnabled();
for (Component component : components.keySet()) {
if (component instanceof DesktopAbstractComponent) {
JComponent composition = DesktopComponentsHelper.getComposition(component);
TabImpl tab = tabContents.get(composition);
((DesktopAbstractComponent) component).setParentEnabled(tab.isEnabled() && isEnabledWithParent());
}
}
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopTabSheet method removeTab.
@Override
public void removeTab(String name) {
TabImpl tab = getTabImpl(name);
Component component = tab.getComponent();
components.remove(component);
impl.remove(DesktopComponentsHelper.getComposition(component));
DesktopContainerHelper.assignContainer(component, null);
if (component instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) component).setParentEnabled(true);
}
component.setParent(null);
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopTabSheet method initLazyTab.
protected void initLazyTab(JComponent tab) {
LazyTabInfo lti = null;
for (LazyTabInfo lazyTabInfo : lazyTabs) {
if (lazyTabInfo.getTabComponent() == tab) {
lti = lazyTabInfo;
break;
}
}
if (lti == null) {
// already initialized
return;
}
if (!lti.getTab().isEnabled()) {
return;
}
lazyTabs.remove(lti);
lti.loader.createComponent();
Component lazyContent = lti.loader.getResultComponent();
lazyContent.setWidth("100%");
lti.tabContent.add(lazyContent);
lti.tabContent.expand(lazyContent, "", "");
lazyContent.setParent(this);
lti.loader.loadComponent();
if (lazyContent instanceof DesktopAbstractComponent && !isEnabledWithParent()) {
((DesktopAbstractComponent) lazyContent).setParentEnabled(false);
}
final Window window = ComponentsHelper.getWindow(DesktopTabSheet.this);
if (window != null) {
ComponentsHelper.walkComponents(lti.tabContent, (component, name) -> {
if (component instanceof HasSettings) {
Settings settings = window.getSettings();
if (settings != null) {
Element e = settings.get(name);
((HasSettings) component).applySettings(e);
}
}
});
lti.getTab().setLazyInitialized(true);
}
}
use of com.haulmont.cuba.gui.components.Component in project cuba by cuba-platform.
the class DesktopTabSheet method setSelectedTab.
@Override
public void setSelectedTab(Tab tab) {
Component component = ((TabImpl) tab).getComponent();
impl.setSelectedComponent(DesktopComponentsHelper.getComposition(component));
}
Aggregations