Skip to content

RUPS: Plugin System #87

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions itext-rups-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.itextpdf</groupId>
<artifactId>itext-rups-parent</artifactId>
<version>7.2.4-SNAPSHOT</version>
</parent>

<artifactId>itext-rups-api</artifactId>

<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>kernel</artifactId>
<version>${itext.version}</version>
</dependency>

</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.itextpdf.rups.api;

public abstract class AbstractRupsPlugin implements IRupsPlugin {

protected IPdfController pdfController;

@Override
public void setIPdfController(IPdfController pdfController) {
this.pdfController = pdfController;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2022 iText Group NV
Authors: iText Software.

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License version 3
as published by the Free Software Foundation with the addition of the
following permission added to Section 15 as permitted in Section 7(a):
FOR ANY PART OF THE COVERED WORK IN WHICH THE COPYRIGHT IS OWNED BY
ITEXT GROUP. ITEXT GROUP DISCLAIMS THE WARRANTY OF NON INFRINGEMENT
OF THIRD PARTY RIGHTS

This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program; if not, see http://www.gnu.org/licenses or write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA, 02110-1301 USA, or download the license from the following URL:
http://itextpdf.com/terms-of-use/

The interactive user interfaces in modified source and object code versions
of this program must display Appropriate Legal Notices, as required under
Section 5 of the GNU Affero General Public License.

In accordance with Section 7(b) of the GNU Affero General Public License,
a covered work must retain the producer line in every PDF that is created
or manipulated using iText.

You can be released from the requirements of the license by purchasing
a commercial license. Buying such a license is mandatory as soon as you
develop commercial activities involving the iText software without
disclosing the source code of your own applications.
These activities include: offering paid services to customers as an ASP,
serving PDFs on the fly in a web application, shipping iText with a closed
source product.

For more information, please contact iText Software Corp. at this
address: [email protected]
*/
package com.itextpdf.rups.api;

import java.io.File;
import java.util.Collection;

/**
* The controller in charge of handling PDF file operations, such as opening a new file, closing the current file, ...
*/
public interface IPdfController {
/**
* Returns the currently loaded File.
*
* @return IPdfFile
*/
IPdfFile getPdfFile();

/**
* Gets all open PDF files.
*
* @return Collection<IPdfFile>
*/
Collection<IPdfFile> getAllOpenPdfFiles();

/**
* Opens a new File in RUPS.
*
* @param file the file to be opened.
*/
void openNewFile(File file);

/**
* Closes the currently opened file.
*/
void closeCurrentFile();
}
30 changes: 30 additions & 0 deletions itext-rups-api/src/main/java/com/itextpdf/rups/api/IPdfFile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.itextpdf.rups.api;

import com.itextpdf.kernel.pdf.PdfDocument;

import java.io.File;

public interface IPdfFile {

/**
* Getter for iText's PdfDocument object.
*
* @return a PdfDocument object
*/
PdfDocument getPdfDocument();

/**
* Getter for the filename
*
* @return the original filename
* @since 5.0.3
*/
String getFileName();

/**
* Returns the directory of the PdfFile instance.
*
* @return the directory of the opened file
*/
File getDirectory();
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ This file is part of the iText (R) project.
For more information, please contact iText Software Corp. at this
address: [email protected]
*/
package com.itextpdf.rups.controller;

import com.itextpdf.rups.model.PdfFile;
package com.itextpdf.rups.api;

import java.awt.Component;
import java.io.File;

/**
* The controller in charge of the application. To view the specific tab controllers, look at the RupsInstanceController
Expand All @@ -59,23 +56,4 @@ public interface IRupsController {
* @return Component, typically a JTabbedPane
*/
Component getMasterComponent();

/**
* Returns the currently loaded File.
*
* @return PdfFile
*/
PdfFile getCurrentFile();

/**
* Opens a new File in RUPS.
*
* @param file the file to be opened.
*/
void openNewFile(File file);

/**
* Closes the currently opened file.
*/
void closeCurrentFile();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.itextpdf.rups.api;

public interface IRupsPlugin {

boolean initialize(RupsPluginContext rupsPluginContext);

void setIPdfController(IPdfController pdfController);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package com.itextpdf.rups.api;

import javax.swing.JMenuBar;

public class RupsPluginContext {
private JMenuBar menuBar;
private IRupsController rupsController;
private IPdfController pdfController;

public JMenuBar getMenuBar() {
return menuBar;
}

public RupsPluginContext setMenuBar(JMenuBar rupsMenuBar) {
this.menuBar = rupsMenuBar;
return this;
}

public IRupsController getRupsController() {
return rupsController;
}

public RupsPluginContext setRupsController(IRupsController rupsController) {
this.rupsController = rupsController;
return this;
}

public IPdfController getPdfController() {
return pdfController;
}

public RupsPluginContext setPdfController(IPdfController pdfController) {
this.pdfController = pdfController;
return this;
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading