Package de.timefinder.core.ui.metadata

Examples of de.timefinder.core.ui.metadata.DualEventDescriptor


    @Override
    protected void doOnce() {
        ViewDescriptorRegistry viewDescriptorRegistry = (ViewDescriptorRegistry) ApplicationServicesLocator.services().getService(ViewDescriptorRegistry.class);

        final DualEventDescriptor view = (DualEventDescriptor) viewDescriptorRegistry.getViewDescriptor("dualEventView");
        final List<DualEvent> eventsList = view.getDualEvents();
        final Dao<Event> dao = view.getDao();
        final StatusBar bar = getApplicationWindow().getStatusBar();

        bar.getProgressMonitor().taskStarted(tr.get(ID + ".startTask"), 100);
        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
                double delta = 90.0 / dao.getAll().size();
                double counter = 1;
                for (Event a : dao.getAll()) {
                    bar.getProgressMonitor().worked((int) counter);
                    counter += delta;
                    if (!firstEvent(a))
                        continue;

                    for (Event b : dao.getAll()) {
                        if (a == b || !firstEvent(b))
                            continue;

                        eventsList.add(new DualEvent(a, b));
                    }
                }
                logger.info("Read dual events:" + eventsList.size());
            }

            private boolean firstEvent(Event ev) {
                DifferentDayConstraint constr = ev.getConstraint(DifferentDayConstraint.class);
                if (constr != null) {
                    // only one event of the event group
                    if (constr.getEvents().size() > 0
                            && ev == constr.getEvents().iterator().next())
                        return true;
                }
                return false;
            }

            @Override
            protected void done() {
                bar.getProgressMonitor().worked(95);
                view.createShowViewCommand(getApplicationWindow()).execute();
                super.done();
            }
        };

        sw.execute();
View Full Code Here

TOP

Related Classes of de.timefinder.core.ui.metadata.DualEventDescriptor

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.