@FXML private void submitOpenQuestion() { System.out.println("submit"); QuestionSubmit submit = questionForPane.get(questionAccordion.expandedPaneProperty().get()); answerForQuestion.put(submit, submit.createAnswerSubmit(openAnswer.getText(), teamId)); }
@FXML private void submitMultipleQuestion() { String answer = choises.getSelectedToggle() == null ? "" : ((RadioButton) choises.getSelectedToggle()).getText(); QuestionSubmit submit = questionForPane.get(questionAccordion.expandedPaneProperty().get()); answerForQuestion.put(submit, submit.createAnswerSubmit(answer, teamId)); }
private void initBindings() { // zorgen dat de content van de scrollpane de juiste brete aanhoud quizPane.prefWidthProperty().bind(questionScroll.widthProperty().add(-5)); // wrappings zetten openQuestionText.wrappingWidthProperty().bind(openQuestionVbox.widthProperty().add(-20)); multipleChoiceText.wrappingWidthProperty().bind(multipleChoiseVbox.widthProperty().add(-20)); imageQuestionText.wrappingWidthProperty().bind(imageQuestionVbox.widthProperty().add(-20)); questionListener = new ListChangeListener<QuestionSubmit>() { @Override public void onChanged( javafx.collections.ListChangeListener.Change<? extends QuestionSubmit> c) { for (QuestionSubmit s : c.getList()) { if (!questionForPane.values().contains(s)) { TitledPane p = new TitledPane(s.getQuestion(), new AnchorPane()); questionAccordion.getPanes().add(p); questionForPane.put(p, s); } } } }; questionAccordion .expandedPaneProperty() .addListener( new ChangeListener<TitledPane>() { @Override public void changed( ObservableValue<? extends TitledPane> observable, TitledPane oldValue, TitledPane newValue) { if (oldValue != null) { ((AnchorPane) oldValue.getContent()).getChildren().clear(); } if (newValue != null) { createQuestionFor(newValue); } } }); currentPlayingRound.addListener( new ChangeListener<RoundSubmit>() { @Override public void changed( ObservableValue<? extends RoundSubmit> observable, RoundSubmit oldValue, RoundSubmit newValue) { removeRound(oldValue); setRound(newValue); } }); quizPane.visibleProperty().bind(currentPlayingRound.isNotNull()); }
public void bind(final Accordion accordion, final String propertyName) { Object selectedPane = props.getProperty(propertyName); for (TitledPane tp : accordion.getPanes()) { if (tp.getText() != null && tp.getText().equals(selectedPane)) { accordion.setExpandedPane(tp); break; } } accordion .expandedPaneProperty() .addListener( (ov, t, expandedPane) -> { if (expandedPane != null) { props.setProperty(propertyName, expandedPane.getText()); } }); }
private void createConferences() { final TitledPane sf = createConference( "JavaOne SF", 37.775057, -122.416534, "http://steveonjava.com/wp-content/uploads/2010/07/JavaOne-2010-Speaker.png"); // "JavaOne India", 17.385371, 78.484268, // "http://steveonjava.com/wp-content/uploads/2011/03/javaone-india.png"); conferenceAccordion.getPanes().add(sf); conferenceAccordion .getPanes() .add( createConference( "OSCON", 45.515008, -122.693253, "http://steveonjava.com/wp-content/uploads/2011/05/oscon.png")); conferenceAccordion .getPanes() .add( createConference( "Devoxx", 51.206883, 4.44, "http://steveonjava.com/wp-content/uploads/2010/07/LogoDevoxxNeg150.png")); conferenceAccordion .getPanes() .add( createConference( "J-Fall", 52.219913, 5.474253, "http://steveonjava.com/wp-content/uploads/2011/11/jfall3.png")); conferenceAccordion .getPanes() .add( createConference( "JavaOne India", 17.385371, 78.484268, "http://steveonjava.com/wp-content/uploads/2011/03/javaone-india.png")); conferenceAccordion .getPanes() .add( createConference( "Jazoon", 47.382079, 8.528137, "http://steveonjava.com/wp-content/uploads/2010/04/jazoon.png")); conferenceAccordion .getPanes() .add( createConference( "GeeCON", 50.064633, 19.949799, "http://steveonjava.com/wp-content/uploads/2011/03/geecon.png")); sf.setExpanded(true); conferenceAccordion.setExpandedPane(sf); conferenceAccordion .expandedPaneProperty() .addListener( new ChangeListener<TitledPane>() { public void changed( ObservableValue<? extends TitledPane> ov, TitledPane t, TitledPane t1) { if (t1 != null) { ((ConferencePane) t1).navigateTo(); } } }); }
@FXML private void submitImageQuestion() { QuestionSubmit submit = questionForPane.get(questionAccordion.expandedPaneProperty().get()); answerForQuestion.put(submit, submit.createAnswerSubmit(imageAnswer.getText(), teamId)); }
public static void add(Accordion acc, Stage stage) { acc.expandedPaneProperty().addListener(new AccordionSizeHack(stage)); }