Example usage for org.joda.time LocalDate LocalDate

List of usage examples for org.joda.time LocalDate LocalDate

Introduction

In this page you can find the example usage for org.joda.time LocalDate LocalDate.

Prototype

public LocalDate() 

Source Link

Document

Constructs an instance set to the current local time evaluated using ISO chronology in the default zone.

Usage

From source file:com.einzig.ipst2.activities.PSDetailsActivity.java

License:Open Source License

/**
 * Create a File for saving an image// w  w  w  . j a  v  a  2  s. com
 */
private File getOutputMediaFile() {
    File mediaStorageDir = new File(Environment.getExternalStorageDirectory() + "/Android/data/"
            + getApplicationContext().getPackageName() + "/Files");
    if (!mediaStorageDir.exists()) {
        if (!mediaStorageDir.mkdirs()) {
            return null;
        }
    }
    String timeStamp = new SimpleDateFormat("ddMMyyyy_HHmm", Locale.getDefault())
            .format(new LocalDate().toDate());
    File mediaFile;
    String mImageName = "MI_" + timeStamp + ".jpg";
    mediaFile = new File(mediaStorageDir.getPath() + File.separator + mImageName);
    return mediaFile;
}

From source file:com.einzig.ipst2.activities.PSEditActivity.java

License:Open Source License

public void buildUI() {
    ThemeHelper.styleView(namebg_pseditactivity, this);
    updateDateButton(datesubbutton_pseditactivity, portal.getDateSubmitted().toString());
    ThemeHelper.styleView(datesubbg_pseditactivity, this);
    ThemeHelper.styleView(saveportalbuttonbg_pseditactivity, this);
    ThemeHelper.styleView(typespinnerlayout_pseditactivity, this);
    ThemeHelper.styleButton(datesubbutton_pseditactivity, this);
    ThemeHelper.styleButton(saveportalbutton_pseditactivity, this);

    String[] portalTypes = new String[] { "Pending", "Accepted", "Rejected" };
    typespinner_pseditactivity.setAdapter(ThemeHelper.styleSpinner(portalTypes, this));
    typespinner_pseditactivity.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
        @Override/*from ww w . ja v a  2  s  .c  om*/
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            portalrespondedlayout_pseditactivity.removeAllViews();
            switch (i) {
            case 0:
                portal = new PortalSubmission(portal.getName(), portal.getDateSubmitted(),
                        portal.getPictureURL());
                break;
            case 1:
                if (!(portal instanceof PortalAccepted)) {
                    portal = new PortalAccepted(portal.getName(), portal.getDateSubmitted(),
                            portal.getPictureURL(), new LocalDate(), "N/A", "N/A");
                }
                buildAcceptedUI();
                break;
            case 2:
                if (!(portal instanceof PortalRejected)) {
                    portal = new PortalRejected(portal.getName(), portal.getDateSubmitted(),
                            portal.getPictureURL(), new LocalDate(), "N/A");
                }
                buildRejectedUI();
                break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {

        }
    });
    if (portal instanceof PortalAccepted)
        typespinner_pseditactivity.setSelection(1);
    else if (portal instanceof PortalRejected)
        typespinner_pseditactivity.setSelection(2);
}

From source file:com.einzig.ipst2.database.DatabaseInterface.java

License:Open Source License

/**
 * Insert a PortalSubmission into the database
 *
 * @param portal The portal getting stored in the database
 *//*from  www  .ja  v  a  2 s.c  o  m*/
public void addPortalSubmission(PortalSubmission portal) {
    Logger.d("Add portal submission: " + portal.getName());
    if (portal.getDateSubmitted() == null)
        portal.setDateSubmitted(new LocalDate());
    String dateSubmitted = DATE_FORMATTER.print(portal.getDateSubmitted());
    ContentValues values = new ContentValues();
    // Values put!
    Logger.v("DBI#addPortalSubmission", "Name: " + portal.getName());
    values.put(COLUMN_NAME, portal.getName());
    values.put(COLUMN_DATE_SUBMITTED, dateSubmitted);
    Logger.v("DBI#addPortalSubmission", "Submitted: " + dateSubmitted);
    values.put(COLUMN_PICTURE_URL, portal.getPictureURL());
    addPortal(TABLE_PENDING, values);
}

