当前位置: 首页>>代码示例>>Java>>正文


Java DateCell类代码示例

本文整理汇总了Java中javafx.scene.control.DateCell的典型用法代码示例。如果您正苦于以下问题:Java DateCell类的具体用法?Java DateCell怎么用?Java DateCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


DateCell类属于javafx.scene.control包,在下文中一共展示了DateCell类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initializeDatePickers

import javafx.scene.control.DateCell; //导入依赖的package包/类
/**
 * Ensures that the date pickers only allow selection of dates within the valid booking date
 * range, as defined in the specifications document.
 *
 * Chief among these rules is that bookings may not be placed more than one year in advance.
 */
private void initializeDatePickers() {
    Callback<DatePicker, DateCell> dayCellFactory =
        (final DatePicker datePicker) -> new DateCell() {
            @Override
            public void updateItem(LocalDate item, boolean empty) {
                super.updateItem(item, empty);

                if(item.isAfter(LocalDate.now().plusYears(1))) {
                    setDisable(true);
                }
                if(item.isBefore(ChronoLocalDate.from(LocalDate.now()))) {
                    setDisable(true);
                }
            }
        };
    // Disable selecting invalid check-in/check-out dates
    checkInDatePicker.setDayCellFactory(dayCellFactory);
    checkOutDatePicker.setDayCellFactory(dayCellFactory);
}
 
开发者ID:maillouxc,项目名称:git-rekt,代码行数:26,代码来源:BrowseRoomsScreenController.java

示例2: setRanges

import javafx.scene.control.DateCell; //导入依赖的package包/类
public void setRanges(LocalDateTime startDate, LocalDateTime endDate){
    logger.debug("Setting allowed dates from {} to {}", startDate, endDate);
    final Callback<DatePicker, DateCell> dayCellFactory =
            new Callback<DatePicker, DateCell>() {
                @Override
                public DateCell call(final DatePicker datePicker) {
                    return new DateCell() {
                        @Override
                        public void updateItem(LocalDate item, boolean empty) {
                            super.updateItem(item, empty);
                            if (item.isBefore(startDate.toLocalDate()) || item.isAfter(endDate.toLocalDate())) {
                                setDisable(true);
                                setStyle("-fx-background-color: #ffc0cb;");
                            }
                        }
                    };
                }
            };
    setDayCellFactory(dayCellFactory);
}
 
开发者ID:travelimg,项目名称:travelimg,代码行数:21,代码来源:FlickrDatePicker.java

示例3: DateCellDescription

