Java 类javafx.collections.MapChangeListener.Change 实例源码

项目:JttDesktop    文件:JobPolicyPanel.java   
/**
 * Constructs a new {@link JobPolicyPanel}.
 * @param configuration the {@link BuildWallConfiguration}.
 * @param styling the {@link JavaFxStyle} to apply.
 * @param defaults the {@link ConfigurationPanelDefaults}.
 */
JobPolicyPanel( BuildWallConfiguration configuration, JavaFxStyle styling, ConfigurationPanelDefaults defaults ) {
   this.configuration = configuration;
   this.styling = styling;

   labels = new HashMap<>();
   boxes = new HashMap<>();
   properties = new HashMap<>();

   defaults.configureColumnConstraints( this );
   constructLayout();

   configuration.jobPolicies().addListener( ( Change< ? extends JenkinsJob, ? extends BuildWallJobPolicy > change ) -> {
      if ( !labels.containsKey( change.getKey() ) ) {
         constructLayout();
      } else {
         boxes.get( change.getKey() ).getSelectionModel().select( change.getValueAdded() );
      }
   } );
}
项目:jmusic    文件:GetArtist.java   
private void createMedia() {
    try {
      media = new Media("http://traffic.libsyn.com/dickwall/JavaPosse373.mp3");
      media.getMetadata().addListener(new MapChangeListener<String, Object>() {
        @Override
        public void onChanged(Change<? extends String, ? extends Object> ch) {
          if (ch.wasAdded()) {
            handleMetadata(ch.getKey(), ch.getValueAdded());
          }
        }
      });

//      mediaPlayer = new MediaPlayer(media);
//      mediaPlayer.setOnError(new Runnable() {
//        @Override
//        public void run() {
//          final String errorMessage = media.getError().getMessage();
//          // Handle errors during playback
//          System.out.println("MediaPlayer Error: " + errorMessage);
//        }
//      });
//
//      mediaPlayer.play();

    } catch (RuntimeException re) {
      // Handle construction errors
      System.out.println("Caught Exception: " + re.getMessage());
    }
  }
项目:CalendarFX    文件:CalendarView.java   
/**
 * Constructs a new calendar view.
 */
public CalendarView() {
    getStyleClass().add(DEFAULT_STYLE_CLASS);

    this.dayPage = new DayPage();
    this.weekPage = new WeekPage();
    this.monthPage = new MonthPage();
    this.yearPage = new YearPage();

    this.searchField = (CustomTextField) TextFields.createClearableTextField();
    this.sourceView = new SourceView();
    this.searchResultView = new SearchResultView();
    this.yearMonthView = new YearMonthView();

    if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$
        this.developerConsole = new DeveloperConsole();
        this.developerConsole.setDateControl(this);
    }

    selectedPage.set(dayPage);

    Bindings.bindBidirectional(searchField.visibleProperty(), showSearchFieldProperty());

    /*
     * We do have a user agent stylesheet, but it doesn't seem to work
     * properly when run as a standalone jar file.
     */
    getStylesheets().add(CalendarView.class.getResource("calendar.css").toExternalForm()); //$NON-NLS-1$

    /*
     * We are "abusing" the properties map to pass new values of read-only
     * properties from the skin to the control.
     */
    getProperties().addListener((Change<?, ?> change) -> {
        if (change.getKey().equals(SELECTED_PAGE)) {
            if (change.getValueAdded() != null) {
                PageBase page = (PageBase) change.getValueAdded();
                selectedPage.set(page);
                getProperties().remove(SELECTED_PAGE);
            }
        }
    });

    InvalidationListener fixSelectedPageListener = it -> fixSelectedPage();

    dayPage.hiddenProperty().addListener(fixSelectedPageListener);
    weekPage.hiddenProperty().addListener(fixSelectedPageListener);
    monthPage.hiddenProperty().addListener(fixSelectedPageListener);
    yearPage.hiddenProperty().addListener(fixSelectedPageListener);

    fixSelectedPage();
}
项目:JProCalendarFX    文件:CalendarView.java   
/**
   * Constructs a new uk.co.senapt.desktop.ui.modules.calendar view.
   */
  public CalendarView() {
      getStyleClass().add(DEFAULT_STYLE_CLASS);

      this.dayPage = new DayPage();

      bind(dayPage, true);

      this.sourceView = new SourceView();
      this.searchResultView = new SearchResultView();
      this.yearMonthView = new YearMonthView();

      if (Boolean.getBoolean("calendarfx.developer")) { //$NON-NLS-1$
          this.developerConsole = new DeveloperConsole();
          this.developerConsole.setDateControl(this);
      }

      selectedPage.set(dayPage);

/*
       * We do have a user agent stylesheet, but it doesn't seem to work
 * properly when run as a standalone jar file.
 */
      getStylesheets().add(com.calendarfx.view.CalendarView.class.getResource("calendar.css").toExternalForm()); //$NON-NLS-1$

/*
       * We are "abusing" the properties map to pass new values of read-only
 * properties from the skin to the control.
 */
      getProperties().addListener((Change<?, ?> change) -> {
          if (change.getKey().equals(SELECTED_PAGE)) {
              if (change.getValueAdded() != null) {
                  PageBase page = (PageBase) change.getValueAdded();
                  selectedPage.set(page);
                  getProperties().remove(SELECTED_PAGE);
              }
          }
      });

      dayPage.hiddenProperty().addListener(fixSelectedPageListener);
      dayPage.setDayPageLayout(DayPageLayout.DAY_ONLY);
      fixSelectedPage();

      setTraysAnimated(false);

      getYearMonthView().setShowWeekNumbers(false);
  }
项目:fx-player    文件:MediaInfo.java   
void onChanged(MediaInfo info, Media media,
Change<? extends String, ? extends Object> change);