Examples of DateTimePanel


Examples of jsynoptic.builtin.ui.DateTimePanel

    //  An optional date for sync -> async or async -> sync format conversions
    JPanel initialDatePanel = new JPanel(new BorderLayout());
    initialDateLabel= new JLabel(resources.getString("initialDate"));
    initialDateLabel.setFont(new Font("Dialog", Font.PLAIN,12));
    initialDatePanel.add( initialDateLabel, BorderLayout.WEST);
    initialDatePanel.add(initialDate = new DateTimePanel(0, TimeStampedDataSourceCollection.timeStampedDateFormat.getTimeZone()), BorderLayout.CENTER);
    initialDate.setEnabled(false);
    initialDateLabel.setEnabled(false);
    add(initialDatePanel, gbc);
    gbc.gridy++;
  }
View Full Code Here

Examples of org.projectforge.web.wicket.components.DateTimePanel

      @SuppressWarnings("unchecked")
      @Override
      public void validate(final Form< ? > form)
      {
        final DateTimePanel startDateTimePanel = (DateTimePanel) dependentFormComponentsWithCost2[0];
        final DropDownChoice<Integer> stopHourOfDayDropDownChoice = (DropDownChoice<Integer>) dependentFormComponentsWithCost2[1];
        final DropDownChoice<Integer> stopMinuteDropDownChoice = (DropDownChoice<Integer>) dependentFormComponentsWithCost2[2];
        final DateHolder startDate = new DateHolder(startDateTimePanel.getConvertedInput());
        final DateHolder stopDate = new DateHolder(startDate.getTimestamp());
        stopDate.setHourOfDay(stopHourOfDayDropDownChoice.getConvertedInput());
        stopDate.setMinute(stopMinuteDropDownChoice.getConvertedInput());
        if (stopDate.getTimeOfDay() < startDate.getTimeOfDay()) { // Stop time is
          // before start time. Assuming next day for stop time:
          stopDate.add(Calendar.DAY_OF_MONTH, 1);
        }
        data.setStartTime(startDate.getTimestamp());
        data.setStopTime(stopDate.getTimestamp());
        if (data.getDuration() < 60000) {
          // Duration is less than 60 seconds.
          stopMinuteDropDownChoice.error(getString("timesheet.error.zeroDuration"));
        } else if (data.getDuration() > TimesheetDao.MAXIMUM_DURATION) {
          stopMinuteDropDownChoice.error(getString("timesheet.error.maximumDurationExceeded"));
        }
        if (cost2Exists == true) {
          if (cost2Choice != null && cost2Choice.getConvertedInput() == null) {
            // cost2Choice is always != null (but may-be invisible) if cost2 entries does exist in the system.
            // Kost2 is not available for current task.
            final TaskNode taskNode = taskTree.getTaskNodeById(data.getTaskId());
            if (taskNode != null) {
              final List<Integer> descendents = taskNode.getDescendantIds();
              for (final Integer taskId : descendents) {
                if (CollectionUtils.isNotEmpty(taskTree.getKost2List(taskId)) == true) {
                  // But Kost2 is available for sub task, so user should book his time sheet
                  // on a sub task with kost2s.
                  if (cost2Choice.isVisible()) {
                    cost2Choice.error(getString("timesheet.error.kost2NeededChooseSubTask"));
                  } else {
                    error(getString("timesheet.error.kost2NeededChooseSubTask"));
                  }
                  break;
                }
              }
            }
          }
        }
      }
    });
    parentPage.preInit();
    gridBuilder.newGridPanel();
    if (isNew() == true) {
      addTemplatesRow();
    }
    {
      // Task
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("task"));
      final TaskSelectPanel taskSelectPanel = new TaskSelectPanel(fs, new PropertyModel<TaskDO>(data, "task"), parentPage, "taskId") {
        @Override
        protected void selectTask(final TaskDO task)
        {
          super.selectTask(task);
          refresh(); // Task was changed. Therefore update the kost2 list.
        }

        /**
         * @see org.projectforge.web.task.TaskSelectPanel#onModelSelected(org.apache.wicket.ajax.AjaxRequestTarget,
         *      org.projectforge.task.TaskDO)
         */
        @Override
        protected void onModelSelected(final AjaxRequestTarget target, final TaskDO taskDO)
        {
          refresh();
          super.onModelSelected(target, taskDO);
          if (cost2ChoiceFieldset != null) {
            target.add(cost2ChoiceFieldset.getFieldset());
          }
        }
      };
      taskSelectPanel.setAutocompleteOnlyTaskBookableForTimesheets(true);
      fs.add(taskSelectPanel);
      taskSelectPanel.init();
      taskSelectPanel.setRequired(true);
    }
    if (cost2Exists == true) {
      // Cost 2 entries does exist in the data-base.
      cost2ChoiceFieldset = gridBuilder.newFieldset(getString("fibu.kost2"));
      cost2ChoiceFieldset.getFieldset().setOutputMarkupId(true);
      cost2ChoiceFieldset.getFieldset().setOutputMarkupPlaceholderTag(true);
      cost2List = taskTree.getKost2List(data.getTaskId());
      final LabelValueChoiceRenderer<Integer> cost2ChoiceRenderer = getCost2LabelValueChoiceRenderer(parentPage.getBaseDao(), cost2List,
          data, null);
      cost2Choice = createCost2ChoiceRenderer(cost2ChoiceFieldset.getDropDownChoiceId(), parentPage.getBaseDao(), taskTree,
          cost2ChoiceRenderer, data, cost2List);
      cost2ChoicePanel = cost2ChoiceFieldset.add(cost2Choice);
      dependentFormComponentsWithCost2[3] = cost2Choice;
      updateCost2ChoiceValidation();
    }
    {
      // User
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("user"));
      PFUserDO user = data.getUser();
      if (Hibernate.isInitialized(user) == false) {
        user = userGroupCache.getUser(user.getId());
        data.setUser(user);
      }
      userSelectPanel = new UserSelectPanel(fs.newChildId(), new PropertyModel<PFUserDO>(data, "user"), parentPage, "userId");
      userSelectPanel.setRequired(true);
      fs.add(userSelectPanel);
      userSelectPanel.init();
    }
    {
      // Time period
      final FieldsetPanel fs = gridBuilder.newFieldset(getString("timePeriod"));
      final DateTimePanel startDateTimePanel = new DateTimePanel(fs.newChildId(), new PropertyModel<Date>(data, "startTime"),
          (DateTimePanelSettings) DateTimePanelSettings.get().withSelectStartStopTime(true).withTargetType(java.sql.Timestamp.class)
          .withRequired(true), DatePrecision.MINUTE_15);
      dependentFormComponentsWithCost2[0] = dependentFormComponentsWithoutCost2[0] = startDateTimePanel;
      fs.add(startDateTimePanel);
      WicketUtils.addTooltip(startDateTimePanel.getDateField(), new Model<String>() {
        @Override
        public String getObject()
        {
          final StringBuffer buf = new StringBuffer();
          if (data.getStartTime() != null) {
View Full Code Here

Examples of org.projectforge.web.wicket.components.DateTimePanel

    {
      final FieldsetPanel fieldset = gridBuilder.newFieldset(getString("search.periodOfModification"));
      fieldset.add(new HiddenInputPanel(fieldset.newChildId(), new HiddenField<Boolean>(InputPanel.WICKET_ID, new PropertyModel<Boolean>(
          searchFilter, "useModificationFilter"))).setHtmlId("useModificationFilter"));

      startDateTimePanel = new DateTimePanel(fieldset.newChildId(), new PropertyModel<Date>(searchFilter, "startTimeOfModification"),
          (DateTimePanelSettings) DateTimePanelSettings.get().withSelectProperty("startDateOfModification").withSelectPeriodMode(true),
          DatePrecision.MINUTE);
      fieldset.add(startDateTimePanel);
      fieldset.setLabelFor(startDateTimePanel);
      stopDateTimePanel = new DateTimePanel(fieldset.newChildId(), new PropertyModel<Date>(searchFilter, "stopTimeOfModification"),
          (DateTimePanelSettings) DateTimePanelSettings.get().withSelectProperty("stopDateOfModification").withSelectPeriodMode(true),
          DatePrecision.MINUTE);
      stopDateTimePanel.setRequired(false);
      fieldset.add(stopDateTimePanel);
      final HtmlCommentPanel comment = new HtmlCommentPanel(fieldset.newChildId(), new DatesAsUTCModel() {
View Full Code Here

Examples of org.projectforge.web.wicket.components.DateTimePanel

    startDateField = gridBuilder.newFieldset(getString("plugins.teamcal.event.beginDate"));
    startDateField.getFieldset().setOutputMarkupPlaceholderTag(true);
    startDateField.getFieldset().setOutputMarkupId(true);

    startDateField.getFieldset().setOutputMarkupId(true);
    startDateTimePanel = new DateTimePanel(startDateField.newChildId(), new PropertyModel<Date>(data, "startDate"),
        (DateTimePanelSettings) DateTimePanelSettings.get().withSelectStartStopTime(true).withTargetType(java.sql.Timestamp.class)
        .withRequired(true), DatePrecision.MINUTE_5);
    startDateTimePanel.getDateField().setOutputMarkupId(true);

    startDateField.add(startDateTimePanel);
    dateFieldToolTip(startDateTimePanel);
    dependentFormComponents[0] = startDateTimePanel;
    dependentFormComponents[1] = startDateTimePanel.getHourOfDayDropDownChoice();
    dependentFormComponents[2] = startDateTimePanel.getMinuteDropDownChoice();

    endDateField = gridBuilder.newFieldset(getString("plugins.teamcal.event.endDate"));
    endDateField.getFieldset().setOutputMarkupPlaceholderTag(true);
    endDateField.getFieldset().setOutputMarkupId(true);

    endDateField.getFieldset().setOutputMarkupId(true);
    endDateTimePanel = new DateTimePanel(endDateField.newChildId(), new PropertyModel<Date>(data, "endDate"),
        (DateTimePanelSettings) DateTimePanelSettings.get().withSelectStartStopTime(true).withTargetType(java.sql.Timestamp.class)
        .withRequired(true), DatePrecision.MINUTE_5);
    endDateTimePanel.getDateField().setOutputMarkupId(true);
    endDateTimePanel.getDateField().add(new AjaxFormComponentUpdatingBehavior("change") {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.