hades
4 years ago
10 changed files with 140 additions and 11 deletions
@ -0,0 +1,20 @@
|
||||
package com.fr.design.mod; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/5/31 |
||||
*/ |
||||
public class ContentReplaceUtil { |
||||
|
||||
public static final String EQ_STRING = "="; |
||||
|
||||
public static String replaceContent(String content, String oldName, String newName) { |
||||
return content.replaceAll(generateStr(oldName), generateStr(newName)); |
||||
} |
||||
|
||||
private static String generateStr(String str) { |
||||
return "\"" + str + "\""; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.mod; |
||||
|
||||
import com.fr.stable.Filter; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/5/31 |
||||
*/ |
||||
public class ModClassFilter implements Filter<String> { |
||||
|
||||
private static final Set<String> FILTER_SET = new HashSet<>(); |
||||
|
||||
private static final Filter<String> INSTANCE = new ModClassFilter(); |
||||
|
||||
public static Filter<String> getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
static { |
||||
FILTER_SET.add("java.awt.image.BufferedImage"); |
||||
FILTER_SET.add("sun.awt.AppContext"); |
||||
FILTER_SET.add("com.fr.poly.creator.ECBlockCreator"); |
||||
FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet"); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(String s) { |
||||
return FILTER_SET.contains(s); |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mod.impl.change; |
||||
|
||||
import com.fr.design.mod.ContentChange; |
||||
import com.fr.design.mod.ContentReplacer; |
||||
import com.fr.design.mod.bean.ChangeItem; |
||||
import com.fr.design.mod.impl.repalce.VanChartHtmlLabelContentReplacer; |
||||
import com.fr.plugin.chart.base.VanChartHtmlLabel; |
||||
import java.util.HashMap; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/5/31 |
||||
*/ |
||||
public class VanChartHtmlLabelContentChange implements ContentChange<VanChartHtmlLabel> { |
||||
|
||||
private final Map<ChangeItem, ContentReplacer<VanChartHtmlLabel>> map; |
||||
|
||||
public VanChartHtmlLabelContentChange() { |
||||
map = new HashMap<>(); |
||||
map.put(ChangeItem.WIDGET_NAME, new VanChartHtmlLabelContentReplacer()); |
||||
map.put(ChangeItem.TABLE_DATA_NAME, new VanChartHtmlLabelContentReplacer()); |
||||
} |
||||
|
||||
@Override |
||||
public String type() { |
||||
return VanChartHtmlLabel.class.getName(); |
||||
} |
||||
|
||||
@Override |
||||
public Map<ChangeItem, ContentReplacer<VanChartHtmlLabel>> changeInfo() { |
||||
return map; |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.mod.impl.repalce; |
||||
|
||||
import com.fr.design.mod.ContentReplacer; |
||||
import com.fr.design.mod.ContentReplaceUtil; |
||||
import com.fr.plugin.chart.base.VanChartHtmlLabel; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/5/31 |
||||
*/ |
||||
public class VanChartHtmlLabelContentReplacer implements ContentReplacer<VanChartHtmlLabel> { |
||||
|
||||
@Override |
||||
public void replace(VanChartHtmlLabel vanChartHtmlLabel, String oldName, String newName) { |
||||
if (StringUtils.isNotEmpty(vanChartHtmlLabel.getCustomText())) { |
||||
vanChartHtmlLabel.setCustomText( |
||||
ContentReplaceUtil.replaceContent(vanChartHtmlLabel.getCustomText(), oldName, newName)); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue