Skip to content

Commit

Permalink
[RELEASE] iText 7 RUPS 7.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
iText-CI committed Jun 20, 2022
2 parents 01125e3 + 2516a1c commit 9808fb5
Show file tree
Hide file tree
Showing 149 changed files with 8,883 additions and 1,864 deletions.
19 changes: 12 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.itextpdf</groupId>
<artifactId>root</artifactId>
<version>7.2.2</version>
<version>7.2.3</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -55,7 +55,7 @@
<dom4j.version>2.1.3</dom4j.version>
<itext.version>${project.parent.version}</itext.version>
<launch4j.version>1.7.25</launch4j.version>
<logback.version>1.2.10</logback.version>
<logback.version>1.2.11</logback.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.projectName>RUPS</sonar.projectName>
</properties>
Expand All @@ -71,6 +71,11 @@
<artifactId>logback-core</artifactId>
<version>${logback.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>69.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>io</artifactId>
Expand All @@ -86,11 +91,6 @@
<artifactId>dom4j</artifactId>
<version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
<version>69.1</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>pdftest</artifactId>
Expand Down Expand Up @@ -127,6 +127,11 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>5.1.4</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${assembly-plugin.version}</version>
Expand Down
92 changes: 46 additions & 46 deletions src/main/java/com/itextpdf/rups/Rups.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,78 +43,78 @@ This file is part of the iText (R) project.
package com.itextpdf.rups;

import com.itextpdf.kernel.actions.data.ITextCoreProductData;
import com.itextpdf.kernel.utils.CompareTool;
import com.itextpdf.rups.controller.IRupsController;
import com.itextpdf.rups.controller.RupsController;
import com.itextpdf.rups.model.LoggerHelper;
import com.itextpdf.rups.view.Language;
import com.itextpdf.rups.view.RupsDropTarget;
import com.itextpdf.rups.view.RupsMenuBar;
import com.itextpdf.rups.view.RupsTabbedPane;
import com.itextpdf.rups.view.icons.FrameIconUtil;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.File;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;

public class Rups {

private RupsController controller;

private volatile CompareTool.CompareResult lastCompareResult = null;

protected Rups() {
this.controller = null;
}

protected void setController(RupsController controller) {
this.controller = controller;
}

/**
* Initializes the main components of the Rups application.
*
* @param f a file that should be opened on launch
* @param onCloseOperation the close operation
* @param f a file that should be opened on launch
*/
public static void startNewApplication(final File f, final int onCloseOperation) {
final Rups rups = new Rups();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
JFrame frame = new JFrame();
// defines the size and location
initFrameDim(frame);
RupsController controller = new RupsController(frame.getSize(), frame, false);
initApplication(frame, controller, onCloseOperation);
rups.setController(controller);
if (null != f && f.canRead()) {
rups.loadDocumentFromFile(f, false);
}
public static void startNewApplication(final File f) {
SwingUtilities.invokeLater(() -> {
setLookandFeel();
final IRupsController rupsController = initApplication(new JFrame());
if (f != null) {
loadDocumentFromFile(rupsController, f);
}
});
}

public void loadDocumentFromFile(final File f, final boolean readOnly) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
controller.loadFile(f, readOnly);
}
});
static void loadDocumentFromFile(IRupsController rupsController, File f) {
SwingUtilities.invokeLater(() -> rupsController.openNewFile(f));
}

static void initApplication(JFrame frame, RupsController controller, final int onCloseOperation) {
// title bar
frame.setTitle("iText RUPS " + ITextCoreProductData.getInstance().getVersion());
frame.setIconImages(FrameIconUtil.loadFrameIcons());
frame.setDefaultCloseOperation(onCloseOperation);
// the content
frame.setJMenuBar(controller.getMenuBar());
frame.getContentPane().add(controller.getMasterComponent(), java.awt.BorderLayout.CENTER);
frame.setVisible(true);
static void setLookandFeel() {
try {
UIManager.setLookAndFeel(RupsConfiguration.INSTANCE.getLookAndFeel());
} catch (
ClassNotFoundException | InstantiationException |
IllegalAccessException | UnsupportedLookAndFeelException e) {
LoggerHelper.error(Language.ERROR_LOOK_AND_FEEL.getString(), e, Rups.class);
}
}

static void initFrameDim(JFrame frame) {
static IRupsController initApplication(JFrame frame) {
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
frame.setSize((int) (screen.getWidth() * .90), (int) (screen.getHeight() * .90));
frame.setLocation((int) (screen.getWidth() * .05), (int) (screen.getHeight() * .05));
frame.setResizable(true);
}

// title bar
frame.setTitle(
String.format(Language.TITLE.getString(), ITextCoreProductData.getInstance().getVersion()));
frame.setIconImages(FrameIconUtil.loadFrameIcons());
frame.setDefaultCloseOperation(RupsConfiguration.INSTANCE.getCloseOperation());

final RupsTabbedPane rupsTabbedPane = new RupsTabbedPane();
final RupsController rupsController = new RupsController(screen, rupsTabbedPane);
final RupsMenuBar rupsMenuBar = new RupsMenuBar(rupsController);
rupsController.addObserver(rupsMenuBar);

frame.setDropTarget(new RupsDropTarget(rupsController));
frame.setJMenuBar(rupsMenuBar);

frame.getContentPane().add(rupsController.getMasterComponent(), BorderLayout.CENTER);
frame.setVisible(true);

return rupsController;
}
}
Loading

0 comments on commit 9808fb5

Please sign in to comment.