diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..adba910 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +*.iml +.idea/ +.classpath +lib/report/*.jar +.DS_Store diff --git a/README.md b/README.md index 5bde33b..70c034a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # 自定义条件属性 + 当前已有的条件属性包含下图中的几种类型 -![0](effect/e0.png) +![0](screenshots/e0.png) 在特殊情况下,已有的几种类型并不能完全满足需求,典型的就是,根据不同的条件把单元格内的内容做不同的对齐。 这个时候,就可以使用条件属性接口```com.fr.design.fun.HighlightProvider```以及其抽象类```com.fr.design.fun.impl.AbstractHighlightProvider```了。 通过这个接口可以制作出如下如所示的插件效果 -![1](effect/e1.png) +![1](screenshots/e1.png) 可以看到多出了一个"我的条件属性"的项,当然这个名字是可以根据实际情况修改的。 选择了以后,就可以设置单元格的对齐方式了 -![2](effect/e2.png) +![2](screenshots/e2.png) diff --git a/build.xml b/build.xml index 7cc9e50..86a0542 100644 --- a/build.xml +++ b/build.xml @@ -1,10 +1,11 @@ - + + @@ -13,7 +14,7 @@ - + @@ -29,6 +30,9 @@ + + + @@ -44,7 +48,7 @@ - + @@ -59,11 +63,15 @@ target="${target_jdk_version}" fork="true" memoryMaximumSize="512m" listfiles="false" srcdir="${basedir}" executable="${compile_jdk_version}/bin/javac"> - + + + + + @@ -93,6 +101,7 @@ + @@ -106,12 +115,16 @@ + + + + + - - + - + \ No newline at end of file diff --git a/lib/report/.gitkeep b/lib/report/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/plugin-dynamichighlight.iml b/plugin-dynamichighlight.iml deleted file mode 100644 index f5bbe9e..0000000 --- a/plugin-dynamichighlight.iml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugin.xml b/plugin.xml index 658b795..d4dc1d6 100644 --- a/plugin.xml +++ b/plugin.xml @@ -1,23 +1,22 @@ - com.fr.plugin.cell.highlight.align + com.fr.plugin.cell.highlight.align.v10 + com.fr.plugin.cell.highlight yes 2.1 - 8.0 - 2016-03-20 - 1000 - solution.richie + 10.0 + 2018-09-20 + author [2016-01-20]增加了插件功能说明

-

[2016-03-21]增加了国际化支持(美国英语)

+

[2016-01-20]增加了插件功能说明。
+

[2016-03-21]增加了国际化支持(美国英语)。
]]> - + - - - + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..a8ffac5 --- /dev/null +++ b/pom.xml @@ -0,0 +1,18 @@ + + + 4.0.0 + + + com.fr.plugin + starter + 10.0 + + jar + demo-highlight-align + + + ${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.cell.highlight.align.v10-1.0/classes + + \ No newline at end of file diff --git a/effect/e0.png b/screenshots/e0.png similarity index 100% rename from effect/e0.png rename to screenshots/e0.png diff --git a/effect/e1.png b/screenshots/e1.png similarity index 100% rename from effect/e1.png rename to screenshots/e1.png diff --git a/effect/e2.png b/screenshots/e2.png similarity index 100% rename from effect/e2.png rename to screenshots/e2.png diff --git a/shop/icon_200.png b/shop/icon_200.png deleted file mode 100644 index a621b9e..0000000 Binary files a/shop/icon_200.png and /dev/null differ diff --git a/shop/icon_400.png b/shop/icon_400.png deleted file mode 100644 index dfb02d4..0000000 Binary files a/shop/icon_400.png and /dev/null differ diff --git a/src/com/fr/plugin/cell/highlight/fun/MyCellFunctionProcessor.java b/src/com/fr/plugin/cell/highlight/fun/MyCellFunctionProcessor.java deleted file mode 100644 index 409db49..0000000 --- a/src/com/fr/plugin/cell/highlight/fun/MyCellFunctionProcessor.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fr.plugin.cell.highlight.fun; - -import com.fr.plugin.cell.highlight.MyConstants; -import com.fr.stable.fun.FunctionHelper; -import com.fr.stable.fun.FunctionProcessor; -import com.fr.stable.fun.impl.AbstractFunctionProcessor; - -/** - * Created by richie on 16/1/22. - */ -public class MyCellFunctionProcessor extends AbstractFunctionProcessor { - - private static MyCellFunctionProcessor instance = new MyCellFunctionProcessor(); - - public static FunctionProcessor getInstance() { - return instance; - } - - @Override - public int getId() { - return FunctionHelper.generateFunctionID(MyConstants.PLUGIN_ID); - } - - @Override - public String getLocaleKey() { - return "Plugin-Highlight_Align"; - } -} \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/locale/align.properties b/src/com/fr/plugin/cell/highlight/locale/align.properties deleted file mode 100644 index 4cbd63b..0000000 --- a/src/com/fr/plugin/cell/highlight/locale/align.properties +++ /dev/null @@ -1,4 +0,0 @@ -Plugin-Highlight_Align=Align -Plugin-Highlight_Align_Left=Left -Plugin-Highlight_Align_Center=Center -Plugin-Highlight_Align_Right=Right \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/locale/align_zh_CN.properties b/src/com/fr/plugin/cell/highlight/locale/align_zh_CN.properties deleted file mode 100644 index 0a9ebef..0000000 --- a/src/com/fr/plugin/cell/highlight/locale/align_zh_CN.properties +++ /dev/null @@ -1,4 +0,0 @@ -Plugin-Highlight_Align=\u5BF9\u9F50 -Plugin-Highlight_Align_Left=\u5DE6\u5BF9\u9F50 -Plugin-Highlight_Align_Center=\u5C45\u4E2D\u5BF9\u9F50 -Plugin-Highlight_Align_Right=\u53F3\u5BF9\u9F50 \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/MyCellHighlight.java b/src/main/java/com/fr/plugin/cell/highlight/AlignCellHighlightBridge.java similarity index 58% rename from src/com/fr/plugin/cell/highlight/MyCellHighlight.java rename to src/main/java/com/fr/plugin/cell/highlight/AlignCellHighlightBridge.java index ed5b552..cc861ca 100644 --- a/src/com/fr/plugin/cell/highlight/MyCellHighlight.java +++ b/src/main/java/com/fr/plugin/cell/highlight/AlignCellHighlightBridge.java @@ -3,6 +3,9 @@ package com.fr.plugin.cell.highlight; import com.fr.design.condition.ConditionAttrSingleConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.fun.impl.AbstractHighlightProvider; +import com.fr.plugin.cell.highlight.fun.AlignHighlightAction; +import com.fr.plugin.cell.highlight.fun.AlignHighlightConstants; +import com.fr.plugin.cell.highlight.ui.AlignHighlightPane; import com.fr.stable.fun.Authorize; /** @@ -10,8 +13,8 @@ import com.fr.stable.fun.Authorize; * @date 2015-03-26 * @since 8.0 */ -@Authorize(callSignKey = MyConstants.PLUGIN_ID) -public class MyCellHighlight extends AbstractHighlightProvider { +@Authorize(callSignKey = AlignHighlightConstants.PLUGIN_ID) +public class AlignCellHighlightBridge extends AbstractHighlightProvider { @Override public int currentAPILevel() { @@ -20,11 +23,11 @@ public class MyCellHighlight extends AbstractHighlightProvider { @Override public Class classForHighlightAction() { - return MyHighlightAction.class; + return AlignHighlightAction.class; } @Override public ConditionAttrSingleConditionPane appearanceForCondition(ConditionAttributesPane conditionAttributesPane) { - return new MyHighlightPane(conditionAttributesPane); + return new AlignHighlightPane(conditionAttributesPane); } } \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/MyCellHighlightLocaleFinder.java b/src/main/java/com/fr/plugin/cell/highlight/AlignHighlightLocaleBridge.java similarity index 81% rename from src/com/fr/plugin/cell/highlight/MyCellHighlightLocaleFinder.java rename to src/main/java/com/fr/plugin/cell/highlight/AlignHighlightLocaleBridge.java index 207d427..20fe2e8 100644 --- a/src/com/fr/plugin/cell/highlight/MyCellHighlightLocaleFinder.java +++ b/src/main/java/com/fr/plugin/cell/highlight/AlignHighlightLocaleBridge.java @@ -5,7 +5,7 @@ import com.fr.stable.fun.impl.AbstractLocaleFinder; /** * Created by richie on 16/1/22. */ -public class MyCellHighlightLocaleFinder extends AbstractLocaleFinder { +public class AlignHighlightLocaleBridge extends AbstractLocaleFinder { @Override public int currentAPILevel() { diff --git a/src/com/fr/plugin/cell/highlight/MyHighlightAction.java b/src/main/java/com/fr/plugin/cell/highlight/fun/AlignHighlightAction.java similarity index 51% rename from src/com/fr/plugin/cell/highlight/MyHighlightAction.java rename to src/main/java/com/fr/plugin/cell/highlight/fun/AlignHighlightAction.java index 1c55a06..b2c592a 100644 --- a/src/com/fr/plugin/cell/highlight/MyHighlightAction.java +++ b/src/main/java/com/fr/plugin/cell/highlight/fun/AlignHighlightAction.java @@ -1,15 +1,14 @@ -package com.fr.plugin.cell.highlight; +package com.fr.plugin.cell.highlight.fun; import com.fr.base.Style; -import com.fr.plugin.ExtraClassManager; +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; -import com.fr.plugin.cell.highlight.fun.MyCellFunctionProcessor; +import com.fr.record.analyzer.EnableMetrics; import com.fr.report.cell.cellattr.highlight.AbstractStyleHighlightAction; +import com.fr.stable.AssistUtils; import com.fr.stable.Constants; -import com.fr.stable.fun.FunctionHelper; -import com.fr.stable.fun.FunctionProcessor; -import com.fr.stable.fun.impl.AbstractFunctionProcessor; import com.fr.stable.xml.XMLPrintWriter; import com.fr.stable.xml.XMLableReader; @@ -18,27 +17,16 @@ import com.fr.stable.xml.XMLableReader; * @date 2015-03-26 * @since 8.0 */ -public class MyHighlightAction extends AbstractStyleHighlightAction { - - private static final FunctionProcessor PPP = new AbstractFunctionProcessor() { - @Override - public int getId() { - return FunctionHelper.generateFunctionID(MyConstants.PLUGIN_ID); - } - - @Override - public String getLocaleKey() { - return "Plugin-Highlight_Align"; - } - }; +@EnableMetrics +public class AlignHighlightAction extends AbstractStyleHighlightAction { private int align = Constants.RIGHT; - public MyHighlightAction() { + public AlignHighlightAction() { this(Constants.RIGHT, 0); } - public MyHighlightAction(int align, int scope) { + public AlignHighlightAction(int align, int scope) { super(scope); this.align = align; } @@ -48,12 +36,9 @@ public class MyHighlightAction extends AbstractStyleHighlightAction { } @Override + @Focus(id = AlignHighlightConstants.PLUGIN_ID, text = "Plugin-Highlight_Align", source = Original.PLUGIN) protected Style modStyle(Style style) { - FunctionProcessor processor= ExtraClassManager.getInstance().getFunctionProcessor(); - if(processor!=null){ - processor.recordFunction(PPP); - } - PluginLicense pluginLicense = PluginLicenseManager.getInstance().getPluginLicenseByID(MyConstants.PLUGIN_ID); + PluginLicense pluginLicense = PluginLicenseManager.getInstance().getPluginLicenseByID(AlignHighlightConstants.PLUGIN_ID); if (pluginLicense != null && pluginLicense.isAvailable()) { return style.deriveHorizontalAlignment(align); } @@ -64,7 +49,7 @@ public class MyHighlightAction extends AbstractStyleHighlightAction { public void readXML(XMLableReader reader) { if (reader.isChildNode()) { String tagName = reader.getTagName(); - if (tagName.equals("MyAlign")) { + if (tagName.equals("Align")) { align = reader.getAttrAsInt("align", Constants.RIGHT); } } @@ -72,13 +57,23 @@ public class MyHighlightAction extends AbstractStyleHighlightAction { @Override public void writeXML(XMLPrintWriter writer) { - writer.startTAG("MyAlign").attr("align", align); + writer.startTAG("Align").attr("align", align); writer.end(); } + @Override + public boolean equals(Object o) { + return o instanceof AlignHighlightAction && super.equals(o) && ((AlignHighlightAction) o).align == align; + } + + @Override + public int hashCode() { + return AssistUtils.hashCode(align); + } + public Object clone() throws CloneNotSupportedException { - MyHighlightAction cloned = (MyHighlightAction)super.clone(); + AlignHighlightAction cloned = (AlignHighlightAction) super.clone(); cloned.align = align; - return cloned; + return cloned; } } \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/MyConstants.java b/src/main/java/com/fr/plugin/cell/highlight/fun/AlignHighlightConstants.java similarity index 51% rename from src/com/fr/plugin/cell/highlight/MyConstants.java rename to src/main/java/com/fr/plugin/cell/highlight/fun/AlignHighlightConstants.java index 49ceb49..c965fc6 100644 --- a/src/com/fr/plugin/cell/highlight/MyConstants.java +++ b/src/main/java/com/fr/plugin/cell/highlight/fun/AlignHighlightConstants.java @@ -1,10 +1,10 @@ -package com.fr.plugin.cell.highlight; +package com.fr.plugin.cell.highlight.fun; /** * Created by richie on 16/3/30. */ -public class MyConstants { +public class AlignHighlightConstants { - public static final String PLUGIN_ID = "com.fr.plugin.cell.highlight.align"; + public static final String PLUGIN_ID = "com.fr.plugin.cell.highlight.align.v10"; } diff --git a/src/com/fr/plugin/cell/highlight/MyHighlightPane.java b/src/main/java/com/fr/plugin/cell/highlight/ui/AlignHighlightPane.java similarity index 68% rename from src/com/fr/plugin/cell/highlight/MyHighlightPane.java rename to src/main/java/com/fr/plugin/cell/highlight/ui/AlignHighlightPane.java index ed4b5af..0e81a5a 100644 --- a/src/com/fr/plugin/cell/highlight/MyHighlightPane.java +++ b/src/main/java/com/fr/plugin/cell/highlight/ui/AlignHighlightPane.java @@ -1,10 +1,11 @@ -package com.fr.plugin.cell.highlight; +package com.fr.plugin.cell.highlight.ui; import com.fr.design.condition.ConditionAttrSingleConditionPane; import com.fr.design.condition.ConditionAttributesPane; import com.fr.design.gui.icombobox.UIComboBox; import com.fr.design.gui.icombobox.UIDictionaryComboBox; import com.fr.general.Inter; +import com.fr.plugin.cell.highlight.fun.AlignHighlightAction; import com.fr.report.cell.cellattr.highlight.HighlightAction; import com.fr.stable.Constants; @@ -15,11 +16,11 @@ import javax.swing.*; * @date 2015-03-26 * @since 8.0 */ -public class MyHighlightPane extends ConditionAttrSingleConditionPane { +public class AlignHighlightPane extends ConditionAttrSingleConditionPane { private UIDictionaryComboBox alignComboBox; private JComboBox scopeComboBox; - public MyHighlightPane(ConditionAttributesPane conditionAttributesPane) { + public AlignHighlightPane(ConditionAttributesPane conditionAttributesPane) { super(conditionAttributesPane); this.alignComboBox = new UIDictionaryComboBox( new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}, @@ -30,9 +31,9 @@ public class MyHighlightPane extends ConditionAttrSingleConditionPane