commit 568ca0d80699caaf766848560bc6470287c9754f Author: richie Date: Wed Mar 30 16:57:47 2016 +0800 迁移插件源码 diff --git a/README.md b/README.md new file mode 100644 index 0000000..2ade0d7 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ +# Զ +ǰе԰ͼеļ + +![0](effect/e0.png) + +£еļͲȫ󣬵͵ľǣݲͬѵԪڵͬĶ롣 +ʱ򣬾ͿʹԽӿ```com.fr.design.fun.HighlightProvider```Լ```com.fr.design.fun.impl.AbstractHighlightProvider```ˡ +ͨӿڿʾIJЧ + +![1](effect/e1.png) + +Կһ"ҵ"ȻǿԸʵ޸ĵġ +ѡԺ󣬾ͿõԪĶ뷽ʽ + +![2](effect/e2.png) diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..7cc9e50 --- /dev/null +++ b/build.xml @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/effect/e0.png b/effect/e0.png new file mode 100644 index 0000000..9dc4920 Binary files /dev/null and b/effect/e0.png differ diff --git a/effect/e1.png b/effect/e1.png new file mode 100644 index 0000000..1e8c9c7 Binary files /dev/null and b/effect/e1.png differ diff --git a/effect/e2.png b/effect/e2.png new file mode 100644 index 0000000..089ccb9 Binary files /dev/null and b/effect/e2.png differ diff --git a/plugin-dynamichighlight.iml b/plugin-dynamichighlight.iml new file mode 100644 index 0000000..f5bbe9e --- /dev/null +++ b/plugin-dynamichighlight.iml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..658b795 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,23 @@ + + com.fr.plugin.cell.highlight.align + + yes + 2.1 + 8.0 + 2016-03-20 + 1000 + solution.richie + + [2016-01-20]增加了插件功能说明

+

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

