A minimalist Rich Client Platform inspired by Netbeans Platform
Since there is Eclipse RCP and Netbeans Platform for Java, why reinvent the wheel? The reason is simple, there are too huge for basic applications. If all you need is menus, a few docks here and there and your application is not an IDE why go through the long learning curve of Eclipse and Netbeans (they are not intended for IDEs alone) just for an application that requires a few lines of codes.
mvn exec:java -pl rcplite-examples
Add as dependencies
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.github.yemikudaisi:RCP-Lite:master-SNAPSHOT'
annotationProcessor 'com.github.yemikudaisi:RCP-Lite:master-SNAPSHOT'
}
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.yemikudaisi</groupId>
<artifactId>RCP-Lite</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
Add this to the main method of your application
package org.rcplite.examples;
import org.rcplite.api.windows.ShellService;
import org.rcplite.core.RcpApplication;
import org.rcplite.core.config.PlatformShellConfiguration;
import javax.swing.SwingUtilities;
public class Quickstart {
public static void main(String[] args) {
RcpApplication app = new RcpApplication();
app.getShellConfiguration()
.setShowToolboxOnStartup(false)
.setTitle("RCP Lite")
.setMaximizeOnStartup(true)
.setPreferredLeftWindoWidth(0.15f) // Specifies width of the Tab window to the left
.setPreferredRightWindowWidth(0.18f) // Specifies width of the Tab window to the right
.setPreferredBottomWindowHeight(0.2f); // Specifies width of the Tab bottom (log) window
app.start();
}
}
Now, when you run your application you should see a pretty empty window with some basic menu item as shown below.
RCP lite allows you to build you application by composing concerns as separate tools. This provides a convenient way to separate code for various working parts of you application as tools.
For example, below is a very basic tool:
package org.rcplite.sample.foo;
import org.rcplite.platform.modules.Tool;
import org.rcplite.platform.processing.ServiceProvider;
import org.rcplite.platform.utils.ImageManager;
import org.rcplite.platform.windows.Perspective;
import javax.swing.*;
@ServiceProvider(Tool.class)
public class FooTool implements Tool {
@Override
public String getTitle() {
return "Foo Tool";
}
@Override
public Icon getIcon() {
return ImageManager.getImageIcon("/foo.png");
}
@Override
public Perspective getPerspective() {
return new Perspective();
}
}
Asides inheriting the Tool
class RCP Lite determines that the above class is a tool by use of annotations. In the above example notice the @ServiceProvider(Tool.class)
annotation. It enables RCP Lite to add the Tool to its Tool Explorer and Menu in it's shell.
Components are displayed as tabs in the shell of the application depending on the position specified. To create a component simply inherit from ViewComponent
class:
public class FooDocumentComponent extends ViewComponent {
public FooDocumentComponent() {
setTitle("Foo Document");
setIcon(ImageManager.getImageIcon("/foo.png"));
setLayout(new BorderLayout());
add(new JLabel("Foo Document"), BorderLayout.CENTER);
}
}
Components can be position in one of 4 places:
- Document (Center)
- Explorer (Left)
- Property (Right)
- Output (Bottom)
To diplay a Component as an explorer component, add the following annotation above the class
@ViewComponent.Configuration(
position = ComponentPosition.EXPLORER
)
other position can be configured as:
position = ComponentPosition.DOCUMENT
position = ComponentPosition.PROPERTY
position = ComponentPosition.OUTPUT
The RCP Lite Perspective
is the name given to an initial collection and arrangement of Components
for a given Tool
. The shell can have multiple perspectives for each registered Tool
but only one perspective is active at any point of time. The active perspective controls what components are displayed in the tabs in shell.
The RCP Lite event aggregator allows tools and components to publish and handle events using interfaces so that they don't have to know about each other existence and (most importantly) avoid dependencies across tools.
RCP Lite ships with a log panel position in the output area (Bottom) of the shell.....
TODO
- Bug Fixes
- Complete documentation
This framework should not be used in a production environment at this stage.