Package org.zkoss.ganttz.util.LongOperationFeedback

Examples of org.zkoss.ganttz.util.LongOperationFeedback.IDesktopUpdate


                    updatesEmitter.doUpdate(disableButton(false));
                }
            }

            private IDesktopUpdate disableButton(final boolean disable) {
                return new IDesktopUpdate() {

                    @Override
                    public void doUpdate() {
                        btnRunMonteCarlo.setDisabled(disable);
                    }
                };
            }

            private int getIterations() {
                int iterations = ibIterations.getValue() != null ? ibIterations
                        .getValue().intValue() : 0;
                if (iterations == 0) {
                    throw new WrongValueException(ibIterations,
                            _("cannot be empty"));
                }
                if (iterations < 0 || iterations > MAX_NUMBER_ITERATIONS) {
                    throw new WrongValueException(ibIterations,
                            _("Number of iterations should be between 1 and {0}",
                                    MAX_NUMBER_ITERATIONS));
                }
                return iterations;
            }

            private void validateRowsPercentages() {
                Intbox intbox;

                int page = 0;
                int counter = 0;

                Rows rows = gridCriticalPathTasks.getRows();
                for (Object each : rows.getChildren()) {
                    Row row = (Row) each;
                    List<org.zkoss.zk.ui.Component> children = row
                            .getChildren();

                    Integer sum = 0;
                    intbox = (Intbox) children.get(3);
                    sum += intbox.getValue();
                    intbox = (Intbox) children.get(5);
                    sum += intbox.getValue();
                    intbox = (Intbox) children.get(7);
                    sum += intbox.getValue();

                    if (sum != 100) {
                        gridCriticalPathTasks.setActivePage(page);
                        throw new WrongValueException(row,
                                _("Percentages should sum 100"));
                    }

                    counter++;
                    if (counter % gridCriticalPathTasks.getPageSize() == 0) {
                        page++;
                    }
                }
            }

            private IDesktopUpdatesEmitter<Integer> percentageCompletedNotifier(
                    final IDesktopUpdatesEmitter<IDesktopUpdate> updatesEmitter) {
                return new IDesktopUpdatesEmitter<Integer>() {

                    @Override
                    public void doUpdate(final Integer percentage) {
                        updatesEmitter
                                .doUpdate(showCompletedPercentage(percentage));
                    }

                    private IDesktopUpdate showCompletedPercentage(
                            final Integer value) {
                        return new IDesktopUpdate() {
                            @Override
                            public void doUpdate() {
                                progressMonteCarloCalculation.setValue(value);
                            }
                        };
                    }
                };
            }

            private IDesktopUpdate showCalculatedData(
                    final Map<LocalDate, BigDecimal> monteCarloData) {
                return new IDesktopUpdate() {

                    @Override
                    public void doUpdate() {
                        showMonteCarloGraph(monteCarloData);
                    }
View Full Code Here


            }
        };
    }

    private IDesktopUpdate busyStart(final int total) {
        return new IDesktopUpdate() {
            @Override
            public void doUpdate() {
                Clients.showBusy(_("Doing {0} reassignations", total), true);
            }
        };
View Full Code Here

            }
        };
    }

    private IDesktopUpdate showCompleted(final int number, final int total) {
        return new IDesktopUpdate() {

            @Override
            public void doUpdate() {
                Clients.showBusy(_("Done {0} of {1}", number, total), true);
            }
View Full Code Here

            }
        };
    }

    private IDesktopUpdate reloadCharts(final IContext<?> context) {
        return new IDesktopUpdate() {
            @Override
            public void doUpdate() {
                context.reloadCharts();
            }
        };
View Full Code Here

        };
    }

    private IDesktopUpdate doNotifications(
            final GanttDiagramGraph<Task, Dependency>.DeferedNotifier notifier) {
        return new IDesktopUpdate() {
            @Override
            public void doUpdate() {
                notifier.doNotifications();
            }
        };
View Full Code Here

            }
        };
    }

    private IDesktopUpdate busyEnd() {
        return new IDesktopUpdate() {

            @Override
            public void doUpdate() {
                Clients.showBusy(null, false);
            }
View Full Code Here

    private IDesktopUpdate tellUserOnEnd(final IContext<TaskElement> context,
            String icon, final Callable<String> message) {
        // using callable so the message is built inside a zk execution and the
        // locale is correctly retrieved

        return new IDesktopUpdate() {

            @Override
            public void doUpdate() {
                final org.zkoss.zk.ui.Component relativeTo = context
                        .getRelativeTo();
View Full Code Here

                                        Thread.sleep(seconds * 1000);
                                    } catch (InterruptedException e) {
                                        throw new RuntimeException(e);
                                    }
                                    desktopUpdateEmitter
                                            .doUpdate(new IDesktopUpdate() {

                                                @Override
                                                public void doUpdate() {
                                                    resetConfirmClose();
                                                    Clients.confirmClose(message);
View Full Code Here

        LongOperationFeedback.progressive(desktop, reassignations);
    }

    private IDesktopUpdate notifySuccess(
            final IOnFinished onFinish) {
        return new IDesktopUpdate() {

            @Override
            public void doUpdate() {
                onFinish.onWithoutErrorFinish();
            }
View Full Code Here

        };
    }

    private IDesktopUpdate notifyException(final IOnFinished onFinish,
            final Exception exceptionHappened) {
        return new IDesktopUpdate() {

            @Override
            public void doUpdate() {
                onFinish.errorHappened(exceptionHappened);
            }
View Full Code Here

TOP

Related Classes of org.zkoss.ganttz.util.LongOperationFeedback.IDesktopUpdate

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.