Skip to content

Commit

Permalink
build javadoc
Browse files Browse the repository at this point in the history
  • Loading branch information
LabyStudio committed Mar 3, 2021
1 parent 88cd518 commit 2f113c5
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 7 deletions.
13 changes: 13 additions & 0 deletions build.gradle
Expand Up @@ -28,4 +28,17 @@ jar {
from {
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
}
}

task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
classifier = 'javadoc'
}
task packageSources(type: Jar, dependsOn: 'classes') {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives packageJavadoc
archives packageSources
}
Expand Up @@ -40,6 +40,7 @@ public class DesktopModules {
* Create an instance of the DesktopModules application and load all addons using the given classloader
*
* @param classLoader Class loader to use for the addons
* @throws Exception exception during initialization of the class
*/
public DesktopModules(URLClassLoader classLoader) throws Exception {
this.classLoader = classLoader;
Expand Down
24 changes: 20 additions & 4 deletions src/core/java/de/labystudio/desktopmodules/core/addon/Addon.java
@@ -1,10 +1,18 @@
package de.labystudio.desktopmodules.core.addon;

import com.google.gson.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import de.labystudio.desktopmodules.core.DesktopModules;
import de.labystudio.desktopmodules.core.module.Module;

import java.io.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

Expand All @@ -30,6 +38,7 @@ public abstract class Addon {
* Don't register any modules here!
*
* @param desktopModules DesktopModules core instance
* @throws Exception Possible exception during pre initialization
*/
public void onPreInitialize(DesktopModules desktopModules) throws Exception {
this.desktopModules = desktopModules;
Expand All @@ -39,16 +48,22 @@ public void onPreInitialize(DesktopModules desktopModules) throws Exception {
* Called when loading the addon classes into the application.
* This event has access to the config object of the addon.
* Register your modules in this event!
*
* @throws Exception exception during initialization
*/
public abstract void onInitialize() throws Exception;

/**
* Called when enabling on of your modules
*
* @throws Exception exception during enable
*/
public abstract void onEnable() throws Exception;

/**
* Called when all modules are disabled
*
* @throws Exception exception during disable
*/
public abstract void onDisable() throws Exception;

Expand Down Expand Up @@ -79,7 +94,7 @@ public void onModuleVisibilityChanged(Module<? extends Addon> module, boolean en
}

// Call module enable and disable event
if(enabled) {
if (enabled) {
module.onEnable();
} else {
module.onDisable();
Expand Down Expand Up @@ -162,8 +177,9 @@ public File getConfigFile() {
* Register a module for this addon
*
* @param moduleClass The class of the module to register
* @param <T> The addon class of the module
* @return The loaded module
* @throws Exception
* @throws Exception module loading exception
*/
public <T> T registerModule(Class<? extends Module> moduleClass) throws Exception {
return (T) this.desktopModules.getSourceLoader().loadModule(this, moduleClass);
Expand Down
Expand Up @@ -50,6 +50,7 @@ public class SourceLoader {
*
* @param desktopModules Main instance for texture loader and class loader
* @param workingDirectory Home directory of the application to load the addons folder
* @throws NoSuchMethodException exception caused by finding the add URL method of the class loader
*/
public SourceLoader(DesktopModules desktopModules, File workingDirectory) throws NoSuchMethodException {
this.desktopModules = desktopModules;
Expand Down Expand Up @@ -220,7 +221,7 @@ public Addon registerAddon(String addonClassName) throws Exception {
* @param addon Addon of the module
* @param moduleClass Module class to load
* @return The loaded module instance
* @throws Exception
* @throws Exception exception during module loading
*/
public Module<? extends Addon> loadModule(Addon addon, Class<? extends Module> moduleClass) throws Exception {
// Create instance of the module
Expand Down
Expand Up @@ -4,7 +4,7 @@
import de.labystudio.desktopmodules.core.renderer.font.StringAlignment;
import de.labystudio.desktopmodules.core.renderer.font.StringEffect;

import java.awt.*;
import java.awt.Color;
import java.awt.image.BufferedImage;

/**
Expand Down Expand Up @@ -43,7 +43,7 @@ public interface IRenderContext {
* @param y Top edge position relative to the module position
* @param width Width of the rectangle
* @param height Height of the rectangle
* @param color
* @param color Color of the rectangle
*/
void drawRectWH(double x, double y, double width, double height, Color color);

Expand Down Expand Up @@ -72,6 +72,7 @@ public interface IRenderContext {
* @param alignment Text alignment option
* @param effect Text effect option
* @param color Text color option
* @param font The font of the text
*/
void drawString(String text, double x, double y, StringAlignment alignment, StringEffect effect, Color color, Font font);

Expand All @@ -87,6 +88,7 @@ public interface IRenderContext {
* @param rightBound String alignment from right or left
* @param effect Text effect option
* @param color Text color option
* @param font The font of the text
*/
void drawString(String text, double width, double offsetX, double y, boolean rightBound, StringEffect effect, Color color, Font font);

Expand Down

0 comments on commit 2f113c5

Please sign in to comment.