@Override public void refresh() { if (loader != null) { loader.load(); } }
@Override public void loadAll() { for (DataLoader loader : loaders.values()) { loader.load(); } }
protected <E extends Entity> void refreshItems(DataUnit dataSource) { CollectionContainer<E> container = dataSource instanceof ContainerDataUnit ? ((ContainerDataUnit) dataSource).getContainer() : null; if (container != null) { DataLoader loader = null; if (container instanceof HasLoader) { loader = ((HasLoader) container).getLoader(); } if (loader != null) { loader.load(); } else { log.warn("Target container has no loader, refresh is impossible"); } } }
@Override public void actionPerform(Component component) { if (!hasSubscriptions(ActionPerformedEvent.class)) { if (!(target.getItems() instanceof ContainerDataUnit)) { throw new IllegalStateException("RefreshAction target is null or does not implement SupportsContainerBinding"); } CollectionContainer container = ((ContainerDataUnit) target.getItems()).getContainer(); if (container == null) { throw new IllegalStateException("RefreshAction target is not bound to CollectionContainer"); } DataLoader loader = null; if (container instanceof HasLoader) { loader = ((HasLoader) container).getLoader(); } if (loader != null) { loader.load(); } else { log.warn("RefreshAction '{}' target container has no loader, refresh is impossible", getId()); } } else { super.actionPerform(component); } } }
/** * Loads options of LookupFields if any. */ protected void refreshOptionsForLookupFields() { for (Component component : getForm().getOwnComponents()) { if (component instanceof LookupField) { Options options = ((LookupField) component).getOptions(); if (options instanceof ContainerOptions) { CollectionContainer container = ((ContainerOptions) options).getContainer(); if (container instanceof HasLoader) { DataLoader optionsLoader = ((HasLoader) container).getLoader(); if (optionsLoader != null) { optionsLoader.load(); } } } } } }