Package org.pushingpixels.flamingo.api.common

Examples of org.pushingpixels.flamingo.api.common.AsynchronousLoading


    new Thread() {
      @Override
      public void run() {
        // still loading?
        if (icon instanceof AsynchronousLoading) {
          AsynchronousLoading async = (AsynchronousLoading) icon;
          if (async.isLoading()) {
            final CountDownLatch latch = new CountDownLatch(1);
            final boolean[] status = new boolean[1];
            AsynchronousLoadListener all = new AsynchronousLoadListener() {
              public void completed(boolean success) {
                status[0] = success;
                latch.countDown();
              }
            };
            async.addAsynchronousLoadListener(all);
            try {
              latch.await();
            } catch (InterruptedException ie) {
            }
            async.removeAsynchronousLoadListener(all);
          }
        }
        setApplicationAndMenuButtonIcon(icon);
      }
    }.start();
View Full Code Here


  }

  private static Image getImage(ResizableIcon icon, int size) {
    icon.setDimension(new Dimension(size, size));
    if (icon instanceof AsynchronousLoading) {
      AsynchronousLoading async = (AsynchronousLoading) icon;
      if (async.isLoading()) {
        final CountDownLatch latch = new CountDownLatch(1);
        final boolean[] status = new boolean[1];
        AsynchronousLoadListener all = new AsynchronousLoadListener() {
          public void completed(boolean success) {
            status[0] = success;
            latch.countDown();
          }
        };
        async.addAsynchronousLoadListener(all);
        try {
          latch.await();
        } catch (InterruptedException ie) {
        }
        async.removeAsynchronousLoadListener(all);
        if (!status[0]) {
          return null;
        }
        if (async.isLoading()) {
          return null;
        }
      }
    }
    Image result = FlamingoUtilities.getBlankImage(size, size);
View Full Code Here

    // check cache
    String key = this.getIconWidth() + ":" + this.getIconHeight();
    if (!this.cachedImages.containsKey(key)) {
      // check if loading
      if (this.delegate instanceof AsynchronousLoading) {
        AsynchronousLoading asyncDelegate = (AsynchronousLoading) this.delegate;
        // if the delegate is still loading - do nothing
        if (asyncDelegate.isLoading())
          return;
      }
      BufferedImage offscreen = FlamingoUtilities.getBlankImage(this
          .getIconWidth(), this.getIconHeight());
      Graphics2D g2d = offscreen.createGraphics();
View Full Code Here

    // check cache
    String key = this.getIconWidth() + ":" + this.getIconHeight();
    if (!this.cachedImages.containsKey(key)) {
      // check if loading
      if (this.delegate instanceof AsynchronousLoading) {
        AsynchronousLoading asyncDelegate = (AsynchronousLoading) this.delegate;
        // if the delegate is still loading - do nothing
        if (asyncDelegate.isLoading())
          return;
      }
      BufferedImage offscreen = FlamingoUtilities.getBlankImage(this
          .getIconWidth(), this.getIconHeight());
      Graphics2D g2d = offscreen.createGraphics();
View Full Code Here

    setAppIconExecutor.execute(new Runnable() {
      @Override
      public void run() {
        // still loading?
        if (icon instanceof AsynchronousLoading) {
          AsynchronousLoading async = (AsynchronousLoading) icon;
          if (async.isLoading()) {
            final CountDownLatch latch = new CountDownLatch(1);
            final boolean[] status = new boolean[1];
            AsynchronousLoadListener all = new AsynchronousLoadListener() {
              @Override
                            public void completed(boolean success) {
                status[0] = success;
                latch.countDown();
              }
            };
            async.addAsynchronousLoadListener(all);
            try {
              latch.await();
            } catch (InterruptedException ie) {
            }
            async.removeAsynchronousLoadListener(all);
          }
        }
        setApplicationAndMenuButtonIcon(icon);
      }
    });
View Full Code Here

  }

  private static Image getImage(ResizableIcon icon, int size) {
    icon.setDimension(new Dimension(size, size));
    if (icon instanceof AsynchronousLoading) {
      AsynchronousLoading async = (AsynchronousLoading) icon;
      if (async.isLoading()) {
        final CountDownLatch latch = new CountDownLatch(1);
        final boolean[] status = new boolean[1];
        AsynchronousLoadListener all = new AsynchronousLoadListener() {
          @Override
                    public void completed(boolean success) {
            status[0] = success;
            latch.countDown();
          }
        };
        async.addAsynchronousLoadListener(all);
        try {
          latch.await();
        } catch (InterruptedException ie) {
        }
        async.removeAsynchronousLoadListener(all);
        if (!status[0]) {
          return null;
        }
        if (async.isLoading()) {
          return null;
        }
      }
    }
    Image result = FlamingoUtilities.getBlankImage(size, size);
View Full Code Here

    new Thread() {
      @Override
      public void run() {
        // still loading?
        if (icon instanceof AsynchronousLoading) {
          AsynchronousLoading async = (AsynchronousLoading) icon;
          if (async.isLoading()) {
            final CountDownLatch latch = new CountDownLatch(1);
            final boolean[] status = new boolean[1];
            AsynchronousLoadListener all = new AsynchronousLoadListener() {
              @Override
                            public void completed(boolean success) {
                status[0] = success;
                latch.countDown();
              }
            };
            async.addAsynchronousLoadListener(all);
            try {
              latch.await();
            } catch (InterruptedException ie) {
            }
            async.removeAsynchronousLoadListener(all);
          }
        }
        setApplicationAndMenuButtonIcon(icon);
      }
    }.start();
View Full Code Here

  }

  private static Image getImage(ResizableIcon icon, int size) {
    icon.setDimension(new Dimension(size, size));
    if (icon instanceof AsynchronousLoading) {
      AsynchronousLoading async = (AsynchronousLoading) icon;
      if (async.isLoading()) {
        final CountDownLatch latch = new CountDownLatch(1);
        final boolean[] status = new boolean[1];
        AsynchronousLoadListener all = new AsynchronousLoadListener() {
          @Override
                    public void completed(boolean success) {
            status[0] = success;
            latch.countDown();
          }
        };
        async.addAsynchronousLoadListener(all);
        try {
          latch.await();
        } catch (InterruptedException ie) {
        }
        async.removeAsynchronousLoadListener(all);
        if (!status[0]) {
          return null;
        }
        if (async.isLoading()) {
          return null;
        }
      }
    }
    Image result = FlamingoUtilities.getBlankImage(size, size);
View Full Code Here

TOP

Related Classes of org.pushingpixels.flamingo.api.common.AsynchronousLoading

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.