Skip to content
Permalink
Browse files

JavaScript API refactor + jsdoc

  • Loading branch information
lichnost committed May 8, 2019
1 parent be80e74 commit 55901792badf6ee3c9773baec6a77dccd3ffa54b
Showing with 1,798 additions and 1,673 deletions.
  1. +9 −1 pom.xml
  2. +0 −5 whirl-app/whirl-app-client/pom.xml
  3. +1 −1 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/app/client/AppEntryPoint.java
  4. +0 −2 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/app/client/ViewportContainer.java
  5. +0 −5 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/app/client/Whirl.java
  6. +6 −3 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/base/ButtonBuilder.java
  7. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/base/package-info.java
  8. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/check/package-info.java
  9. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/combo/package-info.java
  10. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/date/package-info.java
  11. +48 −68 ...pp/whirl-app-client/src/main/java/org/whirlplatform/component/client/event/JavaScriptContext.java
  12. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/event/package-info.java
  13. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/grid/package-info.java
  14. +46 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/js/Application.java
  15. +50 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/js/Components.java
  16. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/js/package-info.java
  17. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/package-info.java
  18. +1 −9 .../whirl-app-client/src/main/java/org/whirlplatform/component/client/selenium/SeleniumJSExport.java
  19. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/tree/package-info.java
  20. +28 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/utils/LogHelper.java
  21. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/component/client/window/package-info.java
  22. +3 −7 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/event/client/EventHelperImpl.java
  23. +1 −29 ...app/whirl-app-client/src/main/java/org/whirlplatform/js/client/BorderContainerBuilderOverlay.java
  24. +1 −10 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/BoxLayoutDataOverlay.java
  25. +0 −58 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/Builders.java
  26. +2 −24 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ButtonBuilderOverlay.java
  27. +1 −22 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/CaptchaBuilderOverlay.java
  28. +1 −25 ...app/whirl-app-client/src/main/java/org/whirlplatform/js/client/CenterContainerBuilderOverlay.java
  29. +1 −31 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/CheckBoxBuilderOverlay.java
  30. +2 −22 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/CheckGroupBuilderOverlay.java
  31. +3 −35 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ComboBoxBuilderOverlay.java
  32. +1 −10 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ComponentBuilderOverlay.java
  33. +1 −27 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ContentPanelBuilderOverlay.java
  34. +24 −39 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/DataValueOverlay.java
  35. +3 −35 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/DateFieldBuilderOverlay.java
  36. +9 −37 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/EditGridBuilderOverlay.java
  37. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/EventCallbackResultOverlay.java
  38. +1 −17 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/EventParameterOverlay.java
  39. +2 −10 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/Events.java
  40. +1 −27 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/FieldSetOverlay.java
  41. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/Files.java
  42. +4 −36 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/FormBuilderOverlay.java
  43. +2 −20 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/FrameBuilderOverlay.java
  44. +1 −19 ...pp/whirl-app-client/src/main/java/org/whirlplatform/js/client/FramedLoginPanelBuilderOverlay.java
  45. +1 −27 ...l-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/HBoxContainerBuilderOverlay.java
  46. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/HandlerRegistrationOverlay.java
  47. +0 −78 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/Helper.java
  48. +1 −30 ...whirl-app-client/src/main/java/org/whirlplatform/js/client/HorizontalContainerBuilderOverlay.java
  49. +1 −11 ...l-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/HorizontalLayoutDataOverlay.java
  50. +1 −20 ...-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/HorizontalMenuBuilderOverlay.java
  51. +1 −21 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/HtmlBuilderOverlay.java
  52. +1 −26 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/HtmlEditorBuilderOverlay.java
  53. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/IDataValueOverlay.java
  54. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/IEventParameterOverlay.java
  55. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/IListModelDataOverlay.java
  56. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/IRowListValueOverlay.java
  57. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/IRowModelDataOverlay.java
  58. +1 −6 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/IRowValueOverlay.java
  59. +2 −20 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ImageBuilderOverlay.java
  60. +1 −25 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/JavaScriptContextOverlay.java
  61. +1 −7 ...-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/JavaScriptEventResultOverlay.java
  62. +1 −22 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/LabelBuilderOverlay.java
  63. +1 −14 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ListModelDataOverlay.java
  64. +1 −20 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/LoginPanelBuilderOverlay.java
  65. +5 −35 ...l-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/MultiComboBoxBuilderOverlay.java
  66. +3 −37 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/NumberFieldBuilderOverlay.java
  67. +1 −35 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/RadioBuilderOverlay.java
  68. +2 −23 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/RadioGroupBuilderOverlay.java
  69. +1 −19 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/ReportBuilderOverlay.java
  70. +1 −15 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/RowListValueOverlay.java
  71. +1 −12 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/RowModelDataOverlay.java
  72. +1 −15 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/RowValueOverlay.java
  73. +1 −26 ...app/whirl-app-client/src/main/java/org/whirlplatform/js/client/SimpleContainerBuilderOverlay.java
  74. +3 −29 ...pp/whirl-app-client/src/main/java/org/whirlplatform/js/client/SimpleHtmlEditorBuilderOverlay.java
  75. +5 −12 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/Storage.java
  76. +1 −5 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/StorageWrapperOverlay.java
  77. +1 −28 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TabItemBuilderOverlay.java
  78. +1 −29 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TabPanelBuilderOverlay.java
  79. +1 −20 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TaskBarBuilderOverlay.java
  80. +3 −35 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TextAreaBuilderOverlay.java
  81. +3 −35 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TextFieldBuilderOverlay.java
  82. +1 −19 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TimerBuilderOverlay.java
  83. +8 −35 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TreeBuilderOverlay.java
  84. +3 −28 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TreeComboBoxBuilderOverlay.java
  85. +1 −20 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/TreeMenuBuilderOverlay.java
  86. +1 −30 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/UploadFieldBuilderOverlay.java
  87. +1 −26 ...l-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/VBoxContainerBuilderOverlay.java
  88. +1 −30 ...p/whirl-app-client/src/main/java/org/whirlplatform/js/client/VerticalContainerBuilderOverlay.java
  89. +1 −11 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/VerticalLayoutDataOverlay.java
  90. +1 −36 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/js/client/WindowBuilderOverlay.java
  91. +4 −0 whirl-app/whirl-app-client/src/main/java/org/whirlplatform/storage/client/package-info.java
  92. +0 −6 whirl-app/whirl-app-shared/pom.xml
  93. +0 −2 whirl-app/whirl-app-shared/src/main/java/org/whirlplatform/meta/shared/JavaScriptEventResult.java
  94. +1 −1 whirl-editor/whirl-editor-client/src/main/java/org/whirlplatform/editor/client/view/EventView.java
  95. +27 −0 whirl-jsdoc/.esdoc.json
  96. +6 −0 whirl-jsdoc/.gitignore
  97. +1,328 −0 whirl-jsdoc/package-lock.json
  98. +46 −8 whirl-jsdoc/pom.xml
  99. +19 −2 whirl-jsdoc/src/main/java/org/whirlplatform/jsdoc/EsDocProcessor.java
