Skip to content

Commit

Permalink
Deleted the obsolete module Pages.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Aug 8, 2015
1 parent 3f57964 commit f91ee86
Show file tree
Hide file tree
Showing 19 changed files with 35 additions and 552 deletions.
1 change: 0 additions & 1 deletion pom.xml
Expand Up @@ -114,7 +114,6 @@
<module>rapidoid-dispatch</module>
<module>rapidoid-html</module>
<module>rapidoid-widget</module>
<module>rapidoid-pages</module>
<module>rapidoid-oauth</module>
<module>rapidoid-app</module>
<module>rapidoid-extras</module>
Expand Down
9 changes: 7 additions & 2 deletions rapidoid-app/pom.xml
Expand Up @@ -24,12 +24,17 @@
</dependency>
<dependency>
<groupId>org.rapidoid</groupId>
<artifactId>rapidoid-rql</artifactId>
<artifactId>rapidoid-widget</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.rapidoid</groupId>
<artifactId>rapidoid-templates-mustache</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.rapidoid</groupId>
<artifactId>rapidoid-pages</artifactId>
<artifactId>rapidoid-rql</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
Expand Down
4 changes: 2 additions & 2 deletions rapidoid-app/src/main/java/org/rapidoid/app/AppGUI.java
Expand Up @@ -8,8 +8,8 @@
import org.rapidoid.lambda.Predicate;
import org.rapidoid.model.Items;
import org.rapidoid.model.impl.DbItems;
import org.rapidoid.pages.PageGUI;
import org.rapidoid.plugins.entities.Entities;
import org.rapidoid.widget.BootstrapWidgets;
import org.rapidoid.widget.GridWidget;

