Beispiel #1
0
  /**
   * DOCUMENT ME!
   *
   * @param ae DOCUMENT ME!
   */
  public void actionPerformed(ActionEvent ae) {
    ReportDocument doc = getEditor().getDocument();

    if (doc != null) {
      ReportChooser chooser = ReportChooser.getInstance();
      File docFile = ReportDocument.getCachedFile(doc);

      if (docFile == null) {
        chooser.setSelectedFile(null);
        chooser.setDocument(doc);
        chooser.showSaveDialog();
        docFile = ReportDocument.getCachedFile(doc);
      } else {
        try {
          ReportDocument.save(doc, docFile, false);
        } catch (Exception e) {
          MessageBox.error(
              Main.getInstance(), App.messages.getString("res.568") + Util.toString(e));
          Util.debug("ZSaveAction", e);
        }
      }

      Main.getInstance().save(doc, docFile);
    }
  }
Beispiel #2
0
  /**
   * DOCUMENT ME!
   *
   * @param doc DOCUMENT ME!
   * @param queryAsClosed DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  public static Frame newFrame(ReportDocument doc, boolean queryAsClosed) {
    Main mainFrame = new Main();

    mainFrame.pack();
    mainFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);

    if (doc != null) {
      mainFrame.createEditor(
          doc,
          ReportDocument.getCachedFile(doc).getName(),
          ReportDocument.getCachedFile(doc).getAbsolutePath(),
          true);
    }

    return mainFrame;
  }
Beispiel #3
0
  /**
   * DOCUMENT ME!
   *
   * @param args DOCUMENT ME!
   */
  public static void main(String[] args) {
    String working_dir = System.getProperty("user.dir");
    boolean nosplash = false;
    boolean nolookandfeel = false;

    String doc = null;

    if ((args != null) && (args.length > 0)) {
      for (int i = 0; i < args.length; i++) {
        if (args[i].startsWith("-nosplash")) {
          nosplash = true;
        } else if (args[i].startsWith("-nolookandfeel")) {
          nolookandfeel = true;
        } else if (args[i].startsWith("-working_dir:")) {
          working_dir = args[i].substring("-working_dir:".length());
        } else if (args[i].startsWith("-doc:")) {
          doc = args[i].substring("-doc:".length());
        }
      }
    }

    System2.setUserPath(working_dir);

    if (!nolookandfeel) {
      // setLookAndFeel();
    }

    loadMru();

    if (!nosplash) {
      splash = new SplashWindow(Util.getIcon("/jatools/icons/splash.jpg"));
    }

    JDialog chooser = null;
    Main m = null;

    if (doc != null) {
      try {
        m = (Main) newFrame(ReportDocument.load(new File(doc)), true);
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {
      m = (Main) newFrame(null, true);
    }

    m.show();

    if (!nosplash) {
      splash.setVisible(false);
    }

    if (chooser != null) {
      chooser.show();
    }
  }
Beispiel #4
0
  /**
   * DOCUMENT ME!
   *
   * @param doc DOCUMENT ME!
   * @param context DOCUMENT ME!
   */
  public void format(ReportDocument doc, BuilderContext context) {
    Page page = new Page();

    PagePanel header = new PagePanel();
    header.setHeight(80);

    page.setHeader(header);

    PagePanel footer = new PagePanel();
    footer.setHeight(280);

    page.setFooter(footer);

    PagePanel body = new PagePanel();

    page.setBody(body);

    doc.setPage(page);

    doc.setNodeSource(getRootNodeSource1());
  }