Skip to content

Commit

Permalink
refact: simplified generatePDF and displayPDF (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
asmfstatoil authored Apr 7, 2022
1 parent 022bc2c commit 361aba7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
6 changes: 4 additions & 2 deletions src/main/java/neqsim/thermo/system/SystemInterface.java
Original file line number Diff line number Diff line change
Expand Up @@ -2273,14 +2273,16 @@ public double calcBeta() throws neqsim.util.exception.IsNaNException,
* generatePDF.
* </p>
*/
public void generatePDF();
public neqsim.dataPresentation.iTextPDF.PdfCreator generatePDF();

/**
* <p>
* displayPDF.
* </p>
*/
public void displayPDF();
default public void displayPDF() {
generatePDF().openPDF();
}

/**
* <p>
Expand Down
12 changes: 2 additions & 10 deletions src/main/java/neqsim/thermo/system/SystemThermo.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ abstract class SystemThermo implements SystemInterface {
protected neqsim.standards.StandardInterface standard = null;
protected InterphasePropertiesInterface interfaceProp = null;
private boolean multiphaseWaxCheck = false;
Object pdfDocument = null;
private boolean forcePhaseTypes = false;
static Logger logger = LogManager.getLogger(SystemThermo.class);

Expand Down Expand Up @@ -4011,7 +4010,7 @@ public neqsim.standards.StandardInterface getStandard(String standardName) {

/** {@inheritDoc} */
@Override
public void generatePDF() {
public neqsim.dataPresentation.iTextPDF.PdfCreator generatePDF() {
neqsim.dataPresentation.iTextPDF.PdfCreator pdfDocument = null;
pdfDocument = new neqsim.dataPresentation.iTextPDF.PdfCreator();
pdfDocument.getDocument().addTitle("NeqSim Thermo Simulation Report");
Expand Down Expand Up @@ -4051,14 +4050,7 @@ public void generatePDF() {
logger.error("error", e);
}
pdfDocument.getDocument().close();
this.pdfDocument = pdfDocument;
}

/** {@inheritDoc} */
@Override
public void displayPDF() {
generatePDF();
((neqsim.dataPresentation.iTextPDF.PdfCreator) pdfDocument).openPDF();
return pdfDocument;
}

/**
Expand Down

0 comments on commit 361aba7

Please sign in to comment.