Package org.springframework.richclient.progress

Examples of org.springframework.richclient.progress.ProgressMonitor


        if (ret != JOptionPane.OK_OPTION)
            return;

        ApplicationWindow aw = getApplicationWindow();
        final StatusBar bar = aw.getStatusBar();
        ProgressMonitor pm = bar.getProgressMonitor();

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int res = fc.showOpenDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }

        file = fc.getSelectedFile();
        if (!file.isDirectory()) {
            int resultOP = JOptionPane.showConfirmDialog(null, tr.get(ID + ".confirmation.message"),
                    tr.get(ID + ".confirmation.title"), JOptionPane.OK_CANCEL_OPTION);
            if (resultOP != JOptionPane.OK_OPTION) {
                return;
            }
        }
        pm.taskStarted(tr.get(ID + ".startTask"), 100);
        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
                bar.getProgressMonitor().worked(10);
View Full Code Here


     */
    private ApplicationContext loadRootApplicationContext(String[] configLocations, MessageSource messageSource) {
        final ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext(configLocations, false);

        if (splashScreen instanceof MonitoringSplashScreen) {
            final ProgressMonitor tracker = ((MonitoringSplashScreen) splashScreen).getProgressMonitor();

            applicationContext.addBeanFactoryPostProcessor(
                    new ProgressMonitoringBeanFactoryPostProcessor(tracker, messageSource));

        }
View Full Code Here

        checkIfDataIsAlreadyAvailable();
        closeAllViews();

        ApplicationWindow aw = getApplicationWindow();
        final StatusBar bar = aw.getStatusBar();
        final ProgressMonitor pm = bar.getProgressMonitor();

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int res = fc.showOpenDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }
        file = fc.getSelectedFile();
        if (!file.isDirectory()) {
            int resultOP = JOptionPane.showConfirmDialog(null, tr.get(ID + ".confirmation.message"),
                    tr.get(ID + ".confirmation.title"), JOptionPane.OK_CANCEL_OPTION);
            if (resultOP != JOptionPane.OK_OPTION) {
                return;
            }
        }
        pm.taskStarted(tr.get(ID + ".startTask"), 100);

        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
View Full Code Here

        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
                StatusBar bar = getApplicationWindow().getStatusBar();
                ProgressMonitor pm = bar.getProgressMonitor();

                int resultDownload = JOptionPane.showConfirmDialog(null, tr.get(ID + ".downloadQuestion"),
                        tr.get(ID + ".downloadQuestion"), JOptionPane.YES_NO_OPTION);
                if (resultDownload == JOptionPane.YES_OPTION) {
                    String str = "http://peat_hal.users.sourceforge.net/sessions_catalog.j1";
                    bar.setMessage(tr.get("downloadFrom", str));
                    istream = new UrlResource(str).getInputStream();
                    pm.worked(5);
                    bar.setMessage("");
                }

                pm.taskStarted(tr.get(ID + ".startTask"), -1);
                pm.worked(10);

                ImportJavaOne importer = new ImportJavaOne();
                ImportJavaOne.overwriteSettings(settings);
                FastMap<String, Person> persons = new FastMap<String, Person>();
                // TODO update progres:
                Collection<JavaOneInterval> coll = importer.parse(istream);
                double tmp = 80.0 / (coll.size() + 1);
                int counter = 0;
                Dao<Event> eDao = dataPool.getDao(Event.class);
                for (JavaOneInterval ev : coll) {
                    pm.worked(10 + (int) (counter * tmp));
                    counter++;
                    Event event = eDao.create();
                    if (ev.getStart() >= 0 && ev.getDuration() > 0) {
                        IntervalInt si = settings.toInterval(ev.getStartDateTime(), ev.getEndDateTime());
                        if (si != null)
                            event.setInterval(si.getStart(), si.getDuration());
                    }
                    event.setName(ev.getId());
                    event.setDescription(ev.getDescription());
                    if (ev.getSpeakers() != null) {
                        for (String str : ev.getSpeakers().split(";")) {
                            str = str.trim();
                            Person p = persons.get(str);
                            if (p == null) {
                                p = new Person();
                                p.setName(str);
                                persons.put(str, p);
                            }
                            p.addEvent(event, Role.TEACHER, true);
                        }
                    }
                    eDao.attach(event);
                }
                pm.worked(90);
                dataPool.getDao(Person.class).attachAll(persons.values());
                pm.worked(100);
            }

            @Override
            protected void done() {
                openAllViews();
View Full Code Here

        checkIfDataIsAlreadyAvailable();
        closeAllViews();

        ApplicationWindow aw = getApplicationWindow();
        final StatusBar bar = aw.getStatusBar();
        final ProgressMonitor pm = bar.getProgressMonitor();

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
        int res = fc.showOpenDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }
        file = fc.getSelectedFile();
        if (!file.isDirectory()) {
            int resultOP = JOptionPane.showConfirmDialog(null, tr.get(ID + ".confirmation.message"),
                    tr.get(ID + ".confirmation.title"), JOptionPane.OK_CANCEL_OPTION);
            if (resultOP != JOptionPane.OK_OPTION) {
                return;
            }
        }
        pm.taskStarted(tr.get(ID + ".startTask"), 100);
        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
                bar.getProgressMonitor().worked(10);
