Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refact: simplified generatePDF and displayPDF #385

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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