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.esofthead.mycollab.module.project.view.user.ProjectUnresolvedAssignmentWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsThisWeek() {
    title = AppContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_ASSIGNMENT_THIS_WEEK);
    searchCriteria = new ProjectGenericTaskSearchCriteria();
    searchCriteria.setIsOpenned(new SearchField());
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    LocalDate now = new LocalDate();
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();/*from w w w .ja  v a  2 s.  co m*/
}

From source file:com.esofthead.mycollab.module.project.view.user.ProjectUnresolvedAssignmentWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsNextWeek() {
    title = AppContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_ASSIGNMENT_NEXT_WEEK);
    searchCriteria = new ProjectGenericTaskSearchCriteria();
    searchCriteria.setIsOpenned(new SearchField());
    searchCriteria.setProjectIds(new SetSearchField<>(CurrentProjectVariables.getProjectId()));
    LocalDate now = new LocalDate();
    now = now.plusDays(7);/*w w  w.j  av  a  2s . c o  m*/
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();
}

From source file:com.esofthead.mycollab.module.project.view.user.UserUnresolvedAssignmentWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsThisWeek() {
    title = AppContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_ASSIGNMENT_THIS_WEEK);
    searchCriteria = new ProjectGenericTaskSearchCriteria();
    searchCriteria.setIsOpenned(new SearchField());
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    LocalDate now = new LocalDate();
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();//w  w w.  ja  v  a  2s  . com
}

From source file:com.esofthead.mycollab.module.project.view.user.UserUnresolvedAssignmentWidget.java

License:Open Source License

public void displayUnresolvedAssignmentsNextWeek() {
    title = AppContext.getMessage(ProjectI18nEnum.OPT_UNRESOLVED_ASSIGNMENT_NEXT_WEEK);
    searchCriteria = new ProjectGenericTaskSearchCriteria();
    UserDashboardView userDashboardView = UIUtils.getRoot(this, UserDashboardView.class);
    searchCriteria.setIsOpenned(new SearchField());
    searchCriteria.setProjectIds(new SetSearchField<>(userDashboardView.getInvolvedProjectKeys()));
    LocalDate now = new LocalDate();
    now = now.plusDays(7);/*from  w  ww.j  a  va  2  s  . com*/
    Date[] bounceDateOfWeek = DateTimeUtils.getBounceDatesOfWeek(now.toDate());
    RangeDateSearchField range = new RangeDateSearchField(bounceDateOfWeek[0], bounceDateOfWeek[1]);
    searchCriteria.setDateInRange(range);
    updateSearchResult();
}

From source file:com.esofthead.mycollab.servlet.SetupServlet.java

License:Open Source License

protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);

    Configuration configuration = SiteConfiguration.freemarkerConfiguration();
    Map<String, Object> context = new HashMap<>();

    String postUrl = "/install";
    context.put("postUrl", postUrl);

    Map<String, String> defaultUrls = new HashMap<>();
    defaultUrls.put("cdn_url", "/assets/");
    defaultUrls.put("app_url", "/");
    defaultUrls.put("facebook_url", "https://www.facebook.com/mycollab2");
    defaultUrls.put("google_url", "https://plus.google.com/u/0/b/112053350736358775306/+Mycollab/about/p/pub");
    defaultUrls.put("twitter_url", "https://twitter.com/mycollabdotcom");
    context.put("defaultUrls", defaultUrls);
    context.put("current_year", new LocalDate().getYear());

    StringWriter writer = new StringWriter();
    Template template = configuration.getTemplate("pageSetupFresh.ftl");
    try {/* w  w  w. j  a  v  a  2s .c  o m*/
        template.process(context, writer);
    } catch (TemplateException e) {
        throw new IOException(e);
    }

    PrintWriter out = response.getWriter();
    out.print(writer.toString());
}

From source file:com.esofthead.mycollab.servlet.UpgradeServlet.java

License:Open Source License

protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
    response.setContentType("text/html");
    response.setStatus(HttpServletResponse.SC_OK);

    Configuration configuration = SiteConfiguration.freemarkerConfiguration();

    Template template = ServerInstance.getInstance().isUpgrading()
            ? configuration.getTemplate("pageWaitingUpgrade.ftl")
            : configuration.getTemplate("pageNoUpgrade.ftl");

    Map<String, Object> context = new HashMap<>();
    Map<String, String> defaultUrls = SiteConfiguration.defaultUrls();
    defaultUrls.put("cdn_url", "/assets/");
    defaultUrls.put("app_url", "/");

    context.put("current_year", new LocalDate().getYear());
    context.put("defaultUrls", defaultUrls);

    StringWriter writer = new StringWriter();
    try {/*  w  ww  .  java2 s . co  m*/
        template.process(context, writer);
    } catch (TemplateException e) {
        throw new IOException(e);
    }
    PrintWriter out = response.getWriter();
    out.print(writer.toString());
}

