当前位置: 首页>>代码示例>>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;未经允许,请勿转载。