View Full Code Here

     */
    @Override
    protected void doOnce() {
        ApplicationWindow aw = getApplicationWindow();
        final StatusBar bar = aw.getStatusBar();
        ProgressMonitor pm = bar.getProgressMonitor();

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        int res = fc.showSaveDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }
        final File f = fc.getSelectedFile();

        pm.taskStarted(tr.get(ID + ".startTask"), -1);

        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
View Full Code Here

        checkIfDataIsAlreadyAvailable();
        closeAllViews();

        ApplicationWindow aw = getApplicationWindow();
        final StatusBar bar = aw.getStatusBar();
        final ProgressMonitor pm = bar.getProgressMonitor();

        JFileChooser fc = new JFileChooser();
        fc.setDialogTitle(tr.get(ID + ".fileDialog"));
        int res = fc.showOpenDialog(aw.getControl());
        if (res != JFileChooser.APPROVE_OPTION) {
            bar.setMessage(tr.get(ID + ".noFileSelected"));
            return;
        }
        file = fc.getSelectedFile();
        if (!file.getName().endsWith(".xml")) {
            int resultOP = JOptionPane.showConfirmDialog(null, tr.get(ID + ".confirmation.message"),
                    tr.get(ID + ".confirmation.title"), JOptionPane.OK_CANCEL_OPTION);
            if (resultOP != JOptionPane.OK_OPTION) {
                return;
            }
        }
        pm.taskStarted(tr.get(ID + ".startTask"), 100);
        MySwingWorker sw = new MySwingWorker(ID) {

            @Override
            protected void myconstruct() throws Exception {
                bar.getProgressMonitor().worked(10);
View Full Code Here

//        progressLabel.setBackground(new Color(0x425DA9));
    }

    public ProgressMonitor getProgressMonitor()
    {
         return new ProgressMonitor()
         {
             private int currentWork = 0;

             public void taskStarted(String name, int totalWork)
             {
View Full Code Here

        .getDefault(), loadingAppCtxMessage);

    messageSource.addMessage(ProgressMonitoringBeanFactoryPostProcessor.LOADING_BEAN_KEY, Locale.getDefault(),
        loadingBeanMessage);

    ProgressMonitor mockProgressMonitor = (ProgressMonitor) EasyMock.createStrictMock(ProgressMonitor.class);
    mockProgressMonitor.taskStarted(loadingAppCtxMessage, expectedSingletonBeanCount);
    mockProgressMonitor.subTaskStarted(expectedLoadBean1Message);
    mockProgressMonitor.worked(1);
    mockProgressMonitor.subTaskStarted(expectedLoadBean2Message);
    mockProgressMonitor.worked(1);
    EasyMock.replay(mockProgressMonitor);

    ProgressMonitoringBeanFactoryPostProcessor processor = new ProgressMonitoringBeanFactoryPostProcessor(
        mockProgressMonitor, messageSource);
View Full Code Here

    StaticApplicationContext appCtx = new StaticApplicationContext();
    appCtx.registerSingleton(beanName1, Object.class);
    appCtx.registerSingleton(beanName2, Object.class);
    appCtx.registerPrototype(beanName3, Object.class);

    ProgressMonitor mockProgressMonitor = (ProgressMonitor) EasyMock.createStrictMock(ProgressMonitor.class);
    mockProgressMonitor.taskStarted("Loading Application Context ...", expectedSingletonBeanCount);
    mockProgressMonitor.subTaskStarted("Loading " + beanName1 + " ...");
    mockProgressMonitor.worked(1);
    mockProgressMonitor.subTaskStarted("Loading " + beanName2 + " ...");
    mockProgressMonitor.worked(1);
    EasyMock.replay(mockProgressMonitor);

    ProgressMonitoringBeanFactoryPostProcessor processor = new ProgressMonitoringBeanFactoryPostProcessor(
        mockProgressMonitor, null);
    appCtx.addBeanFactoryPostProcessor(processor);
View Full Code Here

TOP

Related Classes of org.springframework.richclient.progress.ProgressMonitor

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.