Ejemplo n.º 1
0
  /**
   * Adds the given module to the menu structure. If the module is not visible (i.e., {@link
   * ModuleInfo#isVisible()} returns false), it is ignored.
   *
   * <p>{@inheritDoc}
   */
  @Override
  public boolean add(final ModuleInfo o) {
    if (!o.isVisible()) return false;

    final ShadowMenu node = addInternal(o);
    if (node == null) return false;
    if (es != null) es.publish(new MenusAddedEvent(node));
    return true;
  }
Ejemplo n.º 2
0
 /**
  * Adds the given modules to the menu structure. If a module is not visible (i.e., {@link
  * ModuleInfo#isVisible()} returns false), it is ignored.
  *
  * <p>{@inheritDoc}
  */
 @Override
 public boolean addAll(final Collection<? extends ModuleInfo> c) {
   final HashSet<ShadowMenu> nodes = new HashSet<>();
   for (final ModuleInfo info : c) {
     if (!info.isVisible()) continue;
     final ShadowMenu node = addInternal(info);
     if (node != null) nodes.add(node);
   }
   if (nodes.isEmpty()) return false;
   if (es != null) es.publish(new MenusAddedEvent(nodes));
   return true;
 }