Package de.timefinder.data

Examples of de.timefinder.data.DataPool


    private TimeFinderPlanner planner;

    @Override
    public CollectionMasterDetailForm<Location> createForm(Dao<Location> dao, String[] columns) {
        final DataPool pool = ((PoolDescriptor) getDescriptor()).getDataPool();
        return new CollectionMasterDetailForm<Location>(dao, columns) {

            @Override
            protected void printAction(Iterator<Location> iter) {
                HtmlPlannerComponent.printResources(iter, settings);
            }

            @Override
            protected AbstractDetailForm createDetailForm(HierarchicalFormModel parentFormModel,
                    ValueModel valueHolder, ObservableList masterList) {
                AbstractDaoForm objForm = new LocationForm(parentFormModel,
                        "locationDetails", valueHolder, masterList) {

                    @Override
                    protected void addTabs() {
                        TimeFinderPlannerBindingFactory factory = (TimeFinderPlannerBindingFactory) getBindingFactory();
                        TableFormBuilder fBuilder = createTab(getMessage("features.label"));

                        final Dao<Feature> featureDao = pool.getDao(Feature.class);
                        final ValueHolder featureHolder = new ValueHolder(new ArrayList<Feature>(featureDao.getAll()));
                        ShuttleList sl = (ShuttleList) fBuilder.add(
                                factory.createBoundShuttleList("features", featureHolder, null))[1];
                        sl.setVisibleRowCount(10);
View Full Code Here


    private TimeFinderPlanner planner;

    @Override
    public CollectionMasterDetailForm<Person> createForm(Dao<Person> dao, String[] columns) {
        final DataPool pool = ((PoolDescriptor) getDescriptor()).getDataPool();
        return new CollectionMasterDetailForm<Person>(dao, columns) {

            @Override
            protected void printAction(Iterator<Person> iter) {
                HtmlPlannerComponent.printResources(iter, settings);
            }

            @Override
            protected AbstractDetailForm createDetailForm(HierarchicalFormModel parentFormModel,
                    ValueModel valueHolder, ObservableList masterList) {
                AbstractDaoForm objForm = new PersonForm(parentFormModel,
                        "personDetails", valueHolder, masterList) {

                    @Override
                    protected void addTabs() {
                        TimeFinderPlannerBindingFactory factory = (TimeFinderPlannerBindingFactory) getBindingFactory();
                        // warning: the methods person.set + getEvents is necessary!
                        TableFormBuilder builder = createTab(getMessage("events.label"));

                        final Dao<Event> eventDao = pool.getDao(Event.class);
                        final ValueHolder eventsHolder = new ValueHolder(
                                new ArrayList<Event>(eventDao.getAll()));

                        // TODO SPRING RC the problem of "name" instead null is that duplicate names will be removed!!!
                        ShuttleList sl = (ShuttleList) builder.add(factory.createBoundShuttleList("events", eventsHolder, null))[1];
View Full Code Here

*/
public class EventMasterDetailView extends TimeFinderMasterDetailView<Event> {

    @Override
    public CollectionMasterDetailForm<Event> createForm(Dao<Event> dao, String[] columns) {
        final DataPool pool = ((PoolDescriptor) getDescriptor()).getDataPool();
        return new CollectionMasterDetailForm<Event>(dao, columns) {

            @Override
            protected void printAction(Iterator<Event> iter) {
                final List<Event> events = new ArrayList<Event>();

                while (iter.hasNext()) {
                    events.add(iter.next());
                }

                Iterator<? extends Resource> resIter = Arrays.asList(new Resource() {

                    @Override
                    public Collection<Event> getEvents() {
                        return events;
                    }

                    @Override
                    public void addEvent(Event ev, boolean reverseAdd) {
                        throw new UnsupportedOperationException("Not supported yet.");
                    }

                    @Override
                    public boolean removeEvent(Event ev, boolean reverseRemove) {
                        throw new UnsupportedOperationException("Not supported yet.");
                    }

                    @Override
                    public String getName() {
                        return "Master Plan";
                    }

                    @Override
                    public void setName(String name) {
                        throw new UnsupportedOperationException("Not supported yet.");
                    }
                }).iterator();

                HtmlPlannerComponent.printResources(resIter, settings);
            }
           
            private EventForm objForm;

            @Override
            protected AbstractDetailForm createDetailForm(HierarchicalFormModel parentFormModel,
                    ValueModel valueHolder, ObservableList masterList) {
                objForm = new EventForm(parentFormModel,
                        "eventsDetails", valueHolder, masterList) {

                    @Override
                    protected void addTabs() {
                        SwingBindingFactory factory = (SwingBindingFactory) getBindingFactory();

                        getFormBuilder().add(factory.createBoundComboBox(
                                "location", pool.getDao(Location.class).getAll(), "name"));

                        TableFormBuilder builder = createTab(getMessage("persons.label"));

                        final Dao<Person> personDao = pool.getDao(Person.class);

                        /****************************************************************
                         * WARNING: it is important to wrap the (person) collection in
                         * another one (here ArrayList). Otherwise the changes
                         * to the dao will have direct effect to the value in ValueHolder
                         * and newValue.equals(oldValue) == true for every change!
                         ****************************************************************/
                        final ValueHolder personHolder = new ValueHolder(new ArrayList<Person>(personDao.getAll()));
                        //1. persons => Event.set and getPersons are necessary
                        //2. personDao.getAll() => all available persons
                        //3. name => prints the name as one list item
                        ShuttleList sl = (ShuttleList) builder.add(
                                factory.createBoundShuttleList("persons",
                                personHolder, "name"))[1];
                        sl.setVisibleRowCount(10);

                        TableFormBuilder fBuilder = createTab(getMessage("features.label"));
                        final Dao<Feature> featureDao = pool.getDao(Feature.class);
                        final ValueHolder featureHolder = new ValueHolder(new ArrayList<Feature>(featureDao.getAll()));
                        sl = (ShuttleList) fBuilder.add(factory.createBoundShuttleList("features",
                                featureHolder, null))[1];
                        sl.setVisibleRowCount(10);

View Full Code Here

        EventDao eDao = new EventDaoSimpl();
        PersonDao pDao = new PersonDaoSimpl();
        LocationDao lDao = new LocationDaoSimpl();
        FeatureDao fDao = new FeatureDaoSimpl();
        DataPool dataPool = new DataPoolImpl();
        dataPool.setDao(eDao);
        dataPool.setDao(fDao);
        dataPool.setDao(pDao);
        dataPool.setDao(lDao);

        // 1 hour
        DataPoolSettings settings = new DataPoolSettings();
        settings.setMillisPerTimeslot(60 * 60 * 1000L);
        settings.setNumberOfDays(5);
View Full Code Here

TOP

Related Classes of de.timefinder.data.DataPool

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.