Example usage for javafx.scene.control ProgressIndicator INDETERMINATE_PROGRESS

List of usage examples for javafx.scene.control ProgressIndicator INDETERMINATE_PROGRESS

Introduction

In this page you can find the example usage for javafx.scene.control ProgressIndicator INDETERMINATE_PROGRESS.

Prototype

double INDETERMINATE_PROGRESS

To view the source code for javafx.scene.control ProgressIndicator INDETERMINATE_PROGRESS.

Click Source Link

Document

Value for progress indicating that the progress is indeterminate.

Usage

From source file:org.pdfsam.ui.module.ProgressPane.java

@EventListener
public void onProgress(PercentageOfWorkDoneChangedEvent event) {
    open.setVisible(false);//w  w  w . ja  v a2  s.  c om
    failed.setVisible(false);
    if (event.isUndetermined()) {
        statusLabel.setText(DefaultI18nContext.getInstance().i18n("Running"));
        bar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
    } else {
        statusLabel.setText(String.format("%d %%", event.getPercentage().intValue()));
        bar.setProgress(event.getPercentage().divide(new BigDecimal(100)).doubleValue());
    }
}

From source file:frontend.GUIController.java

public void setInputFolder(String path) throws Exception {
    System.out.println("setInputFolder(" + path + ")");
    inFolder.setText(path);//from  w  ww . j a  va2 s.c  om
    at.setInputDir(inFolder.getText());
    List<String> headers = at.readHeader();
    for (int i = 0; i < comboBoxes.size(); i++) {
        comboBoxes.get(i).getSelectionModel().clearSelection();
        comboBoxes.get(i).getItems().clear();
        comboBoxes.get(i).getItems().addAll(headers);
        comboBoxes.get(i).setPromptText("Choose one");
        if (headers.contains(at.defaultProperties.getHeader(AppProperties.propKeys[i]))) {
            comboBoxes.get(i).setValue(at.defaultProperties.getHeader(AppProperties.propKeys[i]));
        }
    }
    if (at.usingCustomConfig() && at.defaultProperties.getModel() != null) {
        predModel.setValue(MODELTYPE.CUSTOM);
        customModelFile = at.defaultProperties.getModel();
        System.out.println(customModelFile);
        at.setCustomModelFile(customModelFile);
    }
    progressBar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
}

From source file:gov.va.isaac.gui.ConceptNode.java

/**
 * descriptionReader is optional/*  w ww  . j av a  2 s.  co m*/
 */