From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.GanttExt.java

License:Open Source License

private void updateGanttDates() {
    if (minDate.isAfter(maxDate)) {
        minDate = new LocalDate();
        maxDate = new LocalDate();
    }//from   ww w  .  ja v  a2  s  . c o m
    this.setStartDate(minDate.minusDays(14).toDate());
    this.setEndDate(maxDate.plusDays(14).toDate());
}

From source file:com.esofthead.mycollab.module.project.view.assignments.gantt.GanttItemWrapper.java

License:Open Source License

public void setTask(AssignWithPredecessors task) {
    this.task = task;
    if (task.getStartDate() == null) {
        startDate = new LocalDate();
        task.setStartDate(startDate.toDate());
    } else {/*w ww .j  av  a 2  s .  c om*/
        startDate = new LocalDate(task.getStartDate());
    }

    if (task.getEndDate() == null) {
        endDate = new LocalDate();
        task.setEndDate(task.getEndDate());
    } else {
        endDate = new LocalDate(task.getEndDate());
    }

    buildAssociateStepIfNotExisted();
}

From source file:com.esofthead.mycollab.module.project.view.bug.BugCustomizeReportOutputWindow.java

License:Open Source License

@Override
protected Object[] buildSampleData() {
    return new Object[] { "Bug A", "Virtual Environment", OptionI18nEnum.BugPriority.Critical.name(),
            OptionI18nEnum.BugSeverity.Major.name(), OptionI18nEnum.BugStatus.Open.name(),
            OptionI18nEnum.BugResolution.None.name(), "John Adam",
            AppContext.formatDate(new LocalDate().minusDays(2).toDate()),
            AppContext.formatDate(new LocalDate().plusDays(1).toDate()),
            AppContext.formatDate(new LocalDate().plusDays(2).toDate()), "Will Smith", "Project Execution",
            "10", "2" };
}

From source file:com.esofthead.mycollab.module.project.view.bug.components.BugSavedFilterComboBox.java

License:Open Source License

