Compare commits
78 Commits
Author | SHA1 | Date |
---|---|---|
richie | 298d68108e | 2 years ago |
左良 | 8304ca3fca | 2 years ago |
fanglei | d478c5195c | 3 years ago |
方磊 | 6c6d508a4d | 3 years ago |
fanglei | e2e8e2ae9b | 3 years ago |
方磊 | d7b8d62996 | 3 years ago |
fanglei | dfd16cb126 | 3 years ago |
方磊 | 198f73b578 | 3 years ago |
方磊 | 7013e6461f | 3 years ago |
方磊 | 649edf31f9 | 3 years ago |
fanglei | 2f51c2b3c0 | 3 years ago |
方磊 | b6778538bc | 3 years ago |
richie | 6df075061c | 3 years ago |
richie | 30b5970252 | 3 years ago |
Yvan | 521dd29c3e | 3 years ago |
richie | 8280abdf3b | 3 years ago |
lucian | c8fb5454f3 | 3 years ago |
richie | 22c28b7090 | 3 years ago |
Yvan | a1900cf1ba | 3 years ago |
richie | eaf185c3ed | 3 years ago |
Dylan.Liu | 753eb6961b | 3 years ago |
richie | c0cfb5d757 | 3 years ago |
Dylan.Liu | c7b4de0094 | 3 years ago |
Dylan.Liu | a74076a85f | 3 years ago |
richie | 49a526fe18 | 3 years ago |
Dylan.Liu | a5f9492492 | 3 years ago |
Dylan.Liu | 40754f05de | 3 years ago |
zed | 4793f9c62f | 3 years ago |
zed | afef877673 | 3 years ago |
zed | ed3d398e94 | 3 years ago |
zed | a7632f3931 | 3 years ago |
richie | f989336efe | 3 years ago |
zed | defd3cce2a | 3 years ago |
zed | 420bc83904 | 3 years ago |
zed | 8439799f7e | 3 years ago |
zed | fb3039634b | 3 years ago |
zed | 94a302baa3 | 3 years ago |
zed | 9cff6a3549 | 3 years ago |
richie | 143dd065b8 | 4 years ago |
richie | 02ce67e177 | 4 years ago |
richie | 3ceb9c1043 | 4 years ago |
superman | f5268bd1eb | 4 years ago |
方磊 | 63bf89f824 | 4 years ago |
superman | a6a113c0f0 | 4 years ago |
方磊 | fa0421f466 | 4 years ago |
richie | ee06a919f7 | 4 years ago |
richie | e2ae3cd143 | 4 years ago |
richie | 267d432649 | 4 years ago |
richie | d3efdfe017 | 4 years ago |
lidongy | 30f57b7bc8 | 4 years ago |
richie | ea6dadfaa5 | 4 years ago |
richie | 9fe18b1d23 | 4 years ago |
richie | 140ff682d5 | 4 years ago |
zed | 59913502d7 | 4 years ago |
richie | c9927c04d9 | 4 years ago |
zed | 189e9cbde9 | 4 years ago |
zed | a308409036 | 4 years ago |
Dylan.Liu | 535e65c21b | 4 years ago |
richie | 35d99d0ad6 | 4 years ago |
Dylan.Liu | e0de2f3888 | 4 years ago |
Dylan.Liu | 3f6d4208f2 | 4 years ago |
richie | 141d939c65 | 4 years ago |
Dylan.Liu | 5419aded99 | 4 years ago |
Dylan.Liu | 4199182e20 | 4 years ago |
richie | 19ffaa02e9 | 4 years ago |
lucian | d1e64878b0 | 4 years ago |
lucian | 6eabb72ab5 | 4 years ago |
lucian | f3f6fe516a | 4 years ago |
lucian | 1592d614d2 | 4 years ago |
lucian | 34ba599b1c | 4 years ago |
richie | 7d66eae57a | 4 years ago |
richie | 92e765c216 | 4 years ago |
richie | 307fa89147 | 4 years ago |
Dylan.Liu | 8e226b3039 | 4 years ago |
richie | 57a82d1950 | 4 years ago |
richie | f42dc631ec | 4 years ago |
richie | 6ff386cc38 | 4 years ago |
richie | 036f4302eb | 4 years ago |
128 changed files with 3117 additions and 183 deletions
@ -1,6 +1,13 @@
|
||||
*.iml |
||||
.idea/ |
||||
target/ |
||||
/target/ |
||||
/download/ |
||||
/webroot/ |
||||
.DS_Store |
||||
.classpath |
||||
.gradle |
||||
build |
||||
local.properties |
||||
classes/ |
||||
transform-classes/ |
||||
tomcat.* |
||||
*.jar |
@ -0,0 +1,60 @@
|
||||
apply plugin: 'java' |
||||
|
||||
/** |
||||
* 可以修改这个变量以依赖不同的开发版本 |
||||
*/ |
||||
def fineVersion = '10.0-FEATURE-SNAPSHOT' |
||||
|
||||
group = 'com.fanruan.api' |
||||
version = '10.0' |
||||
sourceCompatibility = '1.8' |
||||
|
||||
static def getDate() { |
||||
def date = new Date() |
||||
def formattedDate = date.format('yyyyMMdd') |
||||
return formattedDate |
||||
} |
||||
|
||||
jar { |
||||
manifest{ |
||||
attributes ("Implementation-Version" : "10.0", "Specification-Version" : getDate()) |
||||
} |
||||
baseName 'finekit' |
||||
version archiveVersion.get() + "-" + getDate() |
||||
} |
||||
|
||||
repositories { |
||||
mavenLocal() |
||||
maven { |
||||
url = uri('http://mvn.finedevelop.com/repository/maven-public/') |
||||
} |
||||
|
||||
maven { |
||||
url = uri('http://repo.maven.apache.org/maven2') |
||||
} |
||||
} |
||||
|
||||
dependencies { |
||||
implementation files("${System.getProperty('java.home')}/../lib/tools.jar") |
||||
implementation 'com.fr.third:fine-third:' + fineVersion |
||||
implementation 'com.fr.activator:fine-activator:' + fineVersion |
||||
implementation 'com.fr.core:fine-core:' + fineVersion |
||||
implementation 'com.fr.webui:fine-webui:' + fineVersion |
||||
implementation 'com.fr.datasource:fine-datasource:' + fineVersion |
||||
implementation 'com.fr.decision:fine-decision:' + fineVersion |
||||
implementation 'com.fr.decision:fine-decision-report:' + fineVersion |
||||
implementation 'com.fr.schedule:fine-schedule:' + fineVersion |
||||
implementation 'com.fr.schedule:fine-schedule-report:' + fineVersion |
||||
implementation 'com.fr.intelligence:fine-swift:' + fineVersion |
||||
implementation 'com.fr.intelligence:fine-accumulator:' + fineVersion |
||||
implementation 'com.fr.report:fine-report-engine:' + fineVersion |
||||
implementation 'com.fr.report:fine-report-designer:' + fineVersion |
||||
|
||||
implementation 'org.slf4j:slf4j-api:1.7.30' |
||||
implementation 'org.slf4j:slf4j-simple:1.7.30' |
||||
testImplementation 'junit:junit:4.12' |
||||
testImplementation 'org.easymock:easymock:3.5.1' |
||||
testImplementation 'org.powermock:powermock-api-easymock:1.7.1' |
||||
testImplementation 'org.powermock:powermock-module-junit4:1.7.1' |
||||
testImplementation 'com.squareup.okhttp3:mockwebserver:4.0.1' |
||||
} |
@ -0,0 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME |
||||
distributionPath=wrapper/dists |
||||
distributionUrl=https\://downloads.gradle-dn.com/distributions/gradle-6.1-bin.zip |
||||
zipStoreBase=GRADLE_USER_HOME |
||||
zipStorePath=wrapper/dists |
@ -0,0 +1,183 @@
|
||||
#!/usr/bin/env sh |
||||
|
||||
# |
||||
# Copyright 2015 the original author or authors. |
||||
# |
||||
# Licensed under the Apache License, Version 2.0 (the "License"); |
||||
# you may not use this file except in compliance with the License. |
||||
# You may obtain a copy of the License at |
||||
# |
||||
# https://www.apache.org/licenses/LICENSE-2.0 |
||||
# |
||||
# Unless required by applicable law or agreed to in writing, software |
||||
# distributed under the License is distributed on an "AS IS" BASIS, |
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
# See the License for the specific language governing permissions and |
||||
# limitations under the License. |
||||
# |
||||
|
||||
############################################################################## |
||||
## |
||||
## 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" "-Xms64m"' |
||||
|
||||
# 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 or MSYS, switch paths to Windows format before running java |
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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" |
||||
|
||||
exec "$JAVACMD" "$@" |
@ -0,0 +1,100 @@
|
||||
@rem |
||||
@rem Copyright 2015 the original author or authors. |
||||
@rem |
||||
@rem Licensed under the Apache License, Version 2.0 (the "License"); |
||||
@rem you may not use this file except in compliance with the License. |
||||
@rem You may obtain a copy of the License at |
||||
@rem |
||||
@rem https://www.apache.org/licenses/LICENSE-2.0 |
||||
@rem |
||||
@rem Unless required by applicable law or agreed to in writing, software |
||||
@rem distributed under the License is distributed on an "AS IS" BASIS, |
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
@rem See the License for the specific language governing permissions and |
||||
@rem limitations under the License. |
||||
@rem |
||||
|
||||
@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" "-Xms64m" |
||||
|
||||
@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 |
@ -0,0 +1,38 @@
|
||||
package com.fanruan.api.cluster; |
||||
|
||||
import com.fr.cluster.ClusterBridge; |
||||
import com.fr.cluster.core.ClusterNode; |
||||
import com.fr.cluster.core.ClusterView; |
||||
import com.fr.stable.Filter; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class ClusterBridgeKit { |
||||
|
||||
public static ClusterNode getCurrentNode() { |
||||
return ClusterBridge.getView().getCurrent(); |
||||
} |
||||
|
||||
public static ClusterNode getNodeById(String var1) { |
||||
return ClusterBridge.getView().getNodeById(var1); |
||||
} |
||||
|
||||
public static List<ClusterNode> listNodes() { |
||||
return ClusterBridge.getView().listNodes(); |
||||
} |
||||
|
||||
public static List<ClusterNode> listNodes(Filter<ClusterNode> var1) { |
||||
return ClusterBridge.getView().listNodes(var1); |
||||
} |
||||
|
||||
public static boolean isClusterMode() { |
||||
return ClusterBridge.isClusterMode(); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fanruan.api.cluster.resource; |
||||
|
||||
import com.fr.io.config.CommonRepoConfig; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/3 |
||||
*/ |
||||
public class BaseCommonRepoConfig extends CommonRepoConfig { |
||||
|
||||
private static final long serialVersionUID = 6713243696930557143L; |
||||
|
||||
public BaseCommonRepoConfig(String identity) { |
||||
super(identity); |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fanruan.api.cluster.resource; |
||||
|
||||
import com.fr.decision.fileserver.FineFileServer; |
||||
import com.fr.io.config.RepositoryConfig; |
||||
|
||||
/** |
||||
* 文件服务器Kit. |
||||
* |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/12 |
||||
*/ |
||||
public class FineFileServerKit { |
||||
|
||||
/** |
||||
* 获取文件服务器当前配置. |
||||
* |
||||
* @return 文件服务器当前配置 |
||||
* @throws Exception 获取配置失败时异常 |
||||
*/ |
||||
public static <T extends RepositoryConfig> T getRepoConfig() throws Exception { |
||||
return FineFileServer.getInstance().getRepoConfig(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fanruan.api.cluster.resource; |
||||
|
||||
import com.fr.io.config.RepositoryConfig; |
||||
import com.fr.io.context.ResourceModuleContext; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/3 |
||||
*/ |
||||
public class ResourceModuleContextKit { |
||||
|
||||
public static <T extends RepositoryConfig> T getRepoConfig(String hdfs, String srcRepo) { |
||||
return ResourceModuleContext.getRepoConfig(hdfs, srcRepo); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fanruan.api.cluster.resource; |
||||
|
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.resource.WorkResource; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/3 |
||||
*/ |
||||
public class WorkContextKit { |
||||
public static WorkResource getWorkResource() { |
||||
return WorkContext.getWorkResource(); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.collections.config.CollectionsConfig; |
||||
import com.fr.store.impl.accessor.api.impl.AbstractFineStoreGenericPool; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2020/4/26 |
||||
* 供插件使用 |
||||
* 设置资源连接池, 注册实际资源 |
||||
*/ |
||||
public abstract class BaseFineStoreGenericPool<T> extends AbstractFineStoreGenericPool<T> { |
||||
|
||||
@Override |
||||
public abstract boolean accept(CollectionsConfig config); |
||||
|
||||
@Override |
||||
public abstract BaseFineStoreWrapper refresh(T redisConfig); |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
|
||||
import com.fr.store.impl.accessor.api.FineStoreWrapper; |
||||
import com.fr.store.impl.accessor.api.impl.FineStoreAdapter; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2020/4/26 |
||||
* 供插件使用的资源包装器 |
||||
*/ |
||||
public abstract class BaseFineStoreWrapper implements FineStoreWrapper { |
||||
@Override |
||||
public abstract FineStoreAdapter getResource(); |
||||
|
||||
@Override |
||||
public abstract void destroy(); |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.store.impl.accessor.api.impl.StandAloneStore; |
||||
import com.fr.third.redis.clients.jedis.Jedis; |
||||
|
||||
/** |
||||
* 单机<code>Redis API</code>层. |
||||
* |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/18 |
||||
*/ |
||||
public class BaseStandAloneStore extends StandAloneStore { |
||||
public BaseStandAloneStore(Jedis jedis) { |
||||
super(jedis); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.collections.FineCollections; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/18 |
||||
*/ |
||||
public class FineCollectionsKit { |
||||
|
||||
public FineCollectionsKit() {} |
||||
|
||||
/** |
||||
* 销毁集群集合 |
||||
*/ |
||||
public static void destroy() { |
||||
FineCollections.getInstance().getClient().destroy(); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.cluster.engine.core.jchannel.MachineMarker; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class MachineKit { |
||||
|
||||
public static String currentID() { |
||||
return MachineMarker.currentID(); |
||||
} |
||||
|
||||
public static String currentName() { |
||||
return MachineMarker.currentName(); |
||||
} |
||||
} |
@ -0,0 +1,15 @@
|
||||
package com.fanruan.api.cluster.state; |
||||
|
||||
import com.fr.store.impl.StoreTemplate; |
||||
|
||||
/** |
||||
* @author Dylan.Liu |
||||
* @version 10.0 |
||||
* Created by Dylan.Liu on 2021/1/3 |
||||
*/ |
||||
public class StoreTemplateKit { |
||||
|
||||
public static void close() { |
||||
StoreTemplate.getInstance().close(); |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fanruan.api.concurrent; |
||||
|
||||
import com.fr.concurrent.NamedThreadFactory; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/27 |
||||
*/ |
||||
public class ConcurrentKit { |
||||
|
||||
/** |
||||
* 创建命名的线程工厂 |
||||
* @param prefix 线程池名称前缀 |
||||
* @return 线程工厂 |
||||
*/ |
||||
public static NamedThreadFactory newNamedThreadFactory(String prefix) { |
||||
return new NamedThreadFactory(prefix); |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fanruan.api.conf; |
||||
|
||||
import com.fr.config.MarketConfig; |
||||
|
||||
public class MarketConfigKit { |
||||
/** |
||||
* 获取服务器appId |
||||
* |
||||
* @return appId |
||||
*/ |
||||
public static String getAppId() { |
||||
return MarketConfig.getInstance().getCloudOperationMaintenanceId(); |
||||
} |
||||
|
||||
/** |
||||
* 获取已登录帆软市场的用户名 |
||||
* |
||||
* @return userId |
||||
*/ |
||||
public static long getUserId() { |
||||
return MarketConfig.getInstance().getBbsUid(); |
||||
} |
||||
} |
@ -0,0 +1,30 @@
|
||||
package com.fanruan.api.conf.impl.xml; |
||||
|
||||
import java.util.Collection; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class XmlColConf<T extends Collection> extends com.fr.config.holder.impl.xml.XmlColConf<Collection> { |
||||
public XmlColConf(String s, Collection collection, Class aClass) { |
||||
super(s, collection, aClass); |
||||
} |
||||
|
||||
public XmlColConf(Collection collection, Class aClass) { |
||||
super(collection, aClass); |
||||
} |
||||
|
||||
public XmlColConf(Collection collection, Class aClass, boolean b) { |
||||
super(collection, aClass, b); |
||||
} |
||||
|
||||
public XmlColConf(Collection collection, Class aClass, String s) { |
||||
super(collection, aClass, s); |
||||
} |
||||
|
||||
public XmlColConf(Collection collection, Class aClass, String s, boolean b) { |
||||
super(collection, aClass, s, b); |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fanruan.api.conf.impl.xml; |
||||
|
||||
import com.fr.stable.xml.XMLable; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class XmlConf<T extends XMLable> extends com.fr.config.holder.impl.xml.XmlConf<XMLable> { |
||||
public XmlConf(String s, XMLable xmLable, Class aClass) { |
||||
super(s, xmLable, aClass); |
||||
} |
||||
|
||||
public XmlConf(XMLable xmLable, Class aClass) { |
||||
super(xmLable, aClass); |
||||
} |
||||
|
||||
public XmlConf(XMLable xmLable, Class aClass, String s) { |
||||
super(xmLable, aClass, s); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.fanruan.api.decision.monitor; |
||||
|
||||
import com.fr.decision.system.monitor.gc.load.RuntimeMemScoreProvider; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class RuntimeMemScoreKit { |
||||
|
||||
//分发得分
|
||||
public static int getLoadScore() { |
||||
return RuntimeMemScoreProvider.getLoadScore(); |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fanruan.api.decision.role; |
||||
|
||||
import com.fr.decision.authority.data.CustomRole; |
||||
import com.fr.decision.webservice.utils.ControllerFactory; |
||||
import org.jetbrains.annotations.NotNull; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Zed |
||||
* @version 10.0 |
||||
* Created by Zed on 2020/4/30 |
||||
*/ |
||||
public class CustomRoleKit { |
||||
|
||||
/** |
||||
* 获取角色id |
||||
* |
||||
* @param userId 用户id |
||||
* @param keyword 搜索关键字 |
||||
* @return 角色id |
||||
* @throws Exception 异常 |
||||
*/ |
||||
public static List<String> getCustomRoleIds(@NotNull String userId, String keyword) throws Exception { |
||||
|
||||
List<String> result = new ArrayList<>(); |
||||
CustomRole[] roles = ControllerFactory.getInstance().getCustomRoleController(userId).getAllCustomRoles(userId, keyword); |
||||
for (CustomRole role : roles) { |
||||
result.add(role.getId()); |
||||
} |
||||
|
||||
return result; |
||||
} |
||||
} |
@ -0,0 +1,10 @@
|
||||
package com.fanruan.api.decision.store; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class StateHubManager extends com.fr.store.StateHubManager { |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.Icon; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class UIHeadGroup extends com.fr.design.gui.ibutton.UIHeadGroup { |
||||
public UIHeadGroup(String[] strings) { |
||||
super(strings); |
||||
} |
||||
|
||||
public UIHeadGroup(Icon[] icons) { |
||||
super(icons); |
||||
} |
||||
|
||||
public UIHeadGroup(Icon[] icons, String[] strings) { |
||||
super(icons, strings); |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import com.fr.design.editlock.EditLockChangeEvent; |
||||
import com.fr.design.editlock.EditLockChangeListener; |
||||
import com.fr.design.editlock.EditLockUtils; |
||||
import com.fr.report.LockItem; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* @author Yvan |
||||
* @version 10.0 |
||||
* Created by Yvan on 2021/1/20 |
||||
*/ |
||||
public class UILockButton extends UIButton implements EditLockChangeListener { |
||||
|
||||
/** |
||||
* 锁定状态图标 |
||||
*/ |
||||
private final Icon lockedIcon; |
||||
/** |
||||
* 正常状态图标 |
||||
*/ |
||||
private final Icon normalIcon; |
||||
/** |
||||
* 锁定状态的提示信息 |
||||
*/ |
||||
private final String lockedTooltips; |
||||
/** |
||||
* 正常状态的提示信息 |
||||
*/ |
||||
private final String normalTooltips; |
||||
|
||||
public UILockButton(Icon lockedIcon, Icon normalIcon, String lockedTooltips, String normalTooltips) { |
||||
super(); |
||||
this.lockedIcon = lockedIcon; |
||||
this.normalIcon = normalIcon; |
||||
this.lockedTooltips = lockedTooltips; |
||||
this.normalTooltips = normalTooltips; |
||||
init(); |
||||
} |
||||
|
||||
private void init() { |
||||
boolean locked = EditLockUtils.isLocked(LockItem.CONNECTION); |
||||
this.setIcon(locked ? lockedIcon : normalIcon); |
||||
this.setToolTipText(locked ? lockedTooltips : normalTooltips); |
||||
} |
||||
|
||||
@Override |
||||
public void updateLockedState(EditLockChangeEvent event) { |
||||
this.setIcon(event.isLocked() ? lockedIcon : normalIcon); |
||||
this.setToolTipText(event.isLocked() ? lockedTooltips : normalTooltips); |
||||
this.repaint(); |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fanruan.api.design.ui.component; |
||||
|
||||
import javax.swing.Action; |
||||
import javax.swing.Icon; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/20 |
||||
*/ |
||||
public class UIRadioButton extends com.fr.design.gui.ibutton.UIRadioButton { |
||||
|
||||
public UIRadioButton() { |
||||
super(); |
||||
} |
||||
|
||||
public UIRadioButton(Icon icon) { |
||||
super(icon); |
||||
} |
||||
|
||||
public UIRadioButton(Action action) { |
||||
super(action); |
||||
} |
||||
|
||||
public UIRadioButton(Icon icon, boolean selected) { |
||||
super(icon, selected); |
||||
} |
||||
|
||||
public UIRadioButton(String text) { |
||||
super(text); |
||||
} |
||||
|
||||
public UIRadioButton(String text, boolean selected) { |
||||
super(text, selected); |
||||
} |
||||
|
||||
public UIRadioButton(String text, Icon icon) { |
||||
super(text, icon); |
||||
} |
||||
|
||||
public UIRadioButton(String text, Icon icon, boolean selected) { |
||||
super(text, icon, selected); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.fanruan.api.design.ui.component.target; |
||||
|
||||
/** |
||||
* 模板设计界面 |
||||
*/ |
||||
public abstract class TargetComponent<T> extends com.fr.design.designer.TargetComponent<T> { |
||||
|
||||
public TargetComponent(T t) { |
||||
super(t); |
||||
} |
||||
|
||||
public TargetComponent() { |
||||
super(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,12 @@
|
||||
package com.fanruan.api.design.ui.table; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public abstract class BasePropertyTable extends com.fr.design.gui.itable.AbstractPropertyTable { |
||||
public BasePropertyTable() { |
||||
super(); |
||||
} |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.fanruan.api.design.work; |
||||
|
||||
import com.fr.design.gui.frpane.HyperlinkGroupPaneActionProvider; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class FormHyperlinkGroupPane extends com.fr.design.gui.xpane.FormHyperlinkGroupPane { |
||||
protected FormHyperlinkGroupPane(HyperlinkGroupPaneActionProvider hyperlinkGroupPaneActionProvider) { |
||||
super(hyperlinkGroupPaneActionProvider); |
||||
} |
||||
} |
@ -0,0 +1,198 @@
|
||||
package com.fanruan.api.design.work; |
||||
|
||||
import com.fanruan.api.design.ui.component.UIButton; |
||||
import com.fanruan.api.design.ui.component.UIRadioButton; |
||||
import com.fanruan.api.design.util.GUICoreKit; |
||||
import com.fanruan.api.report.cell.CellImage; |
||||
import com.fr.base.Style; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.frpane.ImgChooseWrapper; |
||||
import com.fr.design.style.background.image.ImageFileChooser; |
||||
import com.fr.design.style.background.image.ImagePreviewPane; |
||||
import com.fr.report.cell.Elem; |
||||
import com.fr.report.cell.painter.CellImagePainter; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.ButtonGroup; |
||||
import javax.swing.JFileChooser; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JScrollPane; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.GridLayout; |
||||
import java.awt.Image; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.io.File; |
||||
|
||||
/** |
||||
* 这个类主要用于插入图片时的设置 |
||||
*/ |
||||
public class SelectImagePane extends BasicPane { |
||||
private ImagePreviewPane previewPane = null; |
||||
|
||||
private ImageFileChooser imageFileChooser = null; |
||||
private UIRadioButton defaultRadioButton = null; |
||||
private UIRadioButton tiledRadioButton = null; |
||||
private UIRadioButton extendRadioButton = null; |
||||
private UIRadioButton adjustRadioButton = null; |
||||
|
||||
private Style imageStyle = null; |
||||
|
||||
private File imageFile; |
||||
|
||||
public SelectImagePane() { |
||||
this.setLayout(GUICoreKit.createBorderLayout()); |
||||
|
||||
// preview pane
|
||||
JPanel previewContainerPane = GUICoreKit.createBorderLayoutPane(); |
||||
this.add(previewContainerPane, BorderLayout.CENTER); |
||||
|
||||
JPanel previewOwnerPane = GUICoreKit.createBorderLayoutPane(); |
||||
previewContainerPane.add(previewOwnerPane, BorderLayout.CENTER); |
||||
|
||||
previewOwnerPane.setBorder(GUICoreKit.createTitledBorder(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview"), null)); |
||||
|
||||
previewPane = new ImagePreviewPane(); |
||||
previewOwnerPane.add(new JScrollPane(previewPane)); |
||||
|
||||
JPanel selectFilePane = GUICoreKit.createBorderLayoutPane(); |
||||
previewContainerPane.add(selectFilePane, BorderLayout.EAST); |
||||
selectFilePane.setBorder(BorderFactory |
||||
.createEmptyBorder(8, 2, 4, 0)); |
||||
|
||||
UIButton selectPictureButton = new UIButton( |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Select_Picture")); |
||||
selectFilePane.add(selectPictureButton, BorderLayout.NORTH); |
||||
selectPictureButton.setMnemonic('S'); |
||||
selectPictureButton.addActionListener(selectPictureActionListener); |
||||
|
||||
JPanel layoutPane = GUICoreKit.createMediumHGapHighTopFlowInnerContainerPane(); |
||||
selectFilePane.add(layoutPane, BorderLayout.CENTER); |
||||
|
||||
//布局
|
||||
defaultRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Default")); |
||||
tiledRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Titled")); |
||||
extendRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image_Extend")); |
||||
adjustRadioButton = new UIRadioButton(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Image_Adjust")); |
||||
|
||||
defaultRadioButton.addActionListener(layoutActionListener); |
||||
tiledRadioButton.addActionListener(layoutActionListener); |
||||
extendRadioButton.addActionListener(layoutActionListener); |
||||
adjustRadioButton.addActionListener(layoutActionListener); |
||||
|
||||
JPanel jp = new JPanel(new GridLayout(4, 1, 15, 15)); |
||||
jp.add(defaultRadioButton); |
||||
jp.add(tiledRadioButton); |
||||
jp.add(extendRadioButton); |
||||
jp.add(adjustRadioButton); |
||||
layoutPane.add(jp); |
||||
|
||||
ButtonGroup layoutBG = new ButtonGroup(); |
||||
layoutBG.add(defaultRadioButton); |
||||
layoutBG.add(tiledRadioButton); |
||||
layoutBG.add(extendRadioButton); |
||||
layoutBG.add(adjustRadioButton); |
||||
|
||||
defaultRadioButton.setSelected(true); |
||||
|
||||
// init image file chooser.
|
||||
imageFileChooser = new ImageFileChooser(); |
||||
imageFileChooser.setMultiSelectionEnabled(false); |
||||
} |
||||
|
||||
/** |
||||
* Select picture. |
||||
*/ |
||||
ActionListener selectPictureActionListener = new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
int returnVal = imageFileChooser |
||||
.showOpenDialog(SelectImagePane.this); |
||||
if (returnVal != JFileChooser.CANCEL_OPTION) { |
||||
File selectedFile = imageFileChooser.getSelectedFile(); |
||||
imageFile = selectedFile; |
||||
ImgChooseWrapper.getInstance(previewPane, imageFileChooser, imageStyle, null).dealWithImageFile(returnVal); |
||||
} |
||||
} |
||||
}; |
||||
|
||||
// 调整图片样式,只有水平和垂直对齐以及拉伸。相对于背景,平铺不予考虑。
|
||||
private void changeImageStyle() { |
||||
previewPane.setImageStyle(this.imageStyle); |
||||
previewPane.repaint(); |
||||
} |
||||
|
||||
private void setImageStyle() { |
||||
if (tiledRadioButton.isSelected()) { |
||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_TILED); |
||||
} else if (adjustRadioButton.isSelected()) { |
||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_ADJUST); |
||||
} else if (extendRadioButton.isSelected()) { |
||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_EXTEND); |
||||
} else { |
||||
imageStyle = Style.DEFAULT_STYLE.deriveImageLayout(Constants.IMAGE_CENTER); |
||||
} |
||||
} |
||||
|
||||
ActionListener layoutActionListener = new ActionListener() { |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
setImageStyle(); |
||||
changeImageStyle(); |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Image"); |
||||
} |
||||
|
||||
public void populate(Elem cell) { |
||||
Style style = null; |
||||
if (cell != null) { |
||||
Object value = cell.getValue(); |
||||
if (value instanceof Image) { |
||||
setImage((Image) value); |
||||
} else if (value instanceof CellImagePainter) { |
||||
setImage(((CellImagePainter) value).getImage()); |
||||
} |
||||
|
||||
style = cell.getStyle(); |
||||
} |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
|
||||
if (style.getImageLayout() == Constants.IMAGE_TILED) { |
||||
tiledRadioButton.setSelected(true); |
||||
} else if (style.getImageLayout() == Constants.IMAGE_EXTEND) { |
||||
extendRadioButton.setSelected(true); |
||||
} else if (style.getImageLayout() == Constants.IMAGE_ADJUST) { |
||||
adjustRadioButton.setSelected(true); |
||||
} else { |
||||
style.deriveImageLayout(Constants.IMAGE_CENTER); |
||||
defaultRadioButton.setSelected(true); |
||||
} |
||||
this.imageStyle = style; |
||||
changeImageStyle(); |
||||
} |
||||
|
||||
public void setImage(Image image) { |
||||
previewPane.setImage(image); |
||||
} |
||||
|
||||
public CellImage update() { |
||||
CellImage cellImage = new CellImage(); |
||||
cellImage.setImage(previewPane.getImageWithSuffix()); |
||||
cellImage.setStyle(this.imageStyle); |
||||
return cellImage; |
||||
} |
||||
|
||||
public File getSelectedImage() { |
||||
return imageFile; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,50 @@
|
||||
package com.fanruan.api.design.work.compat; |
||||
|
||||
import com.fanruan.api.design.ui.component.UIButton; |
||||
import com.fanruan.api.design.ui.component.UILockButton; |
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.editlock.ConnectionLockChangeChecker; |
||||
import com.fr.design.editlock.EditLockUtils; |
||||
import com.fr.report.LockItem; |
||||
|
||||
import java.awt.*; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2021/3/18 |
||||
* 用于兼容没有数据连接lock的版本 |
||||
*/ |
||||
public class ConnectionLockHelper { |
||||
|
||||
public static UIButton generateLockButton(Dimension buttonSize, ActionListener listener) { |
||||
UILockButton editButton = new UILockButton( |
||||
EditLockUtils.CONNECTION_LOCKED_ICON, |
||||
IconUtils.readIcon("/com/fr/design/images/m_web/connection"), |
||||
EditLockUtils.CONNECTION_LOCKED_TOOLTIPS, |
||||
null |
||||
); |
||||
editButton.setPreferredSize(buttonSize); |
||||
editButton.addActionListener(listener); |
||||
ConnectionLockChangeChecker.getInstance().addEditLockChangeListener(editButton); |
||||
return editButton; |
||||
} |
||||
|
||||
public static boolean doLock(Component component) { |
||||
// 尝试为数据连接加锁
|
||||
boolean actionLock = EditLockUtils.lock(LockItem.CONNECTION); |
||||
if (!actionLock) { |
||||
// 锁定失败,代表已经被其他用户锁定,跳出弹窗提示
|
||||
EditLockUtils.showLockMessage(component); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
public static void unlock() { |
||||
// 关闭定义数据连接页面,为其解锁
|
||||
EditLockUtils.unlock(LockItem.CONNECTION); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,122 @@
|
||||
package com.fanruan.api.design.work.component; |
||||
|
||||
import com.fanruan.api.design.ui.component.UIButton; |
||||
import com.fanruan.api.design.ui.component.UIComboBox; |
||||
import com.fanruan.api.util.IOKit; |
||||
import com.fanruan.api.util.StringKit; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @version 10.0 |
||||
* Created by richie on 2021/3/18 |
||||
*/ |
||||
public abstract class ItemEditableComboBoxPanel extends JPanel { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
protected static final Object EMPTY = new Object() { |
||||
public String toString() { |
||||
return StringKit.EMPTY; |
||||
} |
||||
}; |
||||
|
||||
protected UIComboBox<?> itemComboBox; |
||||
protected UIButton editButton; |
||||
protected UIButton refreshButton; |
||||
|
||||
public ItemEditableComboBoxPanel() { |
||||
super(); |
||||
|
||||
initComponents(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout(4, 4)); |
||||
Dimension buttonSize = new Dimension(26, 20); |
||||
itemComboBox = new UIComboBox<>(); |
||||
itemComboBox.setEnabled(true); |
||||
this.add(itemComboBox, BorderLayout.CENTER); |
||||
refreshButton = new UIButton(IOKit.readIcon("/com/fr/design/images/control/refresh.png")); |
||||
JPanel jPanel = new JPanel(new GridLayout(0, 2, 4, 4)); |
||||
editButton = initEditButton(editButton, buttonSize); |
||||
jPanel.add(editButton); |
||||
jPanel.add(refreshButton); |
||||
this.add(jPanel, BorderLayout.EAST); |
||||
refreshButton.setPreferredSize(buttonSize); |
||||
refreshButton.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
refreshItems(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
protected UIButton initEditButton(UIButton editButton, Dimension buttonSize) { |
||||
editButton = new UIButton(IOKit.readIcon("/com/fr/design/images/control/control-center2.png")); |
||||
editButton.setPreferredSize(buttonSize); |
||||
editButton.addActionListener(evt -> editItems()); |
||||
return editButton; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 给itemComboBox添加ActionListener |
||||
*/ |
||||
public void addComboBoxActionListener(ActionListener l) { |
||||
itemComboBox.addActionListener(l); |
||||
} |
||||
|
||||
protected void refreshItems() { |
||||
// 记录原来选中的Item,重新加载后需要再次选中
|
||||
Object lastSelectedItem = itemComboBox.getSelectedItem(); |
||||
|
||||
DefaultComboBoxModel<Object> model = ((DefaultComboBoxModel<Object>) itemComboBox.getModel()); |
||||
model.removeAllElements(); |
||||
|
||||
// 先加EMPTY,再加items
|
||||
model.addElement(EMPTY); |
||||
|
||||
java.util.Iterator<String> itemIt = items(); |
||||
while (itemIt.hasNext()) { |
||||
model.addElement(itemIt.next()); |
||||
} |
||||
|
||||
// 再次选中之前选中的Item
|
||||
int idx = model.getIndexOf(lastSelectedItem); |
||||
if (idx < 0) { |
||||
idx = 0; |
||||
} |
||||
itemComboBox.setSelectedIndex(idx); |
||||
} |
||||
|
||||
/* |
||||
* 得到其中的itemComboBox所选中的Item |
||||
*/ |
||||
public String getSelectedItem() { |
||||
Object selected = itemComboBox.getSelectedItem(); |
||||
|
||||
return selected instanceof String ? (String) selected : null; |
||||
} |
||||
|
||||
/* |
||||
* 选中name项 |
||||
*/ |
||||
public void setSelectedItem(String name) { |
||||
DefaultComboBoxModel model = ((DefaultComboBoxModel) itemComboBox.getModel()); |
||||
model.setSelectedItem(name); |
||||
} |
||||
|
||||
/* |
||||
* 刷新ComboBox.items |
||||
*/ |
||||
protected abstract java.util.Iterator<String> items(); |
||||
|
||||
/* |
||||
* 弹出对话框编辑Items |
||||
*/ |
||||
protected abstract void editItems(); |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fanruan.api.image.general; |
||||
|
||||
import java.awt.Image; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class ImageWithSuffix extends com.fr.general.ImageWithSuffix { |
||||
public ImageWithSuffix(Image image, String format) { |
||||
super(image, format); |
||||
} |
||||
|
||||
public ImageWithSuffix(Image image) { |
||||
super(image); |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fanruan.api.report; |
||||
|
||||
import com.fr.decision.webservice.v10.entry.ReportEntryService; |
||||
|
||||
/** |
||||
* @author Zed |
||||
* @version 10.0 |
||||
* Created by Zed on 2020/12/14 |
||||
* 在平台挂查看FR模板的工具类 |
||||
*/ |
||||
public class ReportEntryKit { |
||||
|
||||
/** |
||||
* 获取FR模板树 |
||||
* |
||||
* @param currentUserId 当前用户id |
||||
* @param keyword keyword |
||||
* @return 模板树 |
||||
* @throws Exception 异常 |
||||
*/ |
||||
public static Object getReportTemplateTree(String currentUserId, String keyword) throws Exception { |
||||
return ReportEntryService.getInstance().getReportTemplateTree(currentUserId, keyword); |
||||
} |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fanruan.api.report.cell; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class CellImage extends com.fr.report.cell.cellattr.CellImage { |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fanruan.api.report.cell; |
||||
|
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class FloatElement extends com.fr.report.cell.FloatElement { |
||||
public FloatElement() { |
||||
super(); |
||||
} |
||||
|
||||
public FloatElement(Object value) { |
||||
super(value); |
||||
} |
||||
|
||||
public FloatElement(UNIT leftDistance, UNIT topDistance, UNIT width, UNIT height, Object value) { |
||||
super(leftDistance, topDistance, width, height, value); |
||||
} |
||||
} |
@ -0,0 +1,16 @@
|
||||
package com.fanruan.api.util; |
||||
|
||||
import com.fr.collections.FineCollections; |
||||
import com.fr.collections.api.FineCollectionClient; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class FineCollectionKit { |
||||
|
||||
public static FineCollectionClient getClient() { |
||||
return FineCollections.getInstance().getClient(); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fanruan.api.util; |
||||
|
||||
import com.fr.js.HyperlinkUtils; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.json.JSONArray; |
||||
import com.fr.json.JSONException; |
||||
import com.fr.stable.web.Repository; |
||||
|
||||
/** |
||||
* @author Lucian.Chen |
||||
* @version 10.0 |
||||
* Created by Lucian.Chen on 2020/3/23 |
||||
*/ |
||||
public class HyperKit { |
||||
|
||||
/** |
||||
* 写超链的内容 |
||||
* |
||||
* @param g 超级链接的集合 |
||||
* @param repo 库 |
||||
* @return JSONArray转化的字符串 |
||||
* @throws JSONException JSON异常 J |
||||
*/ |
||||
public static String writeJSLinkContent(NameJavaScriptGroup g, Repository repo) throws JSONException { |
||||
return HyperlinkUtils.writeJSLinkContent(g, repo); |
||||
} |
||||
|
||||
/** |
||||
* 把超链转化成json |
||||
* |
||||
* @param g 超链 |
||||
* @param repo 库 |
||||
* @return json对象 |
||||
* @throws JSONException JSON异常 |
||||
*/ |
||||
public static JSONArray createJSLink(NameJavaScriptGroup g, Repository repo) throws JSONException { |
||||
return HyperlinkUtils.createJSLink(g, repo); |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fanruan.api.util; |
||||
|
||||
import com.fr.json.JSONObject; |
||||
import com.fr.license.exception.RegistEditionException; |
||||
import com.fr.regist.FRCoreContext; |
||||
import com.fr.regist.FunctionPoint; |
||||
|
||||
/** |
||||
* 获取Lic相关信息的类 |
||||
*/ |
||||
public class LicKit { |
||||
public LicKit() { |
||||
} |
||||
|
||||
/** |
||||
* 获取Lic的JSON信息 |
||||
* @return JSONObject |
||||
*/ |
||||
public static JSONObject getJsonFromLic() { |
||||
return FRCoreContext.getLicense().getJSONObject(); |
||||
} |
||||
|
||||
/** |
||||
* 检查某个功能点的lic权限,如果没有权限就跳转到没有lic权限的报错页面 |
||||
* @param point 功能点 |
||||
*/ |
||||
public static void checkFunctionPointSupport(FunctionPoint point) { |
||||
if (!point.isSupport()) { |
||||
throw new RegistEditionException(point); |
||||
} |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue