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.
67 lines
2.2 KiB
67 lines
2.2 KiB
package com.fr.design.present; |
|
|
|
import java.util.ArrayList; |
|
import java.util.List; |
|
|
|
import com.fr.base.FRContext; |
|
import com.fr.general.NameObject; |
|
import com.fr.design.condition.HighLightConditionAttributesPane; |
|
import com.fr.design.gui.controlpane.JListControlPane; |
|
import com.fr.design.gui.controlpane.NameObjectCreator; |
|
import com.fr.design.gui.controlpane.NameableCreator; |
|
import com.fr.general.Inter; |
|
import com.fr.report.cell.cellattr.highlight.DefaultHighlight; |
|
import com.fr.report.cell.cellattr.highlight.Highlight; |
|
import com.fr.report.cell.cellattr.highlight.HighlightGroup; |
|
import com.fr.stable.Nameable; |
|
|
|
public class ConditionAttributesGroupPane extends JListControlPane { |
|
|
|
@Override |
|
public NameableCreator[] createNameableCreators() { |
|
return new NameableCreator[] { new NameObjectCreator(Inter.getLocText("Condition_Attributes"), DefaultHighlight.class, HighLightConditionAttributesPane.class) }; |
|
} |
|
|
|
@Override |
|
public String title4PopupWindow() { |
|
return Inter.getLocText("Condition_Attributes"); |
|
} |
|
|
|
/** |
|
* Populate |
|
*/ |
|
public void populate(HighlightGroup highlightGroup) { |
|
// marks这个必须放在前面,不论是否有高亮分组都可以操作 |
|
if (highlightGroup == null || highlightGroup.size() <= 0) { |
|
return; |
|
} |
|
List<NameObject> nameObjectList = new ArrayList<NameObject>(); |
|
|
|
for (int i = 0; i < highlightGroup.size(); i++) { |
|
nameObjectList.add(new NameObject(highlightGroup.getHighlight(i).getName(), highlightGroup.getHighlight(i))); |
|
} |
|
|
|
this.populate(nameObjectList.toArray(new NameObject[nameObjectList.size()])); |
|
} |
|
|
|
/** |
|
* Update. |
|
*/ |
|
public HighlightGroup updateHighlightGroup() { |
|
Nameable[] res = this.update(); |
|
Highlight[] res_array = new Highlight[res.length]; |
|
for (int i = 0; i < res.length; i++) { |
|
// carl:update出来的是一个对象,在块操作时就需要clone |
|
Highlight highlight = (Highlight)((NameObject)res[i]).getObject(); |
|
highlight.setName(((NameObject)res[i]).getName()); |
|
try { |
|
highlight = (Highlight)highlight.clone(); |
|
} catch (CloneNotSupportedException e) { |
|
FRContext.getLogger().error(e.getMessage(), e); |
|
} |
|
res_array[i] = highlight; |
|
} |
|
|
|
return new HighlightGroup(res_array); |
|
} |
|
} |