public BugSavedFilterComboBox() {
    super(ProjectTypeConstants.BUG);

    SearchQueryInfo allBugsQuery = new SearchQueryInfo(ALL_BUGS, "All Bugs",
            SearchFieldInfo.inCollection(BugSearchCriteria.p_projectIds, new CurrentProjectIdInjector()));

    SearchQueryInfo allOpenBugsQuery = new SearchQueryInfo(OPEN_BUGS, "All Open Bugs",
            SearchFieldInfo.inCollection(BugSearchCriteria.p_status, ConstantValueInjector.valueOf(String.class,
                    Arrays.asList(BugStatus.Open.name(), BugStatus.ReOpen.name()))));

    SearchQueryInfo overdueTaskQuery = new SearchQueryInfo(OVERDUE_BUGS, "Overdue Bugs", new SearchFieldInfo(
            SearchField.AND, BugSearchCriteria.p_duedate, DateParam.BEFORE, new VariableInjector() {
                @Override/*w  ww  . j av  a 2  s . com*/
                public Object eval() {
                    return new LocalDate().toDate();
                }

                @Override
                public Class getType() {
                    return Date.class;
                }

                @Override
                public boolean isArray() {
                    return false;
                }

                @Override
                public boolean isCollection() {
                    return false;
                }
            }), new SearchFieldInfo(SearchField.AND, new StringParam("id-status", "m_tracker_bug", "status"),
                    StringParam.IS_NOT, ConstantValueInjector.valueOf(BugStatus.Verified.name())));

    SearchQueryInfo myBugsQuery = new SearchQueryInfo(MY_BUGS, "My Bugs", SearchFieldInfo.inCollection(
            BugSearchCriteria.p_assignee,
            ConstantValueInjector.valueOf(String.class, Collections.singletonList(AppContext.getUsername()))));

    SearchQueryInfo newBugsThisWeekQuery = new SearchQueryInfo(NEW_THIS_WEEK, "New This Week",
            SearchFieldInfo.inDateRange(BugSearchCriteria.p_createddate, VariableInjector.THIS_WEEK));

    SearchQueryInfo updateBugsThisWeekQuery = new SearchQueryInfo(UPDATE_THIS_WEEK, "Update This Week",
            SearchFieldInfo.inDateRange(BugSearchCriteria.p_lastupdatedtime, VariableInjector.THIS_WEEK));

    SearchQueryInfo newBugsLastWeekQuery = new SearchQueryInfo(NEW_LAST_WEEK, "New Last Week",
            SearchFieldInfo.inDateRange(BugSearchCriteria.p_createddate, VariableInjector.LAST_WEEK));

    SearchQueryInfo updateBugsLastWeekQuery = new SearchQueryInfo(UPDATE_LAST_WEEK, "Update Last Week",
            SearchFieldInfo.inDateRange(BugSearchCriteria.p_lastupdatedtime, VariableInjector.LAST_WEEK));

    SearchQueryInfo waitForApproveQuery = new SearchQueryInfo(WAITING_FOR_APPROVAL, "Waiting For Approval",
            SearchFieldInfo.inCollection(BugSearchCriteria.p_status,
                    ConstantValueInjector.valueOf(String.class, Arrays.asList(BugStatus.Resolved.name()))));

    this.addSharedSearchQueryInfo(allBugsQuery);
    this.addSharedSearchQueryInfo(allOpenBugsQuery);
    this.addSharedSearchQueryInfo(overdueTaskQuery);
    this.addSharedSearchQueryInfo(myBugsQuery);
    this.addSharedSearchQueryInfo(newBugsThisWeekQuery);
    this.addSharedSearchQueryInfo(updateBugsThisWeekQuery);
    this.addSharedSearchQueryInfo(newBugsLastWeekQuery);
    this.addSharedSearchQueryInfo(updateBugsLastWeekQuery);
    this.addSharedSearchQueryInfo(waitForApproveQuery);
}

From source file:com.esofthead.mycollab.module.project.view.milestone.MilestoneCustomizeReportOutputWindow.java

License:Open Source License

@Override
protected Object[] buildSampleData() {
    return new Object[] { "Milestone 1", AppContext.formatDate(new LocalDate().minusDays(30).toDate()),
            AppContext.formatDate(new LocalDate().plusDays(7).toDate()),
            AppContext.getMessage(OptionI18nEnum.MilestoneStatus.InProgress), "John Adam", "10", "2" };
}

From source file:com.esofthead.mycollab.module.project.view.task.components.TaskSavedFilterComboBox.java

License:Open Source License

