Package org.joda.time

Examples of org.joda.time.DateTime$Property


      if ( level01.getDataItems()[i] instanceof ElementaryDataItem ) {
        ElementaryDataItem edi = (ElementaryDataItem)level01.getDataItems()[i];
        String attrName = edi.getDataName();
        DataField dataField = (DataField)edi.interpret();
        if (dataField != null) {
          Property attr = (Property)attrs.get(attrName);
          Type type = dataField.getType() == Integer.class ? integerType : stringType;
          if (attr == null) {
            String timestampFormat = "";
            String dateFormat = "";
            String length = "" + dataField.getLength();
            String fraction = "" + dataField.getFraction();
            System.out.println("INFO [jIvalo]  - Adding new attribute: " + attrName);
            Property newAttr = addAttribute(c, attrName, type, timestampFormat, dateFormat, length, fraction);
          }
          else {
            System.out.println("INFO [jIvalo]  - Updating new attribute: " + attrName);
            attr.setType(type);
            setTagValue(attr, "length", "" + dataField.getLength());
            setTagValue(attr, "fraction", "" + dataField.getFraction());
            attrs.remove(attrName);
          }
        }
      }
      else if ( level01.getDataItems()[i] instanceof GroupDataItem ) {
        GroupDataItem gdi = (GroupDataItem)level01.getDataItems()[i];
        String className = c.getName() + "_" + gdi.getDataName();
        Class cl = getClass(p, className);
        if (cl == null) {
          addClass(p, className);
          System.out.println("INFO [jIvalo] Added class: " + className);
          cl = getClass(p, className);
        }
        else {
          System.out.println("INFO [jIvalo] Updating existing class: " + className);
        }
       
        if (cl != null) {
          addAttributes(gdi, p, cl, model);
   
          Property newAttr = null;
          if ( level01.getDataItems()[i] instanceof GroupDataItemOccurs ) {
            GroupDataItemOccurs gdio = (GroupDataItemOccurs)level01.getDataItems()[i];
            newAttr = c.createOwnedAttribute(className,p.getOwnedType(cl.getName()),gdio.getOccurs(),gdio.getOccurs());
          }
          else {
            newAttr = c.createOwnedAttribute(className,p.getOwnedType(cl.getName()),1,1);
          }
          if (newAttr != null) {
            newAttr.setVisibility(VisibilityKind.PUBLIC_LITERAL);
            addStereotype(newAttr, jIvaloAttributeStereotype);
            setTagValue(newAttr, "timestampFormat", "");
            setTagValue(newAttr, "dateFormat", "");
            setTagValue(newAttr, "length", "0");
            setTagValue(newAttr, "fraction", "0");
View Full Code Here


    cobolResourceDir = Namespaces.instance().getNamespace(namespace).getProperty("cobolResourceDir").getValue();
    targetPackage = Namespaces.instance().getNamespace(namespace).getProperty("targetPackage").getValue();
   
    jIvaloPackage = getPackage(jIvaloPackageName, model);
    jIvaloClass = getClass(jIvaloPackage, jIvaloClassName);
    Property attribute1 = getAttribute(jIvaloClass, "string");
    stringType = attribute1.getType();
    Property attribute2 = getAttribute(jIvaloClass, "integer");
    integerType = attribute2.getType();

    jIvaloClassStereotype = getStereotype(jIvaloClass, jIvaloClassSteroetypeName);
    jIvaloAttributeStereotype = getStereotype(attribute1, jIvaloAttrSteroetypeName);

  }
View Full Code Here

    Repositories.instance().getImplementation(encoding).writeModel(element,
        outputLocation, xmiVersion);
  }

  private Property addAttribute(Class c, String name, Type type, String timestampFormat, String dateFormat, String length, String fraction) {
    Property p = c.createOwnedAttribute(name, type, 1, 1);
    p.setVisibility(VisibilityKind.PUBLIC_LITERAL);
    setTagValue(p, "timestampFormat", timestampFormat);
    setTagValue(p, "dateFormat", dateFormat);
    setTagValue(p, "length", length);
    setTagValue(p, "fraction", fraction);
    return p;
View Full Code Here

                // set 1/4h as one timeslot, now even half of an hour will be displayed
                settings.setMillisPerTimeslot(15 * 60 * 1000L);
                settings.setTimeslotsPerDay(4 * 8);

                settings.setStartDate(new DateTime(2009, 4, 6, 8, 0, 0, 0));
                TimeFinderPlanner planner = new TimeFinderPlanner(settings);

                // monday
                planner.addInterval(new IntervalLongImpl("Interval 1", 2009, 4, 6, 8, 30, 60));
                planner.addInterval(new IntervalLongImpl("Interval 2", 2009, 4, 6, 9, 0, 60));
View Full Code Here

                for (int y = 1; y < getHoursPerDay() + 1; y++) {
                    g2d.drawLine(0, y * hourWidth, xEnd, y * hourWidth);
                }

                RoundBox selectedBox = null;
                DateTime startDate = settings.getStartDate();
                // paint events
                for (IntervalLong interval : getCurrentIntervals()) {
                    long startMillisOffset = interval.getStart() - startDate.getMillis()
                            + startDate.getMillisOfDay();
                    int day = (int) (startMillisOffset / ICalendarSettings.DAY);

                    int duration_hourWidth = (int) (interval.getDuration() / settings.getMillisPerTimeslot()
                            * getHourFactor() * hourWidth);

                    int start_hourWidth = (int) ((startMillisOffset % CalendarSettings.DAY
                            - startDate.getMillisOfDay()) / ICalendarSettings.HOUR * hourWidth)
                            + (hourWidth * interval.getStartDateTime().getMinuteOfHour() / 60);

                    int numberOfConflicts = stepFunction.getMaxAssignments(interval);
                    int position = stepFunction.getOffset(interval);
                    int thickness = dayWidth / numberOfConflicts;
                    int offset = position * thickness;

                    Rectangle2D paintingRect = new Rectangle2D.Double(
                            day * dayWidth + offset, start_hourWidth,
                            thickness, duration_hourWidth);

                    String text = interval.getDescription();
                    if (text == null || text.length() == 0)
                        text = interval.getName();
                    RoundBox box = new RoundBox(text, numberOfConflicts);
                    box.setRect(paintingRect);

                    if (paintingRect.intersects(mousePositionX, mousePositionY, 1, 1)) {
                        selectedBox = box;
                        continue;
                    }

                    box.paintComponent(g2d);
                }

                // now paint a selected interval a bit larger *and* on the top of the other
                if (selectedBox != null) {
                    selectedBox.setTransparent(false);
                    selectedBox.zoom(g2d.getClip());
                    selectedBox.paintComponent(g2d);
                }
            }
        };

        final DateTimeFormatter fmt = new DateTimeFormatterBuilder().appendDayOfWeekText().
                appendLiteral(" - ").
                appendDayOfMonth(2).
                appendLiteral(". ").
                appendMonthOfYearText().toFormatter();

        columnHeader = new JPanel() {

            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);

                Shape oldClip = g.getClip();
                DateTime tempDateTime = settings.getStartDate();
                for (int x = 0; x < visibleDays; x++) {
                    g.setClip(new Rectangle2D.Double(x * dayWidth, 0,
                            dayWidth, columnHeaderHeight));
                    g.drawString(fmt.print(tempDateTime),
                            xTextOffset + x * dayWidth, yHeaderTextOffset);
                    tempDateTime = tempDateTime.plusDays(1);
                }
                g.setClip(oldClip);
            }
        };

        rowHeader = new JPanel() {

            @Override
            protected void paintComponent(Graphics g) {
                super.paintComponent(g);
                for (int y = 0; y < getHoursPerDay(); y++) {
                    g.drawString(String.format("%1$02d", y + getHourOffset()) + ":00",
                            xTextOffset, yHeaderTextOffset + y * hourWidth);
                }
            }
        };

        scroll = new JScrollPane();
        scroll.setRowHeaderView(rowHeader);