10 pom.xml
@@ -14,8 +14,8 @@
<module>whirl-selenium</module>
<module>whirl-app</module>
<module>whirl-codemirror</module>
<module>whirl-editor</module>
<module>whirl-jsdoc</module>
<module>whirl-editor</module>
</modules>

<properties>
@@ -53,6 +53,14 @@
<name>JBoss public</name>
<url>http://repository.jboss.org/nexus/content/groups/public-jboss</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>nodejs-proxy</id>
<name>NodeJS proxy repository</name>
<url>https://maven-nodejs-proxy.pvtool.org/</url>
</repository>
</repositories>

<build>
@@ -49,11 +49,6 @@
<artifactId>gxt</artifactId>
</dependency>

<dependency>
<groupId>org.timepedia.exporter</groupId>
<artifactId>gwtexporter</artifactId>
<version>2.5.1</version>
</dependency>
<dependency>
<groupId>com.seanchenxi.gwt</groupId>
<artifactId>gwt-storage</artifactId>

Large diffs are not rendered by default.

@@ -1,7 +1,6 @@
package org.whirlplatform.app.client;

import com.sencha.gxt.widget.core.client.container.Viewport;
import org.timepedia.exporter.client.Export;
import org.whirlplatform.component.client.ComponentBuilder;
import org.whirlplatform.component.client.Containable;