From source file:com.esofthead.mycollab.shell.view.MainViewImpl.java

License:Open Source License

private ComponentContainer createFooter() {
    MHorizontalLayout footer = new MHorizontalLayout().withFullWidth()
            .withMargin(new MarginInfo(false, true, false, true));
    footer.setStyleName("footer");
    footer.setHeight("30px");

    Div companyInfoDiv = new Div().appendText("Powered by ")
            .appendChild(new A("https://www.mycollab.com", "_blank").appendText("MyCollab"))
            .appendText(" &copy; " + new LocalDate().getYear());
    ELabel companyInfoLbl = new ELabel(companyInfoDiv.write(), ContentMode.HTML).withWidth("-1px");
    footer.with(companyInfoLbl).withAlign(companyInfoLbl, Alignment.MIDDLE_LEFT);

    Div socialLinksDiv = new Div().appendText(FontAwesome.RSS.getHtml())
            .appendChild(new A("https://www.mycollab.com/blog", "_blank").appendText(" Blog"))
            .appendText("  " + FontAwesome.REPLY_ALL.getHtml())
            .appendChild(new A("http://support.mycollab.com", "_blank").appendText(" Support"));

    if (SiteConfiguration.isCommunityEdition()) {
        socialLinksDiv.appendText("  " + FontAwesome.THUMBS_O_UP.getHtml())
                .appendChild(new A("http://sourceforge.net/projects/mycollab/reviews/new", "_blank")
                        .appendText("" + " Rate us"));
    }/*from www.  j ava  2 s  . c om*/

    socialLinksDiv.appendText("  " + FontAwesome.FACEBOOK.getHtml())
            .appendChild(new A("https://www.facebook.com/mycollab2", "_blank").appendText(" FB page"));
    socialLinksDiv.appendText("  " + FontAwesome.TWITTER.getHtml())
            .appendChild(new A(
                    "https://twitter.com/intent/tweet?text=I am using MyCollab to manage all project "
                            + "activities, accounts and it works great @mycollabdotcom &source=webclient",
                    "_blank").appendText(" Tweet"));

    ELabel socialsLbl = new ELabel(socialLinksDiv.write(), ContentMode.HTML).withWidth("-1px");
    footer.with(socialsLbl).withAlign(socialsLbl, Alignment.MIDDLE_RIGHT);
    return footer;
}

From source file:com.excilys.sugadroid.activities.AppointmentsActivity.java

License:Open Source License

@Override
public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setContentView(R.layout.appointments);

    findViews();// w  w  w.j  ava2 s. com
    setListeners();
    setTasks();

    calendar = (EagerLoadingCalendar) getIntent().getSerializableExtra(CALENDAR);

    currentDay = new LocalDate();

    pageFlipper.setInAnimation(AnimationUtils.loadAnimation(this, android.R.anim.slide_in_left));
    pageFlipper.setOutAnimation(AnimationUtils.loadAnimation(this, android.R.anim.slide_out_right));

    views = new ArrayList<View>();

    for (int i = 0; i < 3; i++) {
        views.add(View.inflate(this, R.layout.appointments_page, null));
    }

    for (View view : views) {
        pageFlipper.addView(view);
        initFlippingView(view);
    }

    setDayTextView(currentDay);

    fillFlippingView(pageFlipper.getCurrentView(), currentDay);
}

From source file:com.excilys.sugadroid.activities.AppointmentsActivity.java

License:Open Source License

private void setDayTextView(LocalDate day) {
    String dayString;/*from  w  w  w.  ja v a  2  s  . c o  m*/
    if (day.equals(new LocalDate())) {
        dayString = getString(R.string.today) + " " + day.toString(getString(R.string.day_date_format));
    } else {
        dayString = day.toString(getString(R.string.day_date_format));
    }

    currentDayText.setText(dayString);
}

From source file:com.excilys.sugadroid.tasks.GetInitialCalendarTask.java

License:Open Source License

@Override
public void doRunAuthenticatedTask() throws ServiceException {

    Map<LocalDate, List<IAppointmentBean>> initialDaysAppointments;

    LocalDate today = new LocalDate();
    LocalDate before = today.minusDays(appointmentsLoadingBefore);
    LocalDate after = today.plusDays(appointmentsLoadingAfter);

    initialDaysAppointments = appointmentServices.getAppointmentsInInterval(before, after);

    EagerLoadingCalendar calendar = new EagerLoadingCalendar(before, after, initialDaysAppointments);

    activity.onInitialCalendarLoaded(calendar);

}