You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.3 KiB
84 lines
2.3 KiB
package com.fr.plugin.cell.highlight.fun; |
|
|
|
|
|
import com.fr.base.Style; |
|
import com.fr.intelli.record.Focus; |
|
import com.fr.intelli.record.Original; |
|
import com.fr.record.analyzer.EnableMetrics; |
|
import com.fanruan.api.report.cell.AbstractStyleHighlightAction; |
|
import com.fanruan.api.macro.Constants; |
|
import com.fr.stable.xml.XMLPrintWriter; |
|
import com.fr.stable.xml.XMLableReader; |
|
import com.fanruan.api.util.AssistKit; |
|
import com.fanruan.api.runtime.PluginKit; |
|
//import com.fanruan.api.design.ui.layout.Style; |
|
//import com.fanruan.api.design.ui.layout.AbstractStyleHighlightAction; |
|
/** |
|
* @author richie |
|
* @date 2015-03-26 |
|
* @since 8.0 |
|
*/ |
|
@EnableMetrics |
|
public class AlignHighlightAction extends AbstractStyleHighlightAction { |
|
|
|
private int align = Constants.RIGHT; |
|
|
|
public AlignHighlightAction() { |
|
this(Constants.RIGHT, 0); |
|
} |
|
|
|
public AlignHighlightAction(int align, int scope) { |
|
super(scope); |
|
this.align = align; |
|
} |
|
|
|
public int getAlign() { |
|
return align; |
|
} |
|
|
|
// @Override |
|
// public void action(CellElement cellElement, Calculator calculator) { |
|
// super.action(cellElement, calculator); |
|
// } |
|
|
|
@Override |
|
@Focus(id = AlignHighlightConstants.PLUGIN_ID, text = "Plugin-Highlight_Align", source = Original.PLUGIN) |
|
protected Style modStyle(Style style) { |
|
if (PluginKit.isCurrentPluginAvailable()) { |
|
return style.deriveHorizontalAlignment(align); |
|
} |
|
return style; |
|
} |
|
|
|
@Override |
|
public void readXML(XMLableReader reader) { |
|
if (reader.isChildNode()) { |
|
String tagName = reader.getTagName(); |
|
if (tagName.equals("Align")) { |
|
align = reader.getAttrAsInt("align", Constants.RIGHT); |
|
} |
|
} |
|
} |
|
|
|
@Override |
|
public void writeXML(XMLPrintWriter writer) { |
|
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 AssistKit.hashCode(align); |
|
} |
|
|
|
public Object clone() throws CloneNotSupportedException { |
|
AlignHighlightAction cloned = (AlignHighlightAction) super.clone(); |
|
cloned.align = align; |
|
return cloned; |
|
} |
|
} |