//        scroll.setCorner(ScrollPaneConstants.UPPER_LEFT_CORNER, new JLabel() {
//
//            @Override
//            public String getText() {
//                return "no:" + getCurrentIntervals().size();
//            }
//        });

        scroll.setColumnHeaderView(columnHeader);

        JPanel timeNorthPanel = new JPanel();
        calendarDateField = CalendarFactory.createDateField();
        calendarDateField.addChangeListener(new ChangeListener() {

            @Override
            public void stateChanged(ChangeEvent e) {
                // get the date only - not the time
                DateTime val = new DateTime(((Date) calendarDateField.getValue()).getTime());
                DateTime start = settings.getStartDate();
                setStartDate(start.withYear(val.getYear()).
                        withMonthOfYear(val.getMonthOfYear()).withDayOfMonth(val.getDayOfMonth()));
            }
        });
        timeNorthPanel.add(calendarDateField);
        timeNorthPanel.add(prevDaysButton = new SmallButton("<"));
View Full Code Here

        this(year, month, day, hour, minute, durationInMinutes);
        setDescription(description);
    }

    public IntervalLongImpl(int year, int month, int day, int hour, int minute, int durationInMinutes) {
        start = new DateTime(year, month, day, hour, minute, 0, 0).getMillis();
        setInterval(start, durationInMinutes * 60 * 1000);
    }
View Full Code Here

    public boolean isAssigned() {
        return assigned;
    }

    public DateTime getStartDateTime() {
        return new DateTime(start);
    }
View Full Code Here

    public DateTime getStartDateTime() {
        return new DateTime(start);
    }

    public DateTime getEndDateTime() {
        return new DateTime(start + duration);
    }
View Full Code Here

    }

    @Override
    protected void initDefault() {
        // set to the first monday in the current month
        setDefault("startDate", new DateTime().withDayOfMonth(1).weekOfWeekyear().roundCeilingCopy().
                plusHours(8));
        setDefault("milliSecondsPerTimeSlot", 1000 * 60 * 60L);
        setDefault("timeSlotsPerDay", 12);
        setDefault("numberOfDays", 5);
    }
View Full Code Here

        return settings.getStartDate().plusDays(startDayInt).plusMinutes(startMinutes);
    }
    public Log log = LogFactory.getLog(getClass());

    public IntervalInt toEvent(DateTime start, DateTime end) {
        DateTime settingsStartDate = settings.getStartDate();
        int startSlot = (int) ((start.getMillisOfDay()
                - settingsStartDate.getMillisOfDay()) / settings.getMillisPerTimeslot());
        if (startSlot < 0) {
            log.fatal("Cannot convert DateTimes - start would be negative: " + startSlot + " start=" + start + " end=" + end);
            return null;
        }
        if (startSlot >= settings.getTimeslotsPerDay()) {
            log.fatal("Cannot convert DateTimes - start would be too big: " + startSlot + " start=" + start + " end=" + end);
            return null;
        }

        int days = (int) ((start.getMillis()
                - (settingsStartDate.getMillis() - settingsStartDate.getMillisOfDay()))
                / ICalendarSettings.DAY);
        if (days < 0) {
            log.fatal("Cannot convert DateTimes - start would have negative day: " + days + " start=" + start + " end=" + end);
            return null;
        }
View Full Code Here

TOP

Related Classes of org.joda.time.DateTime$Property

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.