當前位置: 首頁>>代碼示例>>Java>>正文


Java DateSelectionEvent類代碼示例

本文整理匯總了Java中org.jdesktop.swingx.event.DateSelectionEvent的典型用法代碼示例。如果您正苦於以下問題:Java DateSelectionEvent類的具體用法?Java DateSelectionEvent怎麽用?Java DateSelectionEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DateSelectionEvent類屬於org.jdesktop.swingx.event包,在下文中一共展示了DateSelectionEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testAdjusting

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * adding api: adjusting.
 *
 */
@Test
public void testAdjusting() {
    // default value
    assertFalse(model.isAdjusting());
    DateSelectionReport report = new DateSelectionReport(model);
    // set adjusting
    model.setAdjusting(true);
    assertTrue("model must be adjusting", model.isAdjusting());
    assertEquals(1, report.getEventCount());
    assertEquals(DateSelectionEvent.EventType.ADJUSTING_STARTED, 
            report.getLastEventType());
    // next round - reset to default adjusting
    report.clear();
    model.setAdjusting(false);
    assertFalse("model must not be adjusting", model.isAdjusting());
    assertEquals(1, report.getEventCount());
    assertEquals(DateSelectionEvent.EventType.ADJUSTING_STOPPED, 
            report.getLastEventType());
    
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:25,代碼來源:AbstractTestDateSelectionModel.java

示例2: testDateSelectionClearSelectionFireIfSelected

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * related to #625-swingx: DateSelectionModel must fire SELECTION_CLEARED if 
 * had selection.
 * Testing here for sanity reasons ... be sure we didn't prevent the firing
 * altogether while changing.
 */
@Test
public void testDateSelectionClearSelectionFireIfSelected() {
    Date date = new Date();
    model.setSelectionInterval(date, date);
    // sanity
    assertFalse(model.isSelectionEmpty());
    DateSelectionReport report = new DateSelectionReport(model);
    model.clearSelection();
    assertEquals("selection must fire on clearing selection",
            1,
            report.getEventCount());
    assertEquals("event type must be SELECTION_CLEARED",
            DateSelectionEvent.EventType.SELECTION_CLEARED,
            report.getLastEventType());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:22,代碼來源:DefaultDateSelectionModelTest.java

示例3: testDateSelectionSetSelectionFire

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * related to #625-swingx: DateSelectionModel must fire SELECTION_CLEARED if 
 * had selection.
 * Testing here for sanity reasons ... be sure we didn't prevent the firing
 * altogether while changing.
 */
@Test
public void testDateSelectionSetSelectionFire() {
    Date date = new Date();
    model.setSelectionInterval(date, date);
    // sanity
    assertTrue(model.isSelected(date));
    DateSelectionReport report = new DateSelectionReport(model);
    // modify the date
    calendar.setTime(date);
    calendar.add(Calendar.HOUR, 1);
    model.setSelectionInterval(calendar.getTime(), calendar.getTime());
    assertEquals("selection must fire on selection",
            1,
            report.getEventCount());
    assertEquals("event type must be DATES_SET",
            DateSelectionEvent.EventType.DATES_SET,
            report.getLastEventType());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:25,代碼來源:DefaultDateSelectionModelTest.java

示例4: assertUnselectableDatesSelectedWhileHasValidSelection

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * @param model
 */
private void assertUnselectableDatesSelectedWhileHasValidSelection(
        DateSelectionModel model) {
    SortedSet<Date> unselectableDates = new TreeSet<Date>();
    unselectableDates.add(tomorrow);
    model.setUnselectableDates(unselectableDates);
    // valid selection
    model.setSelectionInterval(today, today);
    DateSelectionReport report = new DateSelectionReport(model);
    model.setSelectionInterval(tomorrow, tomorrow);
    if (model.isSelectionEmpty()) {
        assertEquals("implementation clears old selection, must fire clear event", 
                1, report.getEventCount(DateSelectionEvent.EventType.SELECTION_CLEARED));
    } else {
        assertEquals("implementation does not clear old selection, old must be unchanged", 
                today, model.getSelection().first());
    }
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:21,代碼來源:DateSelectionModelIssues.java

示例5: testDateSelectionSetSelectionFire

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * related to #625-swingx: DateSelectionModel must fire SELECTION_CLEARED if 
 * had selection.
 * Testing here for sanity reasons ... be sure we didn't prevent the firing
 * altogether while changing.
 */
@Test
public void testDateSelectionSetSelectionFire() {
    model.setSelectionInterval(today, today);
    // sanity
    assertTrue(model.isSelected(today));
    DateSelectionReport report = new DateSelectionReport(model);
    model.setSelectionInterval(tomorrow, tomorrow);
    assertEquals("selection must fire on selection",
            1,
            report.getEventCount());
    assertEquals("event type must be DATES_SET",
            DateSelectionEvent.EventType.DATES_SET,
            report.getLastEventType());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:21,代碼來源:SingleDaySelectionModelTest.java

示例6: testEventImmutable

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * Event properties should be immutable.
 *
 */
@Test
public void testEventImmutable() {
    DateSelectionReport report = new DateSelectionReport(model);
    Date date = new Date();
    model.setSelectionInterval(date, date);
    assertEquals(1, report.getEventCount());
    DateSelectionEvent event = report.getLastEvent();
    // sanity
    assertEquals(date, event.getSelection().first());
    Date next = new Date();
    model.setSelectionInterval(next, next);
    assertSame(date, event.getSelection().first());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:18,代碼來源:DateSelectionModelIssues.java

示例7: hasEvent

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
public boolean hasEvent(EventType type) {
    for (DateSelectionEvent ev : events) {
        if (ev.getEventType().equals(type)) {
            return true;
        }
    }
    return false;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:9,代碼來源:DateSelectionReport.java

示例8: getEventCount

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
public int getEventCount(EventType type) {
    int count = 0;
    for (DateSelectionEvent ev : events) {
        if (ev.getEventType().equals(type)) {
            count++;
        }
    }
    return count;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:10,代碼來源:DateSelectionReport.java

示例9: valueChanged

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(DateSelectionEvent ev) {
    monthView.repaint();
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:5,代碼來源:BasicMonthViewUI.java

示例10: valueChanged

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
@Override
public void valueChanged(DateSelectionEvent ev) {
    updateFromSelectionChanged(ev.getEventType(), ev.isAdjusting());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:5,代碼來源:BasicDatePickerUI.java

示例11: interactiveMonthViewEvents

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
/**
 * Issue #??-swingx: esc/enter does not always fire actionEvent.
 * 
 * Fixed: committing/canceling user gestures always fire.
 * 
 * Open: mouse-gestures?
 *
 */
public void interactiveMonthViewEvents() {
    JXMonthView monthView = new JXMonthView();
    JXMonthView interval = new JXMonthView();
    interval.setSelectionMode(SelectionMode.SINGLE_INTERVAL_SELECTION);
    JXMonthView multiple = new JXMonthView();
    multiple.setSelectionMode(SelectionMode.MULTIPLE_INTERVAL_SELECTION);
    ActionListener l = new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            LOG.info("got action from: " + e.getSource().getClass().getName() + 
                    "\n" + e);
        }
        
    };
    monthView.addActionListener(l);
    interval.addActionListener(l);
    multiple.addActionListener(l);
    DateSelectionListener d = new DateSelectionListener() {

        @Override
        public void valueChanged(DateSelectionEvent ev) {
            LOG.info("got selection from: " + ev.getSource().getClass().getName() + 
                    "\n" + ev);
        }
        
    };
    monthView.getSelectionModel().addDateSelectionListener(d);
    interval.getSelectionModel().addDateSelectionListener(d);
    multiple.getSelectionModel().addDateSelectionListener(d);
    
    JXDatePicker picker = new JXDatePicker();
    JXMonthView intervalForPicker = new JXMonthView();
    intervalForPicker.setSelectionMode(SelectionMode.SINGLE_INTERVAL_SELECTION);
    // JW: this picker comes up with today - should have taken the
    // empty selection (which it does the unit test)
    picker.setMonthView(intervalForPicker);
    
    JComponent comp = new JPanel();
    comp.add(monthView);
    comp.add(interval);
    comp.add(multiple);
    comp.add(picker);
    JXFrame frame = showInFrame(comp, "events from monthView");
    // JXRootPane eats esc 
    frame.getRootPaneExt().getActionMap().remove("esc-action");

}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:57,代碼來源:JXMonthViewVisualCheck.java

示例12: valueChanged

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
public void valueChanged(DateSelectionEvent evt) {
    events.add(0, evt);
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:4,代碼來源:DateSelectionReport.java

示例13: getLastEvent

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
public DateSelectionEvent getLastEvent() {
    return hasEvents() ? events.get(0) : null;
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:4,代碼來源:DateSelectionReport.java

示例14: valueChanged

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
public void valueChanged(DateSelectionEvent ev) {
    monthView.repaint();
}
 
開發者ID:sing-group,項目名稱:aibench-project,代碼行數:4,代碼來源:BasicMonthViewUI.java

示例15: valueChanged

import org.jdesktop.swingx.event.DateSelectionEvent; //導入依賴的package包/類
public void valueChanged(DateSelectionEvent ev) {
    updateFromSelectionChanged(ev.getEventType(), ev.isAdjusting());
}
 
開發者ID:sing-group,項目名稱:aibench-project,代碼行數:4,代碼來源:BasicDatePickerUI.java


注:本文中的org.jdesktop.swingx.event.DateSelectionEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。