/*
Expand All @@ -34,7 +34,7 @@

@Authors("Nikolche Mihajlovski")
@Since("2.0.0")
public class AppGUI extends PageGUI {
public class AppGUI extends BootstrapWidgets {

public static <T> Items all(Class<T> type) {
return new DbItems<T>(type, null, Beany.<T> comparator("id"));
Expand Down
7 changes: 7 additions & 0 deletions rapidoid-app/src/main/java/org/rapidoid/app/AppHandler.java
Expand Up @@ -55,6 +55,8 @@
@Since("2.0.0")
public class AppHandler implements Handler {

private static final String PAGE_RELOAD = "<h2>&nbsp;Reloading...</h2><script>location.reload();</script>";

private static final Pattern DIRECTIVE = Pattern.compile("\\s*\\Q<!--\\E\\s+([\\w\\+\\-\\, ]+)\\s+\\Q-->\\E\\s*");

private CustomizableClassLoader classLoader;
Expand Down Expand Up @@ -369,4 +371,9 @@ public DispatchResult on(HttpExchange x, PojoDispatcher dispatcher, String event
return doDispatch(dispatcher, req);
}

public static final void reload(HttpExchange x) {
Map<String, String> sel = U.map("body", PAGE_RELOAD);
x.writeJSON(U.map("_sel_", sel));
}

}
10 changes: 1 addition & 9 deletions rapidoid-app/src/main/java/org/rapidoid/app/Apps.java
Expand Up @@ -38,7 +38,6 @@
import org.rapidoid.http.HttpExchange;
import org.rapidoid.log.Log;
import org.rapidoid.oauth.OAuth;
import org.rapidoid.pages.HttpExchangeHolder;
import org.rapidoid.plugins.Plugins;
import org.rapidoid.plugins.db.DBPlugin;
import org.rapidoid.plugins.entities.EntitiesPlugin;
Expand Down Expand Up @@ -189,14 +188,7 @@ public static void terminate() {
}

public static Object instantiate(Class<?> appClass, HttpExchange x) {
return appClass != null ? wireExchange(Cls.newInstance(appClass), x) : new Object();
}

public static <T> T wireExchange(T target, HttpExchange x) {
if (target instanceof HttpExchangeHolder) {
((HttpExchangeHolder) target).setHttpExchange(x);
}
return target;
return appClass != null ? Cls.newInstance(appClass) : new Object();
}

}
13 changes: 1 addition & 12 deletions rapidoid-app/src/main/java/org/rapidoid/app/GUI.java
Expand Up @@ -24,12 +24,11 @@
import org.rapidoid.annotation.Local;
import org.rapidoid.annotation.Since;
import org.rapidoid.http.HttpExchange;
import org.rapidoid.pages.HttpExchangeHolder;
import org.rapidoid.util.U;

@Authors("Nikolche Mihajlovski")
@Since("2.0.0")
public abstract class GUI extends AppGUI implements HttpExchangeHolder {
public abstract class GUI extends AppGUI {

@Local
public String modal = null;
Expand Down Expand Up @@ -60,16 +59,6 @@ public void onBack(HttpExchange x) {
x.goBack(1);
}

@Override
public HttpExchange getHttpExchange() {
return ctx;
}

@Override
public void setHttpExchange(HttpExchange x) {
this.ctx = x;
}

protected HttpExchange ctx() {
U.notNull(ctx, "App context is not initialized yet!");
return ctx;
Expand Down
@@ -1,4 +1,4 @@
package org.rapidoid.pages.impl;
package org.rapidoid.app.builtin;

/*
* #%L
Expand Down
Expand Up @@ -24,7 +24,6 @@
import org.rapidoid.annotation.Since;
import org.rapidoid.app.GUI;
import org.rapidoid.html.Tag;
import org.rapidoid.log.Log;
import org.rapidoid.plugins.db.DB;
import org.rapidoid.security.annotation.DevMode;

Expand All @@ -35,27 +34,14 @@ public class DeleteAllDataScreenBuiltIn extends GUI {

public Object content() {
Tag caption = titleBox("Debug Mode - Delete All data");
// TODO ask "Are you sure you want to delete all data in the database?"
return div(caption, div(btn("DELETE ALL DATA!").danger().command("DeleteAll"), CANCEL));
}

public void onDeleteAll() {
showModal("confirmDelete");
}

public Tag confirmDelete() {
return modal("Confirm data deletion", h2("Are you sure you want to delete all data in the database?"),
div(YES_DELETE, NO));
}

public void onYesDelete() {
Log.info("yes");
hideModal();
DB.deleteAllData();
ctx().goBack(1);
}

public void onNo() {
hideModal();
}

}
Expand Up @@ -61,19 +61,12 @@ public void onEdit() {
}

public void onDelete() {
showModal("confirmDeletion");
}

public void onYesDelete() {
// TODO ask h4("Are you sure you want to delete the record?"), div(YES_DELETE, CANCEL));
String id = ctx().pathSegment(1);
DB.delete(entityType, id);

hideModal();
ctx().goBack(1);
}

public Tag confirmDeletion() {
return modal("Confirm deletion", h4("Are you sure you want to delete the record?"), div(YES_DELETE, CANCEL));
}

}
27 changes: 0 additions & 27 deletions rapidoid-demo/src/main/java/demo/taskplanner/gui/About.java
Expand Up @@ -26,7 +26,6 @@
import org.rapidoid.annotation.Web;
import org.rapidoid.app.GUI;
import org.rapidoid.html.Tag;
import org.rapidoid.log.Log;
import org.rapidoid.plugins.db.DB;
import org.rapidoid.security.annotation.CanInsert;
import org.rapidoid.util.U;
Expand Down Expand Up @@ -54,14 +53,6 @@ public Object content() {
return arr(mix, tx, dlg, ADD);
}

public Tag addBook() {
return modal("Add new book", create(new Book()), div(SAVE, CANCEL));
}

public Tag yesNo() {
return modal("Confirm deletion", h1("Are you sure?"), div(YES, NO));
}

@Transaction
public void onTx() {
String id = DB.insert(task());
Expand All @@ -77,22 +68,4 @@ private Task task() {
return task;
}

public void onDialog() {
showModal("yesNo");
}

public void onAdd() {
showModal("addBook");
}

public void onYes() {
Log.info("yes");
hideModal();
}

public void onNo() {
Log.info("no");
hideModal();
}

}
48 changes: 0 additions & 48 deletions rapidoid-pages/pom.xml

This file was deleted.

This file was deleted.

49 changes: 0 additions & 49 deletions rapidoid-pages/src/main/java/org/rapidoid/pages/PageGUI.java

This file was deleted.

30 changes: 0 additions & 30 deletions rapidoid-pages/src/main/java/org/rapidoid/pages/PageRequest.java

This file was deleted.

0 comments on commit f91ee86

Please sign in to comment.