com.google.gwt.event.logical.shared.CloseEvent Java Examples

The following examples show how to use com.google.gwt.event.logical.shared.CloseEvent. 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: MsgDestinationsPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewQueueDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("JMS Queue"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewQueueWizard(this).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example #2
Source File: MsgDestinationsPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewAddrDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Addressing Setting"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewAddressPatternWizard(this, providerEntity).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example #3
Source File: TopologyPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void showVersionInfo(String json) {
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
}
 
Example #4
Source File: HostPropertiesPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewPropertyDialoge(String group) {

        propertyWindow = new DefaultWindow(Console.MESSAGES.newTitle("Host Property"));
        propertyWindow.setWidth(480);
        propertyWindow.setHeight(360);
        propertyWindow.addCloseHandler(new CloseHandler<PopupPanel>() {
            @Override
            public void onClose(CloseEvent<PopupPanel> event) {

            }
        });

        propertyWindow.trapWidget(
                new NewPropertyWizard(this, group, true).asWidget()
        );

        propertyWindow.setGlassEnabled(true);
        propertyWindow.center();
    }
 
Example #5
Source File: MaterialTreeItem.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
public void select() {
    // Fire selection event
    SelectionEvent.fire(getTree(), this);

    List<MaterialTreeItem> treeItems = getTreeItems();
    if (!treeItems.isEmpty()) {
        for (MaterialTreeItem treeItem : treeItems) {
            if (hide) {
                treeItem.setVisible(false);
            } else {
                treeItem.setVisible(true);
            }
        }
        // Firing of events based on the status of the tree item
        if (hide) {
            CloseEvent.fire(getTree(), this);
            hide = false;
        } else {
            OpenEvent.fire(getTree(), this);
            hide = true;
        }
    }
}
 
Example #6
Source File: MaterialTreeTest.java    From gwt-material-addins with Apache License 2.0 6 votes vote down vote up
public void testImageItems() {
    // given
    final String URL_OPEN = "open.png";
    final String URL_CLOSE = "close.png";
    MaterialTree tree = getWidget();

    // when / then
    tree.clear();
    assertEquals(0, tree.getWidgetCount());

    MaterialTreeItem item = new MaterialTreeItem();
    item.setText("Tree Item");
    tree.add(item);
    assertEquals(1, tree.getWidgetCount());

    // Check Open
    tree.addOpenHandler(openEvent -> openEvent.getTarget().setUrl(URL_OPEN));
    OpenEvent.fire(tree, item);
    assertEquals(URL_OPEN, item.getImage().getUrl());

    // Check Close
    tree.addCloseHandler(closeEvent -> closeEvent.getTarget().setUrl(URL_CLOSE));
    CloseEvent.fire(tree, item);
    assertEquals(URL_CLOSE, item.getImage().getUrl());
}
 
Example #7
Source File: MsgDestinationsPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewSecDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Security Setting"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewSecurityPatternWizard(this, providerEntity).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example #8
Source File: WebPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchConnectorDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("Connector"));
    window.setWidth(480);
    window.setHeight(400);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewConnectorWizard(this, connectors, socketsBindingList).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example #9
Source File: MsgDestinationsPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewTopicDialogue() {
    window = new DefaultWindow(Console.MESSAGES.createTitle("JMS Topic"));
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    window.trapWidget(
            new NewTopicWizard(this).asWidget()
    );

    window.setGlassEnabled(true);
    window.center();
}
 
Example #10
Source File: PropertiesPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void launchNewPropertyDialoge(String group) {

        propertyWindow = new DefaultWindow(Console.MESSAGES.createTitle("System Property"));
        propertyWindow.setWidth(480);
        propertyWindow.setHeight(360);
        propertyWindow.addCloseHandler(new CloseHandler<PopupPanel>() {
            @Override
            public void onClose(CloseEvent<PopupPanel> event) {

            }
        });

        propertyWindow.trapWidget(
                new NewPropertyWizard(this, group, true).asWidget()
        );

        propertyWindow.setGlassEnabled(true);
        propertyWindow.center();
    }
 
Example #11
Source File: StandaloneServerPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
private void showVersionInfo(String json)
{
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
}
 