import javafx.scene.control.DateCell; //导入依赖的package包/类
public DateCellDescription(Wrap<? extends DateCell> dateCellWrap) {
    Lookup lookup = dateCellWrap.as(Parent.class, Node.class).lookup();
    if (lookup.lookup(LabeledText.class).size() > 0) {
        final Wrap<? extends LabeledText> mainText = lookup.lookup(LabeledText.class).wrap();
        mainDate = Integer.parseInt(getText(mainText));
    } else {
        mainDate = -1;
    }

    if (lookup.lookup(Text.class, new ByStyleClass("secondary-text")).size() > 0) {
        final Wrap<? extends Text> secondaryText = lookup.lookup(Text.class, new ByStyleClass("secondary-text")).wrap();
        secondaryDate = Integer.parseInt(getText(secondaryText));
    } else {
        secondaryDate = -1;
    }
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:17,代码来源:TestBase.java

示例4: UpdateDatePicker

import javafx.scene.control.DateCell; //导入依赖的package包/类
private void UpdateDatePicker(){
	Callback<DatePicker, DateCell> dayCellFactory = dp -> new DateCell()
       {
           @Override
           public void updateItem(LocalDate item, boolean empty)
           {
               super.updateItem(item, empty);

               if(item.isBefore(Instant.ofEpochMilli(repoBeginDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate()) 
               		|| item.isAfter(Instant.ofEpochMilli(repoEndDate.getTime()).atZone(ZoneId.systemDefault()).toLocalDate()))
               {
                   setStyle("-fx-background-color: #ffc0cb;");
                   setDisable(true);

                   /* When Hijri Dates are shown, setDisable() doesn't work. Here is a workaround */
                 //  addEventFilter(MouseEvent.MOUSE_CLICKED, e -> e.consume());
               }
               
    
           }
       };

       beginDate.setDayCellFactory(dayCellFactory);
       endDate.setDayCellFactory(dayCellFactory);
}
 
开发者ID:gems-uff,项目名称:dominoes,代码行数:26,代码来源:ProjectInfoPane.java

示例5: call

import javafx.scene.control.DateCell; //导入依赖的package包/类
public DateCell call(DatePicker param) {
    return new DateCell() {

        @Override
        public void updateItem(LocalDate item, boolean empty) {
            super.updateItem(item, empty);

            if (isRestricted(item)) {
                setStyle("-fx-background-color: #ff4444;");
                setDisable(true);
            }
        }
    };
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:15,代码来源:DatePickerApp.java

示例6: setDayCellFactory

import javafx.scene.control.DateCell; //导入依赖的package包/类
void setDayCellFactory(Callback<DatePicker, DateCell> dayCellFactory) {
    new GetAction<Void>() {
        @Override public void run(Object... parameters) throws Exception {
            testedControl.getControl().setDayCellFactory((Callback<DatePicker, DateCell>) parameters[0]);
        }
    }.dispatch(testedControl.getEnvironment(), dayCellFactory);
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:8,代码来源:TestBase.java

示例7: getDayCellFactory

import javafx.scene.control.DateCell; //导入依赖的package包/类
Callback<DatePicker, DateCell> getDayCellFactory() {
    return new GetAction<Callback<DatePicker, DateCell>>() {
        @Override public void run(Object... parameters) throws Exception {
            setResult(testedControl.getControl().getDayCellFactory());
        }
    }.dispatch(testedControl.getEnvironment());
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:8,代码来源:TestBase.java

示例8: daysRestriction

import javafx.scene.control.DateCell; //导入依赖的package包/类
/**
 * Checks that disabled DateCell can't be selected and
 * that state doesn't change after.
 */
@Test(timeout = 10000)
public void daysRestriction() throws InterruptedException {
    rememberInitialState(Properties.showing, Properties.hover, Properties.pressed, Properties.armed);

    final Callback<DatePicker, DateCell> dayCellFactory = new Callback<DatePicker, DateCell>() {
        public DateCell call(DatePicker param) { return new DateCell(); }
    };
    setDayCellFactory(dayCellFactory);
    assertSame(dayCellFactory, getDayCellFactory());

    selectObjectFromChoiceBox(SettingType.BIDIRECTIONAL, Properties.dayCellFactory, WorkingDays.class);
    setDate(LocalDate.of(2020, 10, 31));
    clickDropDownButton();
    waitPopupShowingState(true);

    PopupSceneDescription description = new PopupSceneDescription();
    description.extractData();
    Wrap<? extends DateCell> cellWrap = description.currentMonthDays.get(24);
    DateCellDescription cell = new DateCellDescription(cellWrap);
    assertEquals("[Selected wrong day]", 25, cell.mainDate);

    cellWrap.mouse().click();
    waitPopupShowingState(true);

    HashMap<String, String> expectedState = new HashMap<String, String>(2);
    expectedState.put("selectedDay", "31");
    expectedState.put("monthName", "October");
    expectedState.put("year", "2020");
    testedControl.waitState(new DateState(expectedState, description));
    waitShownText("10/31/2020");

    testedControl.keyboard().pushKey(KeyboardButtons.ESCAPE);
    setDate(LocalDate.of(2020, Month.OCTOBER, 25));
    checkFinalState();
}
 
开发者ID:teamfx,项目名称:openjfx-8u-dev-tests,代码行数:40,代码来源:DatePickerTest.java

示例9: initRepeatingArea

import javafx.scene.control.DateCell; //导入依赖的package包/类
private void initRepeatingArea() 
{
	checkBoxRepeat.selectedProperty().addListener((listener, oldValue, newValue) -> {
		toggleRepeatingArea(newValue);
	});		
	
	initSpinnerRepeatingPeriod();
	initComboBoxRepeatingDay();		
	initComboBoxCategory();		

	final ToggleGroup toggleGroup = new ToggleGroup();
	radioButtonPeriod.setToggleGroup(toggleGroup);
	radioButtonDay.setToggleGroup(toggleGroup);
	radioButtonPeriod.selectedProperty().addListener((listener, oldValue, newValue) -> {
		toggleRadioButtonPeriod(newValue);
	});

	datePickerEnddate.setDayCellFactory((p) -> new DateCell()
	{
		@Override
		public void updateItem(LocalDate ld, boolean bln)
		{
			super.updateItem(ld, bln);

			if(datePicker.getValue() != null && ld.isBefore(datePicker.getValue()))
			{
				setDisable(true);
				setStyle("-fx-background-color: #ffc0cb;");
			}
		}
	});
	
	checkBoxEndDate.selectedProperty().addListener((obs, oldValue, newValue)->{
		datePickerEnddate.setDisable(!newValue);
	});
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:37,代码来源:NewPaymentController.java

示例10: init

import javafx.scene.control.DateCell; //导入依赖的package包/类
public void init(Controller controller)
{
	this.controller = controller;

	datePickerEnd.setDayCellFactory(param -> new DateCell()
	{
		@Override
		public void updateItem(LocalDate item, boolean empty)
		{
			super.updateItem(item, empty);
			if(item.isBefore(datePickerStart.getValue().plusDays(1)))
			{
				setDisable(true);
				setStyle("-fx-background-color: #ffc0cb;");
			}
		}
	});

	comboBoxStartMonth.setItems(FXCollections.observableArrayList(Helpers.getMonthList()));
	comboBoxStartYear.setItems(FXCollections.observableArrayList(Helpers.getYearList()));
	comboBoxEndMonth.setItems(FXCollections.observableArrayList(Helpers.getMonthList()));
	comboBoxEndYear.setItems(FXCollections.observableArrayList(Helpers.getYearList()));

	final ToggleGroup toggleGroup = new ToggleGroup();
	radioButtonBars.setToggleGroup(toggleGroup);
	radioButtonBars.setSelected(true);
	radioButtonLines.setToggleGroup(toggleGroup);

	accordion.setExpandedPane(accordion.getPanes().get(0));
	vboxChartMonth.setSpacing(15);
	
	applyStyle();
}
 
开发者ID:deadlocker8,项目名称:BudgetMaster,代码行数:34,代码来源:ChartController.java

示例11: findDayCellOfDate

import javafx.scene.control.DateCell; //导入依赖的package包/类
private DateCell findDayCellOfDate(LocalDate date) {
    for (int i = 0; i < dayCellDates.length; i++) {
        if (date.equals(dayCellDates[i])) {
            return dayCells.get(i);
        }
    }
    return dayCells.get(dayCells.size() / 2 + 1);
}
 
开发者ID:jfoenixadmin,项目名称:JFoenix,代码行数:9,代码来源:JFXDatePickerContent.java

示例12: makeStartDatePickerCellsDisabled

import javafx.scene.control.DateCell; //导入依赖的package包/类
private DateCell makeStartDatePickerCellsDisabled(DatePicker datePicker) {
    return new DateCell() {
        @Override
        public void updateItem(LocalDate startDate, boolean empty) {
            super.updateItem(startDate, empty);
            if (startDate.isBefore(controller.getProject().getStartDate())) {
                setDisable(true);
            }
            if (startDate.isEqual(controller.getProject().getFinishDate()) || startDate.isAfter(controller.getProject().getFinishDate())) {
                setDisable(true);
            }
        }
    };
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:15,代码来源:TaskInformationModuleController.java

示例13: makeFinishDatePickerCellsDisabled

import javafx.scene.control.DateCell; //导入依赖的package包/类
private DateCell makeFinishDatePickerCellsDisabled(DatePicker datePicker) {
    return new DateCell() {
        @Override
        public void updateItem(LocalDate finishDate, boolean empty) {
            super.updateItem(finishDate, empty);
            if (finishDate.isBefore(module.getStartDatePicker().getValue().plusDays(1))) {
                setDisable(true);
            }
            if (finishDate.isEqual(controller.getProject().getFinishDate().plusDays(1)) || finishDate.isAfter(controller.getProject().getFinishDate().plusDays(1))) {
                setDisable(true);
            }
        }
    };
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:15,代码来源:TaskInformationModuleController.java

示例14: makeFinishDatePickerCellsDisabledBeforeStartDate

import javafx.scene.control.DateCell; //导入依赖的package包/类
private DateCell makeFinishDatePickerCellsDisabledBeforeStartDate(DatePicker datePicker) {
    return new DateCell() {
        @Override
        public void updateItem(LocalDate finishDate, boolean empty) {
            super.updateItem(finishDate, empty);
            if (finishDate.isBefore(module.getStartDatePicker().getValue().plusDays(1))) {
                setDisable(true);
            }
        }
    };
}
 
开发者ID:khasang,项目名称:Cachoeira,代码行数:12,代码来源:ProjectInformationModuleController.java

示例15: testGetDateCellAdjuster

import javafx.scene.control.DateCell; //导入依赖的package包/类
@Test
public void testGetDateCellAdjuster() {
	Adjuster adjuster = Adjuster.getAdjuster(DateCell.class);
	
	assertThat(adjuster, is(instanceOf(ControlAdjuster.class)));
	assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class)));
}
 
开发者ID:yumix,项目名称:javafx-dpi-scaling,代码行数:8,代码来源:AdjusterTest.java


注:本文中的javafx.scene.control.DateCell类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。