Package name.pehl.karaka.shared.model

Examples of name.pehl.karaka.shared.model.Activity


    }

    @Override
    public void onActivityChanged(ActivityChangedEvent event)
    {
        Activity activity = event.getActivity();
        ChangeAction action = event.getAction();
        switch (action)
        {
            case NEW:
                break;
            case RESUMED:
            case STARTED:
            case STOPPED:
                currentActivity = activity;
                break;
            case DELETE:
                if (activity.equals(currentActivity))
                {
                    currentActivity = null;
                }
                break;
            default:
View Full Code Here


    @Override
    public void onActivityAction(ActivityActionEvent event)
    {
        Action action = event.getAction();
        Activity activity = event.getActivity();
        switch (action)
        {
            case SAVE:
                save(activity);
                break;
            case COPY:
                copy(activity);
                break;
            case START_STOP:
                if (activity.isRunning())
                {
                    stop(activity);
                }
                else
                {
View Full Code Here

        dispatcher.execute(new SaveActivityAction(activityToSave), new KarakaCallback<SaveActivityResult>(eventBus)
        {
            @Override
            public void onSuccess(SaveActivityResult result)
            {
                Activity savedActivity = result.getSaved();
                info(activity, activityToSave + " successfully saved as " + savedActivity);
                activities.update(savedActivity);
                ActivityChangedEvent.fire(ActivityController.this, CHANGED, savedActivity, activities);
                ShowMessageEvent.fire(ActivityController.this,
                        new Message(INFO, "Activity \"" + savedActivity.getName() + "\" saved", true));
                checkAndrefreshProjectsAndTags(activityToSave);
            }
        });
    }
View Full Code Here

                new KarakaCallback<CopyActivityResult>(eventBus)
                {
                    @Override
                    public void onSuccess(CopyActivityResult result)
                    {
                        Activity copiedActivity = result.getCopy();
                        info(activity, activityToCopy + " successfully copied as " + copiedActivity);
                        activities.update(copiedActivity);
                        ActivityChangedEvent.fire(ActivityController.this, NEW, copiedActivity, activities);
                        ShowMessageEvent.fire(ActivityController.this,
                                new Message(INFO, "Activity \"" + copiedActivity.getName() + "\" added", true));
                    }
                });
    }
View Full Code Here

            dispatcher.execute(new StopActivityAction(activityToStop), new KarakaCallback<StopActivityResult>(eventBus)
            {
                @Override
                public void onSuccess(StopActivityResult result)
                {
                    Activity stoppedActivity = result.getStopped();
                    info(activity,
                            activityToStop + " successfully stopped as " + stoppedActivity);
                    activities.update(stoppedActivity);
                    ActivityChangedEvent.fire(ActivityController.this, STOPPED, stoppedActivity, activities);
                    ShowMessageEvent.fire(ActivityController.this,
                            new Message(INFO, "Activity \"" + stoppedActivity.getName() + "\" stopped", true));
                }
            });
        }
    }
View Full Code Here


    @UiHandler("save")
    void onSaveClicked(ClickEvent event)
    {
        Activity changedActivity = driver.flush();
        if (driver.hasErrors())
        {
            List<EditorError> errors = driver.getErrors();
            warn(activity, "There are errors: " + errors);
        }
        else if (driver.isDirty())
        {
            hide();
            if (getUiHandlers() != null)
            {
                changedActivity.setProject(currentProject);
                getUiHandlers().onSave(changedActivity);
            }
        }
    }
View Full Code Here

    }


    public Activity newActivity(DateTime start, DateTime end)
    {
        Activity activity = new Activity(UUID.randomUUID().toString(), "Test activity");
        if (start != null)
        {
            activity.setStart(newTime(start));
        }
        if (end != null)
        {
            activity.setEnd(newTime(end));
        }
        return activity;
    }
View Full Code Here

    }

    @Override
    protected Resource resourceFor(StartActivityAction action)
    {
        Activity activity = action.getActivity();
        UrlBuilder urlBuilder = new UrlBuilder().module("rest").path("activities");
        if (activity.isTransient())
        {
            urlBuilder.path("start");
        }
        else
        {
            urlBuilder = urlBuilder.path(activity.getId(), "start");
        }
        return new Resource(urlBuilder.toUrl());
    }
View Full Code Here

    @Override
    @SuppressWarnings("deprecation")
    public void onNewActivity()
    {
        // 1. Activity
        Activity activity = null;
        if (enteredActivity != null)
        {
            activity = new Activity(enteredActivity);
        }
        else if (selectedActivity != null)
        {
            activity = selectedActivity;
        }
        else
        {
            ShowMessageEvent.fire(this, new Message(SEVERE, "Please specify a name for the activity", true));
            return;
        }

        // 2. Project
        Project project = null;
        if (enteredProject != null)
        {
            project = new Project(enteredProject);
        }
        else if (selectedProject != null)
        {
            project = selectedProject;
        }
        activity.setProject(project);

        // 3. Duration
        if (enteredDuration == null || enteredDuration.isZero())
        {
            // Start the new activity
            ActivityActionEvent.fire(this, START_STOP, activity);
        }
        else
        {
            // Just store the new activity
            if (!activity.isTransient())
            {
                activity = activity.copy();
                activity.setProject(project);
            }
            // selectedDate must not be changed!
            Date now = new Date();
            Date start = selectedDate;
            if (start == null)
            {
                start = now;
            }
            else
            {
                start.setHours(now.getHours());
                start.setMinutes(now.getMinutes());
                start.setSeconds(now.getSeconds());
            }
            // This is the only valid use case to call
            // Activity.setMinutes(long) directly. On the server side it is
            // recognized that the activity is stopped and that there's a
            // init time, a value for minutes but no end time. In this case
            // the end time is calculated on the server
            activity.setStart(new Time(start));
            activity.setEnd(null);
            activity.setDuration(enteredDuration);
            ActivityActionEvent.fire(this, SAVE, activity);
        }
        getView().clear();
        reset();
    }
View Full Code Here

    }

    @Override
    protected Method methodFor(StartActivityAction action, Resource resource)
    {
        Activity activity = action.getActivity();
        Method method = new Method(resource, PUT.name()).header(HEADER_CONTENT_TYPE, CONTENT_TYPE_JSON);
        if (action.getActivity().isTransient())
        {
            method = method.text(activityWriter.toJson(activity));
        }
View Full Code Here

TOP

Related Classes of name.pehl.karaka.shared.model.Activity

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.