Package jfxtras.scene.control

Examples of jfxtras.scene.control.CalendarTextField


        return null;
      }
    });
   
    HBox lHBox = new HBox();
    CalendarTextField lCalendarTextField = new CalendarTextField();
    lCalendarTextField.calendarProperty().bindBidirectional(lAgenda.displayedCalendar());   
        lHBox.getChildren().add(lCalendarTextField);
       
        // create scene
        BorderPane lBorderPane = new BorderPane();
        lBorderPane.setCenter(lAgenda);
View Full Code Here


    lBorderPane.setCenter(lMenuVBox);

    // time
    lMenuVBox.getChildren().add(new Text("Time:"));
    // start
    final CalendarTextField lStartCalendarTextField = new CalendarTextField().withDateFormat(SimpleDateFormat.getDateTimeInstance());
    lStartCalendarTextField.setLocale(getSkinnable().getLocale());
    lStartCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getStartTime());
    lMenuVBox.getChildren().add(lStartCalendarTextField);
    // end
    final CalendarTextField lEndCalendarTextField = new CalendarTextField().withDateFormat(SimpleDateFormat.getDateTimeInstance());
    lEndCalendarTextField.setLocale(getSkinnable().getLocale());
    lEndCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getEndTime());
    lMenuVBox.getChildren().add(lEndCalendarTextField);
    lEndCalendarTextField.calendarProperty().addListener(new ChangeListener<Calendar>()
    {
      @Override
      public void changed(ObservableValue<? extends Calendar> arg0, Calendar oldValue, Calendar newValue)
      {
        abstractAppointmentPane.appointment.setEndTime(newValue);
        // refresh is done upon popup close
      }
    });
    lEndCalendarTextField.setVisible(abstractAppointmentPane.appointment.getEndTime() != null);
    // wholeday
    if ((abstractAppointmentPane.appointment.isWholeDay() != null && abstractAppointmentPane.appointment.isWholeDay() == true) || abstractAppointmentPane.appointment.getEndTime() != null)
    {
      final CheckBox lWholedayCheckBox = new CheckBox("Wholeday");
      lWholedayCheckBox.setId("wholeday-checkbox");
      lWholedayCheckBox.selectedProperty().set(abstractAppointmentPane.appointment.isWholeDay());
      lMenuVBox.getChildren().add(lWholedayCheckBox);
      lWholedayCheckBox.selectedProperty().addListener(new ChangeListener<Boolean>()
      {
        @Override
        public void changed(ObservableValue<? extends Boolean> arg0, Boolean oldValue, Boolean newValue)
        {
          abstractAppointmentPane.appointment.setWholeDay(newValue);
          if (newValue == true)
          {
            abstractAppointmentPane.appointment.setEndTime(null);
          }
          else
          {
            Calendar lEndTime = (Calendar)abstractAppointmentPane.appointment.getStartTime().clone();
            lEndTime.add(Calendar.MINUTE, 30);
            abstractAppointmentPane.appointment.setEndTime(lEndTime);
            lEndCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getEndTime());
          }
          lEndCalendarTextField.setVisible(abstractAppointmentPane.appointment.getEndTime() != null);
          // refresh is done upon popup close
        }
      });
    }
    // event handling
    lStartCalendarTextField.calendarProperty().addListener(new ChangeListener<Calendar>()
    {
      @Override
      public void changed(ObservableValue<? extends Calendar> arg0, Calendar oldValue, Calendar newValue)
      {
        // enddate
        if (abstractAppointmentPane.appointment.isWholeDay())
        {
          abstractAppointmentPane.appointment.setStartTime(newValue);
        }
        else
        {
          // remember
          Calendar lOldStart = abstractAppointmentPane.appointment.getStartTime();

          // set
          abstractAppointmentPane.appointment.setStartTime(newValue);

          // end date
          if (abstractAppointmentPane.appointment.getEndTime() != null)
          {
            long lDurationInMS = abstractAppointmentPane.appointment.getEndTime().getTimeInMillis() - lOldStart.getTimeInMillis();
            Calendar lEndCalendar = (Calendar)abstractAppointmentPane.appointment.getStartTime().clone();
            lEndCalendar.add(Calendar.MILLISECOND, (int)lDurationInMS);
            abstractAppointmentPane.appointment.setEndTime(lEndCalendar);

            // update field
            lEndCalendarTextField.setCalendar(abstractAppointmentPane.appointment.getEndTime());
          }

          // refresh is done upon popup close
        }
      }
View Full Code Here

   * construct the nodes
   */
  private void createNodes()
  {
    // we use our universal control
    calendarTextField = new CalendarTextField();
    getChildren().add(calendarTextField);
   
    // setup CSS
        getSkinnable().getStyleClass().add(this.getClass().getSimpleName()); // always add self as style class, because CSS should relate to the skin not the control
  }
View Full Code Here

   * construct the nodes
   */
  private void createNodes()
  {
    // setup the grid so all weekday togglebuttons will grow, but the weeknumbers do not
    calendarTextField = new CalendarTextField();
    getChildren().add(calendarTextField);
   
    // setup CSS
        getSkinnable().getStyleClass().add(this.getClass().getSimpleName()); // always add self as style class, because CSS should relate to the skin not the control
  }
View Full Code Here

   */
  @Override
  public CalendarTextField build()
  {
    Locale lLocale = (iLocale == null ? Locale.getDefault() : iLocale);
    CalendarTextField lCalendarTextField = new CalendarTextField();
    if (iDateFormat != null) lCalendarTextField.setDateFormat(new SimpleDateFormat(iDateFormat, lLocale));
    if (iLocale != null) lCalendarTextField.setLocale(iLocale);
    if (iPromptText != null) lCalendarTextField.setPromptText(iPromptText);
    if (iDateFormats != null)
    {
      ObservableList<DateFormat> lDateFormats = FXCollections.observableArrayList();
      for (String lPart : iDateFormats)
      {
        lDateFormats.add( new SimpleDateFormat(lPart.trim(), lLocale) );
      }
      lCalendarTextField.setDateFormats(lDateFormats);
    }
    applyCommonProperties(lCalendarTextField);
    return lCalendarTextField;
  }
View Full Code Here

  {
    // show the correct tab
    click("#defaultControl");
   
    // get the node
    CalendarTextField lCalendarTextField = (CalendarTextField)find(".CalendarTextField");
   
    // default value is null
    Assert.assertNull(lCalendarTextField.getCalendar());

    // popup the picker
    click(".icon");

    // click the last day in the first week (this button is always visible)
    click("#" + new SimpleDateFormat("yyyy-MM-01").format(Calendar.getInstance().getTime()));

    // default value is not null
    Assert.assertNotNull(lCalendarTextField.getCalendar());
  }
View Full Code Here

  {
    // show the correct tab
    click("#atributesAreSet2");
   
    // get the node
    CalendarTextField lCalendarTextField = (CalendarTextField)find(".CalendarTextField");
    TextField lTextField = (TextField)find(".CalendarTextField .text-field");
   
    // check properties
    Assert.assertEquals("2013-01-01 22:33:44", lCalendarTextField.getDateFormat().format(new GregorianCalendar(2013, 1-1, 1, 22, 33, 44).getTime()));
   
    // type value
    click(".CalendarTextField .text-field");
    type("2010");
    click(".button"); //just to move the focus
    Assert.assertEquals("2010-01-01T00:00:00.000", TestUtil.quickFormatCalendarAsDateTime(lCalendarTextField.getCalendar()) );
    TestUtil.runThenWaitForPaintPulse( () -> {
      lTextField.clear();
    });
   
    // type value
    click(".CalendarTextField .text-field");
    type("2010-06");
    click(".button"); //just to move the focus
    Assert.assertEquals("2010-06-01T00:00:00.000", TestUtil.quickFormatCalendarAsDateTime(lCalendarTextField.getCalendar()) );
    TestUtil.runThenWaitForPaintPulse( () -> {
      lTextField.clear();
    });
   
    // type value
    click(".CalendarTextField .text-field");
    type("2010-06-12");
    click(".button"); //just to move the focus
    Assert.assertEquals("2010-06-12T00:00:00.000", TestUtil.quickFormatCalendarAsDateTime(lCalendarTextField.getCalendar()) );
    TestUtil.runThenWaitForPaintPulse( () -> {
      lTextField.clear();
    });
  }
View Full Code Here

  {
    // show the correct tab
    click("#atributesAreSet3");
   
    // get the node
    CalendarTextField lCalendarTextField = (CalendarTextField)find(".CalendarTextField");   
    TextField lTextField = (TextField)find(".CalendarTextField .text-field");
   
    // check properties
    Assert.assertEquals("de", lCalendarTextField.getLocale().toString());
    Assert.assertEquals("locale set", lTextField.getPromptText());
  }
View Full Code Here

    final private List<String> expected = FXCollections.observableArrayList("CalendarTextField");
    private volatile boolean pass = true;

    @Test
    public void TestAnonymousCalendarPicker() throws Exception {
        final CalendarTextField spinner = new CalendarTextField() {};
        Assert.assertEquals(expected, spinner.getStyleClass());
        FXTestUtils.invokeAndWait(new Runnable() {
            @Override
            public void run() {
                root.getChildren().add(spinner);
            }
View Full Code Here

  public Parent getRootNode()
  {
    Locale.setDefault(Locale.ENGLISH);
   
    HBox box = new HBox();
    calendarTextField = new CalendarTextField();
    box.getChildren().add(calendarTextField);
    Button lButton = new Button("focus helper");
    lButton.setId("focusHelper");
    box.getChildren().add(lButton);
View Full Code Here

TOP

Related Classes of jfxtras.scene.control.CalendarTextField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.