JXDatePicker extends JComponent { public void addPopupMenuListener(PopupMenuListener l) { listenerMap.add(PopupMenuListener.class, l); } JXDatePicker();  JXDatePicker(Date selected);  JXDatePicker(Locale locale);  JXDatePicker(Date selection, Locale locale); void setDate(Date date); Date getDate(); DatePickerUI getUI(); void setUI(DatePickerUI ui); @Override void updateUI(); @Override String getUIClassID(); void setFormats(String... formats); void setFormats(DateFormat... formats); DateFormat[] getFormats(); JXMonthView getMonthView(); void setMonthView(JXMonthView monthView); TimeZone getTimeZone(); void setTimeZone(TimeZone tz); Date getLinkDay(); void setLinkDay(Date linkDay, String linkFormatString); void setLinkDay(Date linkDay); JPanel getLinkPanel(); void setLinkPanel(JPanel linkPanel); JFormattedTextField getEditor(); void setEditor(JFormattedTextField editor); @Override void setComponentOrientation(ComponentOrientation orientation); boolean isEditValid(); void commitEdit(); void cancelEdit(); void setEditable(boolean value); boolean isEditable(); @Override Font getFont(); @Override void setFont(final Font font); void setLightWeightPopupEnabled(boolean aFlag); boolean isLightWeightPopupEnabled(); @Override int getBaseline(int width, int height); void addActionListener(ActionListener l); void removeActionListener(ActionListener l); @Override @SuppressWarnings("unchecked") T[] getListeners(Class<T> listenerType); void addPopupMenuListener(PopupMenuListener l); void removePopupMenuListener(PopupMenuListener l); PopupMenuListener[] getPopupMenuListeners(); static final String uiClassID; static final String EDITOR; static final String MONTH_VIEW; static final String LINK_PANEL; static final String COMMIT_KEY; static final String CANCEL_KEY; static final String HOME_NAVIGATE_KEY; static final String HOME_COMMIT_KEY; }
@Test public void testPopupMenuListenerNotificationPickerIsSourceOnShowing() throws InterruptedException, InvocationTargetException { if (GraphicsEnvironment.isHeadless()) { LOG.fine("cannot run testLinkPanelNull - headless"); return; } final JXDatePicker picker = new JXDatePicker(); final JXFrame frame = new JXFrame("showing", false); frame.add(picker); frame.pack(); frame.setVisible(true); final PopupMenuReport report = new PopupMenuReport(); picker.addPopupMenuListener(report); Action togglePopup = picker.getActionMap().get("TOGGLE_POPUP"); togglePopup.actionPerformed(null); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { assertEquals(1, report.getVisibleEventCount()); assertEquals(picker, report.getLastEvent().getSource()); frame.dispose(); } }); }
@Test public void testPopupMenuListenerNotificationPickerIsSourceOnHiding() throws InterruptedException, InvocationTargetException { if (GraphicsEnvironment.isHeadless()) { LOG.fine("cannot run testLinkPanelNull - headless"); return; } final JXDatePicker picker = new JXDatePicker(); final JXFrame frame = new JXFrame("showing", false); frame.add(picker); frame.pack(); frame.setVisible(true); final Action togglePopup = picker.getActionMap().get("TOGGLE_POPUP"); togglePopup.actionPerformed(null); final PopupMenuReport report = new PopupMenuReport(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { picker.addPopupMenuListener(report); togglePopup.actionPerformed(null); } }); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { assertEquals(1, report.getInvisibleEventCount()); assertEquals(picker, report.getLastEvent().getSource()); frame.dispose(); } }); }
@Test public void testPopupMenuListenerNotificationVisible() throws InterruptedException, InvocationTargetException { if (GraphicsEnvironment.isHeadless()) { LOG.fine("cannot run testLinkPanelNull - headless"); return; } final JXDatePicker picker = new JXDatePicker(); final JXFrame frame = new JXFrame("showing", false); frame.add(picker); frame.pack(); frame.setVisible(true); final PopupMenuReport report = new PopupMenuReport(); picker.addPopupMenuListener(report); Action togglePopup = picker.getActionMap().get("TOGGLE_POPUP"); togglePopup.actionPerformed(null); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { assertEquals(1, report.getEventCount()); assertEquals(1, report.getVisibleEventCount()); frame.dispose(); } }); }
@Test public void testPopupMenuListenerNotificationInvisible() throws InterruptedException, InvocationTargetException { if (GraphicsEnvironment.isHeadless()) { LOG.fine("cannot run testLinkPanelNull - headless"); return; } final JXDatePicker picker = new JXDatePicker(); final JXFrame frame = new JXFrame("showing", false); frame.add(picker); frame.pack(); frame.setVisible(true); final Action togglePopup = picker.getActionMap().get("TOGGLE_POPUP"); togglePopup.actionPerformed(null); final PopupMenuReport report = new PopupMenuReport(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { picker.addPopupMenuListener(report); togglePopup.actionPerformed(null); } }); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { assertEquals(1, report.getEventCount()); assertEquals(1, report.getInvisibleEventCount()); frame.dispose(); } }); }