Java Code Examples for com.vaadin.ui.Component#isVisible()
The following examples show how to use
com.vaadin.ui.Component#isVisible() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebComponentsHelper.java From cuba with Apache License 2.0 | 6 votes |
/** * Checks if the component should be visible to the client. Returns false if * the child should not be sent to the client, true otherwise. * * @param child The child to check * @return true if the child is visible to the client, false otherwise */ public static boolean isComponentVisibleToClient(Component child) { if (!child.isVisible()) { return false; } HasComponents parent = child.getParent(); if (parent instanceof SelectiveRenderer) { if (!((SelectiveRenderer) parent).isRendered(child)) { return false; } } if (parent != null) { return isComponentVisibleToClient(parent); } else { if (child instanceof UI) { // UI has no parent and visibility was checked above return true; } else { // Component which is not attached to any UI return false; } } }
Example 2
Source File: WebComponentsHelper.java From cuba with Apache License 2.0 | 6 votes |
/** * Tests if component visible and its container visible. * * @param child component * @return component visibility */ public static boolean isComponentVisible(Component child) { if (child.getParent() instanceof TabSheet) { TabSheet tabSheet = (TabSheet) child.getParent(); TabSheet.Tab tab = tabSheet.getTab(child); if (!tab.isVisible()) { return false; } } if (child.getParent() instanceof CubaGroupBox) { // ignore groupbox content container visibility return isComponentVisible(child.getParent()); } return child.isVisible() && (child.getParent() == null || isComponentVisible(child.getParent())); }
Example 3
Source File: WebAbstractTable.java From cuba with Apache License 2.0 | 6 votes |
protected void updateCompositionStylesTopPanelVisible() { if (topPanel != null) { boolean hasChildren = topPanel.getComponentCount() > 0; boolean anyChildVisible = false; for (Component childComponent : topPanel) { if (childComponent.isVisible()) { anyChildVisible = true; break; } } boolean topPanelVisible = hasChildren && anyChildVisible; if (!topPanelVisible) { componentComposition.removeStyleName(HAS_TOP_PANEL_STYLENAME); internalStyles.remove(HAS_TOP_PANEL_STYLENAME); } else { componentComposition.addStyleName(HAS_TOP_PANEL_STYLENAME); if (!internalStyles.contains(HAS_TOP_PANEL_STYLENAME)) { internalStyles.add(HAS_TOP_PANEL_STYLENAME); } } } }
Example 4
Source File: WebAbstractDataGrid.java From cuba with Apache License 2.0 | 6 votes |
protected void updateCompositionStylesTopPanelVisible() { if (topPanel != null) { boolean hasChildren = topPanel.getComponentCount() > 0; boolean anyChildVisible = false; for (Component childComponent : topPanel) { if (childComponent.isVisible()) { anyChildVisible = true; break; } } boolean topPanelVisible = hasChildren && anyChildVisible; if (!topPanelVisible) { componentComposition.removeStyleName(HAS_TOP_PANEL_STYLE_NAME); internalStyles.remove(HAS_TOP_PANEL_STYLE_NAME); } else { componentComposition.addStyleName(HAS_TOP_PANEL_STYLE_NAME); if (!internalStyles.contains(HAS_TOP_PANEL_STYLE_NAME)) { internalStyles.add(HAS_TOP_PANEL_STYLE_NAME); } } } }