Example #12
Source File: Popup.java    From incubator-retired-wave with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a popup.
 *
 * @param reference   reference element for the positioner
 * @param positioner  strategy for positioning the popup
 */
public Popup(Element reference, RelativePopupPositioner positioner) {
  this.reference = reference;
  this.positioner = positioner;
  popupPanel.addStyleName("editor-popup");
  popupPanel.setAnimationEnabled(true);
  popupPanel.addCloseHandler(new CloseHandler<PopupPanel>() {
    @Override
    public void onClose(CloseEvent<PopupPanel> event) {
      Popup.this.hide();
    }
  });
}
 
Example #13
Source File: Popup.java    From swellrt with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a popup.
 *
 * @param reference   reference element for the positioner
 * @param positioner  strategy for positioning the popup
 */
public Popup(Element reference, RelativePopupPositioner positioner) {
  this.reference = reference;
  this.positioner = positioner;
  popupPanel.addStyleName("editor-popup");
  popupPanel.setAnimationEnabled(true);
  popupPanel.addCloseHandler(new CloseHandler<PopupPanel>() {
    @Override
    public void onClose(CloseEvent<PopupPanel> event) {
      Popup.this.hide();
    }
  });
}
 
Example #14
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
@Override
public void onClose(CloseEvent<PopupPanel> event) {
	debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

	if (event.isAutoClosed()) {
		this.lastAutoClosed = new Date().getTime();
	}
	
	connector.sendBlurEvent();			
}
 
Example #15
Source File: VComboBoxMultiselect.java    From vaadin-combobox-multiselect with Apache License 2.0 5 votes vote down vote up
@Override
public void onClose(CloseEvent<PopupPanel> event) {
	debug("VComboBoxMultiselect.SP: onClose(" + event.isAutoClosed() + ")");

	if (event.isAutoClosed()) {
		this.lastAutoClosed = new Date().getTime();
	}
	
	connector.sendBlurEvent();			
}
 
Example #16
Source File: DefaultTabLayoutPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public boolean remove(int index) {
    // only visible tabs can be removed!
    if (index < 0 || index > getWidgetCount() - 1) {
        return false;
    }

    boolean removed = false;
    Widget removedWidget = getWidget(index);
    int count = getWidgetCount();
    if (count < PAGE_LIMIT) {
        // no need to take care of any off-page handling
        tabs.remove(index);
        removed = super.remove(index);

    } else {
        if (index < PAGE_LIMIT - 1) {
            // 'regular' visible tab is about to be removed; there's at least one element in offPageContainer
            // first remove the specified tab
            tabs.remove(index);
            removed = super.remove(index);

            // then remove the last tab (offPageContainer)
            int last = getWidgetCount() - 1;
            OffPageContainer backup = offPageContainer.copy();
            offPageContainer.clear();
            tabs.remove(last);
            super.remove(last);

            // and finally re-add the off page elements
            for (Map.Entry<OffPageText, Widget> entry : backup) {
                add(entry.getValue(), entry.getKey().getText());
            }
            backup.clear();

        } else if (index == PAGE_LIMIT - 1) {
            // last tab which contains the offPageContainer is about to be removed
            offPageContainer.remove(0);
            if (offPageContainer.isEmpty()) {
                // no other off-page element is left, completely remove the last tab
                selectTab(0, false);
                tabs.remove(index);
                removed = super.remove(index);
            } else if (getSelectedIndex() == PAGE_LIMIT - 1) {
                // the last tab is visible while we're removing the page, select the first off page element
                selectTab(offPageContainer.getText(0).getText());
                removed = true;
            }
        }
    }

    if (offPageContainer.size() > 1) {
        tabs.showSelector();
    } else {
        tabs.hideSelector();
    }
    if (removed && removedWidget != null) {
        CloseEvent.fire(this, removedWidget);
    }
    return removed;
}
 
