Exemplo n.º 1
0
 public void refresh() {
   if (SettingsHandler.getGame() != theGameMode) {
     theSheetDir =
         SettingsHandler.getPcgenPreviewDir()
             + File.separator
             + SettingsHandler.getGame().getPreviewDir();
     buildCombo();
   }
 }
Exemplo n.º 2
0
  CharacterSheetSelectionPanel(final InfoCharacterSheet aParent) {
    theParent = aParent;

    theGameMode = SettingsHandler.getGame();

    theSheetDir =
        SettingsHandler.getPcgenPreviewDir()
            + File.separator
            + SettingsHandler.getGame().getPreviewDir();
    initComponents();
  }
Exemplo n.º 3
0
  @Override
  protected void updateCharacterInfo() {
    if (theHandler == null) {
      return;
    }

    if (theSelectPanel != null) {
      theSelectPanel.refresh();
    }

    final StringWriter out = new StringWriter();
    final BufferedWriter buf = new BufferedWriter(out);
    theHandler.write(getPc(), buf);
    final String genText = out.toString().replace("preview_color.css", getColorCSS());
    ByteArrayInputStream instream = new ByteArrayInputStream(genText.getBytes());
    try {
      final URI root =
          new URI(
              "file",
              SettingsHandler.getPcgenPreviewDir().getAbsolutePath().replaceAll("\\\\", "/"),
              null);
      final Document doc =
          theDocBuilder.parse(new InputSourceImpl(instream, root.toString(), "UTF-8"));
      theSheetPanel.setDocument(doc, theRendererContext);
    } catch (Throwable e) {
      final String errorMsg = "<html><body>Unable to process sheet<br>" + e + "</body></html>";
      instream = new ByteArrayInputStream(errorMsg.getBytes());
      try {
        final Document doc = theDocBuilder.parse(instream);
        theSheetPanel.setDocument(doc, theRendererContext);
      } catch (Exception ex) {
        ex.printStackTrace();
      }
      Logging.errorPrint("Unable to process sheet: ", e);
    }
  }