/**
  * Returns parent component with this type
  *
  * @param <T> searching type
  * @param component child component
  * @param type parent type
  * @return found parent
  */
 protected <T> T getParentComponent(final Component component, final Class<T> type) {
   Component comp = component;
   while (!(type.isInstance(comp)) && comp.getParent() != null) {
     comp = comp.getParent();
   }
   return (comp == null || !(type.isInstance(comp))) ? null : type.cast(comp);
 }
Esempio n. 2
0
 @Command
 @NotifyChange("*")
 public void addCandidates() {
   Tabbox mainTab = (Tabbox) view.getParent().getParent().getParent().getParent();
   RQMSTabUtil.openNewTab(
       "Candidate List",
       String.format("add_candidate_list.zul?JobID=%d", this.selectedItem.getJobid()),
       mainTab);
 }
Esempio n. 3
0
 // bug #3051305: Active Page not update when drag & drop item to the end
 public boolean insertBefore(Component newChild, Component refChild) {
   final Tree tree = getTree();
   if (newChild.getParent() == this
       && tree != null
       && tree.inPagingMold()
       && !tree.isInvalidated()) { // might change page, have to invalidate
     tree.invalidate();
   }
   return super.insertBefore(newChild, refChild);
 }
Esempio n. 4
0
  /** Makes sure it is not draggable. */
  private void checkOverlappable(int mode) {
    if (!"false".equals(getDraggable()))
      throw new UiException(
          "Draggable window cannot be modal, overlapped, popup, or highlighted: " + this);

    if (mode == MODAL)
      for (Component comp = this; (comp = comp.getParent()) != null; )
        if (!comp.isVisible())
          throw new UiException(
              "One of its ancestors, "
                  + comp
                  + ", is not visible, so unable to be modal or highlighted");
  }
Esempio n. 5
0
 private Component getParentComponent(Component component, final Class clazz) throws Exception {
   int index = 0;
   while ((component != null) && !clazz.isInstance((component = component.getParent()))) {
     index++;
     if (index == 50) {
       throw new Exception("No parent " + clazz + " found!");
     }
   }
   if (component == null) {
     throw new Exception("No parent " + clazz + " found!");
   }
   return component;
 }
Esempio n. 6
0
 /** Returns the {@link Tree} instance containing this element. */
 public Tree getTree() {
   for (Component p = this; (p = p.getParent()) != null; ) if (p instanceof Tree) return (Tree) p;
   return null;
 }
  @Override
  public void doAfterCompose(Component comp) throws Exception {
    super.doAfterCompose(comp);

    zkpaintWindow = (Window) comp.getParent().getFellow("zkpaintWindow");
  }
Esempio n. 8
0
 /** Returns the listbox that this belongs to. */
 public Listbox getListbox() {
   final Component comp = getParent();
   return comp != null ? (Listbox) comp.getParent() : null;
 }