public ConceptNode(ConceptVersionBI initialConcept, boolean flagAsInvalidWhenBlank,
        ObservableList<SimpleDisplayConcept> dropDownOptions,
        Function<ConceptVersionBI, String> descriptionReader) {
    c_ = initialConcept;
    //We can't simply use the ObservableList from the CommonlyUsedConcepts, because it infinite loops - there doesn't seem to be a way 
    //to change the items in the drop down without changing the selection.  So, we have this hack instead.
    listChangeListener_ = new ListChangeListener<SimpleDisplayConcept>() {
        @Override
        public void onChanged(Change<? extends SimpleDisplayConcept> c) {
            //TODO I still have an infinite loop here.  Find and fix.
            logger.debug("updating concept dropdown");
            disableChangeListener_ = true;
            SimpleDisplayConcept temp = cb_.getValue();
            cb_.setItems(FXCollections.observableArrayList(dropDownOptions_));
            cb_.setValue(temp);
            cb_.getSelectionModel().select(temp);
            disableChangeListener_ = false;
        }
    };
    descriptionReader_ = (descriptionReader == null ? (conceptVersion) -> {
        return conceptVersion == null ? "" : OTFUtility.getDescription(conceptVersion);
    } : descriptionReader);
    dropDownOptions_ = dropDownOptions == null
            ? AppContext.getService(CommonlyUsedConcepts.class).getObservableConcepts()
            : dropDownOptions;
    dropDownOptions_.addListener(new WeakListChangeListener<SimpleDisplayConcept>(listChangeListener_));
    conceptBinding_ = new ObjectBinding<ConceptVersionBI>() {
        @Override
        protected ConceptVersionBI computeValue() {
            return c_;
        }
    };

    flagAsInvalidWhenBlank_ = flagAsInvalidWhenBlank;
    cb_ = new ComboBox<>();
    cb_.setConverter(new StringConverter<SimpleDisplayConcept>() {
        @Override
        public String toString(SimpleDisplayConcept object) {
            return object == null ? "" : object.getDescription();
        }

        @Override
        public SimpleDisplayConcept fromString(String string) {
            return new SimpleDisplayConcept(string, 0);
        }
    });
    cb_.setValue(new SimpleDisplayConcept("", 0));
    cb_.setEditable(true);
    cb_.setMaxWidth(Double.MAX_VALUE);
    cb_.setPrefWidth(ComboBox.USE_COMPUTED_SIZE);
    cb_.setMinWidth(200.0);
    cb_.setPromptText("Type, drop or select a concept");

    cb_.setItems(FXCollections.observableArrayList(dropDownOptions_));
    cb_.setVisibleRowCount(11);

    cm_ = new ContextMenu();

    MenuItem copyText = new MenuItem("Copy Description");
    copyText.setGraphic(Images.COPY.createImageView());
    copyText.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            CustomClipboard.set(cb_.getEditor().getText());
        }
    });
    cm_.getItems().add(copyText);

    CommonMenusNIdProvider nidProvider = new CommonMenusNIdProvider() {
        @Override
        public Set<Integer> getNIds() {
            Set<Integer> nids = new HashSet<>();
            if (c_ != null) {
                nids.add(c_.getNid());
            }
            return nids;
        }
    };
    CommonMenuBuilderI menuBuilder = CommonMenus.CommonMenuBuilder.newInstance();
    menuBuilder.setInvisibleWhenFalse(isValid);
    CommonMenus.addCommonMenus(cm_, menuBuilder, nidProvider);

    cb_.getEditor().setContextMenu(cm_);

    updateGUI();

    new LookAheadConceptPopup(cb_);

    if (cb_.getValue().getNid() == 0) {
        if (flagAsInvalidWhenBlank_) {
            isValid.setInvalid("Concept Required");
        }
    } else {
        isValid.setValid();
    }

    cb_.valueProperty().addListener(new ChangeListener<SimpleDisplayConcept>() {
        @Override
        public void changed(ObservableValue<? extends SimpleDisplayConcept> observable,
                SimpleDisplayConcept oldValue, SimpleDisplayConcept newValue) {
            if (newValue == null) {
                logger.debug("Combo Value Changed - null entry");
            } else {
                logger.debug("Combo Value Changed: {} {}", newValue.getDescription(), newValue.getNid());
            }

            if (disableChangeListener_) {
                logger.debug("change listener disabled");
                return;
            }

            if (newValue == null) {
                //This can happen if someone calls clearSelection() - it passes in a null.
                cb_.setValue(new SimpleDisplayConcept("", 0));
                return;
            } else {
                if (newValue.shouldIgnoreChange()) {
                    logger.debug("One time change ignore");
                    return;
                }
                //Whenever the focus leaves the combo box editor, a new combo box is generated.  But, the new box will have 0 for an id.  detect and ignore
                if (oldValue != null && oldValue.getDescription().equals(newValue.getDescription())
                        && newValue.getNid() == 0) {
                    logger.debug("Not a real change, ignore");
                    newValue.setNid(oldValue.getNid());
                    return;
                }
                lookup();
            }
        }
    });

    AppContext.getService(DragRegistry.class).setupDragAndDrop(cb_, new SingleConceptIdProvider() {
        @Override
        public String getConceptId() {
            return cb_.getValue().getNid() + "";
        }
    }, true);

    pi_ = new ProgressIndicator(ProgressIndicator.INDETERMINATE_PROGRESS);
    pi_.visibleProperty().bind(isLookupInProgress_);
    pi_.setPrefHeight(16.0);
    pi_.setPrefWidth(16.0);
    pi_.setMaxWidth(16.0);
    pi_.setMaxHeight(16.0);

    lookupFailImage_ = Images.EXCLAMATION.createImageView();
    lookupFailImage_.visibleProperty().bind(isValid.not().and(isLookupInProgress_.not()));
    Tooltip t = new Tooltip();
    t.textProperty().bind(isValid.getReasonWhyInvalid());
    Tooltip.install(lookupFailImage_, t);

    StackPane sp = new StackPane();
    sp.setMaxWidth(Double.MAX_VALUE);
    sp.getChildren().add(cb_);
    sp.getChildren().add(lookupFailImage_);
    sp.getChildren().add(pi_);
    StackPane.setAlignment(cb_, Pos.CENTER_LEFT);
    StackPane.setAlignment(lookupFailImage_, Pos.CENTER_RIGHT);
    StackPane.setMargin(lookupFailImage_, new Insets(0.0, 30.0, 0.0, 0.0));
    StackPane.setAlignment(pi_, Pos.CENTER_RIGHT);
    StackPane.setMargin(pi_, new Insets(0.0, 30.0, 0.0, 0.0));

    hbox_ = new HBox();
    hbox_.setSpacing(5.0);
    hbox_.setAlignment(Pos.CENTER_LEFT);

    hbox_.getChildren().add(sp);
    HBox.setHgrow(sp, Priority.SOMETIMES);
}

From source file:org.pdfsam.ui.module.Footer.java

@EventListener
public void onProgress(PercentageOfWorkDoneChangedEvent event) {
    statusLabel.setText(DefaultI18nContext.getInstance().i18n("Running"));
    if (event.isUndetermined()) {
        bar.setProgress(ProgressIndicator.INDETERMINATE_PROGRESS);
    } else {/*from  w ww .j ava 2 s.  c o m*/
        bar.setProgress(event.getPercentage().divide(new BigDecimal(100)).doubleValue());
        statusLabel.setText(DefaultI18nContext.getInstance().i18n("Running {0}%",
                Integer.toString(event.getPercentage().intValue())));
    }
}