Example #17
Source File: MainLayoutViewImpl.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Inject
public MainLayoutViewImpl(final Header header, Footer footer, MessageCenter messageCenter, PlaceManager placeManager) {

    this.messageCenter = messageCenter;
    this.header = header;
    this.placeManager = placeManager;

    mainContentPanel = new LayoutPanel();
    mainContentPanel.setStyleName("main-content-panel");
    mainContentPanel.addStyleName("animated");

    // see http://www.w3.org/TR/wai-aria/states_and_properties#aria-live
    mainContentPanel.getElement().setAttribute("role", "region");
    mainContentPanel.getElement().setAttribute("aria-live", "polite");
    mainContentPanel.getElement().setId("main-content-area");

    headerPanel = new LayoutPanel();
    headerPanel.setStyleName("header-panel");
    headerPanel.getElement().setId("header");

    footerPanel = new LayoutPanel();
    footerPanel.setStyleName("footer-panel");
    footerPanel.getElement().setId("footer");

    panel = new DockLayoutPanel(Style.Unit.PX);
    panel.getElement().setAttribute("id", "container");

    panel.addNorth(headerPanel, 80);
    panel.addSouth(footerPanel, 42);
    panel.add(mainContentPanel);

    getHeaderPanel().add(header.asWidget());
    getFooterPanel().add(footer.asWidget());

    // the application window
    window = new DefaultWindow("");
   // window.addStyleName("animated");

    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

            Console.getPlaceManager().revealRelativePlace(-1);
            // clearing the slot:
            // this is necessary to signal GWTP that the slot is not used
            // without subsequent attempts to reveal the same place twice would not succeed
            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
                @Override
                public void execute() {
                    presenter.clearSlot(MainLayoutPresenter.TYPE_Popup);
                }
            });

           /* window.removeStyleName(ACTIVE_CSS);
            window.addStyleName(INACTIVE_CSS);*/
        }
    });

    window.setWidth(640);
    window.setHeight(480);
    window.setAutoHideOnHistoryEventsEnabled(true);
    //window.setGlassStyleName("application-panel-glass");
    window.setGlassEnabled(true);
}
 
Example #18
Source File: DefaultTabLayoutPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public HandlerRegistration addCloseHandler(CloseHandler<Widget> handler) {
    return addHandler(handler, CloseEvent.getType());
}
 
Example #19
Source File: ContentBox.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public void onClose(final CloseEvent<DisclosurePanel> event) {
    setIconClassname("icon-angle-right");
}
 
Example #20
Source File: CellBrowser.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Update the state of a child node based on the keyboard selection of the
 * specified {@link BrowserCellList}. This method will open/close child
 * {@link TreeNode}s as needed.
 *
 * @param cellList the CellList that changed state.
 * @param fireEvents true to fireEvents
 * @return the open {@link TreeNode}, or null if not opened
 */
private <C> TreeNode updateChildState(BrowserCellList<C> cellList, boolean fireEvents) {
  /*
   * Verify that the specified list is still in the browser. It possible for
   * the list to receive deferred updates after it has been removed
   */
  if (cellList.isDestroyed) {
    return null;
  }

  // Get the key of the value to open.
  C newValue = cellList.getPresenter().getKeyboardSelectedRowValue();
  Object newKey = cellList.getValueKey(newValue);

  // Close the current open node.
  TreeNode closedNode = null;
  if (cellList.focusedKey != null && cellList.isFocusedOpen
      && !cellList.focusedKey.equals(newKey)) {
    // Get the node to close.
    closedNode =
            (treeNodes.size() > cellList.level + 1) ? treeNodes.get(cellList.level + 1) : null;

    // Close the node.
    trimToLevel(cellList.level);
  }

  // Open the new node.
  TreeNode openNode = null;
  boolean justOpenedNode = false;
  if (newKey != null) {
    if (newKey.equals(cellList.focusedKey)) {
      // The node is already open.
      openNode = cellList.isFocusedOpen ? treeNodes.get(cellList.level + 1) : null;
    } else {
      // Select this value.
      if (KeyboardSelectionPolicy.BOUND_TO_SELECTION == getKeyboardSelectionPolicy()) {
        cellList.setSelectedValue(newValue);
      }

      // Add the child node if this node has children.
      cellList.focusedKey = newKey;
      NodeInfo<?> childNodeInfo = isLeaf(newValue) ? null : getNodeInfo(newValue);
      if (childNodeInfo != null) {
        cellList.isFocusedOpen = true;
        justOpenedNode = true;
        openNode = appendTreeNode(childNodeInfo, newValue);
      }
    }
  }

  /*
   * Fire event. We fire events after updating the view in case user event
   * handlers modify the open state of nodes, which would interrupt the
   * process.
   */
  if (fireEvents) {
    if (closedNode != null) {
      CloseEvent.fire(this, closedNode);
    }
    if (openNode != null && justOpenedNode) {
      OpenEvent.fire(this, openNode);
    }
  }

  // Return the open node if it is still open.
  return (openNode == null || openNode.isDestroyed()) ? null : openNode;
}
 
