Browse Source

Merge branch 'master' of Mars.Ma/demo-show-present into master

master
richie 5 years ago committed by Gogs
parent
commit
91473ccf80
  1. 6
      build.xml
  2. 10
      pom.xml
  3. 13
      src/main/java/com/fr/plugin/present/fun/StarPainter.java
  4. 25
      src/main/java/com/fr/plugin/present/fun/StarPresent.java
  5. 24
      src/main/java/com/fr/plugin/present/ui/StarPresentPane.java

6
build.xml

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8/Contents/Home"/>
<property name="jdk.home" value="C:\Program Files\Java\jdk1.8.0_211"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
@ -88,8 +88,8 @@
<param name="resources_from" value="${basedir}"/>
</antcall>
<antcall target="compile_javas">
<param name="source_jdk_version" value="1.6"/>
<param name="target_jdk_version" value="1.6"/>
<param name="source_jdk_version" value="1.8"/>
<param name="target_jdk_version" value="1.8"/>
<param name="compile_jdk_version" value="${jdk.home}"/>
<param name="compile_files" value="${basedir}/src"/>
</antcall>

10
pom.xml

@ -14,5 +14,15 @@
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.present.star-1.0/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

13
src/main/java/com/fr/plugin/present/fun/StarPainter.java

@ -2,18 +2,17 @@ package com.fr.plugin.present.fun;
import com.fr.base.AbstractPainter;
import com.fr.base.Style;
import com.fr.general.IOUtils;
import com.fr.report.cell.cellattr.core.CellUtils;
import com.fanruan.api.util.IOKit;
import com.fanruan.api.report.PaintKit;
import com.fr.stable.html.Tag;
import com.fr.stable.web.Repository;
import com.fr.web.BaseHTMLWriterUtils;
import com.fanruan.api.report.BaseHTMLWriterKit;
import java.awt.*;
import java.awt.image.BufferedImage;
public class StarPainter extends AbstractPainter {
private static final BufferedImage image = IOUtils.readImage("/com/fr/plugin/present/images/star.png");
private static final BufferedImage image = IOKit.readImage("/com/fr/plugin/present/images/star.png");
private int count;
private int hGap = 4;
@ -36,8 +35,8 @@ public class StarPainter extends AbstractPainter {
@Override
public void paintTag(Repository repo, int width, int height, Style style, Tag tag) {
tag.cls("imageCellElement");
tag.sub(BaseHTMLWriterUtils.createImageTag4RepoWithCheckVml(
CellUtils.value2Image(this, repo.getResolution(), style, width, height), new Dimension(width, height), repo
tag.sub(BaseHTMLWriterKit.createImageTag4RepoWithCheckVml(
PaintKit.value2Image(this, repo.getResolution(), style, width, height), new Dimension(width, height), repo
));
}
}

25
src/main/java/com/fr/plugin/present/fun/StarPresent.java

@ -2,19 +2,18 @@ package com.fr.plugin.present.fun;
import com.fr.base.BaseFormula;
import com.fr.base.present.AbstractPresent;
import com.fr.general.GeneralUtils;
import com.fanruan.api.util.GeneralKit;
import com.fr.intelli.record.Focus;
import com.fr.intelli.record.Original;
import com.fr.log.FineLoggerFactory;
import com.fanruan.api.log.LogKit;
import com.fr.record.analyzer.EnableMetrics;
import com.fr.script.Calculator;
import com.fr.stable.AssistUtils;
import com.fanruan.api.util.AssistKit;
import com.fr.stable.ColumnRow;
import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils;
import com.fr.stable.UtilEvalError;
import com.fanruan.api.util.StringKit;
import com.fr.stable.xml.XMLPrintWriter;
import com.fr.stable.xml.XMLableReader;
import com.fanruan.api.cal.FormulaKit;
/**
* @author richie
@ -38,16 +37,16 @@ public class StarPresent extends AbstractPresent {
@Focus(id = "com.fr.plugin.present.star", text = "", source = Original.PLUGIN)
public Object present(Object value, Calculator calculator, ColumnRow cr) {
Object result = null;
if (StableUtils.canBeFormula(condition)) {
if (FormulaKit.canBeFormula(condition)) {
try {
result = calculator.evalValue(BaseFormula.createFormulaBuilder().build(condition));
} catch (UtilEvalError e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
} catch (Exception e) {
LogKit.error(e.getMessage(), e);
}
} else {
result = condition;
}
Number num = GeneralUtils.objectToNumber(result, true);
Number num = GeneralKit.objectToNumber(result, true);
if (num == null) {
return value;
}
@ -66,7 +65,7 @@ public class StarPresent extends AbstractPresent {
@Override
public void writeXML(XMLPrintWriter writer) {
if (StringUtils.isNotEmpty(condition)) {
if (StringKit.isNotEmpty(condition)) {
writer.startTAG("Condition").textNode(condition).end();
}
}
@ -80,11 +79,11 @@ public class StarPresent extends AbstractPresent {
public boolean equals(Object o) {
return o instanceof StarPresent
&& super.equals(o)
&& AssistUtils.equals(((StarPresent) o).condition, condition);
&& AssistKit.equals(((StarPresent) o).condition, condition);
}
@Override
public int hashCode() {
return AssistUtils.hashCode(condition);
return AssistKit.hashCode(condition);
}
}

24
src/main/java/com/fr/plugin/present/ui/StarPresentPane.java

@ -1,16 +1,10 @@
package com.fr.plugin.present.ui;
import com.fr.design.beans.FurtherBasicBeanPane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import com.fr.design.editor.editor.Editor;
import com.fr.design.editor.editor.FormulaEditor;
import com.fr.design.editor.editor.IntegerEditor;
import com.fr.design.formula.TinyFormulaPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.i18n.Toolkit;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fanruan.api.design.ui.component.formula.UIFormulaTextField;
import com.fanruan.api.design.ui.component.UILabel;
import com.fanruan.api.design.DesignKit;
import com.fanruan.api.design.util.GUICoreKit;
import com.fr.plugin.present.fun.StarPresent;
import java.awt.*;
@ -22,7 +16,7 @@ import java.awt.*;
*/
public class StarPresentPane extends FurtherBasicBeanPane<StarPresent> {
private TinyFormulaPane formulaPane;
private UIFormulaTextField formulaPane;
public StarPresentPane() {
initComponents();
@ -30,9 +24,9 @@ public class StarPresentPane extends FurtherBasicBeanPane<StarPresent> {
private void initComponents() {
setLayout(new BorderLayout());
formulaPane = new TinyFormulaPane();
add(GUICoreUtils.createBorderLayoutPane(
new UILabel(Toolkit.i18nText("Plugin-Present_Value") + ":"),
formulaPane = new UIFormulaTextField();
add(GUICoreKit.createBorderLayoutPane(
new UILabel(DesignKit.i18nText("Plugin-Present_Value") + ":"),
BorderLayout.WEST,
formulaPane,
BorderLayout.CENTER
@ -48,7 +42,7 @@ public class StarPresentPane extends FurtherBasicBeanPane<StarPresent> {
@Override
public String title4PopupWindow() {
return Toolkit.i18nText("Plugin-Present_Star");
return DesignKit.i18nText("Plugin-Present_Star");
}
@Override

Loading…
Cancel
Save