Java 类javafx.beans.property.ReadOnlyIntegerWrapper 实例源码

项目:Capstone2016    文件:GluonMapLoadingService.java   
@Override
public ReadOnlyIntegerProperty preloadMapTiles(double minLatitude, double maxLatitude, double minLongitude, double maxLongitude) {
    ReadOnlyIntegerWrapper remainingCount = new ReadOnlyIntegerWrapper();
    int minX = getTileX(minLongitude, ZOOM);
    int maxX = getTileX(maxLongitude, ZOOM);
    int minY = getTileY(minLatitude, ZOOM);
    int maxY = getTileY(maxLatitude, ZOOM);
    int totalCount = (maxX-minX+1)*(maxY-minY+1);
    if (totalCount > MAX_TILES) {
        throw new IllegalArgumentException("The number of tiles required ("+totalCount+") is greater than the maximum allowed ("+MAX_TILES+")");
    }
    int remaining = 0;
    for (int x = minX; x <= maxX; x++) {
        for (int y = minY; y <= maxY; y++) {
            File f = getCacheFile(ZOOM, x, y);
            if (!f.exists()) {
                remaining++;
                fetchAndStoreTile(remainingCount, ZOOM, x, y);
            }
        }
    }
    remainingCount.set(remaining);
    return remainingCount;
}
项目:JFXC    文件:HourMinSecTextField.java   
public HourMinSecTextField(String time) {
    super(time);
    this.time = new SimpleLongProperty();
    timePattern = Pattern.compile("\\d\\d:\\d\\d:\\d\\d");
    if (!validate(time)) {
        throw new IllegalArgumentException("Invalid time: " + time);
    }

    hours = new ReadOnlyIntegerWrapper(this, "hours");
    minutes = new ReadOnlyIntegerWrapper(this, "minutes");
    hours.bind(new TimeUnitBinding(Unit.HOURS));
    minutes.bind(new TimeUnitBinding(Unit.MINUTES));
    seconds = new ReadOnlyIntegerWrapper(this, "seconds");
    seconds.bind(new TimeUnitBinding(Unit.SECONDS));

    this.time.bind(seconds.add(minutes.multiply(60).add(hours.multiply(60))));
}
项目:cnctools    文件:AbstractOpenGLRenderer.java   
public AbstractOpenGLRenderer(final StreamHandler readHandler) {
    this.pendingRunnables = new ConcurrentLinkedQueue<Runnable>();

    this.fps = new ReadOnlyIntegerWrapper(this, "fps", 0);

    if ((Pbuffer.getCapabilities() & Pbuffer.PBUFFER_SUPPORTED) == 0)
        throw new UnsupportedOperationException("Support for pbuffers is required.");

    try {
        pbuffer = new Pbuffer(1, 1, new PixelFormat(), null, null, new ContextAttribs().withDebug(false));
        pbuffer.makeCurrent();
    } catch (LWJGLException e) {
        throw new RuntimeException(e);
    }

    final ContextCapabilities caps = GLContext.getCapabilities();
    if (caps.GL_ARB_debug_output) {
        glDebugMessageCallbackARB(new ARBDebugOutputCallback());
    } else if (caps.GL_AMD_debug_output) {
        glDebugMessageCallbackAMD(new AMDDebugOutputCallback());
    }

    this.renderStreamFactory = StreamUtil.getRenderStreamImplementation();
    this.renderStream = renderStreamFactory.create(readHandler, samples, transfersToBuffer);
}
项目:farmsim    文件:World.java   
/**
 * Instantiates a World object with the specified parameters.
 *
 * @param name
 *            The name of the World
 * @param width
 *            The width of the World
 * @param height
 *            The height of the World
 * @param baseTileType
 *            The initial tile type to set every tile to
 */
public World(String name, int width, int height,
                int baseTileType, long seed) {

    tiles = new Array2D<>(width, height);

    this.seed = seed;
    this.height = new ReadOnlyIntegerWrapper(height);
    this.width = new ReadOnlyIntegerWrapper(width);
    initialise();
    for (int y = 0; y < getHeight(); y++) {
        for (int x = 0; x < getWidth(); x++) {
            tiles.set(x, y, new Tile(x, y, baseTileType));
        }
    }

    buildings = new HashSet<>();

    this.name = name;
    this.modifierManager = new ModifierManager();
    this.seasonManager = new SeasonManager();
    this.weatherManager = new WeatherManager();
    this.fireManager = new FireManager(this);
    this.timeManager = new DayNight();
    this.contractGenerator = new ContractGenerator();
    this.activeContracts = new ContractHandler();
    this.availableContracts = new ContractHandler();
    this.storageManager = new StorageManager();
    this.predatorManager = new PredatorManager();
    this.buildingPlacer = new BuildingPlacer();
    this.moneyHandler = new Money();
}
项目:Capstone2016    文件:GluonMapLoadingService.java   
private void fetchAndStoreTile(ReadOnlyIntegerWrapper remaining, int zoom, int x, int y) {
BackgroundTasks.runInBackground(() -> {
    try {
        String urlString = TILE_HOST+zoom+"/"+x+"/"+y+".png";
           URL url = new URL(urlString);
           try (InputStream inputStream = url.openConnection().getInputStream()) {
               File candidate = getCacheFile(zoom, x, y);
               candidate.getParentFile().mkdirs();
               try (FileOutputStream fos = new FileOutputStream(candidate)) {
                   byte[] buff = new byte[4096];
                   int len = inputStream.read(buff);
                   while (len > 0) {
                       fos.write(buff, 0, len);
                       len = inputStream.read(buff);
                   }
                   fos.close();
               }
           }
       } catch (IOException ex) {
           LOG.log(Level.SEVERE, "Failed to fetch & store map tile "+x+","+y, ex);
       } finally {
        Platform.runLater(() -> {
            remaining.set(remaining.get()-1);//Identify it as loaded regardless
        });             
       }
});        
  }
