forked from fanruan/design
Browse Source
Merge in DESIGN/design from ~VITO/c-design:release/10.0 to release/10.0 * commit 'cfcd0ff50c8da4dbb941402a59b1fdcb48ea7955': (61 commits) 无JIRA任务 gradle配置修改 KERNEL-4069 添加注释 KERNEL-4069 JDK11适配 删除无用的类与mac下的适配 KERNEL-4069 fix 漏交 KERNEL-4069 配合完成JDK11构建设计器的开发 无jira feature打包失败 无jira任务,打包失败,代码重复 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 ...feature/big-screen
39 changed files with 1177 additions and 690 deletions
@ -0,0 +1,82 @@ |
|||||||
|
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel |
||||||
|
|
||||||
|
plugins { |
||||||
|
id 'java' |
||||||
|
id 'java-library' |
||||||
|
id 'com.fr.common' version '1.0-SNAPSHOT' |
||||||
|
} |
||||||
|
|
||||||
|
// 模块参数 |
||||||
|
ext { |
||||||
|
frVersion = "" |
||||||
|
outputPath = "build" |
||||||
|
ignoreTestFailureSetting = true |
||||||
|
languageLevelSetting = 1.8 |
||||||
|
} |
||||||
|
|
||||||
|
applyGlobalConfigPathIfExist() |
||||||
|
|
||||||
|
if (versions.frVersion) { |
||||||
|
frVersion = versions.frVersion |
||||||
|
} |
||||||
|
def frDevVersion = "DEV" + frVersion |
||||||
|
|
||||||
|
dependencies { |
||||||
|
api project(':designer-base') |
||||||
|
api project(':designer-chart') |
||||||
|
api project(':designer-form') |
||||||
|
api project(':designer-realize') |
||||||
|
} |
||||||
|
|
||||||
|
allprojects { |
||||||
|
apply plugin: 'java' |
||||||
|
apply plugin: 'java-library' |
||||||
|
apply plugin: 'idea' |
||||||
|
|
||||||
|
group 'com.fr.design' |
||||||
|
version frDevVersion |
||||||
|
sourceCompatibility = languageLevelSetting |
||||||
|
targetCompatibility = languageLevelSetting |
||||||
|
|
||||||
|
tasks.withType(JavaCompile) { |
||||||
|
options.encoding = "UTF-8" |
||||||
|
} |
||||||
|
|
||||||
|
repositories { |
||||||
|
mavenLocal() |
||||||
|
} |
||||||
|
|
||||||
|
idea { |
||||||
|
module { |
||||||
|
inheritOutputDirs = false |
||||||
|
outputDir = file(outputPath +"/classes") |
||||||
|
testOutputDir = file(outputPath +"/test-classes") |
||||||
|
languageLevel = new IdeaLanguageLevel(sourceCompatibility) |
||||||
|
targetBytecodeVersion = targetCompatibility |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
dependencies { |
||||||
|
implementation 'com.fr.third:jxbrowser:7.5' |
||||||
|
implementation 'com.fr.third:jxbrowser-swing:7.5' |
||||||
|
implementation 'com.fr.third:jxbrowser-mac:7.5' |
||||||
|
implementation 'com.fr.third:jxbrowser-win64:7.5' |
||||||
|
implementation 'com.fr.third.server:servlet-api:3.0' |
||||||
|
implementation 'org.swingexplorer:swexpl:2.0.1' |
||||||
|
implementation 'org.swingexplorer:swag:1.0' |
||||||
|
implementation 'net.java.dev.jna:jna:5.4.0' |
||||||
|
implementation 'org.apache.tomcat:tomcat-catalina:8.5.32' |
||||||
|
implementation 'io.socket:socket.io-client:0.7.0' |
||||||
|
implementation 'com.fr.third:fine-third:' + frVersion |
||||||
|
implementation 'com.fr.core:fine-core:' + frVersion |
||||||
|
implementation 'com.fr.activator:fine-activator:' + frVersion |
||||||
|
implementation 'com.fr.datasource:fine-datasource:' + frVersion |
||||||
|
implementation 'com.fr.decision:fine-decision:' + frVersion |
||||||
|
implementation 'com.fr.schedule:fine-schedule:' + frVersion |
||||||
|
implementation 'com.fr.report:fine-report-engine:' + frDevVersion |
||||||
|
testImplementation 'org.easymock:easymock:3.5.1' |
||||||
|
testImplementation 'org.powermock:powermock-module-junit4:1.7.1' |
||||||
|
testImplementation 'org.powermock:powermock-api-easymock:1.7.1' |
||||||
|
testImplementation 'junit:junit:4.12' |
||||||
|
} |
||||||
|
} |
@ -1,234 +0,0 @@ |
|||||||
package com.fr.design.extra; |
|
||||||
|
|
||||||
import com.fr.design.dialog.FineJOptionPane; |
|
||||||
import com.fr.general.CloudCenter; |
|
||||||
import com.fr.general.ComparatorUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
import javafx.application.Platform; |
|
||||||
import javafx.beans.property.BooleanProperty; |
|
||||||
import javafx.beans.property.SimpleBooleanProperty; |
|
||||||
import javafx.beans.value.ChangeListener; |
|
||||||
import javafx.beans.value.ObservableValue; |
|
||||||
import javafx.concurrent.Worker; |
|
||||||
import javafx.embed.swing.JFXPanel; |
|
||||||
import javafx.event.ActionEvent; |
|
||||||
import javafx.event.EventHandler; |
|
||||||
import javafx.scene.Group; |
|
||||||
import javafx.scene.Node; |
|
||||||
import javafx.scene.Scene; |
|
||||||
import javafx.scene.control.ButtonBuilder; |
|
||||||
import javafx.scene.control.LabelBuilder; |
|
||||||
import javafx.scene.input.MouseEvent; |
|
||||||
import javafx.scene.layout.BorderPane; |
|
||||||
import javafx.scene.layout.HBox; |
|
||||||
import javafx.scene.layout.HBoxBuilder; |
|
||||||
import javafx.scene.paint.Color; |
|
||||||
import javafx.scene.web.WebEngine; |
|
||||||
import javafx.scene.web.WebEvent; |
|
||||||
import javafx.scene.web.WebView; |
|
||||||
import javafx.stage.Modality; |
|
||||||
import javafx.stage.Screen; |
|
||||||
import javafx.stage.Stage; |
|
||||||
import javafx.stage.StageStyle; |
|
||||||
import javafx.stage.WindowEvent; |
|
||||||
import javafx.util.Callback; |
|
||||||
import netscape.javascript.JSObject; |
|
||||||
|
|
||||||
import javax.swing.JOptionPane; |
|
||||||
import javax.swing.SwingUtilities; |
|
||||||
import java.awt.Toolkit; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by zhaohehe on 16/7/28. |
|
||||||
*/ |
|
||||||
public class QQLoginWebPane extends JFXPanel { |
|
||||||
|
|
||||||
private WebEngine webEngine; |
|
||||||
private String url; |
|
||||||
|
|
||||||
private static JSObject window; |
|
||||||
|
|
||||||
private static int DEFAULT_PRIMARYSTAGE_WIDTH = 100; |
|
||||||
private static int DEFAULT_PRIMARYSTAGE_HEIGHT = 100; |
|
||||||
|
|
||||||
private static int DEFAULT_CONFIRM_WIDTH = 450; |
|
||||||
private static int DEFAULT_CONFIRM_HEIGHT = 160; |
|
||||||
private static int DEFAULT_OFFEST = 20; |
|
||||||
|
|
||||||
class Delta { |
|
||||||
double x, y; |
|
||||||
} |
|
||||||
|
|
||||||
public QQLoginWebPane(final String installHome) { |
|
||||||
Platform.setImplicitExit(false); |
|
||||||
Platform.runLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
BorderPane root = new BorderPane(); |
|
||||||
Scene scene = new Scene(root); |
|
||||||
QQLoginWebPane.this.setScene(scene); |
|
||||||
final WebView webView = new WebView(); |
|
||||||
webEngine = webView.getEngine(); |
|
||||||
url = "file:///" + installHome + "/scripts/qqLogin.html"; |
|
||||||
webEngine.load(url); |
|
||||||
|
|
||||||
final Stage primaryStage = new Stage(); |
|
||||||
|
|
||||||
HBox layout = new HBox(); |
|
||||||
try { |
|
||||||
primaryStage.initStyle(StageStyle.TRANSPARENT); |
|
||||||
primaryStage.setScene(new Scene(layout)); |
|
||||||
webView.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm()); |
|
||||||
primaryStage.initStyle(StageStyle.UTILITY); |
|
||||||
primaryStage.setScene(new Scene(new Group(), DEFAULT_PRIMARYSTAGE_WIDTH, DEFAULT_PRIMARYSTAGE_HEIGHT)); |
|
||||||
primaryStage.setX(0); |
|
||||||
primaryStage.setY(Screen.getPrimary().getBounds().getHeight() + DEFAULT_PRIMARYSTAGE_HEIGHT); |
|
||||||
primaryStage.show(); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
|
||||||
} |
|
||||||
webEngine.setConfirmHandler(new Callback<String, Boolean>() { |
|
||||||
@Override |
|
||||||
public Boolean call(String msg) { |
|
||||||
Boolean confirmed = confirm(primaryStage, msg, webView); |
|
||||||
return confirmed; |
|
||||||
} |
|
||||||
}); |
|
||||||
configWebEngine(); |
|
||||||
webView.setContextMenuEnabled(false);//屏蔽右键
|
|
||||||
root.setCenter(webView); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
private void configWebEngine() { |
|
||||||
|
|
||||||
webEngine.locationProperty().addListener(new ChangeListener<String>() { |
|
||||||
@Override |
|
||||||
public void changed(ObservableValue<? extends String> observable, final String oldValue, String newValue) { |
|
||||||
disableLink(webEngine); |
|
||||||
// webView好像默认以手机版显示网页,浏览器里过滤掉这个跳转
|
|
||||||
if (ComparatorUtils.equals(newValue, url) || ComparatorUtils.equals(newValue, CloudCenter.getInstance().acquireUrlByKind("bbs.mobile"))) { |
|
||||||
return; |
|
||||||
} |
|
||||||
LoginWebBridge.getHelper().openUrlAtLocalWebBrowser(webEngine, newValue); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
webEngine.setOnAlert(new EventHandler<WebEvent<String>>() { |
|
||||||
@Override |
|
||||||
public void handle(WebEvent<String> event) { |
|
||||||
showAlert(event.getData()); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
webEngine.getLoadWorker().stateProperty().addListener( |
|
||||||
new ChangeListener<Worker.State>() { |
|
||||||
public void changed(ObservableValue ov, Worker.State oldState, Worker.State newState) { |
|
||||||
if (newState == Worker.State.SUCCEEDED) { |
|
||||||
window = (JSObject) webEngine.executeScript("window"); |
|
||||||
window.setMember("QQLoginHelper", LoginWebBridge.getHelper()); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
private void showAlert(final String message) { |
|
||||||
SwingUtilities.invokeLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
FineJOptionPane.showMessageDialog(QQLoginWebPane.this, message); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
private void disableLink(final WebEngine eng) { |
|
||||||
try { |
|
||||||
// webView端不跳转 虽然webView可以指定本地浏览器打开某个链接,但是当本地浏览器跳转到指定链接的同时,webView也做了跳转,
|
|
||||||
// 为了避免出现在一个600*400的资讯框里加载整个网页的情况,webView不跳转到新网页
|
|
||||||
Platform.runLater(new Runnable() { |
|
||||||
@Override |
|
||||||
public void run() { |
|
||||||
eng.executeScript("location.reload()"); |
|
||||||
LoginWebBridge.getHelper().closeQQWindow(); |
|
||||||
} |
|
||||||
}); |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private Boolean confirm(final Stage parent, String msg, final WebView webView) { |
|
||||||
final BooleanProperty confirmationResult = new SimpleBooleanProperty(); |
|
||||||
// initialize the confirmation dialog
|
|
||||||
final Stage dialog = new Stage(StageStyle.UTILITY); |
|
||||||
dialog.setX(Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 2 - DEFAULT_CONFIRM_WIDTH / 2.0D + DEFAULT_OFFEST); |
|
||||||
dialog.setY(Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2 + DEFAULT_OFFEST); |
|
||||||
dialog.setHeight(DEFAULT_CONFIRM_HEIGHT); |
|
||||||
dialog.setWidth(DEFAULT_CONFIRM_WIDTH); |
|
||||||
dialog.setIconified(false); |
|
||||||
dialog.initOwner(parent); |
|
||||||
dialog.initModality(Modality.WINDOW_MODAL); |
|
||||||
dialog.setScene( |
|
||||||
new Scene( |
|
||||||
HBoxBuilder.create().styleClass("modal-dialog").children( |
|
||||||
LabelBuilder.create().text(msg).build(), |
|
||||||
ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_BBSLogin_Switch_Account")).defaultButton(true).onAction(new EventHandler<ActionEvent>() { |
|
||||||
@Override |
|
||||||
public void handle(ActionEvent actionEvent) { |
|
||||||
// take action and close the dialog.
|
|
||||||
confirmationResult.set(true); |
|
||||||
webView.getEngine().reload(); |
|
||||||
dialog.close(); |
|
||||||
} |
|
||||||
}).build(), |
|
||||||
ButtonBuilder.create().text(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Engine_Cancel")).cancelButton(true).onAction(new EventHandler<ActionEvent>() { |
|
||||||
@Override |
|
||||||
public void handle(ActionEvent actionEvent) { |
|
||||||
// abort action and close the dialog.
|
|
||||||
confirmationResult.set(false); |
|
||||||
dialog.close(); |
|
||||||
} |
|
||||||
}).build() |
|
||||||
).build() |
|
||||||
, Color.TRANSPARENT |
|
||||||
) |
|
||||||
); |
|
||||||
configDrag(dialog); |
|
||||||
// style and show the dialog.
|
|
||||||
dialog.getScene().getStylesheets().add(IOUtils.getResource("modal-dialog.css", getClass()).toExternalForm()); |
|
||||||
dialog.setOnCloseRequest(new EventHandler<WindowEvent>() { |
|
||||||
@Override |
|
||||||
public void handle(WindowEvent event) { |
|
||||||
event.consume(); |
|
||||||
dialog.close(); |
|
||||||
} |
|
||||||
}); |
|
||||||
dialog.showAndWait(); |
|
||||||
return confirmationResult.get(); |
|
||||||
} |
|
||||||
|
|
||||||
private void configDrag(final Stage dialog) { |
|
||||||
// allow the dialog to be dragged around.
|
|
||||||
final Node root = dialog.getScene().getRoot(); |
|
||||||
final Delta dragDelta = new Delta(); |
|
||||||
|
|
||||||
root.setOnMousePressed(new EventHandler<MouseEvent>() { |
|
||||||
@Override |
|
||||||
public void handle(MouseEvent mouseEvent) { |
|
||||||
// record a delta distance for the drag and drop operation.
|
|
||||||
dragDelta.x = dialog.getX() - mouseEvent.getScreenX(); |
|
||||||
dragDelta.y = dialog.getY() - mouseEvent.getScreenY(); |
|
||||||
} |
|
||||||
}); |
|
||||||
root.setOnMouseDragged(new EventHandler<MouseEvent>() { |
|
||||||
@Override |
|
||||||
public void handle(MouseEvent mouseEvent) { |
|
||||||
dialog.setX(mouseEvent.getScreenX() + dragDelta.x); |
|
||||||
dialog.setY(mouseEvent.getScreenY() + dragDelta.y); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
@ -1,68 +0,0 @@ |
|||||||
package com.fr.design.ui; |
|
||||||
|
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
import com.teamdev.jxbrowser.chromium.Browser; |
|
||||||
import com.teamdev.jxbrowser.chromium.BrowserContext; |
|
||||||
import com.teamdev.jxbrowser.chromium.ProtocolService; |
|
||||||
import com.teamdev.jxbrowser.chromium.URLResponse; |
|
||||||
|
|
||||||
import javax.activation.MimetypesFileTypeMap; |
|
||||||
import java.io.DataInputStream; |
|
||||||
import java.io.File; |
|
||||||
import java.io.IOException; |
|
||||||
import java.io.InputStream; |
|
||||||
import java.nio.file.Files; |
|
||||||
import java.nio.file.Path; |
|
||||||
import java.nio.file.Paths; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author richie |
|
||||||
* @version 10.0 |
|
||||||
* Created by richie on 2019-03-07 |
|
||||||
*/ |
|
||||||
public class Assistant { |
|
||||||
|
|
||||||
public static URLResponse inputStream2Response(InputStream inputStream, String filePath) throws Exception { |
|
||||||
URLResponse response = new URLResponse(); |
|
||||||
DataInputStream stream = new DataInputStream(inputStream); |
|
||||||
byte[] data = new byte[stream.available()]; |
|
||||||
stream.readFully(data); |
|
||||||
response.setData(data); |
|
||||||
String mimeType = getMimeType(filePath); |
|
||||||
response.getHeaders().setHeader("Content-Type", mimeType); |
|
||||||
return response; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private static String getMimeType(String path) { |
|
||||||
if (StringUtils.isBlank(path)) { |
|
||||||
return "text/html"; |
|
||||||
} |
|
||||||
if (path.endsWith(".html")) { |
|
||||||
return "text/html"; |
|
||||||
} |
|
||||||
if (path.endsWith(".css")) { |
|
||||||
return "text/css"; |
|
||||||
} |
|
||||||
if (path.endsWith(".js")) { |
|
||||||
return "text/javascript"; |
|
||||||
} |
|
||||||
if (path.endsWith(".svg")) { |
|
||||||
return "image/svg+xml"; |
|
||||||
} |
|
||||||
Path file = new File(path).toPath(); |
|
||||||
try { |
|
||||||
return Files.probeContentType(file); |
|
||||||
} catch (IOException e) { |
|
||||||
return "text/html"; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static void setEmbProtocolHandler(Browser browser, EmbProtocolHandler handler) { |
|
||||||
BrowserContext browserContext = browser.getContext(); |
|
||||||
ProtocolService protocolService = browserContext.getProtocolService(); |
|
||||||
// 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png
|
|
||||||
protocolService.setProtocolHandler("emb", handler); |
|
||||||
protocolService.setProtocolHandler("file", handler); |
|
||||||
} |
|
||||||
} |
|
@ -1,130 +0,0 @@ |
|||||||
package com.fr.design.ui; |
|
||||||
|
|
||||||
import com.fr.base.TemplateUtils; |
|
||||||
import com.fr.general.IOUtils; |
|
||||||
import com.fr.log.FineLoggerFactory; |
|
||||||
import com.fr.stable.EncodeConstants; |
|
||||||
import com.fr.stable.StringUtils; |
|
||||||
import com.fr.third.org.apache.commons.codec.net.URLCodec; |
|
||||||
import com.fr.third.org.apache.commons.io.FileUtils; |
|
||||||
import com.fr.third.org.apache.commons.io.FilenameUtils; |
|
||||||
import com.fr.web.struct.AssembleComponent; |
|
||||||
import com.fr.web.struct.AtomBuilder; |
|
||||||
import com.fr.web.struct.PathGroup; |
|
||||||
import com.fr.web.struct.category.ScriptPath; |
|
||||||
import com.fr.web.struct.category.StylePath; |
|
||||||
import com.teamdev.jxbrowser.chromium.ProtocolHandler; |
|
||||||
import com.teamdev.jxbrowser.chromium.URLRequest; |
|
||||||
import com.teamdev.jxbrowser.chromium.URLResponse; |
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream; |
|
||||||
import java.io.File; |
|
||||||
import java.io.FileInputStream; |
|
||||||
import java.io.IOException; |
|
||||||
import java.io.InputStream; |
|
||||||
import java.io.StringReader; |
|
||||||
import java.net.URI; |
|
||||||
import java.nio.charset.StandardCharsets; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author richie |
|
||||||
* @version 10.0 |
|
||||||
* Created by richie on 2019-03-07 |
|
||||||
*/ |
|
||||||
public class EmbProtocolHandler implements ProtocolHandler { |
|
||||||
|
|
||||||
private AssembleComponent component; |
|
||||||
private Map<String, String> map; |
|
||||||
|
|
||||||
public EmbProtocolHandler() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public EmbProtocolHandler(AssembleComponent component) { |
|
||||||
this.component = component; |
|
||||||
} |
|
||||||
|
|
||||||
public EmbProtocolHandler(AssembleComponent component, Map<String, String> map) { |
|
||||||
this.component = component; |
|
||||||
this.map = map; |
|
||||||
} |
|
||||||
|
|
||||||
public EmbProtocolHandler(Map<String, String> map) { |
|
||||||
this.map = map; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public URLResponse onRequest(URLRequest req) { |
|
||||||
InputStream inputStream = null; |
|
||||||
try { |
|
||||||
String path = req.getURL(); |
|
||||||
if (path.startsWith("file:")) { |
|
||||||
String url = new URLCodec().decode(path); |
|
||||||
String filePath = TemplateUtils.renderParameter4Tpl(url, map); |
|
||||||
File file = new File(URI.create(filePath).getPath()); |
|
||||||
inputStream = IOUtils.readResource(file.getAbsolutePath()); |
|
||||||
String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); |
|
||||||
text = TemplateUtils.renderParameter4Tpl(text, map); |
|
||||||
return Assistant.inputStream2Response(new ByteArrayInputStream(text.getBytes(StandardCharsets.UTF_8)), path); |
|
||||||
} else if (path.startsWith("emb:dynamic")) { |
|
||||||
URLResponse response = new URLResponse(); |
|
||||||
response.setData(htmlText(map).getBytes()); |
|
||||||
response.getHeaders().setHeader("Content-Type", "text/html"); |
|
||||||
return response; |
|
||||||
} else { |
|
||||||
int index = path.indexOf("="); |
|
||||||
if (index > 0) { |
|
||||||
path = path.substring(index + 1); |
|
||||||
} else { |
|
||||||
path = path.substring(4); |
|
||||||
} |
|
||||||
inputStream = IOUtils.readResource(path); |
|
||||||
return Assistant.inputStream2Response(inputStream, path); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
FineLoggerFactory.getLogger().info(e.getMessage()); |
|
||||||
} finally { |
|
||||||
if (inputStream != null) { |
|
||||||
try { |
|
||||||
inputStream.close(); |
|
||||||
} catch (IOException e) { |
|
||||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
private String htmlText(Map<String, String> map) { |
|
||||||
PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); |
|
||||||
StylePath[] stylePaths = pathGroup.toStylePathGroup(); |
|
||||||
StringBuilder styleText = new StringBuilder(); |
|
||||||
for (StylePath path : stylePaths) { |
|
||||||
if (StringUtils.isNotBlank(path.toFilePath())) { |
|
||||||
styleText.append("<link rel=\"stylesheet\" href=\"emb:"); |
|
||||||
styleText.append(path.toFilePath()); |
|
||||||
styleText.append("\"/>"); |
|
||||||
} |
|
||||||
} |
|
||||||
String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString()); |
|
||||||
ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup(); |
|
||||||
StringBuilder scriptText = new StringBuilder(); |
|
||||||
for (ScriptPath path : scriptPaths) { |
|
||||||
if (StringUtils.isNotBlank(path.toFilePath())) { |
|
||||||
scriptText.append("<script src=\"emb:"); |
|
||||||
scriptText.append(path.toFilePath()); |
|
||||||
scriptText.append("\"></script>"); |
|
||||||
} |
|
||||||
} |
|
||||||
result = result.replaceAll("##script##", scriptText.toString()); |
|
||||||
if (map != null) { |
|
||||||
for (Map.Entry<String, String> entry : map.entrySet()) { |
|
||||||
String key = entry.getKey(); |
|
||||||
String value = entry.getValue(); |
|
||||||
result = result.replaceAll("\\$\\{" + key + "}", value); |
|
||||||
} |
|
||||||
} |
|
||||||
return result; |
|
||||||
} |
|
||||||
} |
|
@ -0,0 +1,85 @@ |
|||||||
|
package com.fr.design.ui; |
||||||
|
|
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.web.struct.AssembleComponent; |
||||||
|
import com.fr.web.struct.AtomBuilder; |
||||||
|
import com.fr.web.struct.PathGroup; |
||||||
|
import com.fr.web.struct.category.ScriptPath; |
||||||
|
import com.fr.web.struct.category.StylePath; |
||||||
|
import com.teamdev.jxbrowser.net.Network; |
||||||
|
import com.teamdev.jxbrowser.net.UrlRequest; |
||||||
|
import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; |
||||||
|
|
||||||
|
import java.io.InputStream; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author richie |
||||||
|
* @version 10.0 |
||||||
|
* Created by richie on 2020/3/25 |
||||||
|
*/ |
||||||
|
public class NxComplexInterceptRequestCallback extends NxInterceptRequestCallback { |
||||||
|
|
||||||
|
private AssembleComponent component; |
||||||
|
|
||||||
|
public NxComplexInterceptRequestCallback(Network network, AssembleComponent component) { |
||||||
|
super(network); |
||||||
|
this.component = component; |
||||||
|
} |
||||||
|
|
||||||
|
public NxComplexInterceptRequestCallback(Network network, AssembleComponent component, Map<String, String> map) { |
||||||
|
super(network, map); |
||||||
|
this.component = component; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected Response next(UrlRequest urlRequest, String path) { |
||||||
|
if (path.startsWith("emb:dynamic")) { |
||||||
|
String text = htmlText(map); |
||||||
|
return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, "text/html", text.getBytes(StandardCharsets.UTF_8))); |
||||||
|
} else { |
||||||
|
int index = path.indexOf("="); |
||||||
|
if (index > 0) { |
||||||
|
path = path.substring(index + 1); |
||||||
|
} else { |
||||||
|
path = path.substring(4); |
||||||
|
} |
||||||
|
InputStream inputStream = IOUtils.readResource(path); |
||||||
|
return InterceptRequestCallback.Response.intercept(generateBasicUrlRequestJob(urlRequest, getMimeType(path), IOUtils.inputStream2Bytes(inputStream))); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private String htmlText(Map<String, String> map) { |
||||||
|
PathGroup pathGroup = AtomBuilder.create().buildAssembleFilePath(ModernRequestClient.KEY, component); |
||||||
|
StylePath[] stylePaths = pathGroup.toStylePathGroup(); |
||||||
|
StringBuilder styleText = new StringBuilder(); |
||||||
|
for (StylePath path : stylePaths) { |
||||||
|
if (StringUtils.isNotBlank(path.toFilePath())) { |
||||||
|
styleText.append("<link rel=\"stylesheet\" href=\"emb:"); |
||||||
|
styleText.append(path.toFilePath()); |
||||||
|
styleText.append("\"/>"); |
||||||
|
} |
||||||
|
} |
||||||
|
String result = ModernUIConstants.HTML_TPL.replaceAll("##style##", styleText.toString()); |
||||||
|
ScriptPath[] scriptPaths = pathGroup.toScriptPathGroup(); |
||||||
|
StringBuilder scriptText = new StringBuilder(); |
||||||
|
for (ScriptPath path : scriptPaths) { |
||||||
|
if (StringUtils.isNotBlank(path.toFilePath())) { |
||||||
|
scriptText.append("<script src=\"emb:"); |
||||||
|
scriptText.append(path.toFilePath()); |
||||||
|
scriptText.append("\"></script>"); |
||||||
|
} |
||||||
|
} |
||||||
|
result = result.replaceAll("##script##", scriptText.toString()); |
||||||
|
if (map != null) { |
||||||
|
for (Map.Entry<String, String> entry : map.entrySet()) { |
||||||
|
String key = entry.getKey(); |
||||||
|
String value = entry.getValue(); |
||||||
|
result = result.replaceAll("\\$\\{" + key + "}", value); |
||||||
|
} |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,134 @@ |
|||||||
|
package com.fr.design.ui; |
||||||
|
|
||||||
|
import com.fr.base.TemplateUtils; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.log.FineLoggerFactory; |
||||||
|
import com.fr.stable.ArrayUtils; |
||||||
|
import com.fr.stable.EncodeConstants; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.third.org.apache.commons.codec.net.URLCodec; |
||||||
|
import com.teamdev.jxbrowser.net.HttpHeader; |
||||||
|
import com.teamdev.jxbrowser.net.HttpStatus; |
||||||
|
import com.teamdev.jxbrowser.net.Network; |
||||||
|
import com.teamdev.jxbrowser.net.UrlRequest; |
||||||
|
import com.teamdev.jxbrowser.net.UrlRequestJob; |
||||||
|
import com.teamdev.jxbrowser.net.callback.InterceptRequestCallback; |
||||||
|
|
||||||
|
import java.io.File; |
||||||
|
import java.io.IOException; |
||||||
|
import java.io.InputStream; |
||||||
|
import java.net.URI; |
||||||
|
import java.nio.charset.StandardCharsets; |
||||||
|
import java.nio.file.Files; |
||||||
|
import java.nio.file.Path; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author richie |
||||||
|
* @version 10.0 |
||||||
|
* Created by richie on 2020/3/25 |
||||||
|
*/ |
||||||
|
public class NxInterceptRequestCallback implements InterceptRequestCallback { |
||||||
|
|
||||||
|
Network network; |
||||||
|
Map<String, String> map; |
||||||
|
|
||||||
|
public NxInterceptRequestCallback(Network network) { |
||||||
|
this.network = network; |
||||||
|
} |
||||||
|
|
||||||
|
public NxInterceptRequestCallback(Network network, Map<String, String> map) { |
||||||
|
this.network = network; |
||||||
|
this.map = map; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Response on(Params params) { |
||||||
|
UrlRequest urlRequest = params.urlRequest(); |
||||||
|
String path = urlRequest.url(); |
||||||
|
if (path.startsWith("file:")) { |
||||||
|
Optional<UrlRequestJob> optional = generateFileProtocolUrlRequestJob(urlRequest, path); |
||||||
|
if (optional.isPresent()) { |
||||||
|
return InterceptRequestCallback.Response.intercept(optional.get()); |
||||||
|
} |
||||||
|
} else { |
||||||
|
return next(urlRequest, path); |
||||||
|
} |
||||||
|
return Response.proceed(); |
||||||
|
} |
||||||
|
|
||||||
|
Response next(UrlRequest urlRequest, String path) { |
||||||
|
return Response.proceed(); |
||||||
|
} |
||||||
|
|
||||||
|
private Optional<UrlRequestJob> generateFileProtocolUrlRequestJob(UrlRequest urlRequest, String path) { |
||||||
|
try { |
||||||
|
String url = new URLCodec().decode(path); |
||||||
|
String filePath = TemplateUtils.renderParameter4Tpl(url, map); |
||||||
|
File file = new File(URI.create(filePath).getPath()); |
||||||
|
InputStream inputStream = IOUtils.readResource(file.getAbsolutePath()); |
||||||
|
String mimeType = getMimeType(path); |
||||||
|
byte[] bytes; |
||||||
|
if (isPlainText(mimeType)) { |
||||||
|
String text = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8); |
||||||
|
text = TemplateUtils.renderParameter4Tpl(text, map); |
||||||
|
bytes = text.getBytes(StandardCharsets.UTF_8); |
||||||
|
} else { |
||||||
|
bytes = IOUtils.inputStream2Bytes(inputStream); |
||||||
|
} |
||||||
|
return Optional.of(generateBasicUrlRequestJob(urlRequest, mimeType, bytes)); |
||||||
|
} catch (Exception e) { |
||||||
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
return Optional.empty(); |
||||||
|
} |
||||||
|
|
||||||
|
private boolean isPlainText(String mimeType) { |
||||||
|
return ArrayUtils.contains(new String[]{"text/html", "text/javascript", "text/css"}, mimeType); |
||||||
|
} |
||||||
|
|
||||||
|
UrlRequestJob generateBasicUrlRequestJob(UrlRequest urlRequest, String mimeType, byte[] bytes) { |
||||||
|
UrlRequestJob.Options options = UrlRequestJob.Options |
||||||
|
.newBuilder(urlRequest.id(), HttpStatus.OK) |
||||||
|
.addHttpHeader(HttpHeader.of("Content-Type", mimeType)) |
||||||
|
.build(); |
||||||
|
UrlRequestJob urlRequestJob = network.newUrlRequestJob(options); |
||||||
|
urlRequestJob.write(bytes); |
||||||
|
urlRequestJob.complete(); |
||||||
|
return urlRequestJob; |
||||||
|
} |
||||||
|
|
||||||
|
String getMimeType(String path) { |
||||||
|
if (StringUtils.isBlank(path)) { |
||||||
|
return "text/html"; |
||||||
|
} |
||||||
|
if (path.endsWith(".html")) { |
||||||
|
return "text/html"; |
||||||
|
} |
||||||
|
if (path.endsWith(".css")) { |
||||||
|
return "text/css"; |
||||||
|
} |
||||||
|
if (path.endsWith(".js")) { |
||||||
|
return "text/javascript"; |
||||||
|
} |
||||||
|
if (path.endsWith(".svg")) { |
||||||
|
return "image/svg+xml"; |
||||||
|
} |
||||||
|
if (path.endsWith(".png")) { |
||||||
|
return "image/png"; |
||||||
|
} |
||||||
|
if (path.endsWith(".jpeg")) { |
||||||
|
return "image/jpeg"; |
||||||
|
} |
||||||
|
if (path.endsWith(".gif")) { |
||||||
|
return "image/gif"; |
||||||
|
} |
||||||
|
Path file = new File(path).toPath(); |
||||||
|
try { |
||||||
|
return Files.probeContentType(file); |
||||||
|
} catch (IOException e) { |
||||||
|
return "text/html"; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,200 @@ |
|||||||
|
package com.fr.design.utils; |
||||||
|
|
||||||
|
import sun.awt.SunToolkit; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 适配jdk10之后被移除的 com.sun.awt.AWTUtilities |
||||||
|
* 参照 https://github.com/frohoff/jdk8u-dev-jdk/blob/master/src/share/classes/com/sun/awt/AWTUtilities.java中实现
|
||||||
|
* |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2020/5/29 |
||||||
|
*/ |
||||||
|
public class AWTUtilities { |
||||||
|
|
||||||
|
/** |
||||||
|
* @param window the window to set the shape to |
||||||
|
* @param shape the shape to set to the window |
||||||
|
* |
||||||
|
*/ |
||||||
|
public static void setWindowShape(Window window, Shape shape) { |
||||||
|
if (window == null) { |
||||||
|
throw new NullPointerException("The window argument should not be null."); |
||||||
|
} |
||||||
|
window.setShape(shape); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* |
||||||
|
* @param window the window to set the shape to |
||||||
|
* @param opaque whether the window must be opaque (true), |
||||||
|
* or translucent (false) |
||||||
|
* |
||||||
|
*/ |
||||||
|
public static void setWindowOpaque(Window window, boolean opaque) { |
||||||
|
if (window == null) { |
||||||
|
throw new NullPointerException("The window argument should not be null."); |
||||||
|
} |
||||||
|
if (!opaque && !isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT)) { |
||||||
|
throw new UnsupportedOperationException("The PERPIXEL_TRANSLUCENT translucency kind is not supported"); |
||||||
|
} |
||||||
|
Color color = window.getBackground(); |
||||||
|
if (color == null) { |
||||||
|
color = new Color(0, 0, 0, 0); |
||||||
|
} |
||||||
|
window.setBackground(new Color(color.getRed(), color.getGreen(), color.getBlue(), opaque ? 255 : 0)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static enum Translucency { |
||||||
|
/** |
||||||
|
* Represents support in the underlying system for windows each pixel |
||||||
|
* of which is guaranteed to be either completely opaque, with |
||||||
|
* an alpha value of 1.0, or completely transparent, with an alpha |
||||||
|
* value of 0.0. |
||||||
|
*/ |
||||||
|
PERPIXEL_TRANSPARENT, |
||||||
|
|
||||||
|
/** |
||||||
|
* Represents support in the underlying system for windows all of |
||||||
|
* the pixels of which have the same alpha value between or including |
||||||
|
* 0.0 and 1.0. |
||||||
|
*/ |
||||||
|
TRANSLUCENT, |
||||||
|
|
||||||
|
/** |
||||||
|
* Represents support in the underlying system for windows that |
||||||
|
* contain or might contain pixels with arbitrary alpha values |
||||||
|
* between and including 0.0 and 1.0. |
||||||
|
*/ |
||||||
|
PERPIXEL_TRANSLUCENT; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Returns whether the given level of translucency is supported by |
||||||
|
* the underlying system. |
||||||
|
* |
||||||
|
* Note that this method may sometimes return the value |
||||||
|
* indicating that the particular level is supported, but |
||||||
|
* the native windowing system may still not support the |
||||||
|
* given level of translucency (due to the bugs in |
||||||
|
* the windowing system). |
||||||
|
* |
||||||
|
* @param translucencyKind a kind of translucency support |
||||||
|
* (either PERPIXEL_TRANSPARENT, |
||||||
|
* TRANSLUCENT, or PERPIXEL_TRANSLUCENT) |
||||||
|
* @return whether the given translucency kind is supported |
||||||
|
*/ |
||||||
|
private static boolean isTranslucencySupported(Translucency translucencyKind) { |
||||||
|
switch (translucencyKind) { |
||||||
|
case PERPIXEL_TRANSPARENT: |
||||||
|
return isWindowShapingSupported(); |
||||||
|
case TRANSLUCENT: |
||||||
|
return isWindowOpacitySupported(); |
||||||
|
case PERPIXEL_TRANSLUCENT: |
||||||
|
return isWindowTranslucencySupported(); |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Returns whether the windowing system supports changing the opacity |
||||||
|
* value of top-level windows. |
||||||
|
* Note that this method may sometimes return true, but the native |
||||||
|
* windowing system may still not support the concept of |
||||||
|
* translucency (due to the bugs in the windowing system). |
||||||
|
*/ |
||||||
|
private static boolean isWindowOpacitySupported() { |
||||||
|
Toolkit curToolkit = Toolkit.getDefaultToolkit(); |
||||||
|
if (!(curToolkit instanceof SunToolkit)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return ((SunToolkit)curToolkit).isWindowOpacitySupported(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Returns whether the windowing system supports changing the shape |
||||||
|
* of top-level windows. |
||||||
|
* Note that this method may sometimes return true, but the native |
||||||
|
* windowing system may still not support the concept of |
||||||
|
* shaping (due to the bugs in the windowing system). |
||||||
|
*/ |
||||||
|
private static boolean isWindowShapingSupported() { |
||||||
|
Toolkit curToolkit = Toolkit.getDefaultToolkit(); |
||||||
|
if (!(curToolkit instanceof SunToolkit)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return ((SunToolkit)curToolkit).isWindowShapingSupported(); |
||||||
|
} |
||||||
|
|
||||||
|
private static boolean isWindowTranslucencySupported() { |
||||||
|
/* |
||||||
|
* Per-pixel alpha is supported if all the conditions are TRUE: |
||||||
|
* 1. The toolkit is a sort of SunToolkit |
||||||
|
* 2. The toolkit supports translucency in general |
||||||
|
* (isWindowTranslucencySupported()) |
||||||
|
* 3. There's at least one translucency-capable |
||||||
|
* GraphicsConfiguration |
||||||
|
*/ |
||||||
|
|
||||||
|
Toolkit curToolkit = Toolkit.getDefaultToolkit(); |
||||||
|
if (!(curToolkit instanceof SunToolkit)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
GraphicsEnvironment env = |
||||||
|
GraphicsEnvironment.getLocalGraphicsEnvironment(); |
||||||
|
|
||||||
|
// If the default GC supports translucency return true.
|
||||||
|
// It is important to optimize the verification this way,
|
||||||
|
// see CR 6661196 for more details.
|
||||||
|
if (isTranslucencyCapable(env.getDefaultScreenDevice() |
||||||
|
.getDefaultConfiguration())) |
||||||
|
{ |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
// ... otherwise iterate through all the GCs.
|
||||||
|
GraphicsDevice[] devices = env.getScreenDevices(); |
||||||
|
|
||||||
|
for (int i = 0; i < devices.length; i++) { |
||||||
|
GraphicsConfiguration[] configs = devices[i].getConfigurations(); |
||||||
|
for (int j = 0; j < configs.length; j++) { |
||||||
|
if (isTranslucencyCapable(configs[j])) { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
private static boolean isTranslucencyCapable(GraphicsConfiguration gc) { |
||||||
|
if (gc == null) { |
||||||
|
throw new NullPointerException("The gc argument should not be null"); |
||||||
|
} |
||||||
|
/* |
||||||
|
return gc.isTranslucencyCapable(); |
||||||
|
*/ |
||||||
|
Toolkit curToolkit = Toolkit.getDefaultToolkit(); |
||||||
|
if (!(curToolkit instanceof SunToolkit)) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
return ((SunToolkit)curToolkit).isTranslucencyCapable(gc); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package com.fr.design.gui.icombocheckbox; |
||||||
|
|
||||||
|
import junit.framework.TestCase; |
||||||
|
import org.junit.Assert; |
||||||
|
import org.junit.Test; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.TreeMap; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author hades |
||||||
|
* @version 10.0 |
||||||
|
* Created by hades on 2020/4/3 |
||||||
|
*/ |
||||||
|
public class UICheckListPopupTest extends TestCase { |
||||||
|
|
||||||
|
@Test |
||||||
|
public void testGetSelectedValues() { |
||||||
|
Object[] values = new Object[]{"a", "b", "c"}; |
||||||
|
Map<Object, Boolean> map = new TreeMap<>(); |
||||||
|
map.put("a", true); |
||||||
|
map.put("b", false); |
||||||
|
map.put("c", true); |
||||||
|
List<Object> list = new ArrayList<>(); |
||||||
|
for (Map.Entry<Object, Boolean> entry : map.entrySet()) { |
||||||
|
if (entry.getValue()) { |
||||||
|
list.add(entry.getKey()); |
||||||
|
} |
||||||
|
} |
||||||
|
Object[] selectValues = list.toArray(); |
||||||
|
UICheckListPopup uiCheckListPopup1 = new UICheckListPopup(values); |
||||||
|
uiCheckListPopup1.setSelectedValue(map); |
||||||
|
Assert.assertArrayEquals(selectValues, uiCheckListPopup1.getSelectedValues()); |
||||||
|
UICheckListPopup uiCheckListPopup2 = new UICheckListPopup(values, false); |
||||||
|
uiCheckListPopup2.setSelectedValue(map); |
||||||
|
Assert.assertArrayEquals(selectValues, uiCheckListPopup2.getSelectedValues()); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
dependencies { |
||||||
|
compile project(':designer-base') |
||||||
|
} |
@ -0,0 +1,3 @@ |
|||||||
|
dependencies { |
||||||
|
compile project(':designer-base') |
||||||
|
} |
@ -0,0 +1,4 @@ |
|||||||
|
dependencies { |
||||||
|
compile project(':designer-form') |
||||||
|
compile project(':designer-chart') |
||||||
|
} |
@ -0,0 +1,29 @@ |
|||||||
|
def getRootGradle() { |
||||||
|
def currentGradle = gradle |
||||||
|
while (currentGradle.parent) { |
||||||
|
currentGradle = currentGradle.parent |
||||||
|
} |
||||||
|
return currentGradle |
||||||
|
} |
||||||
|
|
||||||
|
def findHookIncludedBuild() { |
||||||
|
def rootGradle = getRootGradle() |
||||||
|
def hookProject = rootGradle.getIncludedBuilds() |
||||||
|
.find({ build -> build.name == 'hook' }) |
||||||
|
return hookProject |
||||||
|
} |
||||||
|
|
||||||
|
def findGlobalConfig() { |
||||||
|
def hookProject = findHookIncludedBuild() |
||||||
|
if (hookProject) { |
||||||
|
def path = hookProject.projectDir.parent + '/globalConfig.gradle' |
||||||
|
if (file(path).exists()) { |
||||||
|
return path |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
def globalConfigPath = findGlobalConfig() |
||||||
|
if (globalConfigPath) { |
||||||
|
apply from: globalConfigPath |
||||||
|
} |
Binary file not shown.
@ -0,0 +1,6 @@ |
|||||||
|
#Wed Apr 22 15:17:12 CST 2020 |
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip |
||||||
|
distributionBase=GRADLE_USER_HOME |
||||||
|
distributionPath=wrapper/dists |
||||||
|
zipStorePath=wrapper/dists |
||||||
|
zipStoreBase=GRADLE_USER_HOME |
@ -0,0 +1,172 @@ |
|||||||
|
#!/usr/bin/env sh |
||||||
|
|
||||||
|
############################################################################## |
||||||
|
## |
||||||
|
## Gradle start up script for UN*X |
||||||
|
## |
||||||
|
############################################################################## |
||||||
|
|
||||||
|
# Attempt to set APP_HOME |
||||||
|
# Resolve links: $0 may be a link |
||||||
|
PRG="$0" |
||||||
|
# Need this for relative symlinks. |
||||||
|
while [ -h "$PRG" ] ; do |
||||||
|
ls=`ls -ld "$PRG"` |
||||||
|
link=`expr "$ls" : '.*-> \(.*\)$'` |
||||||
|
if expr "$link" : '/.*' > /dev/null; then |
||||||
|
PRG="$link" |
||||||
|
else |
||||||
|
PRG=`dirname "$PRG"`"/$link" |
||||||
|
fi |
||||||
|
done |
||||||
|
SAVED="`pwd`" |
||||||
|
cd "`dirname \"$PRG\"`/" >/dev/null |
||||||
|
APP_HOME="`pwd -P`" |
||||||
|
cd "$SAVED" >/dev/null |
||||||
|
|
||||||
|
APP_NAME="Gradle" |
||||||
|
APP_BASE_NAME=`basename "$0"` |
||||||
|
|
||||||
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
||||||
|
DEFAULT_JVM_OPTS='"-Xmx64m"' |
||||||
|
|
||||||
|
# Use the maximum available, or set MAX_FD != -1 to use that value. |
||||||
|
MAX_FD="maximum" |
||||||
|
|
||||||
|
warn () { |
||||||
|
echo "$*" |
||||||
|
} |
||||||
|
|
||||||
|
die () { |
||||||
|
echo |
||||||
|
echo "$*" |
||||||
|
echo |
||||||
|
exit 1 |
||||||
|
} |
||||||
|
|
||||||
|
# OS specific support (must be 'true' or 'false'). |
||||||
|
cygwin=false |
||||||
|
msys=false |
||||||
|
darwin=false |
||||||
|
nonstop=false |
||||||
|
case "`uname`" in |
||||||
|
CYGWIN* ) |
||||||
|
cygwin=true |
||||||
|
;; |
||||||
|
Darwin* ) |
||||||
|
darwin=true |
||||||
|
;; |
||||||
|
MINGW* ) |
||||||
|
msys=true |
||||||
|
;; |
||||||
|
NONSTOP* ) |
||||||
|
nonstop=true |
||||||
|
;; |
||||||
|
esac |
||||||
|
|
||||||
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar |
||||||
|
|
||||||
|
# Determine the Java command to use to start the JVM. |
||||||
|
if [ -n "$JAVA_HOME" ] ; then |
||||||
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then |
||||||
|
# IBM's JDK on AIX uses strange locations for the executables |
||||||
|
JAVACMD="$JAVA_HOME/jre/sh/java" |
||||||
|
else |
||||||
|
JAVACMD="$JAVA_HOME/bin/java" |
||||||
|
fi |
||||||
|
if [ ! -x "$JAVACMD" ] ; then |
||||||
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME |
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the |
||||||
|
location of your Java installation." |
||||||
|
fi |
||||||
|
else |
||||||
|
JAVACMD="java" |
||||||
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
||||||
|
|
||||||
|
Please set the JAVA_HOME variable in your environment to match the |
||||||
|
location of your Java installation." |
||||||
|
fi |
||||||
|
|
||||||
|
# Increase the maximum file descriptors if we can. |
||||||
|
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then |
||||||
|
MAX_FD_LIMIT=`ulimit -H -n` |
||||||
|
if [ $? -eq 0 ] ; then |
||||||
|
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then |
||||||
|
MAX_FD="$MAX_FD_LIMIT" |
||||||
|
fi |
||||||
|
ulimit -n $MAX_FD |
||||||
|
if [ $? -ne 0 ] ; then |
||||||
|
warn "Could not set maximum file descriptor limit: $MAX_FD" |
||||||
|
fi |
||||||
|
else |
||||||
|
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" |
||||||
|
fi |
||||||
|
fi |
||||||
|
|
||||||
|
# For Darwin, add options to specify how the application appears in the dock |
||||||
|
if $darwin; then |
||||||
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" |
||||||
|
fi |
||||||
|
|
||||||
|
# For Cygwin, switch paths to Windows format before running java |
||||||
|
if $cygwin ; then |
||||||
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"` |
||||||
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` |
||||||
|
JAVACMD=`cygpath --unix "$JAVACMD"` |
||||||
|
|
||||||
|
# We build the pattern for arguments to be converted via cygpath |
||||||
|
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` |
||||||
|
SEP="" |
||||||
|
for dir in $ROOTDIRSRAW ; do |
||||||
|
ROOTDIRS="$ROOTDIRS$SEP$dir" |
||||||
|
SEP="|" |
||||||
|
done |
||||||
|
OURCYGPATTERN="(^($ROOTDIRS))" |
||||||
|
# Add a user-defined pattern to the cygpath arguments |
||||||
|
if [ "$GRADLE_CYGPATTERN" != "" ] ; then |
||||||
|
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" |
||||||
|
fi |
||||||
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh |
||||||
|
i=0 |
||||||
|
for arg in "$@" ; do |
||||||
|
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` |
||||||
|
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option |
||||||
|
|
||||||
|
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition |
||||||
|
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` |
||||||
|
else |
||||||
|
eval `echo args$i`="\"$arg\"" |
||||||
|
fi |
||||||
|
i=$((i+1)) |
||||||
|
done |
||||||
|
case $i in |
||||||
|
(0) set -- ;; |
||||||
|
(1) set -- "$args0" ;; |
||||||
|
(2) set -- "$args0" "$args1" ;; |
||||||
|
(3) set -- "$args0" "$args1" "$args2" ;; |
||||||
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;; |
||||||
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; |
||||||
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; |
||||||
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; |
||||||
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; |
||||||
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; |
||||||
|
esac |
||||||
|
fi |
||||||
|
|
||||||
|
# Escape application args |
||||||
|
save () { |
||||||
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done |
||||||
|
echo " " |
||||||
|
} |
||||||
|
APP_ARGS=$(save "$@") |
||||||
|
|
||||||
|
# Collect all arguments for the java command, following the shell quoting and substitution rules |
||||||
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" |
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong |
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then |
||||||
|
cd "$(dirname "$0")" |
||||||
|
fi |
||||||
|
|
||||||
|
exec "$JAVACMD" "$@" |
@ -0,0 +1,84 @@ |
|||||||
|
@if "%DEBUG%" == "" @echo off |
||||||
|
@rem ########################################################################## |
||||||
|
@rem |
||||||
|
@rem Gradle startup script for Windows |
||||||
|
@rem |
||||||
|
@rem ########################################################################## |
||||||
|
|
||||||
|
@rem Set local scope for the variables with windows NT shell |
||||||
|
if "%OS%"=="Windows_NT" setlocal |
||||||
|
|
||||||
|
set DIRNAME=%~dp0 |
||||||
|
if "%DIRNAME%" == "" set DIRNAME=. |
||||||
|
set APP_BASE_NAME=%~n0 |
||||||
|
set APP_HOME=%DIRNAME% |
||||||
|
|
||||||
|
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. |
||||||
|
set DEFAULT_JVM_OPTS="-Xmx64m" |
||||||
|
|
||||||
|
@rem Find java.exe |
||||||
|
if defined JAVA_HOME goto findJavaFromJavaHome |
||||||
|
|
||||||
|
set JAVA_EXE=java.exe |
||||||
|
%JAVA_EXE% -version >NUL 2>&1 |
||||||
|
if "%ERRORLEVEL%" == "0" goto init |
||||||
|
|
||||||
|
echo. |
||||||
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. |
||||||
|
echo. |
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the |
||||||
|
echo location of your Java installation. |
||||||
|
|
||||||
|
goto fail |
||||||
|
|
||||||
|
:findJavaFromJavaHome |
||||||
|
set JAVA_HOME=%JAVA_HOME:"=% |
||||||
|
set JAVA_EXE=%JAVA_HOME%/bin/java.exe |
||||||
|
|
||||||
|
if exist "%JAVA_EXE%" goto init |
||||||
|
|
||||||
|
echo. |
||||||
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% |
||||||
|
echo. |
||||||
|
echo Please set the JAVA_HOME variable in your environment to match the |
||||||
|
echo location of your Java installation. |
||||||
|
|
||||||
|
goto fail |
||||||
|
|
||||||
|
:init |
||||||
|
@rem Get command-line arguments, handling Windows variants |
||||||
|
|
||||||
|
if not "%OS%" == "Windows_NT" goto win9xME_args |
||||||
|
|
||||||
|
:win9xME_args |
||||||
|
@rem Slurp the command line arguments. |
||||||
|
set CMD_LINE_ARGS= |
||||||
|
set _SKIP=2 |
||||||
|
|
||||||
|
:win9xME_args_slurp |
||||||
|
if "x%~1" == "x" goto execute |
||||||
|
|
||||||
|
set CMD_LINE_ARGS=%* |
||||||
|
|
||||||
|
:execute |
||||||
|
@rem Setup the command line |
||||||
|
|
||||||
|
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar |
||||||
|
|
||||||
|
@rem Execute Gradle |
||||||
|
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% |
||||||
|
|
||||||
|
:end |
||||||
|
@rem End local scope for the variables with windows NT shell |
||||||
|
if "%ERRORLEVEL%"=="0" goto mainEnd |
||||||
|
|
||||||
|
:fail |
||||||
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of |
||||||
|
rem the _cmd.exe /c_ return code! |
||||||
|
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 |
||||||
|
exit /b 1 |
||||||
|
|
||||||
|
:mainEnd |
||||||
|
if "%OS%"=="Windows_NT" endlocal |
||||||
|
|
||||||
|
:omega |
Loading…
Reference in new issue