+ ]]>
+ + + + + + + + +
\ No newline at end of file diff --git a/shop/icon_200.png b/shop/icon_200.png new file mode 100644 index 0000000..a621b9e Binary files /dev/null and b/shop/icon_200.png differ diff --git a/shop/icon_400.png b/shop/icon_400.png new file mode 100644 index 0000000..dfb02d4 Binary files /dev/null and b/shop/icon_400.png differ diff --git a/src/com/fr/plugin/cell/highlight/MyCellHighlight.java b/src/com/fr/plugin/cell/highlight/MyCellHighlight.java new file mode 100644 index 0000000..ed5b552 --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/MyCellHighlight.java @@ -0,0 +1,30 @@ +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.stable.fun.Authorize; + +/** + * @author richie + * @date 2015-03-26 + * @since 8.0 + */ +@Authorize(callSignKey = MyConstants.PLUGIN_ID) +public class MyCellHighlight extends AbstractHighlightProvider { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public Class classForHighlightAction() { + return MyHighlightAction.class; + } + + @Override + public ConditionAttrSingleConditionPane appearanceForCondition(ConditionAttributesPane conditionAttributesPane) { + return new MyHighlightPane(conditionAttributesPane); + } +} \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/MyCellHighlightLocaleFinder.java b/src/com/fr/plugin/cell/highlight/MyCellHighlightLocaleFinder.java new file mode 100644 index 0000000..207d427 --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/MyCellHighlightLocaleFinder.java @@ -0,0 +1,19 @@ +package com.fr.plugin.cell.highlight; + +import com.fr.stable.fun.impl.AbstractLocaleFinder; + +/** + * Created by richie on 16/1/22. + */ +public class MyCellHighlightLocaleFinder extends AbstractLocaleFinder { + + @Override + public int currentAPILevel() { + return CURRENT_LEVEL; + } + + @Override + public String find() { + return "com/fr/plugin/cell/highlight/locale/align"; + } +} \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/MyConstants.java b/src/com/fr/plugin/cell/highlight/MyConstants.java new file mode 100644 index 0000000..49ceb49 --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/MyConstants.java @@ -0,0 +1,10 @@ +package com.fr.plugin.cell.highlight; + +/** + * Created by richie on 16/3/30. + */ +public class MyConstants { + + public static final String PLUGIN_ID = "com.fr.plugin.cell.highlight.align"; + +} diff --git a/src/com/fr/plugin/cell/highlight/MyHighlightAction.java b/src/com/fr/plugin/cell/highlight/MyHighlightAction.java new file mode 100644 index 0000000..1c55a06 --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/MyHighlightAction.java @@ -0,0 +1,84 @@ +package com.fr.plugin.cell.highlight; + +import com.fr.base.Style; +import com.fr.plugin.ExtraClassManager; +import com.fr.plugin.PluginLicense; +import com.fr.plugin.PluginLicenseManager; +import com.fr.plugin.cell.highlight.fun.MyCellFunctionProcessor; +import com.fr.report.cell.cellattr.highlight.AbstractStyleHighlightAction; +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; + +/** + * @author richie + * @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"; + } + }; + + private int align = Constants.RIGHT; + + public MyHighlightAction() { + this(Constants.RIGHT, 0); + } + + public MyHighlightAction(int align, int scope) { + super(scope); + this.align = align; + } + + public int getAlign() { + return align; + } + + @Override + protected Style modStyle(Style style) { + FunctionProcessor processor= ExtraClassManager.getInstance().getFunctionProcessor(); + if(processor!=null){ + processor.recordFunction(PPP); + } + PluginLicense pluginLicense = PluginLicenseManager.getInstance().getPluginLicenseByID(MyConstants.PLUGIN_ID); + if (pluginLicense != null && pluginLicense.isAvailable()) { + return style.deriveHorizontalAlignment(align); + } + return style; + } + + @Override + public void readXML(XMLableReader reader) { + if (reader.isChildNode()) { + String tagName = reader.getTagName(); + if (tagName.equals("MyAlign")) { + align = reader.getAttrAsInt("align", Constants.RIGHT); + } + } + } + + @Override + public void writeXML(XMLPrintWriter writer) { + writer.startTAG("MyAlign").attr("align", align); + writer.end(); + } + + public Object clone() throws CloneNotSupportedException { + MyHighlightAction cloned = (MyHighlightAction)super.clone(); + cloned.align = align; + return cloned; + } +} \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/MyHighlightPane.java b/src/com/fr/plugin/cell/highlight/MyHighlightPane.java new file mode 100644 index 0000000..ed4b5af --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/MyHighlightPane.java @@ -0,0 +1,57 @@ +package com.fr.plugin.cell.highlight; + +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.report.cell.cellattr.highlight.HighlightAction; +import com.fr.stable.Constants; + +import javax.swing.*; + +/** + * @author richie + * @date 2015-03-26 + * @since 8.0 + */ +public class MyHighlightPane extends ConditionAttrSingleConditionPane { + private UIDictionaryComboBox alignComboBox; + private JComboBox scopeComboBox; + + public MyHighlightPane(ConditionAttributesPane conditionAttributesPane) { + super(conditionAttributesPane); + this.alignComboBox = new UIDictionaryComboBox( + new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}, + new String[]{ + Inter.getLocText("Plugin-Highlight_Align_Left"), + Inter.getLocText("Plugin-Highlight_Align_Center"), + Inter.getLocText("Plugin-Highlight_Align_Right")} + ); + add(alignComboBox); + this.scopeComboBox = new UIComboBox(new String[]{ + Inter.getLocText("Utils-Current_Cell"), + Inter.getLocText("Utils-Current_Row"), + Inter.getLocText("Utils-Current_Column")}); + + this.add(this.scopeComboBox); + } + + @Override + public String nameForPopupMenuItem() { + return Inter.getLocText("Plugin-Highlight_Align"); + } + + @Override + public void populate(HighlightAction condition) { + MyHighlightAction action = (MyHighlightAction) condition; + scopeComboBox.setSelectedIndex(action.getScope()); + alignComboBox.setSelectedItem(action.getAlign()); + } + + @Override + public HighlightAction update() { + return new MyHighlightAction(alignComboBox.getSelectedItem(), scopeComboBox.getSelectedIndex()); + } + +} \ No newline at end of file diff --git a/src/com/fr/plugin/cell/highlight/fun/MyCellFunctionProcessor.java b/src/com/fr/plugin/cell/highlight/fun/MyCellFunctionProcessor.java new file mode 100644 index 0000000..409db49 --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/fun/MyCellFunctionProcessor.java @@ -0,0 +1,28 @@ +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 new file mode 100644 index 0000000..4cbd63b --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/locale/align.properties @@ -0,0 +1,4 @@ +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 new file mode 100644 index 0000000..0a9ebef --- /dev/null +++ b/src/com/fr/plugin/cell/highlight/locale/align_zh_CN.properties @@ -0,0 +1,4 @@ +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