项目:JFXC    文件:HourMinTextField.java   
public HourMinTextField(String time) {
    super(time);
    this.time = new SimpleLongProperty();
    timePattern = Pattern.compile("\\d\\d:\\d\\d");
    if (!validate(time)) {
        throw new IllegalArgumentException("Invalid time: " + time);
    }
    hours = new ReadOnlyIntegerWrapper(this, "hours");
    minutes = new ReadOnlyIntegerWrapper(this, "minutes");
    hours.bind(new TimeUnitBinding(Unit.HOURS));
    minutes.bind(new TimeUnitBinding(Unit.MINUTES));

    this.time.bind(minutes.add(hours.multiply(60)));
}
项目:afc    文件:AbstractRectangularShape2ifx.java   
/** Replies the property that is the width of the box.
 *
 * @return the width property.
 */
@Pure
public IntegerProperty widthProperty() {
    if (this.width == null) {
        this.width = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.WIDTH);
        this.width.bind(Bindings.subtract(maxXProperty(), minXProperty()));
    }
    return this.width;
}
项目:afc    文件:AbstractRectangularShape2ifx.java   
/** Replies the property that is the height of the box.
 *
 * @return the height property.
 */
@Pure
public IntegerProperty heightProperty() {
    if (this.height == null) {
        this.height = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.HEIGHT);
        this.height.bind(Bindings.subtract(maxYProperty(), minYProperty()));
    }
    return this.height;
}
项目:afc    文件:Rectangle2ifx.java   
/** Replies the property that is the width of the box.
 *
 * @return the width property.
 */
@Pure
public IntegerProperty widthProperty() {
    if (this.width == null) {
        this.width = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.WIDTH);
        this.width.bind(Bindings.subtract(maxXProperty(), minXProperty()));
    }
    return this.width;
}
项目:afc    文件:Rectangle2ifx.java   
/** Replies the property that is the height of the box.
 *
 * @return the height property.
 */
@Pure
public IntegerProperty heightProperty() {
    if (this.height == null) {
        this.height = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.HEIGHT);
        this.height.bind(Bindings.subtract(maxYProperty(), minYProperty()));
    }
    return this.height;
}
项目:afc    文件:AbstractRectangularShape3ifx.java   
/** Replies the property that is the width of the box.
 *
 * @return the width property.
 */
@Pure
public IntegerProperty widthProperty() {
    if (this.width == null) {
        this.width = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.WIDTH);
        this.width.bind(Bindings.subtract(maxXProperty(), minXProperty()));
    }
    return this.width;
}
项目:afc    文件:AbstractRectangularShape3ifx.java   
/** Replies the property that is the height of the box.
 *
 * @return the height property.
 */
@Pure
public IntegerProperty heightProperty() {
    if (this.height == null) {
        this.height = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.HEIGHT);
        this.height.bind(Bindings.subtract(maxYProperty(), minYProperty()));
    }
    return this.height;
}
项目:afc    文件:AbstractRectangularShape3ifx.java   
/** Replies the property that is the depth of the box.
 *
 * @return the depth property.
 */
@Pure
public IntegerProperty depthProperty() {
    if (this.depth == null) {
        this.depth = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.DEPTH);
        this.depth.bind(Bindings.subtract(maxZProperty(), minZProperty()));
    }
    return this.depth;
}
项目:afc    文件:RectangularPrism3ifx.java   
/** Replies the property that is the width of the box.
 *
 * @return the width property.
 */
@Pure
public IntegerProperty widthProperty() {
    if (this.width == null) {
        this.width = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.WIDTH);
        this.width.bind(Bindings.subtract(maxXProperty(), minXProperty()));
    }
    return this.width;
}
项目:afc    文件:RectangularPrism3ifx.java   
/** Replies the property that is the height of the box.
 *
 * @return the height property.
 */
@Pure
public IntegerProperty heightProperty() {
    if (this.height == null) {
        this.height = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.HEIGHT);
        this.height.bind(Bindings.subtract(maxYProperty(), minYProperty()));
    }
    return this.height;
}
项目:afc    文件:RectangularPrism3ifx.java   
/** Replies the property that is the depth of the box.
 *
 * @return the depth property.
 */
@Pure
public IntegerProperty depthProperty() {
    if (this.depth == null) {
        this.depth = new ReadOnlyIntegerWrapper(this, MathFXAttributeNames.DEPTH);
        this.depth.bind(Bindings.subtract(maxZProperty(), minZProperty()));
    }
    return this.depth;
}
项目:drd    文件:Vulnerability.java   
public Vulnerability(int vulnerability) {
    this.vulnerability = new ReadOnlyIntegerWrapper(vulnerability);
}