public TaskSavedFilterComboBox() {
    super(ProjectTypeConstants.TASK);

    SearchQueryInfo allTasksQuery = new SearchQueryInfo(ALL_TASKS,
            AppContext.getMessage(TaskI18nEnum.VAL_ALL_TASKS),
            SearchFieldInfo.inCollection(TaskSearchCriteria.p_projectIds, new CurrentProjectIdInjector()));

    SearchQueryInfo allOpenTaskQuery = new SearchQueryInfo(OPEN_TASKS,
            AppContext.getMessage(TaskI18nEnum.VAL_ALL_OPEN_TASKS),
            SearchFieldInfo.inCollection(TaskSearchCriteria.p_status, new VariableInjector() {
                @Override//  w w  w .  ja va2  s. co  m
                public Object eval() {
                    OptionValService optionValService = AppContextUtil.getSpringBean(OptionValService.class);
                    List<OptionVal> options = optionValService.findOptionValsExcludeClosed(
                            ProjectTypeConstants.TASK, CurrentProjectVariables.getProjectId(),
                            AppContext.getAccountId());
                    List<String> statuses = new ArrayList<>();
                    for (OptionVal option : options) {
                        statuses.add(option.getTypeval());
                    }
                    return statuses;
                }

                @Override
                public Class getType() {
                    return String.class;
                }

                @Override
                public boolean isArray() {
                    return false;
                }

                @Override
                public boolean isCollection() {
                    return true;
                }
            }));

    SearchQueryInfo overdueTaskQuery = new SearchQueryInfo(OVERDUE_TASKS,
            AppContext.getMessage(TaskI18nEnum.VAL_OVERDUE_TASKS), new SearchFieldInfo(SearchField.AND,
                    TaskSearchCriteria.p_duedate, DateParam.BEFORE, new LazyValueInjector() {
                        @Override
                        protected Object doEval() {
                            return new LocalDate().toDate();
                        }
                    }),
            new SearchFieldInfo(SearchField.AND, new StringParam("id-status", "m_prj_task", "status"),
                    StringParam.IS_NOT,
                    ConstantValueInjector.valueOf(OptionI18nEnum.StatusI18nEnum.Closed.name())));

    SearchQueryInfo myTasksQuery = new SearchQueryInfo(MY_TASKS,
            AppContext.getMessage(TaskI18nEnum.VAL_MY_TASKS),
            SearchFieldInfo.inCollection(TaskSearchCriteria.p_assignee,
                    ConstantValueInjector.valueOf(Collections.singletonList(AppContext.getUsername()))));

    SearchQueryInfo newTasksThisWeekQuery = new SearchQueryInfo(NEW_TASKS_THIS_WEEK,
            AppContext.getMessage(TaskI18nEnum.VAL_NEW_THIS_WEEK),
            SearchFieldInfo.inDateRange(TaskSearchCriteria.p_createtime, VariableInjector.THIS_WEEK));

    SearchQueryInfo updateTasksThisWeekQuery = new SearchQueryInfo(UPDATE_TASKS_THIS_WEEK,
            AppContext.getMessage(TaskI18nEnum.VAL_UPDATE_THIS_WEEK),
            SearchFieldInfo.inDateRange(TaskSearchCriteria.p_lastupdatedtime, VariableInjector.THIS_WEEK));

    SearchQueryInfo newTasksLastWeekQuery = new SearchQueryInfo(NEW_TASKS_LAST_WEEK,
            AppContext.getMessage(TaskI18nEnum.VAL_NEW_LAST_WEEK),
            SearchFieldInfo.inDateRange(TaskSearchCriteria.p_createtime, VariableInjector.LAST_WEEK));

    SearchQueryInfo updateTasksLastWeekQuery = new SearchQueryInfo(UPDATE_TASKS_LAST_WEEK,
            AppContext.getMessage(TaskI18nEnum.VAL_UPDATE_LAST_WEEK),
            SearchFieldInfo.inDateRange(TaskSearchCriteria.p_lastupdatedtime, VariableInjector.LAST_WEEK));

    this.addSharedSearchQueryInfo(allTasksQuery);
    this.addSharedSearchQueryInfo(allOpenTaskQuery);
    this.addSharedSearchQueryInfo(overdueTaskQuery);
    this.addSharedSearchQueryInfo(myTasksQuery);
    this.addSharedSearchQueryInfo(newTasksThisWeekQuery);
    this.addSharedSearchQueryInfo(updateTasksThisWeekQuery);
    this.addSharedSearchQueryInfo(newTasksLastWeekQuery);
    this.addSharedSearchQueryInfo(updateTasksLastWeekQuery);
}

From source file:com.esofthead.mycollab.module.project.view.task.TaskCustomizeReportOutputWindow.java

License:Open Source License

@Override
protected Object[] buildSampleData() {
    return new Object[] { "Task A", "Note 1", AppContext.formatDate(new LocalDate().minusDays(2).toDate()),
            AppContext.formatDate(new LocalDate().plusDays(1).toDate()),
            AppContext.formatDate(new LocalDate().plusDays(1).toDate()),
            OptionI18nEnum.TaskPriority.High.name(), "50", "Will Smith", "Jonh Adam", "3", "1", "true",
            "Project Closing", "3", "2" };
}