Package org.freeplane.features.format

Examples of org.freeplane.features.format.FormattedDate


        conditionValue = (FormattedNumber)value;
        return;
    }
       
    if(value instanceof FormattedDate){
      final FormattedDate date = (FormattedDate) value;
      if(date.containsTime() ||
          date.getHours() == 0 && date.getMinutes() == 0 && date.getSeconds() == 0) {
        conditionValue = date;
            }
            else{
                final Date reducedDate = new Date(date.getYear(), date.getMonth(), date.getDate());
                 conditionValue = new FormattedDate(reducedDate.getTime(), date.getDateFormat());
      }
      return;
    }
    conditionValue = value.toString();
   
View Full Code Here


    super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    if (value instanceof String) {
      setIcon(FrameController.textIcon);
    }
    else if (value instanceof FormattedDate) {
      final FormattedDate fd = (FormattedDate) value;
      if (fd.containsTime())
        setIcon(FrameController.dateTimeIcon);
      else
        setIcon(FrameController.dateIcon);
    }
    else if (value instanceof URI) {
View Full Code Here

  public ASelectableCondition loadCondition(final XMLElement element) {
    try {
      if (element.getName().equalsIgnoreCase(TimeConditionCreatedBefore.NAME)) {
        final String dateString = element.getAttribute(TimeCondition.DATE, null);
        FormattedDate date  = FormattedDate.createDefaultFormattedDate(Long.parseLong(dateString), IFormattedObject.TYPE_DATETIME);
        return new TimeConditionCreatedBefore(date);
      }
      if (element.getName().equalsIgnoreCase(TimeConditionCreatedAfter.NAME)) {
        final String dateString = element.getAttribute(TimeCondition.DATE, null);
        FormattedDate date  = FormattedDate.createDefaultFormattedDate(Long.parseLong(dateString), IFormattedObject.TYPE_DATETIME);
        return new TimeConditionCreatedAfter(date);
      }
      if (element.getName().equalsIgnoreCase(TimeConditionModifiedBefore.NAME)) {
        final String dateString = element.getAttribute(TimeCondition.DATE, null);
        FormattedDate date  = FormattedDate.createDefaultFormattedDate(Long.parseLong(dateString), IFormattedObject.TYPE_DATETIME);
        return new TimeConditionModifiedBefore(date);
      }
      if (element.getName().equalsIgnoreCase(TimeConditionModifiedAfter.NAME)) {
        final String dateString = element.getAttribute(TimeCondition.DATE, null);
        FormattedDate date  = FormattedDate.createDefaultFormattedDate(Long.parseLong(dateString), IFormattedObject.TYPE_DATETIME);
        return new TimeConditionModifiedAfter(date);
      }
    }
    catch (final Exception e) {
      LogUtils.severe(e);
View Full Code Here

    }
    if (value instanceof String || value instanceof StyleNamedObject) {
      addStatusInfo(ResourceController.OBJECT_TYPE, null, FrameController.textIcon);
    }
    else if (value instanceof FormattedDate) {
      final FormattedDate fd = (FormattedDate) value;
      if (fd.containsTime()) {
        addStatusInfo(ResourceController.OBJECT_TYPE, null, FrameController.dateTimeIcon);
      }
      else {
        addStatusInfo(ResourceController.OBJECT_TYPE, null, FrameController.dateIcon);
      }
View Full Code Here

    assertEquals("failure in deserialization", formattedObject, FormattedObject.deserialize(serialized));
  }
 
  @Test
  public void testStrangeInput() {
    final FormattedDate date = new FormattedDate(new Date(), "yyyy-mm-dd");
    final FormattedObject formattedObject = new FormattedObject(date, "#.##");
    assertEquals("decimal format is not applicable to date", date.toString(), formattedObject.toString());
  }
View Full Code Here

    this.date = (FormattedDate) date;
    showEditorBtn.setText(date == null ? "" : date.toString());
  }

  private void updateDate() {
    final FormattedDate newDate = new FormattedDate(calenderComponent.getDate(),
      calenderComponent.isTimeVisible() ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd");
        final String type = newDate.containsTime() ? IFormattedObject.TYPE_DATETIME : IFormattedObject.TYPE_DATE;
        date = FormattedDate.createDefaultFormattedDate(newDate.getTime(), type);
   
      if (actionListeners.size() == 0) {
        return;
      }
      final ActionEvent actionEvent = new ActionEvent(this, 0, null);
View Full Code Here

    dialog = null;
    TimeManagement.sCurrentlyOpenTimeManagement = null;
  }

  private FormattedDate getCalendarDate() {
    return new FormattedDate(calendar.getTime(), dateFormat.getPattern());
  }
View Full Code Here

          final int[] selectedColumns = table.getSelectedColumns();
          for(int r : selectedRows)
            for(int c : selectedColumns){
              Object date = table.getValueAt(r, c);
              if(date instanceof FormattedDate){
                final FormattedDate fd = (FormattedDate) date;
                if(! fd.getDateFormat().equals(dateFormat)){
                  table.setValueAt(new FormattedDate(fd, dateFormat.getPattern()), r, c);
                }
              }
            }
        }
        else{
          ModeController mController = Controller.getCurrentModeController();
          for (final NodeModel node : mController.getMapController().getSelectedNodes()) {
            final MTextController textController = (MTextController) TextController.getController();
            Object date = node.getUserObject();
            if(date instanceof FormattedDate){
              final FormattedDate fd = (FormattedDate) date;
              if(! fd.getDateFormat().equals(dateFormat)){
                textController.setNodeObject(node, new FormattedDate(fd, dateFormat.getPattern()));
              }
            }
          }
        }
View Full Code Here

    dateFormatChooser.setAlignmentX(Component.LEFT_ALIGNMENT);
    return dateFormatChooser;
  }

  void insertTime(final Dialog dialog, final JButton appendButton) {
      FormattedDate date = getCalendarDate();
      final String dateAsString = dateFormat.formatObject(date).toString();
      final Window parentWindow;
      if (dialog != null) {
        parentWindow = (Window) dialog.getParent();
      }
View Full Code Here

      if (element.getName().equalsIgnoreCase(ReminderConditionExecuted.NAME)) {
        return new ReminderConditionExecuted();
      }
      if (element.getName().equalsIgnoreCase(ReminderConditionBefore.NAME)) {
        final String dateString = element.getAttribute(ReminderCondition.DATE, null);
        final FormattedDate date = FormattedDate.createDefaultFormattedDate(Long.parseLong(dateString), IFormattedObject.TYPE_DATETIME);
        return new ReminderConditionBefore(date);
      }
      if (element.getName().equalsIgnoreCase(ReminderConditionAfter.NAME)) {
        final String dateString = element.getAttribute(ReminderCondition.DATE, null);
        final FormattedDate date = FormattedDate.createDefaultFormattedDate(Long.parseLong(dateString), IFormattedObject.TYPE_DATETIME);
        return new ReminderConditionAfter(date);
      }
    }
    catch (final Exception e) {
      LogUtils.severe(e);
View Full Code Here

TOP

Related Classes of org.freeplane.features.format.FormattedDate

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.