Compare commits

...

1 Commits

Author SHA1 Message Date
e 9ca46fa431 增加组件wrapper、增加收费注解 1 year ago
  1. 27
      .gitignore
  2. 2
      build.gradle
  3. 4
      plugin.xml
  4. 18
      src/main/java/com/fr/plugin/sqy/kj/calendar/FuncRecorder.java
  5. 10
      src/main/java/com/fr/plugin/sqy/kj/calendar/JsFileHandler.java
  6. 35
      src/main/java/com/fr/plugin/sqy/kj/calendar/form/FormXDateEditor.java
  7. 39
      src/main/java/com/fr/plugin/sqy/kj/calendar/parameter/ParameterXDateEditor.java

27
.gitignore vendored

@ -1,25 +1,4 @@
# ---> Java /build
# Compiled class file /classes
*.class /transform-classes
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

2
build.gradle

@ -14,7 +14,7 @@ ext {
/** /**
* class进行加密保护 * class进行加密保护
*/ */
guard = true guard = false
def pluginInfo = getPluginInfo() def pluginInfo = getPluginInfo()
pluginPre = "fine-plugin" pluginPre = "fine-plugin"

4
plugin.xml

@ -2,7 +2,7 @@
<id>com.fr.plugin.sqy.kj.calendar</id> <id>com.fr.plugin.sqy.kj.calendar</id>
<name><![CDATA[ 农历日历 ]]></name> <name><![CDATA[ 农历日历 ]]></name>
<active>yes</active> <active>yes</active>
<version>1.1.1</version> <version>1.1.2</version>
<env-version>10.0~11.0</env-version> <env-version>10.0~11.0</env-version>
<vendor>yy</vendor> <vendor>yy</vendor>
<jartime>2021-05-26</jartime> <jartime>2021-05-26</jartime>
@ -11,7 +11,7 @@
<![CDATA[2021-11-24 初始化工程]]> <![CDATA[2021-11-24 初始化工程]]>
</change-notes> </change-notes>
<main-package>com.fr.plugin.sqy</main-package> <main-package>com.fr.plugin.sqy</main-package>
<function-recorder class="com.fr.plugin.sqy.kj.calendar.JsFileHandler"/> <function-recorder class="com.fr.plugin.sqy.kj.calendar.FuncRecorder"/>
<extra-core> <extra-core>
<!--插件注入国际化--> <!--插件注入国际化-->

18
src/main/java/com/fr/plugin/sqy/kj/calendar/FuncRecorder.java

@ -0,0 +1,18 @@
package com.fr.plugin.sqy.kj.calendar;
import com.fr.plugin.context.PluginContexts;
import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.stable.fun.Authorize;
//功能点注册
@FunctionRecorder
@Authorize(callSignKey = PluginConstants.PLUGIN_ID)
public class FuncRecorder {
public static boolean execute(){
return PluginContexts.currentContext() != null && PluginContexts.currentContext().isAvailable();//付费
}
}

10
src/main/java/com/fr/plugin/sqy/kj/calendar/JsFileHandler.java

@ -1,15 +1,19 @@
package com.fr.plugin.sqy.kj.calendar; package com.fr.plugin.sqy.kj.calendar;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.transform.ExecuteFunctionRecord; import com.fr.plugin.transform.ExecuteFunctionRecord;
import com.fr.plugin.transform.FunctionRecorder; import com.fr.plugin.transform.FunctionRecorder;
import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler; import com.fr.stable.fun.impl.AbstractJavaScriptFileHandler;
@FunctionRecorder
public class JsFileHandler extends AbstractJavaScriptFileHandler{ public class JsFileHandler extends AbstractJavaScriptFileHandler{
@ExecuteFunctionRecord
@Override
public String[] pathsForFiles() { public String[] pathsForFiles() {
if(!FuncRecorder.execute()){
FineLoggerFactory.getLogger().error("[{}]插件未注册或已过期",PluginConstants.PLUGIN_ID);
return new String[]{};
}
return new String[]{ return new String[]{
"com/fr/plugin/sqy/kj/calendar/js/plugin_main.js" "com/fr/plugin/sqy/kj/calendar/js/plugin_main.js"
}; };

35
src/main/java/com/fr/plugin/sqy/kj/calendar/form/FormXDateEditor.java

@ -1,9 +1,10 @@
package com.fr.plugin.sqy.kj.calendar.form; package com.fr.plugin.sqy.kj.calendar.form;
import com.fanruan.api.design.DesignKit;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XDirectWriteEditor; import com.fr.design.designer.creator.XDirectWriteEditor;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -108,7 +109,7 @@ public class FormXDateEditor extends XDirectWriteEditor {
if (this.editor == null) { if (this.editor == null) {
this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.editor.add(this.textField = new UITextField(5), "Center"); this.editor.add(this.textField = new UITextField(5), "Center");
this.btn = new LimpidButton("", this.getIconPath(), this.toData().isVisible() ? 1.0F : 0.4F); this.btn = new LimpidButton("sqy_form_calendar", this.getIconPath(), this.toData().isVisible() ? 1.0F : 0.4F);
this.btn.setPreferredSize(new Dimension(21, 21)); this.btn.setPreferredSize(new Dimension(21, 21));
this.editor.add(this.btn, "East"); this.editor.add(this.btn, "East");
this.textField.setOpaque(false); this.textField.setOpaque(false);
@ -116,6 +117,36 @@ public class FormXDateEditor extends XDirectWriteEditor {
} }
return this.editor; return this.editor;
} }
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
this.initFieldText();
}
@Override
protected void makeVisible(boolean visible) {
this.btn.makeVisible(visible);
}
@Override
protected XLayoutContainer getCreatorWrapper(String widgetName) {
return new XWScaleLayout();
}
@Override
protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight) {
this.setSize(width, minHeight);
parentPanel.add(this);
}
@Override
public boolean shouldScaleCreator() {
return true;
}
@Override
public void firePropertyChange() {
this.initFieldText();
}
} }

39
src/main/java/com/fr/plugin/sqy/kj/calendar/parameter/ParameterXDateEditor.java

@ -1,9 +1,10 @@
package com.fr.plugin.sqy.kj.calendar.parameter; package com.fr.plugin.sqy.kj.calendar.parameter;
import com.fanruan.api.design.DesignKit;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XDirectWriteEditor; import com.fr.design.designer.creator.XDirectWriteEditor;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWScaleLayout;
import com.fr.design.gui.itextfield.UITextField; import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit; import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
@ -103,12 +104,14 @@ public class ParameterXDateEditor extends XDirectWriteEditor {
} }
@Override @Override
protected JComponent initEditor() { protected JComponent initEditor() {
if (this.editor == null) { if (this.editor == null) {
this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane(); this.editor = FRGUIPaneFactory.createBorderLayout_S_Pane();
this.editor.add(this.textField = new UITextField(5), "Center"); this.editor.add(this.textField = new UITextField(5), "Center");
this.btn = new LimpidButton("", this.getIconPath(), this.toData().isVisible() ? 1.0F : 0.4F); this.btn = new LimpidButton("sqy_form_calendar", this.getIconPath(), this.toData().isVisible() ? 1.0F : 0.4F);
this.btn.setPreferredSize(new Dimension(21, 21)); this.btn.setPreferredSize(new Dimension(21, 21));
this.editor.add(this.btn, "East"); this.editor.add(this.btn, "East");
this.textField.setOpaque(false); this.textField.setOpaque(false);
@ -116,6 +119,38 @@ public class ParameterXDateEditor extends XDirectWriteEditor {
} }
return this.editor; return this.editor;
} }
@Override
protected void initXCreatorProperties() {
super.initXCreatorProperties();
this.initFieldText();
}
@Override
protected void makeVisible(boolean visible) {
this.btn.makeVisible(visible);
}
@Override
protected XLayoutContainer getCreatorWrapper(String widgetName) {
return new XWScaleLayout();
}
@Override
protected void addToWrapper(XLayoutContainer parentPanel, int width, int minHeight) {
this.setSize(width, minHeight);
parentPanel.add(this);
}
@Override
public boolean shouldScaleCreator() {
return true;
}
@Override
public void firePropertyChange() {
this.initFieldText();
}
} }

Loading…
Cancel
Save