@@ -49,7 +48,6 @@ public void forceLayout() {
}
}

@Export
public int getChildrenCount() {
if (topComponent == null) {
return 0;
@@ -4,7 +4,6 @@
import com.google.gwt.user.client.Window.ClosingEvent;
import com.google.gwt.user.client.Window.ClosingHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import org.timepedia.exporter.client.ExporterUtil;
import org.whirlplatform.rpc.client.DataServiceAsync;
import org.whirlplatform.rpc.shared.SessionToken;

@@ -66,8 +65,4 @@ public static void setRemoveToken(boolean remove) {
removeToken = remove;
}

public static void exportJavaScript() {
ExporterUtil.exportAll();
}

}
@@ -7,6 +7,7 @@
import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsProperty;
import jsinterop.annotations.JsType;
import org.whirlplatform.component.client.ComponentBuilder;
import org.whirlplatform.component.client.event.ClickEvent;
@@ -20,7 +21,7 @@
/**
* Button.
*/
@JsType(namespace = "Whirl", name = "Button")
@JsType(name = "Button")
public class ButtonBuilder extends ComponentBuilder implements ClickEvent.HasClickHandlers {

private TextButton button;
@@ -119,7 +120,8 @@ public HandlerRegistration addClickHandler(ClickEvent.ClickHandler handler) {
*
* @return title
*/
public String getHTML() {
@JsProperty(name = "html")
public String getHTML() {
return button.getHTML();
}

@@ -128,7 +130,8 @@ public String getHTML() {
*
* @param html title
*/
public void setHTML(String html) {
@JsProperty(name = "html")
public void setHTML(String html) {
button.setHTML(html == null ? "" : html);
}

@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.base;

import jsinterop.annotations.JsPackage;
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.check;

import jsinterop.annotations.JsPackage;
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.combo;

import jsinterop.annotations.JsPackage;
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.date;

import jsinterop.annotations.JsPackage;
@@ -1,80 +1,60 @@
package org.whirlplatform.component.client.event;

import com.google.gwt.core.client.JavaScriptObject;
import org.timepedia.exporter.client.ExporterUtil;
import jsinterop.annotations.JsIgnore;
import jsinterop.annotations.JsType;
import org.whirlplatform.component.client.ComponentBuilder;
import org.whirlplatform.meta.shared.JavaScriptEventResult;
import org.whirlplatform.meta.shared.data.DataValue;

import java.util.List;

@JsType(name = "Context")
public class JavaScriptContext {
private ComponentBuilder source;
private List<DataValue> parameters;

public JavaScriptContext() {
}
private ComponentBuilder source;
private List<DataValue> parameters;

@JsIgnore
public JavaScriptContext() {
}

@JsIgnore
public JavaScriptContext(ComponentBuilder source, List<DataValue> parameters) {
this.source = source;
this.parameters = parameters;
}

@JsIgnore
public ComponentBuilder getSource() {
return source;
}

@JsIgnore
public DataValue[] getParameters() {
return parameters.toArray(new DataValue[0]);
}

@JsIgnore
public DataValue getParameter(int index) {
return parameters.get(index);
}

@JsIgnore
public DataValue getParameter(String code) {
if (code == null) {
return null;
}
for (DataValue v : parameters) {
if (code.equals(v.getCode())) {
return v;
}
}
return null;
}

@JsIgnore
public JavaScriptEventResult newResult() {
return new JavaScriptEventResult();
}

public JavaScriptContext(ComponentBuilder source, List<DataValue> parameters) {
this.source = source;
this.parameters = parameters;
}

public ComponentBuilder getSource() {
return source;
}

public DataValue[] getParameters() {
return parameters.toArray(new DataValue[0]);
}

public DataValue getParameter(int index) {
return parameters.get(index);
}

public DataValue getParameter(String code) {
if (code == null) {
return null;
}
for (DataValue v : parameters) {
if (code.equals(v.getCode())) {
return v;
}
}
return null;
}

public JavaScriptEventResult newResult() {
return new JavaScriptEventResult();
}

// @SuppressWarnings("unchecked")
// public static JavaScriptContext init(String context) {
// Map<String, Object> root = XJSONConverter.decodeSimple(context);
//
// JavaScriptContext result = new JavaScriptContext();
// String componentId = (String) root.get("source");
// result.source = BuilderManager.findBuilder(componentId, false);
// result.parameters = new ArrayList<DataValue>();
//
// for (Map<String, String> item : (List<Map<String, String>>) root
// .get("parameters")) {
// DataType type = DataType.valueOf(item.get("type"));
// DataValue value = new DataValue(type);
// value.setCode(item.get("code"));
// value.setValue(DataValue.convertValueFromString(item.get("value"),
// item.get("listTitle"), type));
// result.parameters.add(value);
// }
//
// return result;
// }

public static Object init(Object context) {
return context;
}

public JavaScriptObject asObject() {
return ExporterUtil.wrap(this);
}
}
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.event;

import jsinterop.annotations.JsPackage;
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.grid;

import jsinterop.annotations.JsPackage;
@@ -0,0 +1,46 @@
package org.whirlplatform.component.client.js;

import com.google.gwt.http.client.UrlBuilder;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.Window.Location;
import jsinterop.annotations.JsType;
import org.whirlplatform.app.client.ClientLoginUtils;
import org.whirlplatform.app.client.LocationManager;
import org.whirlplatform.meta.shared.AppConstant;

/**
* Application level helper methods.
*/
@JsType
public class Application {

/**
* Changes opened application in the current window.
*
* @param appCode application code
*/
public static void setCurrentApplication(String appCode) {
LocationManager.get().setRole(appCode);
LocationManager.get().reload();
}

/**
* Opens application in new browser window with the new session of current user.
*
* @param appCode application code
*/
public static void openApplication(String appCode) {
UrlBuilder url = Location.createUrlBuilder();
url.setParameter(AppConstant.NEW_SESSION, String.valueOf(true));
url.setParameter(AppConstant.APPLICATION_URL, appCode);
Window.open(url.buildString(), "_blank", "");
}

/**
* Logout.
*/
public static void logout() {
ClientLoginUtils.logout();
}

}
@@ -0,0 +1,50 @@
package org.whirlplatform.component.client.js;

import jsinterop.annotations.JsType;
import org.whirlplatform.component.client.BuilderManager;
import org.whirlplatform.component.client.ComponentBuilder;
import org.whirlplatform.component.client.Containable;

/**
* This helper class contains static methods to work with application components.
*/
@JsType
public class Components {

/**
* Finds component by code.
*
* @param code component code
* @return component
*/
public static ComponentBuilder findByCode(String code) {
return BuilderManager.findBuilder(code, true);
}

/**
* Finds component by code in the particular container.
*
* @param container
* @param code component code
* @return component
*/
public static ComponentBuilder findByCodeInContainer(
ComponentBuilder container, String code) {
if (container instanceof Containable) {
return BuilderManager
.findBuilder((Containable) container, code, true);
} else {
return null;
}
}

/**
* Returns all application components currently available in application.
*
* @return components array
*/
public static ComponentBuilder[] getAll() {
return BuilderManager.getAllBuilders().toArray(new ComponentBuilder[0]);
}

}
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client.js;

import jsinterop.annotations.JsPackage;
@@ -0,0 +1,4 @@
@JsPackage(namespace = "Whirl")
package org.whirlplatform.component.client;

import jsinterop.annotations.JsPackage;

0 comments on commit 5590179

Please sign in to comment.
You can’t perform that action at this time.