Example #21
Source File: CellTreeNodeView.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Sets whether this item's children are displayed.
 *
 * @param open       whether the item is open
 * @param fireEvents true to fire events if the state changes
 * @return true if successfully opened, false otherwise.
 */
public boolean setOpen(boolean open, boolean fireEvents) {
  // Early out.
  if (this.open == open) {
    return this.open;
  }

  // If this node is a leaf node, do not call TreeViewModel.getNodeInfo().
  if (open && isLeaf()) {
    return false;
  }

  // The animation clears the innerHtml of the childContainer. If we reopen a
  // node as its closing, it is possible that the new data will be set
  // synchronously, so we have to cancel the animation before attaching the
  // data display to the node info.
  tree.cancelTreeNodeAnimation();
  this.animate = true;
  this.open = open;
  if (open) {
    if (!nodeInfoLoaded) {
      nodeInfoLoaded = true;
      nodeInfo = tree.getNodeInfo(value);

      // Sink events for the new node.
      if (nodeInfo != null) {
        Set<String> eventsToSink = new HashSet<String>();
        // Listen for focus and blur for keyboard navigation
        eventsToSink.add(BrowserEvents.FOCUS);
        eventsToSink.add(BrowserEvents.BLUR);

        Set<String> consumedEvents = nodeInfo.getCell().getConsumedEvents();
        if (consumedEvents != null) {
          eventsToSink.addAll(consumedEvents);
        }
        CellBasedWidgetImpl.get().sinkEvents(tree, eventsToSink);
      }
    }

    // If we don't have any nodeInfo, we must be a leaf node.
    if (nodeInfo != null) {
      // Add a loading message.
      ensureChildContainer();
      showOrHide(showMoreElem, false);
      showOrHide(emptyMessageElem, false);
      if (!isRootNode()) {
        setStyleName(getCellParent(), tree.getStyle().cellTreeOpenItem(), true);
      }
      ensureAnimationFrame().getStyle().setProperty("display", "");
      onOpen(nodeInfo);

      // Fire an event.
      if (fireEvents) {
        OpenEvent.fire(tree, getTreeNode());
      }
    }
    else {
      this.open = false;
    }
  }
  else {
    if (!isRootNode()) {
      setStyleName(getCellParent(), tree.getStyle().cellTreeOpenItem(), false);
    }
    cleanup(false);
    tree.maybeAnimateTreeNode(this);
    updateImage(false);

    // Keyboard select this node if the open node was a child.
    CellTreeNodeView<?> keySelected = tree.getKeyboardSelectedNode();
    while (keySelected != null) {
      if (keySelected == this) {
        tree.keyboardSelect(this, true);
        break;
      }
      keySelected = keySelected.getParentNode();
    }

    // Fire an event.
    if (fireEvents) {
      CloseEvent.fire(tree, getTreeNode());
    }
  }

  return this.open;
}
 
Example #22
Source File: VContextMenu.java    From context-menu with Apache License 2.0 4 votes vote down vote up
@Override
public void onClose(CloseEvent<PopupPanel> event) {
    super.close(event, currentVisibleContextMenu == null);
    currentVisibleContextMenu = null;
}
 
Example #23
Source File: MaterialChip.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
@Override
public HandlerRegistration addCloseHandler(CloseHandler closeHandler) {
    return addHandler(closeHandler, CloseEvent.getType());
}
 
Example #24
Source File: MaterialChip.java    From gwt-material with Apache License 2.0 4 votes vote down vote up
public void close() {
    if (isAttached()) {
        removeFromParent();
        CloseEvent.fire(this, this);
    }
}
 
Example #25
Source File: VContextMenu.java    From cuba with Apache License 2.0 4 votes vote down vote up
@Override
public void onClose(CloseEvent<PopupPanel> event) {
    super.close(event, currentVisibleContextMenu == null);
    currentVisibleContextMenu = null;
}