-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vuecket-extensions (issue #1). Markdown, fullcalendar, chat
- Loading branch information
1 parent
af6403e
commit fa9d975
Showing
10 changed files
with
506 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<?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> | ||
<artifactId>vuecket-parent</artifactId> | ||
<groupId>org.orienteer.vuecket</groupId> | ||
<version>1.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>vuecket-extensions</artifactId> | ||
|
||
<name>vuecket-extensions</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.orienteer.vuecket</groupId> | ||
<artifactId>vuecket</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.eclipse.jetty</groupId> | ||
<artifactId>jetty-maven-plugin</artifactId> | ||
<version>${jetty9.version}</version> | ||
<configuration> | ||
<systemProperties> | ||
<systemProperty> | ||
<name>maven.project.build.directory.test-classes</name> | ||
<value>${project.build.directory}/test-classes</value> | ||
</systemProperty> | ||
</systemProperties> | ||
<useProvidedScope>true</useProvidedScope> | ||
<useTestScope>true</useTestScope> | ||
<supportedPackagings> | ||
<supportedPackaging>jar</supportedPackaging> | ||
</supportedPackagings> | ||
<jettyXml>${project.basedir}/../vuecket-demo/src/test/jetty/jetty.xml,${project.basedir}/../vuecket-demo/src/test/jetty/jetty-http.xml</jettyXml> | ||
<webApp> | ||
<descriptor>${project.basedir}/src/test/jetty/web.xml</descriptor> | ||
<contextPath>/</contextPath> | ||
<resourceBase>src/test/resources</resourceBase> | ||
<containerIncludeJarPattern>^$</containerIncludeJarPattern> | ||
<webInfIncludeJarPattern>^$</webInfIncludeJarPattern> | ||
</webApp> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-site-plugin</artifactId> | ||
<version>3.7.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
<version>3.0.0</version> | ||
</plugin> | ||
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.8.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.22.1</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-install-plugin</artifactId> | ||
<version>2.5.2</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-deploy-plugin</artifactId> | ||
<version>2.8.2</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
</build> | ||
|
||
<reporting> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-project-info-reports-plugin</artifactId> | ||
</plugin> | ||
</plugins> | ||
</reporting> | ||
</project> |
112 changes: 112 additions & 0 deletions
112
vuecket-extensions/src/main/java/org/orienteer/vuecket/extensions/FullCalendar.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
package org.orienteer.vuecket.extensions; | ||
|
||
import java.util.Date; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.apache.wicket.markup.head.CssHeaderItem; | ||
import org.apache.wicket.markup.head.IHeaderResponse; | ||
import org.apache.wicket.markup.head.JavaScriptHeaderItem; | ||
import org.apache.wicket.model.IModel; | ||
import org.apache.wicket.model.Model; | ||
import org.apache.wicket.util.io.IClusterable; | ||
import org.orienteer.vuecket.VueComponent; | ||
import org.orienteer.vuecket.VueSettings; | ||
import org.orienteer.vuecket.VueSettings.INPMPackageProvider; | ||
import org.orienteer.vuecket.descriptor.VueNpm; | ||
import org.orienteer.vuecket.method.IVuecketMethod.Context; | ||
import org.orienteer.vuecket.method.JsFunction; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
|
||
import lombok.Data; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
import org.orienteer.vuecket.method.VueMethod; | ||
import org.orienteer.vuecket.util.VuecketUtils; | ||
|
||
/** | ||
* Vuecket component for FullCalendar js library | ||
* https://fullcalendar.io/docs/vue | ||
*/ | ||
@VueNpm(packageName = "@fullcalendar/vue", path = "dist/main.global.js", enablement = "") | ||
@Slf4j | ||
public class FullCalendar extends VueComponent<FullCalendar.Options> { | ||
|
||
/** | ||
* Class for passing infor about events requests | ||
*/ | ||
@Data | ||
public static class EventsRequestInfo implements IClusterable { | ||
private Date start; | ||
private Date end; | ||
private String startStr; | ||
private String endStr; | ||
private String timeZone; | ||
} | ||
|
||
/** | ||
* Container for events data | ||
*/ | ||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public static class Event implements IClusterable { | ||
private String id; | ||
private String groupId; | ||
private Boolean allDay; | ||
private Date start; | ||
private Date end; | ||
private String title; | ||
private String url; | ||
} | ||
|
||
/** | ||
* Options for FullCalendar | ||
*/ | ||
@Data | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public static class Options implements IClusterable { | ||
private Object events; | ||
private Object headerToolbar = VuecketUtils.toJsonNode("{ center: 'dayGridMonth,timeGridWeek' }"); | ||
|
||
public Options(Object events) { | ||
this.events = events; | ||
} | ||
|
||
public Options(FullCalendar calendar) { | ||
this(JsFunction.call(calendar, "lookupEvents")); | ||
} | ||
} | ||
|
||
public FullCalendar(String id) { | ||
super(id); | ||
setDefaultModel(Model.of(new Options(this))); | ||
} | ||
|
||
public FullCalendar(String id, IModel<Options> optionsModel) { | ||
super(id, optionsModel); | ||
} | ||
|
||
@Override | ||
protected void onInitialize() { | ||
super.onInitialize(); | ||
dataFiberBuilder("options").bindToProperty().init().build(); | ||
} | ||
|
||
@Override | ||
public void renderHead(IHeaderResponse response) { | ||
INPMPackageProvider provider = VueSettings.get().getNpmPackageProvider(); | ||
response.render(CssHeaderItem.forReference(provider.provide("fullcalendar", "main.css"))); | ||
response.render(JavaScriptHeaderItem.forReference(provider.provide("fullcalendar", "main.min.js"), "fullcalendar")); | ||
super.renderHead(response); | ||
} | ||
|
||
@VueMethod("lookupEvents") | ||
public final List<Event> lookupEvents(Context ctx, EventsRequestInfo eventsRequestInfo) { | ||
return lookupEvents(eventsRequestInfo.getStart(), eventsRequestInfo.getEnd()); | ||
} | ||
|
||
public List<Event> lookupEvents(Date start, Date end) { | ||
return new ArrayList<FullCalendar.Event>(); | ||
} | ||
} |
Oops, something went wrong.