Package de.yaams.core.helper.gui

Examples of de.yaams.core.helper.gui.YProgressWindowRepeat


                  "setup_wait");

            }
          };

          YProgressWindowRepeat r = new YProgressWindowRepeat(I18N.t("Warten auf Fertigstellung der Installation vom RTP {0}",
              name), "rtp");
          // start
          SystemHelper.runExternal(new String[] { ex.getAbsolutePath() }, true);

          r.close();
        }

        return isRTPinstalledGui(name, rgssVersion, false);
      }
View Full Code Here


   * Copy all files in the path to another path
   *
   * @param infopath
   */
  public static void copyTree(final File source, final File dest) {
    YProgressWindowRepeat y = new YProgressWindowRepeat(I18N.t("Kopiere {0} nach {1}", source, dest), "folder_copy");
    for (final File file : source.listFiles()) {
      final File d = new File(dest + File.separator + file.getName());
      y.setNote(d.getName());
      if (file.isDirectory()) {
        mkdirs(d);
        copyTree(file, d);
      } else {
        copy(file, d);
      }
    }
    y.close();
  }
View Full Code Here

      // do it
      final ZipFile zipFile = new ZipFile(archive);
      final Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zipFile.entries();

      // progress
      YProgressWindowRepeat y = new YProgressWindowRepeat(I18N.t("Entpacke {0} nach", archive.getName()), "archive_folder");

      final byte[] buffer = new byte[16384];
      int len;
      while (entries.hasMoreElements()) {
        // update progress

        final ZipEntry entry = entries.nextElement();

        final String entryFileName = entry.getName();

        final File dir = buildDirectoryHierarchyFor(entryFileName, destDir);
        if (!dir.exists()) {
          dir.mkdirs();
        }

        y.setNote(dir.getAbsolutePath());

        if (!entry.isDirectory()) {
          final BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(new File(destDir, entryFileName)));

          final BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry));

          while ((len = bis.read(buffer)) > 0) {
            bos.write(buffer, 0, len);
          }

          bos.flush();
          bos.close();
          bis.close();
        }
      }

      y.close();
    } catch (final Throwable t) {
      YEx.warn("Error while extract archive from " + archive + " to " + destDir, t);
      erg = false;
    }
View Full Code Here

   * @author http://www.wsoftware.de/practices/file-io.html
   * @param zip
   * @param goal
   */
  public static void packZip(final File dir, final File goal) {
    YProgressWindowRepeat y = new YProgressWindowRepeat(I18N.t("Packe {0} nach {1}", dir, goal.getName()), "archive_setup");
    try {
      int prefixLength;
      ZipOutputStream zipOut;
      prefixLength = dir.getAbsolutePath().length() + 1;
      zipOut = new ZipOutputStream(new FileOutputStream(goal.getAbsolutePath()));
      try {
        createZipFrom(y, zipOut, prefixLength, dir);
      } finally {
        zipOut.close();
      }
    } catch (final Throwable t) {
      YEx.warn("Can not pack zip from " + dir + " to " + goal, t);
    }
    y.close();
  }
View Full Code Here

   * Send feeback to yaams
   *
   * @param data
   */
  public static void sendData(String type, String title, final HashMap<String, String> data) {
    YProgressWindowRepeat y = new YProgressWindowRepeat(I18N.t("Send Data to yaams.de"), "web");

    try {
      File cap = new File(YrgssCore.tmpFolder, "cap.jpg");
      if (cap.exists()) {
        FileHelper.deleteFile(cap);
      }
      // create screenshot
      try {
        BufferedImage bufferedImage = new Robot().createScreenCapture(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize()));
        ImageIO.write(bufferedImage, "jpg", cap);
      } catch (Throwable t) {
        Log.ger.info("Can not create capture " + cap, t);
        FileHelper.deleteFile(cap);
      }

      // add basic data
      data.put("title", title);
      data.put("type", type);
      data.put("yaams", YrgssCore.TITLE);
      data.put("log", FileHelper.readFileToString(Log.file));

      ClientHttpRequest post = new ClientHttpRequest("http://www.yaams.de/file/sendFeedback.php");

      // add files
      post.setParameter("cap", cap);

      // Construct data
      // final StringBuffer send = new StringBuffer("1=1");
      for (final String key : data.keySet()) {
        post.setParameter(key, data.get(key));
      }

      // // data
      // final URL url = new
      // URL("http://www.yaams.de/launcher/feedback.php");
      // final URLConnection conn = url.openConnection();
      // conn.setDoOutput(true);
      // final OutputStreamWriter wr = new
      // OutputStreamWriter(conn.getOutputStream());
      // wr.write(send.toString());
      // wr.flush();
      //
      // Get the response
      final BufferedReader rd = new BufferedReader(new InputStreamReader(post.post()));
      String line;
      final StringBuffer erg = new StringBuffer("");
      while ((line = rd.readLine()) != null) {
        erg.append(line);
      }

      // clean up
      FileHelper.deleteFile(cap);

      // show it & close all
      YDialog.ok(I18N.t("Feedback"), erg.toString(), "monitor");
      // wr.close();
      rd.close();

    } catch (final Throwable t) {
      YEx.info("Can not send feedback to http://www.yaams.de/launcher/feedback.php", t);
    }
    y.close();
  }
View Full Code Here

      // Open file and seek to the end of it.
      file = new RandomAccessFile(dest, "rw");
      file.seek(downloaded);

      final YProgressWindowRepeat p = new YProgressWindowRepeat(I18N.t("Download {0} ({1})", url.toString(),
          FileHelper.humanReadableByteCount(size, false)), "web");
      stream = connection.getInputStream();
      while (status == DOWNLOADING) {
        /*
         * Size buffer according to how much of the file is left to
         * download.
         */
        byte buffer[];
        if (size - downloaded > MAX_BUFFER_SIZE) {
          buffer = new byte[MAX_BUFFER_SIZE];
        } else {
          buffer = new byte[size - downloaded];
        }

        // Read from server into buffer.
        int read = stream.read(buffer);
        if (read == -1)
          break;

        // Write buffer to file.
        file.write(buffer, 0, read);
        downloaded += read;
        if (viewMonitor) {
          p.setNote((I18N.t("{0}% / {1}", Math.round(getProgress()), FileHelper.humanReadableByteCount(downloaded, false))));

        }
        stateChanged();
      }

View Full Code Here

TOP

Related Classes of de.yaams.core.helper.gui.YProgressWindowRepeat

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.