svnadmin
9 years ago
459 changed files with 60212 additions and 0 deletions
@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<classpath> |
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6u35"/> |
||||
<classpathentry kind="src" path="src"/> |
||||
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.USER_LIBRARY/lib"/> |
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/base"/> |
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/designer_base"/> |
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/form"/> |
||||
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/engine"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/base-stable"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/base-basic"/> |
||||
<classpathentry kind="lib" path="/lib/3rd.jar"/> |
||||
<classpathentry kind="lib" path="/lib/junit.jar"/> |
||||
<classpathentry kind="lib" path="/lib/ojdbc14.jar"/> |
||||
<classpathentry kind="lib" path="/lib/poi2007_fat.jar"/> |
||||
<classpathentry kind="lib" path="/lib/postgresql-8.0-311.jdbc3.jar"/> |
||||
<classpathentry kind="lib" path="/lib/servlet-api.jar"/> |
||||
<classpathentry kind="lib" path="/lib/sqljdbc.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/activation.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/commons-el.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/commons-logging.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/jasper-compiler.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/jasper-runtime.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/javax.servlet.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/jaxrpc.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/mail.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/mx4j-remote.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/mx4j-tools.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/mx4j.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/org.mortbay.jetty.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/org.mortbay.jmx.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/saaj.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/xercesImpl.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/xml-apis.jar"/> |
||||
<classpathentry kind="lib" path="/lib/jetty/xmlParserAPIs.jar"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/base-calculate"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/chart-base"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/chart-chartattr"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/chart-chartdata"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/chart-chartglyph"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/chart-web"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/engine-page"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/base-data"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/engine-view"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/engine-write"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/engine-remote"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/designer_chart"/> |
||||
<classpathentry combineaccessrules="false" kind="src" path="/designer_form"/> |
||||
<classpathentry kind="lib" path="/lib/swt.jar"/> |
||||
<classpathentry kind="lib" path="/lib/sqlite-jdbc.jar"/> |
||||
<classpathentry kind="output" path="bin"/> |
||||
</classpath> |
@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>designer</name>
<comment/>
<projects/>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments/>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription> |
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<module type="JAVA_MODULE" version="4"> |
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_7" inherit-compiler-output="false"> |
||||
<output url="file://$MODULE_DIR$/../../env/WebReport/WEB-INF/classes" /> |
||||
<content url="file://$MODULE_DIR$"> |
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> |
||||
</content> |
||||
<orderEntry type="jdk" jdkName="jdk1.8" jdkType="JavaSDK" /> |
||||
<orderEntry type="sourceFolder" forTests="false" /> |
||||
<orderEntry type="module" module-name="base" /> |
||||
<orderEntry type="module" module-name="base-basic" /> |
||||
<orderEntry type="module" module-name="base-calculate" /> |
||||
<orderEntry type="module" module-name="base-data" /> |
||||
<orderEntry type="module" module-name="base-file" /> |
||||
<orderEntry type="module" module-name="base-performance" /> |
||||
<orderEntry type="module" module-name="base-stable" /> |
||||
<orderEntry type="module" module-name="designer_base" /> |
||||
<orderEntry type="module" module-name="engine" /> |
||||
<orderEntry type="library" name="lib" level="project" /> |
||||
</component> |
||||
</module> |
@ -0,0 +1,56 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import javax.swing.Icon; |
||||
|
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class ButtonGroupAction extends ElementCaseAction{ |
||||
protected Icon[] iconArray; |
||||
protected Integer[] valueArray; |
||||
|
||||
private UIButtonGroup<Integer> group; |
||||
|
||||
protected ButtonGroupAction(ElementCasePane t, Icon[] iconArray, Integer[] valueArray) { |
||||
super(t); |
||||
this.iconArray = iconArray; |
||||
this.valueArray = valueArray; |
||||
} |
||||
|
||||
protected Integer getSelectedValue() { |
||||
if(getSelectedIndex() < 0 || getSelectedIndex() >= valueArray.length) { |
||||
return valueArray[0]; |
||||
} |
||||
return valueArray[getSelectedIndex()]; |
||||
} |
||||
|
||||
private int getSelectedIndex() { |
||||
return createToolBarComponent().getSelectedIndex(); |
||||
} |
||||
|
||||
protected void setSelectedIndex(int value) { |
||||
int index = -1; |
||||
for(int i = 0; i < valueArray.length; i++) { |
||||
if(value == valueArray[i]) { |
||||
index = i; |
||||
break; |
||||
} |
||||
} |
||||
if(value == -1 && createToolBarComponent().hasClick()) { |
||||
index = getSelectedIndex(); |
||||
createToolBarComponent().setClickState(false); |
||||
} |
||||
createToolBarComponent().removeActionListener(this); |
||||
createToolBarComponent().setSelectedIndex(index); |
||||
createToolBarComponent().addActionListener(this); |
||||
} |
||||
|
||||
@Override |
||||
public UIButtonGroup<Integer> createToolBarComponent() { |
||||
if(group == null) { |
||||
group = new UIButtonGroup<Integer>(iconArray, valueArray); |
||||
group.addActionListener(this); |
||||
} |
||||
return group; |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
|
||||
public abstract class CellSelectionAction extends ElementCaseAction { |
||||
protected CellSelectionAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection s = ePane.getSelection(); |
||||
|
||||
// TODO ALEX_SEP instanceof i hate it
|
||||
if (s instanceof CellSelection) { |
||||
return executeActionReturnUndoRecordNeededWithCellSelection((CellSelection)s); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
protected abstract boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs); |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
if (this.isEnabled()) { |
||||
this.setEnabled(this.getEditingComponent().getSelection() instanceof CellSelection); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
//ElementCaseAction应该有GridSelectionChangeListener,就从悬浮元素和单元格来讲,就必须有了,用来判断这些ElementCaseAction是否可以编辑,当然还可以做些其他事情
|
||||
//
|
||||
|
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.design.selection.SelectionEvent; |
||||
import com.fr.design.selection.SelectionListener; |
||||
|
||||
public abstract class ElementCaseAction extends TemplateComponentAction<ElementCasePane> { |
||||
protected ElementCaseAction(ElementCasePane t) { |
||||
super(t); |
||||
t.addSelectionChangeListener(new SelectionListener() { |
||||
|
||||
@Override |
||||
public void selectionChanged(SelectionEvent e) { |
||||
update(); |
||||
if (DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL) { |
||||
Selection selection = getEditingComponent().getSelection(); |
||||
if (selection instanceof CellSelection) { |
||||
CellSelection cellselection = (CellSelection) selection; |
||||
//样式处理
|
||||
getEditingComponent().setCellNeedTOFormat(cellselection); |
||||
} |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
|
||||
public abstract class FloatSelectionAction extends ElementCaseAction { |
||||
|
||||
protected FloatSelectionAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection s = ePane.getSelection(); |
||||
|
||||
// TODO ALEX_SEP instanceof i hate it
|
||||
if (s instanceof FloatSelection) { |
||||
return executeActionReturnUndoRecordNeededWithFloatSelection((FloatSelection)s); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
protected abstract boolean executeActionReturnUndoRecordNeededWithFloatSelection(FloatSelection fs); |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
|
||||
if (this.isEnabled()) { |
||||
this.setEnabled(this.getEditingComponent().getSelection() instanceof FloatSelection); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.JWorkBook; |
||||
|
||||
public abstract class JWorkBookAction extends JTemplateAction<JWorkBook> { |
||||
protected JWorkBookAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.gui.imenu.UICheckBoxMenuItem; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class PresentCheckBoxAction extends ElementCaseAction { |
||||
protected PresentCheckBoxAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public UICheckBoxMenuItem createMenuItem() { |
||||
Object object = this.getValue(UICheckBoxMenuItem.class.getName()); |
||||
if (object == null) { |
||||
object = createCheckBoxMenuItem(this); |
||||
this.putValue(UICheckBoxMenuItem.class.getName(), object); |
||||
} |
||||
|
||||
// isSelected.
|
||||
((UICheckBoxMenuItem) object).setSelected(this.isSelected()); |
||||
|
||||
return (UICheckBoxMenuItem) object; |
||||
} |
||||
|
||||
public abstract boolean isSelected(); |
||||
} |
@ -0,0 +1,9 @@
|
||||
package com.fr.design.actions; |
||||
|
||||
import com.fr.design.mainframe.ReportComponent; |
||||
|
||||
public abstract class ReportComponentAction<T extends ReportComponent> extends TemplateComponentAction<T> { |
||||
protected ReportComponentAction(T tc) { |
||||
super(tc); |
||||
} |
||||
} |
@ -0,0 +1,100 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.GridUtils; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.core.SheetUtils; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
import com.fr.report.stable.ReportConstants; |
||||
|
||||
// TODO ALEX_SEP 这个类与AbstractCellAction有什么关系?
|
||||
public abstract class AbstractCellElementAction extends CellSelectionAction { |
||||
protected AbstractCellElementAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
final ElementCasePane ePane = this.getEditingComponent(); |
||||
final TemplateElementCase tplEC = ePane.getEditingElementCase(); |
||||
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
if (editCellElement == null) { |
||||
editCellElement = new DefaultTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
tplEC.addCellElement(editCellElement); |
||||
} |
||||
if (tplEC != null) { |
||||
SheetUtils.calculateDefaultParent(tplEC); |
||||
} |
||||
final CellSelection finalCS = cs; |
||||
final BasicPane bp = populateBasicPane(editCellElement); |
||||
BasicDialog dialog = bp.showWindow(DesignerContext.getDesignerFrame()); |
||||
dialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
// 需要先行后列地增加新元素。
|
||||
for (int j = 0; j < finalCS.getRowSpan(); j++) { |
||||
for (int i = 0; i < finalCS.getColumnSpan(); i++) { |
||||
int column = i + finalCS.getColumn(); |
||||
int row = j + finalCS.getRow(); |
||||
TemplateCellElement editCellElement = tplEC.getTemplateCellElement(column, row); |
||||
if (editCellElement == null) { |
||||
editCellElement = new DefaultTemplateCellElement(column, row); |
||||
tplEC.addCellElement(editCellElement); |
||||
} |
||||
// alex:不加这一句话会导致跨行跨列的格子被多次update
|
||||
if (editCellElement.getColumn() != column || editCellElement.getRow() != row) { |
||||
continue; |
||||
} |
||||
updateBasicPane(bp, editCellElement); |
||||
// update cell attributes
|
||||
if (isNeedShinkToFit()) { |
||||
// shink to fit.(如果value是String)
|
||||
Object editElementValue = editCellElement.getValue(); |
||||
if (editElementValue != null && (editElementValue instanceof String || editElementValue instanceof Number)) { |
||||
// TODO ALEX_SEP 暂时用FIT_DEFAULT替代,不取reportsetting里面的设置,因为也不知道是应该放在report里面还是elementcase里面
|
||||
GridUtils.shrinkToFit(ReportConstants.AUTO_SHRINK_TO_FIT_DEFAULT, tplEC, editCellElement); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
ePane.fireTargetModified(); |
||||
} |
||||
}); |
||||
//控件设置记住dlg,提交入库智能添加单元格后可以show出来
|
||||
DesignerContext.setReportWritePane(dialog); |
||||
dialog.setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 初始化对话框 |
||||
* |
||||
* @param cellElement |
||||
* @return |
||||
*/ |
||||
protected abstract BasicPane populateBasicPane(TemplateCellElement cellElement); |
||||
|
||||
/** |
||||
* 更新对话框之后,改变值 |
||||
* |
||||
* @param cellElement |
||||
* @return |
||||
*/ |
||||
protected abstract void updateBasicPane(BasicPane basicPane, TemplateCellElement cellElement); |
||||
|
||||
/** |
||||
* if isNeedShinkToFit,please override this method |
||||
* |
||||
* @return isNeedShinkToFit |
||||
*/ |
||||
protected boolean isNeedShinkToFit() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,85 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.core.ActionUtils; |
||||
import com.fr.design.style.BorderUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Border. |
||||
*/ |
||||
public class BorderAction extends ElementCaseAction implements ChangeListener { |
||||
|
||||
private CellBorderStyle oldCellBorderStyle; |
||||
|
||||
public BorderAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Format_A-Border")); |
||||
} |
||||
|
||||
public void stateChanged(ChangeEvent e) { |
||||
this.actionPerformedUndoable(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
Object object = this.getValue(UIToolbarBorderButton.class.getName()); |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
if (object != null && object instanceof UIToolbarBorderButton) { |
||||
oldCellBorderStyle = ((UIToolbarBorderButton) object).getCellBorderStyle(); |
||||
|
||||
return this.update(reportPane); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIToolbarBorderButton.class.getName()); |
||||
if (object == null || !(object instanceof UIToolbarBorderButton)) { |
||||
UIToolbarBorderButton borderStylePane = new UIToolbarBorderButton(BaseUtils.readIcon("/com/fr/design/images/m_format/noboder.png"), this.getEditingComponent()); |
||||
this.putValue(UIToolbarBorderButton.class.getName(), borderStylePane); |
||||
borderStylePane.setEnabled(this.isEnabled()); |
||||
borderStylePane.set4Toolbar(); |
||||
// peter:产生tooltip
|
||||
borderStylePane.setToolTipText(ActionUtils.createButtonToolTipText(this)); |
||||
borderStylePane.setCellBorderStyle(new CellBorderStyle()); |
||||
borderStylePane.addStyleChangeListener(this); |
||||
return borderStylePane; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
|
||||
public boolean update(ElementCasePane elementCasePane) { |
||||
if (oldCellBorderStyle.isNoneBorderStyle()) { |
||||
//无边框格式
|
||||
return BorderUtils.updateCellBorderStyle(elementCasePane, oldCellBorderStyle); |
||||
} |
||||
return BorderUtils.update(elementCasePane, oldCellBorderStyle); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
this.setEnabled(true); |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Cell Attribute. |
||||
*/ |
||||
public class CellAttributeAction extends CellAttributeTableAction { |
||||
public CellAttributeAction() { |
||||
this.setMenuKeySet(KeySetUtils.CELL_OTHER_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
// this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellAttr.png"));
|
||||
} |
||||
|
||||
@Override |
||||
protected String getID() { |
||||
return Inter.getLocText("Datasource-Other_Attributes"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
|
||||
/** |
||||
* 所有的CellAttributeTableAction都是指向单元格属性表的,点了就自动跳转到单元格属性表 |
||||
* |
||||
* @author zhou |
||||
* @since 2012-5-23下午4:19:48 |
||||
*/ |
||||
public abstract class CellAttributeTableAction extends UpdateAction { |
||||
|
||||
protected abstract String getID(); |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
CellElementPropertyPane.getInstance().GoToPane(getID()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
public class CellExpandAttrAction extends CellAttributeTableAction{ |
||||
|
||||
public CellExpandAttrAction() { |
||||
super(); |
||||
this.setMenuKeySet(KeySetUtils.CELL_EXPAND_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public String getID() { |
||||
return Inter.getLocText("ExpandD-Expand_Attribute"); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,72 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.present.CellWriteAttrPane; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.privilege.finegrain.WidgetPrivilegeControl; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
/** |
||||
* Cell Widget Attribute. |
||||
*/ |
||||
public class CellWidgetAttrAction extends AbstractCellElementAction { |
||||
|
||||
public CellWidgetAttrAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.CELL_WIDGET_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/modified.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
CellWriteAttrPane pane = new CellWriteAttrPane(this.getEditingComponent()); |
||||
//got simple cell element from column and row.
|
||||
pane.populate(cellElement); |
||||
|
||||
return pane; |
||||
} |
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||
CellWriteAttrPane pane = (CellWriteAttrPane) bp; |
||||
if (cellElement.getWidget() == null) { |
||||
pane.update(cellElement); |
||||
return; |
||||
} |
||||
try { |
||||
Widget oldWidget = (Widget) cellElement.getWidget().clone(); |
||||
pane.update(cellElement); |
||||
//这边需要重新设置权限细粒度的hashset是因为Update是直接生成一个新的来update的,所以以前里面的hashset都没有了
|
||||
Widget newWidget = cellElement.getWidget(); |
||||
if (newWidget.getClass() == oldWidget.getClass()) { |
||||
newWidget.setWidgetPrivilegeControl((WidgetPrivilegeControl) oldWidget.getWidgetPrivilegeControl().clone()); |
||||
} |
||||
} catch (Exception e) { |
||||
FRLogger.getLogger().error(e.getMessage()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isNeedShinkToFit() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection sel = ePane.getSelection(); |
||||
if (sel instanceof CellSelection) { |
||||
this.setEnabled(true); |
||||
} else { |
||||
this.setEnabled(false); |
||||
} |
||||
} |
||||
} |
File diff suppressed because one or more lines are too long
@ -0,0 +1,37 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.present.ConditionAttributesGroupPane; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
/** |
||||
* Condition Attributes. |
||||
*/ |
||||
public class ConditionAttributesAction extends AbstractCellElementAction { |
||||
public ConditionAttributesAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.CONDITION_ATTR); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/highlight.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
ConditionAttributesGroupPane pane = new ConditionAttributesGroupPane(); |
||||
pane.populate(cellElement.getHighlightGroup()); |
||||
|
||||
return pane; |
||||
} |
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||
cellElement.setHighlightGroup(((ConditionAttributesGroupPane)bp).updateHighlightGroup()); |
||||
} |
||||
} |
@ -0,0 +1,41 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import java.awt.Toolkit; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* EditCellAction. |
||||
*/ |
||||
public class EditCellAction extends ElementCaseAction { |
||||
public EditCellAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Edit")); |
||||
this.setMnemonic('I'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/control/edit.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if(reportPane.isSelectedOneCell()){ |
||||
reportPane.getGrid().startEditing(); |
||||
}else{ |
||||
Toolkit.getDefaultToolkit().beep(); |
||||
} |
||||
} |
||||
|
||||
// TODO ALEX_SEP 这里的undo redo又是怎么回事呢?
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,52 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.ReportStylePane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Cell Style. |
||||
*/ |
||||
public class FloatStyleAction extends ElementCaseAction { |
||||
boolean okreturn = false; |
||||
|
||||
public FloatStyleAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 成功返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
final ReportStylePane reportStylePane = new ReportStylePane(); |
||||
final BasicDialog styleDialog = reportStylePane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
reportStylePane.populate(reportPane); |
||||
styleDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
reportStylePane.update(reportPane); |
||||
FloatStyleAction.this.okreturn = true; |
||||
} |
||||
}); |
||||
styleDialog.setVisible(true); |
||||
return okreturn; |
||||
} |
||||
} |
@ -0,0 +1,153 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
/** |
||||
* richer:global style menu |
||||
*/ |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.ConfigManager; |
||||
import com.fr.base.NameStyle; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.gui.imenu.UIMenu; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.menu.MenuDef; |
||||
import com.fr.design.style.StylePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.base.ConfigManagerProvider; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.pinyin.PinyinHelper; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.util.Iterator; |
||||
|
||||
public class GlobalStyleMenuDef extends MenuDef { |
||||
private static final int MAX_LENTH = 12; |
||||
private ElementCasePane ePane; |
||||
|
||||
public GlobalStyleMenuDef(ElementCasePane ePane) { |
||||
this.ePane = ePane; |
||||
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setIconPath("/com/fr/design/images/m_web/style.png"); |
||||
} |
||||
|
||||
/** |
||||
* 更新菜单项 |
||||
*/ |
||||
public void updateMenu() { |
||||
UIMenu createdMenu = this.createJMenu(); |
||||
createdMenu.removeAll(); |
||||
ConfigManagerProvider configManager = ConfigManager.getProviderInstance(); |
||||
Iterator iterator = configManager.getStyleNameIterator(); |
||||
while (iterator.hasNext()) { |
||||
String name = (String) iterator.next(); |
||||
NameStyle nameStyle = NameStyle.getInstance(name); |
||||
|
||||
UpdateAction.UseMenuItem useMenuItem = new GlobalStyleSelection(ePane, nameStyle).createUseMenuItem(); |
||||
useMenuItem.setNameStyle(nameStyle); |
||||
createdMenu.add(useMenuItem); |
||||
} |
||||
createdMenu.addSeparator(); |
||||
createdMenu.add(new CustomStyleAction(Inter.getLocText("FR-Engine_Custom"))); |
||||
} |
||||
|
||||
/** |
||||
* 控制自定义样式名称的长度 |
||||
* |
||||
* @param longName 名字 |
||||
* @return 控制之后的名字 |
||||
*/ |
||||
public static String judgeChina(String longName) { |
||||
|
||||
//neil:bug 1623 控制自定义样式名称的长度,只显示前12个字符,每个英文算1个字符,每个汉字算2个字符
|
||||
Integer index = 0; |
||||
StringBuffer sBuffer = new StringBuffer(); |
||||
for (int i = 0; i < longName.length(); i++) { |
||||
String bb = longName.substring(i, i + 1); //生成一个Pattern,同时编译一个正则表达式
|
||||
boolean cc = PinyinHelper.isChinese(bb.charAt(0)); |
||||
if (index == MAX_LENTH) { |
||||
sBuffer.append(".."); |
||||
break; |
||||
} |
||||
if ((index == MAX_LENTH - 1 && cc)) { |
||||
continue; |
||||
} |
||||
if (cc) { |
||||
index = index + 2; |
||||
} else { |
||||
index = index + 1; |
||||
} |
||||
|
||||
sBuffer.append(bb); |
||||
if (index > MAX_LENTH) { |
||||
sBuffer.append(".."); |
||||
break; |
||||
} |
||||
|
||||
} |
||||
|
||||
return sBuffer.toString(); |
||||
|
||||
} |
||||
|
||||
public static class CustomStyleAction extends UpdateAction { |
||||
|
||||
public CustomStyleAction(String name) { |
||||
|
||||
this.setName(name); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
CellElementPropertyPane.getInstance().GoToPane(new String[]{Inter.getLocText("FR-Engine_Style"), Inter.getLocText("FR-Engine_Custom")}); |
||||
} |
||||
|
||||
} |
||||
|
||||
public static class GlobalStyleSelection extends ElementCaseAction { |
||||
|
||||
private NameStyle nameStyle; |
||||
|
||||
public GlobalStyleSelection(ElementCasePane t, NameStyle nameStyle) { |
||||
super(t); |
||||
setName(StringUtils.EMPTY); |
||||
//重复画了一次,不需要icon
|
||||
// this.setName(nameStyle == null ? "" : nameStyle.getName());
|
||||
// this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png"));
|
||||
this.setNameStyle(nameStyle); |
||||
} |
||||
|
||||
public NameStyle getNameStyle() { |
||||
return this.nameStyle; |
||||
} |
||||
|
||||
public void setNameStyle(NameStyle nameStyle) { |
||||
this.nameStyle = nameStyle; |
||||
} |
||||
|
||||
/** |
||||
* 执行动作返回 |
||||
* @return 是返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
StylePane stylePane = new StylePane(); |
||||
if (StringUtils.isEmpty(this.getName())) { |
||||
stylePane.setGlobalStyle(this.getNameStyle()); |
||||
} else { |
||||
stylePane.setGlobalStyle(NameStyle.getInstance(this.getName())); |
||||
} |
||||
|
||||
stylePane.updateGlobalStyle(getEditingComponent()); |
||||
return true; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,84 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import com.fr.base.present.Present; |
||||
import com.fr.design.actions.PresentCheckBoxAction; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.GeneralUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.stable.StableUtils; |
||||
|
||||
public class NewPresentAction extends PresentCheckBoxAction { |
||||
|
||||
private String itemName = null; |
||||
|
||||
public NewPresentAction(ElementCasePane t, String title, String name) { |
||||
super(t); |
||||
|
||||
this.setName(title); |
||||
this.itemName = name; |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
if (!ComparatorUtils.equals(this.itemName, "NOPRESENT")) { |
||||
CellElementPropertyPane.getInstance().GoToPane(Inter.getLocText("Present"), this.itemName); |
||||
} else { |
||||
TemplateCellElement ce = getSelectedCellElement(); |
||||
// 只有原来ce设置了形态的情况下才有undo操作
|
||||
if (ce != null && ce.getPresent() != null) { |
||||
ce.setPresent(null); |
||||
return true; |
||||
} else { |
||||
return false; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isSelected() { |
||||
return hasCurrentPresentSet(); |
||||
} |
||||
|
||||
// TODO ALEX_SEP enable有没有可能也通过这个方法来解决呢?
|
||||
private TemplateCellElement getSelectedCellElement() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection sel = ePane.getSelection(); |
||||
if (sel instanceof CellSelection) { |
||||
return (TemplateCellElement) ePane.getEditingElementCase().getCellElement(((CellSelection) sel).getColumn(), ((CellSelection) sel).getRow()); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
Selection sel = ePane.getSelection(); |
||||
if (sel instanceof CellSelection) { |
||||
this.setEnabled(true); |
||||
} else { |
||||
this.setEnabled(false); |
||||
} |
||||
} |
||||
|
||||
public boolean hasCurrentPresentSet() { |
||||
TemplateCellElement ce = getSelectedCellElement(); |
||||
if (ce != null) { |
||||
Present currentPresent = ce.getPresent(); |
||||
try { |
||||
Class clazz = GeneralUtils.classForName(itemName); |
||||
if (itemName.equals(currentPresent.getClass().getName())) { |
||||
return StableUtils.classInstanceOf(currentPresent.getClass(), clazz); |
||||
} |
||||
} catch (Exception e) { |
||||
return "NOPRESENT".equals(itemName) && currentPresent == null; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell; |
||||
|
||||
|
||||
import java.awt.event.ActionEvent; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.CellElementPropertyPane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
public class StyleAction extends UpdateAction { |
||||
|
||||
public StyleAction() { |
||||
|
||||
this.setMenuKeySet(KeySetUtils.GLOBAL_STYLE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cell.png")); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
CellElementPropertyPane.getInstance().GoToPane(new String[] { Inter.getLocText("Style"), Inter.getLocText("Custom") }); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,308 @@
|
||||
package com.fr.design.actions.cell; |
||||
|
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.GridLayout; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.Box; |
||||
import javax.swing.Icon; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JPopupMenu; |
||||
import javax.swing.JSeparator; |
||||
import javax.swing.SwingUtilities; |
||||
import javax.swing.UIManager; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import javax.swing.event.EventListenerList; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.CellBorderStyle; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UICombinationButton; |
||||
import com.fr.design.gui.ipoppane.PopupHider; |
||||
import com.fr.design.icon.BorderIcon; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.style.BorderUtils; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.design.style.BorderPane; |
||||
import com.fr.design.style.color.TransparentPane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
/** |
||||
* 这个Pane用来显示常用边框和设置自定义边框 |
||||
* |
||||
* @author richer |
||||
* |
||||
*/ |
||||
public class UIToolbarBorderButton extends UICombinationButton implements PopupHider { |
||||
private EventListenerList styleChangeListenerList = new EventListenerList(); |
||||
private boolean isCanBeNull = false; |
||||
private ElementCasePane reportPane; |
||||
private JPopupMenu popupWin; |
||||
|
||||
public UIToolbarBorderButton(Icon icon, ElementCasePane reportPane) { |
||||
super(new UIButton(icon), new UIButton(BaseUtils.readIcon("/com/fr/design/images/gui/popup.gif"))); |
||||
this.reportPane = reportPane; |
||||
} |
||||
|
||||
public CellBorderStyle getCellBorderStyle() { |
||||
return this.cellBorderStyle; |
||||
} |
||||
|
||||
public void setCellBorderStyle(CellBorderStyle cellBorderStyle) { |
||||
this.cellBorderStyle = cellBorderStyle; |
||||
this.leftButton.setIcon(new BorderIcon(cellBorderStyle)); |
||||
fireStyleStateChanged(); |
||||
} |
||||
|
||||
@Override |
||||
public void setEnabled(boolean enabled) { |
||||
super.setEnabled(enabled); |
||||
|
||||
if (!enabled) { |
||||
cellBorderStyle = null; |
||||
} |
||||
|
||||
leftButton.setEnabled(enabled); |
||||
rightButton.setEnabled(enabled); |
||||
} |
||||
|
||||
@Override |
||||
public void setToolTipText(String tooltipText) { |
||||
super.setToolTipText(tooltipText); |
||||
|
||||
leftButton.setToolTipText(tooltipText); |
||||
rightButton.setToolTipText(tooltipText); |
||||
} |
||||
|
||||
|
||||
private void showPopupMenu() { |
||||
if (popupWin != null && popupWin.isVisible()) { |
||||
hidePopupMenu(); |
||||
return; |
||||
} |
||||
|
||||
if (!this.isEnabled()) { |
||||
return; |
||||
} |
||||
|
||||
popupWin = this.getActionPopupMenu(); |
||||
GUICoreUtils.showPopupMenu(popupWin, this, 0, this.getSize().height); |
||||
} |
||||
|
||||
protected JPopupMenu getActionPopupMenu() { |
||||
if (this.popupWin == null) { |
||||
this.popupWin = new BorderStyleControlWindow(this.isCanBeNull()); |
||||
} |
||||
|
||||
return popupWin; |
||||
} |
||||
|
||||
protected void leftButtonClickEvent() { |
||||
UIToolbarBorderButton.this.cellBorderStyle = ((BorderIcon)getLeftButton().getIcon()).cellBorderStyle; |
||||
UIToolbarBorderButton.this.fireStyleStateChanged(); |
||||
} |
||||
|
||||
@Override |
||||
protected void rightButtonClickEvent() { |
||||
showPopupMenu(); |
||||
} |
||||
|
||||
class BorderStyleControlWindow extends JPopupMenu { |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public BorderStyleControlWindow(boolean isSupportTransparent) { |
||||
this.initComponents(isSupportTransparent); |
||||
} |
||||
|
||||
public void initComponents(boolean isSupportTransparent) { |
||||
setLightWeightPopupEnabled(JPopupMenu.getDefaultLightWeightPopupEnabled()); |
||||
|
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
setBorderPainted(true); |
||||
setBorder(UIManager.getBorder("PopupMenu.border")); |
||||
setOpaque(false); |
||||
setDoubleBuffered(true); |
||||
setFocusable(false); |
||||
|
||||
this.add(new NormalBorderPane(isSupportTransparent, UIToolbarBorderButton.this), BorderLayout.CENTER); |
||||
this.pack(); |
||||
} |
||||
} |
||||
|
||||
// richer:常用边框线类型展现面板
|
||||
class NormalBorderPane extends TransparentPane { |
||||
PopupHider popupHider; |
||||
|
||||
public NormalBorderPane(boolean isSupportTransparent, PopupHider popupHider) { |
||||
super(isSupportTransparent); |
||||
this.popupHider = popupHider; |
||||
} |
||||
|
||||
@Override |
||||
public void initCenterPaneChildren(JPanel centerPane) { |
||||
JPanel menuColorPane = new /**/JPanel(); |
||||
centerPane.add(menuColorPane); |
||||
|
||||
menuColorPane.setLayout(new /**/GridLayout(3, 4, 2, 2)); |
||||
for (int i = 0; i < borderStyleArray.length; i++) { |
||||
final UIButton borderStyleCell = new UIButton(new BorderIcon(borderStyleArray[i])); |
||||
borderStyleCell.set4ToolbarButton(); |
||||
borderStyleCell.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mousePressed(MouseEvent e) { |
||||
UIButton toolBarButton = (UIButton) e.getSource(); |
||||
if (toolBarButton.getIcon() instanceof BorderIcon) { |
||||
BorderIcon borderIcon = (BorderIcon) toolBarButton.getIcon(); |
||||
UIToolbarBorderButton.this.setCellBorderStyle(borderIcon.cellBorderStyle); |
||||
hidePopupMenu(); |
||||
} else { |
||||
UIToolbarBorderButton.this.setCellBorderStyle(borderStyleArray[0]); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
borderStyleCell.addMouseListener(new MouseAdapter() { |
||||
|
||||
@Override |
||||
public void mouseEntered(MouseEvent e) { |
||||
borderStyleCell.setBorder(BorderFactory.createEtchedBorder()); |
||||
} |
||||
|
||||
@Override |
||||
public void mouseExited(MouseEvent e) { |
||||
borderStyleCell.setBorder(null); |
||||
} |
||||
}); |
||||
borderStyleCell.setToolTipText(BorderStyleTooltips[i]); |
||||
menuColorPane.add(borderStyleCell); |
||||
} |
||||
|
||||
centerPane.add(Box.createVerticalStrut(5)); |
||||
centerPane.add(new JSeparator()); |
||||
centerPane.add(Box.createVerticalStrut(5)); |
||||
} |
||||
|
||||
@Override |
||||
public void doTransparent() { |
||||
UIToolbarBorderButton.this.setCellBorderStyle(null); |
||||
popupHider.hidePopupMenu(); |
||||
} |
||||
|
||||
@Override |
||||
public void customButtonPressed() { |
||||
popupHider.hidePopupMenu(); |
||||
final BorderPane borderPane = new BorderPane(); |
||||
BasicDialog borderDialog = borderPane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
Object[] fourObjectArray = BorderUtils.createCellBorderObject(reportPane); |
||||
if (fourObjectArray != null && fourObjectArray.length == 4) { |
||||
borderPane.populate((CellBorderStyle) fourObjectArray[0], ((Boolean) fourObjectArray[1]).booleanValue(), |
||||
((Integer) fourObjectArray[2]).intValue(), (Color) fourObjectArray[3]); |
||||
} |
||||
borderDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
CellBorderStyle cellBorderStyle = borderPane.update(); |
||||
UIToolbarBorderButton.this.setCellBorderStyle(cellBorderStyle); |
||||
} |
||||
}); |
||||
borderDialog.setVisible(true); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("Border"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Adds a new StyleChangeListener |
||||
*/ |
||||
public void addStyleChangeListener(ChangeListener changeListener) { |
||||
styleChangeListenerList.add(ChangeListener.class, changeListener); |
||||
} |
||||
|
||||
/** |
||||
* Removes an old StyleChangeListener. |
||||
*/ |
||||
public void removeColorChangeListener(ChangeListener changeListener) { |
||||
styleChangeListenerList.remove(ChangeListener.class, changeListener); |
||||
} |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public void fireStyleStateChanged() { |
||||
Object[] listeners = styleChangeListenerList.getListenerList(); |
||||
ChangeEvent e = null; |
||||
|
||||
for (int i = listeners.length - 2; i >= 0; i -= 2) { |
||||
if (listeners[i] == ChangeListener.class) { |
||||
if (e == null) { |
||||
e = new ChangeEvent(this); |
||||
} |
||||
((ChangeListener) listeners[i + 1]).stateChanged(e); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public boolean isCanBeNull() { |
||||
return this.isCanBeNull; |
||||
} |
||||
|
||||
public void setCanBeNull(boolean isCanBeNull) { |
||||
this.isCanBeNull = isCanBeNull; |
||||
} |
||||
|
||||
private CellBorderStyle cellBorderStyle = new CellBorderStyle(); |
||||
|
||||
private static final CellBorderStyle[] borderStyleArray = { |
||||
new CellBorderStyle(), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, |
||||
Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_DOUBLE, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THICK, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_DOUBLE, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_THICK, Color.black, |
||||
Constants.LINE_NONE, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, Constants.LINE_THIN, Color.black, |
||||
Constants.LINE_THIN, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE), |
||||
new CellBorderStyle(Color.black, Constants.LINE_THICK, Color.black, Constants.LINE_THICK, Color.black, Constants.LINE_THICK, Color.black, |
||||
Constants.LINE_THICK, Color.black, Constants.LINE_NONE, Color.black, Constants.LINE_NONE) }; |
||||
private static final String[] BorderStyleTooltips = { Inter.getLocText("NO_Border_Line"), Inter.getLocText("Bottom_Border_Line"), |
||||
Inter.getLocText("Left_Border_Line"), Inter.getLocText("Right_Border_Line"), Inter.getLocText("Double_Bottom_BorderLine"), |
||||
Inter.getLocText("Thick_Bottom_Border_Line"), Inter.getLocText("Top_Bottom_Border_Line"), |
||||
Inter.getLocText("Top_And_Double_Bottom_Border_Line"), Inter.getLocText("Top_And_Thick_Bottom_Border_Line"), |
||||
Inter.getLocText("All_Border_Line"), Inter.getLocText("Out_Border_Line"), Inter.getLocText("Out_Thick_Border_Line") }; |
||||
|
||||
@Override |
||||
public void hidePopupMenu() { |
||||
if (popupWin != null) { |
||||
popupWin.setVisible(false); |
||||
} |
||||
|
||||
popupWin = null; |
||||
} |
||||
} |
@ -0,0 +1,82 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.chart.BaseChartCollection; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.utils.ReportActionUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
/** |
||||
* Abstract cellstyle. |
||||
*/ |
||||
public abstract class AbstractStyleAction extends ElementCaseAction implements StyleActionInterface { |
||||
protected AbstractStyleAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public abstract Style executeStyle(Style style, Style defStyle); |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
|
||||
return ReportActionUtils.executeAction(this, reportPane); |
||||
} |
||||
|
||||
/** |
||||
* Update Style. |
||||
* |
||||
* @param style the updated style. |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
// peter:这个方法默认情况下什么都不做.
|
||||
} |
||||
|
||||
public boolean isFontStye() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
// james:应该从Action中的ReportPane拿Style,而不是从reportFrame中拿
|
||||
this.setEnabled(true); |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
if (isFontStye()) { |
||||
Selection cs = reportPane.getSelection(); |
||||
TemplateElementCase tplEC = reportPane.getEditingElementCase(); |
||||
|
||||
if (tplEC != null && cs instanceof FloatSelection) { |
||||
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); |
||||
if (selectedFloat == null) { |
||||
//有情况是撤销worksheet里面的元素撤消了,但是reportpane里面的selection没有变
|
||||
reportPane.setSelection(new CellSelection()); |
||||
return; |
||||
} |
||||
Object value = selectedFloat.getValue(); |
||||
if (value instanceof BaseChartCollection) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
// 更新Style
|
||||
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
||||
} |
||||
} |
@ -0,0 +1,111 @@
|
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import javax.swing.Icon; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.chart.BaseChartCollection; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.actions.ButtonGroupAction; |
||||
import com.fr.design.actions.utils.ReportActionUtils; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
|
||||
public class AlignmentAction extends ButtonGroupAction implements StyleActionInterface { |
||||
|
||||
public AlignmentAction(ElementCasePane t, Icon[] iconArray, |
||||
Integer[] valueArray) { |
||||
super(t, iconArray, valueArray); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* executeStyle |
||||
* |
||||
* @param style |
||||
* @param selectedStyle |
||||
* @return style |
||||
*/ |
||||
public Style executeStyle(Style style, Style selectedStyle) { |
||||
return style.deriveHorizontalAlignment(getSelectedValue()); |
||||
} |
||||
|
||||
/** |
||||
* 更新Style |
||||
* |
||||
* @param style style |
||||
*/ |
||||
public void updateStyle(Style style) { |
||||
setSelectedIndex(BaseUtils.getAlignment4Horizontal(style)); |
||||
} |
||||
|
||||
/** |
||||
* executeActionReturnUndoRecordNeeded |
||||
* |
||||
* @return |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
|
||||
return ReportActionUtils.executeAction(this, reportPane); |
||||
} |
||||
|
||||
/** |
||||
* update |
||||
*/ |
||||
public void update() { |
||||
super.update(); |
||||
|
||||
//peter:如果当前没有ReportFrame,不需要继续.
|
||||
if (!this.isEnabled()) { |
||||
return; |
||||
} |
||||
|
||||
//got simple cell element from row and column
|
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
Selection cs = reportPane.getSelection(); |
||||
TemplateElementCase tplEC = reportPane.getEditingElementCase(); |
||||
|
||||
if (tplEC != null && cs instanceof FloatSelection) { |
||||
FloatElement selectedFloat = tplEC.getFloatElement(((FloatSelection) cs).getSelectedFloatName()); |
||||
Object value = selectedFloat.getValue(); |
||||
if (value instanceof BaseChartCollection) { |
||||
this.setEnabled(false); |
||||
return; |
||||
} |
||||
} |
||||
this.updateStyle(ReportActionUtils.getCurrentStyle(reportPane)); |
||||
} |
||||
|
||||
/** |
||||
* 创建工具条,且有提示 |
||||
* |
||||
* @return |
||||
*/ |
||||
public UIButtonGroup<Integer> createToolBarComponent() { |
||||
UIButtonGroup<Integer> group = super.createToolBarComponent(); |
||||
if (group != null) { |
||||
group.setForToolBarButtonGroup(true); |
||||
group.setAllToolTips(new String[]{Inter.getLocText("StyleAlignment-Left"), Inter.getLocText("Center"), Inter.getLocText("StyleAlignment-Right")}); |
||||
} |
||||
for (int i = 0; i < 3; i++) { |
||||
group.getButton(i).setRoundBorder(true, UIConstants.ARC); |
||||
group.getButton(i).setBorderPainted(true); |
||||
} |
||||
return group; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,91 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.actions.ToggleButtonUpdateAction; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
|
||||
/** |
||||
* Bold. |
||||
*/ |
||||
public class ReportFontBoldAction extends AbstractStyleAction implements ToggleButtonUpdateAction { |
||||
private UIToggleButton button; |
||||
protected Style style; |
||||
|
||||
public ReportFontBoldAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-bold")); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
} |
||||
|
||||
/** |
||||
* 根据按钮状态获取格式 |
||||
* |
||||
* @param style |
||||
* @param defStyle |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
createToolBarComponent().setSelected(!createToolBarComponent().isSelected()); |
||||
if (createToolBarComponent().isSelected()) { |
||||
setSelectedFont(style); |
||||
createToolBarComponent().setSelected(false); |
||||
} else { |
||||
setUnselectedFont(style); |
||||
createToolBarComponent().setSelected(true); |
||||
} |
||||
|
||||
return this.style; |
||||
} |
||||
|
||||
protected void setSelectedFont(Style style) { |
||||
this.style = StyleUtils.boldReportFont(style); |
||||
} |
||||
|
||||
protected void setUnselectedFont(Style style) { |
||||
this.style = StyleUtils.unBoldReportFont(style); |
||||
} |
||||
|
||||
/** |
||||
* Update Style. |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
FRFont frFont = style.getFRFont(); |
||||
if (frFont == null) { |
||||
return; |
||||
} |
||||
createToolBarComponent().setSelected(isStyle(frFont)); |
||||
} |
||||
|
||||
protected boolean isStyle(FRFont frFont) { |
||||
return frFont.isBold(); |
||||
} |
||||
|
||||
/** |
||||
* Gets component on toolbar. |
||||
* |
||||
* @return the created components on toolbar. |
||||
*/ |
||||
@Override |
||||
public UIToggleButton createToolBarComponent() { |
||||
if (button == null) { |
||||
button = GUICoreUtils.createToolBarComponent(this); |
||||
button.setEventBannded(true); |
||||
} |
||||
return button; |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.actions.core.ActionUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.style.color.UIToolbarColorButton; |
||||
|
||||
/** |
||||
* Foreground. |
||||
*/ |
||||
public class ReportFontForegroundAction extends AbstractStyleAction implements ChangeListener { |
||||
public ReportFontForegroundAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Foreground")); |
||||
} |
||||
|
||||
public void stateChanged(ChangeEvent evt) { |
||||
this.actionPerformedUndoable(); |
||||
} |
||||
|
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object != null && object instanceof UIToolbarColorButton) { |
||||
Color selectedColor = ((UIToolbarColorButton) object).getColor(); |
||||
if (style.getFRFont() != null && |
||||
ComparatorUtils.equals(selectedColor, style.getFRFont())) { |
||||
return style; |
||||
} |
||||
|
||||
style = StyleUtils.setReportFontForeground(style, selectedColor); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object == null || !(object instanceof UIToolbarColorButton)) { |
||||
UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/foreground.png")); |
||||
this.putValue(UIToolbarColorButton.class.getName(), tbButton); |
||||
tbButton.set4Toolbar(); |
||||
tbButton.setEnabled(this.isEnabled()); |
||||
tbButton.addColorChangeListener(this); |
||||
|
||||
//peter:产生tooltip
|
||||
tbButton.setToolTipText(ActionUtils.createButtonToolTipText(this)); |
||||
return tbButton; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Bold. |
||||
*/ |
||||
public class ReportFontItalicAction extends ReportFontBoldAction { |
||||
|
||||
public ReportFontItalicAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-italic")); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
} |
||||
|
||||
|
||||
protected void setSelectedFont (Style style) { |
||||
this.style = StyleUtils.italicReportFont(style); |
||||
} |
||||
|
||||
protected void setUnselectedFont (Style style) { |
||||
this.style = StyleUtils.unItalicReportFont(style); |
||||
} |
||||
|
||||
|
||||
protected boolean isStyle(FRFont frFont) { |
||||
return frFont.isItalic(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,104 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Dimension; |
||||
|
||||
import javax.swing.ComboBoxModel; |
||||
import javax.swing.JComponent; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.Utils; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Font name.. |
||||
*/ |
||||
public class ReportFontNameAction extends AbstractStyleAction { |
||||
public ReportFontNameAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-Family")); |
||||
} |
||||
|
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
String selectedFontName = (String) ((UIComboBox) object).getSelectedItem(); |
||||
//这两个if 语句的意思是:如果传过来的cellStyle.getFRFont() 即不为空也和原来的被选择的相同。则不改变。
|
||||
// 首先判断是否为空,如果空出错。
|
||||
//然后将它们的类型均转化为delCellStyle相同。然后再将之判断是否与选择的相同否。如不同则转化为相同。
|
||||
if (ComparatorUtils.equals(style.getFRFont().getName(), defStyle.getFRFont().getName())) { |
||||
style = StyleUtils.setReportFontName(style, defStyle.getFRFont().getName()); |
||||
} |
||||
if (ComparatorUtils.equals(selectedFontName, style.getFRFont().getName())) { |
||||
return style; |
||||
} |
||||
style = StyleUtils.setReportFontName(style, selectedFontName); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
public void setFontName(String fontName) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
UIComboBox comboBox = (UIComboBox) object; |
||||
ComboBoxModel comboBoxModel = comboBox.getModel(); |
||||
for (int i = 0; i < comboBoxModel.getSize(); i++) { |
||||
Object item = comboBoxModel.getElementAt(i); |
||||
|
||||
if (ComparatorUtils.equals(item, fontName)) { |
||||
//设置新Font Name
|
||||
comboBox.removeActionListener(this); |
||||
comboBox.setSelectedIndex(i); |
||||
comboBox.addActionListener(this); |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object == null || !(object instanceof UIComboBox)) { |
||||
UIComboBox itemComponent = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
this.putValue(UIComboBox.class.getName(), itemComponent); |
||||
//设置最佳宽度.
|
||||
itemComponent.setPreferredSize(new Dimension( |
||||
Math.min(140, itemComponent.getPreferredSize().width), |
||||
itemComponent.getPreferredSize().height)); |
||||
|
||||
itemComponent.setEnabled(this.isEnabled()); |
||||
itemComponent.addActionListener(this); |
||||
|
||||
return itemComponent; |
||||
} |
||||
|
||||
return (UIComboBox) object; |
||||
} |
||||
|
||||
/** |
||||
* Update Style. |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
FRFont frFont = style.getFRFont(); |
||||
if (frFont == null) { |
||||
return; |
||||
} |
||||
|
||||
this.setFontName(frFont.getFamily()); |
||||
} |
||||
} |
@ -0,0 +1,127 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Dimension; |
||||
import java.util.Vector; |
||||
|
||||
import javax.swing.JComponent; |
||||
|
||||
import com.fr.base.Style; |
||||
import com.fr.base.Utils; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
|
||||
/** |
||||
* Font size. |
||||
*/ |
||||
public class ReportFontSizeAction extends AbstractStyleAction { |
||||
|
||||
private static final int MAX_FONT_SIZE = 100; |
||||
|
||||
public ReportFontSizeAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-Size")); |
||||
} |
||||
|
||||
/** |
||||
* 应用选中的样式 |
||||
* |
||||
* @param style 之前的样式 |
||||
* @param defStyle 选中的样式 |
||||
* |
||||
* @return 更改后的样式 |
||||
* |
||||
* @date 2015-1-22-下午4:54:00 |
||||
* |
||||
*/ |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
Object value = ((UIComboBox) object).getSelectedItem(); |
||||
float selectedFontSize; |
||||
selectedFontSize = Utils.round5(Float.parseFloat(value.toString())); |
||||
|
||||
if (style.getFRFont().getSize() == defStyle.getFRFont().getSize()) { |
||||
style = StyleUtils.setReportFontSize(style, defStyle.getFRFont().getSize()); |
||||
} |
||||
if (selectedFontSize == style.getFRFont().getSize()) { |
||||
return style; |
||||
} |
||||
style = StyleUtils.setReportFontSize(style, selectedFontSize); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
public void setFontSize(float size) { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object != null && object instanceof UIComboBox) { |
||||
UIComboBox comboBox = (UIComboBox) object; |
||||
//先和以前的Font Size比较.
|
||||
if (ComparatorUtils.equals(comboBox.getSelectedItem(), size)) { |
||||
return; |
||||
} |
||||
|
||||
//设置新Font Size
|
||||
comboBox.removeActionListener(this); |
||||
comboBox.setSelectedItem(size + ""); |
||||
comboBox.addActionListener(this); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 创建工具栏组件 |
||||
* |
||||
* @return 组件 |
||||
* |
||||
* @date 2015-1-22-下午4:53:29 |
||||
* |
||||
*/ |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIComboBox.class.getName()); |
||||
if (object == null || !(object instanceof UIComboBox)) { |
||||
Vector<Integer> integerList = new Vector<Integer>(); |
||||
for (int i = 1; i < MAX_FONT_SIZE; i++) { |
||||
integerList.add(i); |
||||
} |
||||
|
||||
UIComboBox itemComponent = new UIComboBox(integerList); |
||||
this.putValue(UIComboBox.class.getName(), itemComponent); |
||||
itemComponent.setMinimumSize(new Dimension(50, 20)); |
||||
itemComponent.setPreferredSize(new Dimension(50, 20)); |
||||
itemComponent.setEnabled(this.isEnabled()); |
||||
itemComponent.addActionListener(this); |
||||
//需求字体大小可编辑
|
||||
itemComponent.setEditable(true); |
||||
|
||||
return itemComponent; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
|
||||
/** |
||||
* 更新样式 |
||||
* |
||||
* @param style 样式 |
||||
* |
||||
*/ |
||||
@Override |
||||
public void updateStyle(Style style) { |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
FRFont frFont = style.getFRFont(); |
||||
if (frFont == null) { |
||||
return; |
||||
} |
||||
setFontSize(Utils.round5(frFont.getSize2D())); |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.core.StyleUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.stable.Constants; |
||||
|
||||
/** |
||||
* Bold. |
||||
*/ |
||||
public class ReportFontUnderlineAction extends ReportFontBoldAction { |
||||
public ReportFontUnderlineAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("FRFont-Underline")); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); |
||||
} |
||||
|
||||
protected void setSelectedFont (Style style) { |
||||
this.style = StyleUtils.setReportFontUnderline(style, true); |
||||
} |
||||
|
||||
protected void setUnselectedFont (Style style) { |
||||
this.style = StyleUtils.setReportFontUnderline(style, false); |
||||
} |
||||
|
||||
|
||||
protected boolean isStyle(FRFont frFont) { |
||||
return frFont.getUnderline() != Constants.LINE_NONE; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import com.fr.base.Style; |
||||
|
||||
/** |
||||
* peter:这个方法只是在编辑Style的时候使用. |
||||
*/ |
||||
public interface StyleActionInterface { |
||||
public Style executeStyle(Style style2Mod, Style selectedStyle); |
||||
|
||||
/** |
||||
* Update Style. |
||||
* |
||||
* @param style style |
||||
*/ |
||||
public void updateStyle(Style style); |
||||
} |
@ -0,0 +1,77 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.cell.style; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.base.background.ColorBackground; |
||||
import com.fr.design.actions.core.ActionUtils; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.style.color.UIToolbarColorButton; |
||||
|
||||
/** |
||||
* Background. |
||||
*/ |
||||
public class StyleBackgroundAction extends AbstractStyleAction implements ChangeListener { |
||||
public StyleBackgroundAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Background")); |
||||
} |
||||
|
||||
public void stateChanged(ChangeEvent evt) { |
||||
this.actionPerformedUndoable(); |
||||
} |
||||
|
||||
@Override |
||||
public Style executeStyle(Style style, Style defStyle) { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object != null && object instanceof UIToolbarColorButton) { |
||||
Color selectedColor = ((UIToolbarColorButton) object).getColor(); |
||||
if (style.getBackground() != null && |
||||
style.getBackground() instanceof ColorBackground && |
||||
ComparatorUtils.equals(selectedColor, |
||||
((ColorBackground) style.getBackground()).getColor())) { |
||||
return style; |
||||
} |
||||
|
||||
style = style.deriveBackground(ColorBackground.getInstance(selectedColor)); |
||||
} |
||||
|
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
public boolean isFontStye() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public JComponent createToolBarComponent() { |
||||
Object object = this.getValue(UIToolbarColorButton.class.getName()); |
||||
if (object == null || !(object instanceof UIToolbarColorButton)) { |
||||
UIToolbarColorButton tbButton = new UIToolbarColorButton(BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png")); |
||||
tbButton.set4Toolbar(); |
||||
this.putValue(UIToolbarColorButton.class.getName(), tbButton); |
||||
|
||||
tbButton.setEnabled(this.isEnabled()); |
||||
tbButton.setColor(Color.WHITE); |
||||
tbButton.addColorChangeListener(this); |
||||
|
||||
//peter:产生tooltip
|
||||
tbButton.setToolTipText(ActionUtils.createButtonToolTipText(this)); |
||||
return tbButton; |
||||
} |
||||
|
||||
return (JComponent) object; |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public abstract class AbstractColumnRowIndexAction extends CellSelectionAction { |
||||
private int index = 0; |
||||
|
||||
protected AbstractColumnRowIndexAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t); |
||||
this.index = indexOfColumnOrRow; |
||||
} |
||||
|
||||
/** |
||||
* Return index. |
||||
*/ |
||||
public int getIndex() { |
||||
return this.index; |
||||
} |
||||
} |
@ -0,0 +1,38 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.page.ReportPageAttrProvider; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
public class CancelColumnAction extends CellSelectionAction{ |
||||
public CancelColumnAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Cancel_Repeat_Attributes")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
if (report.getReportPageAttr() == null) { |
||||
return false; |
||||
} |
||||
int[] columns = cs.getSelectedColumns(); |
||||
ReportPageAttrProvider pageAttr = report.getReportPageAttr(); |
||||
int i = columns[0]; |
||||
if (i == pageAttr.getRepeatHeaderColumnFrom() || i == pageAttr.getRepeatHeaderColumnTo()) { |
||||
pageAttr.setRepeatHeaderColumnFrom(-1); |
||||
pageAttr.setRepeatHeaderColumnTo(-1); |
||||
} |
||||
if (i == pageAttr.getRepeatFooterColumnFrom() || i == pageAttr.getRepeatFooterColumnTo()) { |
||||
pageAttr.setRepeatFooterColumnFrom(-1); |
||||
pageAttr.setRepeatFooterColumnTo(-1); |
||||
} |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.page.ReportPageAttrProvider; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
public class CancelRowAction extends CellSelectionAction { |
||||
|
||||
public CancelRowAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Cancel_Repeat_Attributes")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] rows = cs.getSelectedRows(); |
||||
if (report.getReportPageAttr() == null) { |
||||
return false; |
||||
} |
||||
ReportPageAttrProvider pageAttr = report.getReportPageAttr(); |
||||
int i = rows[0]; |
||||
if (i == pageAttr.getRepeatHeaderRowFrom() || i == pageAttr.getRepeatHeaderRowTo()) { |
||||
pageAttr.setRepeatHeaderRowFrom(-1); |
||||
pageAttr.setRepeatHeaderRowTo(-1); |
||||
} |
||||
if (i == pageAttr.getRepeatFooterRowFrom() || i == pageAttr.getRepeatFooterRowTo()) { |
||||
pageAttr.setRepeatFooterRowFrom(-1); |
||||
pageAttr.setRepeatFooterRowTo(-1); |
||||
} |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
public class ColumnHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public ColumnHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText("Hide")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
int[] cols = cs.getSelectedColumns(); |
||||
for (int i = 0; i < cols.length; i++) { |
||||
report.setColumnWidth(cols[i], UNIT.ZERO); |
||||
} |
||||
ePane.fireTargetModified(); |
||||
ePane.repaint(); |
||||
return false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.page.ReportPageAttrProvider; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.bridge.StableFactory; |
||||
|
||||
public abstract class ColumnRowRepeatAction extends CellSelectionAction { |
||||
|
||||
public ColumnRowRepeatAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] indices; |
||||
if (isColumn()) { |
||||
indices = cs.getSelectedColumns(); |
||||
} else { |
||||
indices = cs.getSelectedRows(); |
||||
} |
||||
|
||||
doReportPageAttrSet(isColumn(), isFoot(), report, indices[0], indices[indices.length - 1]); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
protected abstract boolean isColumn(); |
||||
protected abstract boolean isFoot(); |
||||
|
||||
private void doReportPageAttrSet(boolean isColumn, boolean isFoot, ElementCase elementCase, int from, int to) { |
||||
ReportPageAttrProvider reportPageAttr = elementCase.getReportPageAttr(); |
||||
if (reportPageAttr == null) { |
||||
reportPageAttr = (ReportPageAttrProvider) StableFactory.createXmlObject(ReportPageAttrProvider.XML_TAG); |
||||
elementCase.setReportPageAttr(reportPageAttr); |
||||
} |
||||
|
||||
reportPageAttr.setRepeatFromTo(isFoot, isColumn, from, to); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,120 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.design.gui.frpane.UnitInputPane; |
||||
import com.fr.design.gui.frpane.UnitInputPane.ValueNotChangeException; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.ArrayUtils; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.unit.CM; |
||||
import com.fr.stable.unit.INCH; |
||||
import com.fr.stable.unit.MM; |
||||
import com.fr.stable.unit.PT; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* @author richer |
||||
* @since 6.5.3 |
||||
*/ |
||||
public abstract class ColumnRowSizingAction extends AbstractColumnRowIndexAction { |
||||
protected ColumnRowSizingAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
final ElementCasePane ePane = this.getEditingComponent(); |
||||
final ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
final UnitInputPane uPane = new UnitInputPane(3,title4UnitInputPane()) { |
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return ColumnRowSizingAction.this.title4UnitInputPane(); |
||||
} |
||||
}; |
||||
UNIT len = getShowLen(report, cs); |
||||
populateNumberDialog(uPane, len); |
||||
|
||||
final CellSelection finalCS = cs; |
||||
uPane.showSmallWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
try { |
||||
float newHeight = (float) uPane.update(); |
||||
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); |
||||
UNIT len; |
||||
if (unitType == Constants.UNIT_CM) { |
||||
len = new CM(newHeight); |
||||
} else if (unitType == Constants.UNIT_INCH) { |
||||
len = new INCH(newHeight); |
||||
} else if (unitType == Constants.UNIT_PT) { |
||||
len = new PT(newHeight); |
||||
} else { |
||||
len = new MM(newHeight); |
||||
} |
||||
updateAction(report, len, finalCS); |
||||
} catch (ValueNotChangeException e) { |
||||
// nothing
|
||||
} |
||||
|
||||
ePane.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
protected void populateNumberDialog(final UnitInputPane uPane, UNIT unit) { |
||||
int unitType = DesignerEnvManager.getEnvManager().getReportLengthUnit(); |
||||
float va; |
||||
if (unitType == Constants.UNIT_CM) { |
||||
va = unit.toCMValue4Scale2(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_CM")); |
||||
} else if (unitType == Constants.UNIT_INCH) { |
||||
va = unit.toINCHValue4Scale3(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_INCH")); |
||||
} else if (unitType == Constants.UNIT_PT) { |
||||
va = unit.toPTValue4Scale2(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_PT")); |
||||
} else { |
||||
va = unit.toMMValue4Scale2(); |
||||
uPane.setUnitText(Inter.getLocText("Unit_MM")); |
||||
} |
||||
|
||||
uPane.populate(va); |
||||
} |
||||
|
||||
protected abstract String title4UnitInputPane(); |
||||
|
||||
protected abstract void updateAction(ElementCase report, UNIT len, CellSelection cs); |
||||
|
||||
protected abstract UNIT getShowLen(ElementCase report, CellSelection cs); |
||||
|
||||
protected abstract UNIT getIndexLen(int index, ElementCase report); |
||||
|
||||
protected UNIT getSelectedCellsLen(int[] cells, ElementCase report){ |
||||
int length = ArrayUtils.getLength(cells); |
||||
UNIT temp = null; |
||||
for (int i = 0; i < length; i++) { |
||||
UNIT current = getIndexLen(cells[i], report); |
||||
if (temp == null) { |
||||
temp = current; |
||||
continue; |
||||
} |
||||
if (temp.subtract(current).not_equal_zero()){ |
||||
return UNIT.ZERO; |
||||
} |
||||
} |
||||
|
||||
return getIndexLen(this.getIndex(), report); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* Column width. |
||||
*/ |
||||
public class ColumnWidthAction extends ColumnRowSizingAction { |
||||
|
||||
public ColumnWidthAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
|
||||
this.setName(Inter.getLocText("Utils-Column_Width") + "..."); |
||||
this.setMnemonic('C'); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4UnitInputPane() { |
||||
return Inter.getLocText("Utils-Column_Width"); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateAction(ElementCase report, UNIT len, CellSelection cs) { |
||||
int[] columns = cs.getSelectedColumns(); |
||||
for (int i = 0; i < columns.length; i++) { |
||||
report.setColumnWidth(columns[i], len); |
||||
} |
||||
} |
||||
|
||||
protected UNIT getIndexLen(int index, ElementCase report){ |
||||
return report.getColumnWidth(index); |
||||
} |
||||
|
||||
@Override |
||||
protected UNIT getShowLen(ElementCase report, CellSelection cs) { |
||||
int[] columns = cs.getSelectedColumns(); |
||||
return getSelectedCellsLen(columns, report); |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.cell.AbstractCellElementAction; |
||||
import com.fr.design.dscolumn.DSColumnAdvancedPane; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
public class DSColumnAdvancedAction extends AbstractCellElementAction { |
||||
private boolean returnValue=false; |
||||
private TemplateCellElement editCellElement; |
||||
public DSColumnAdvancedAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Advanced")); |
||||
this.setMnemonic('A'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
this.editCellElement = cellElement; |
||||
DSColumnAdvancedPane dSColumnAdvancedPane = new DSColumnAdvancedPane(); |
||||
dSColumnAdvancedPane.populate(cellElement); |
||||
return dSColumnAdvancedPane; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane basicPane, |
||||
TemplateCellElement cellElement) { |
||||
((DSColumnAdvancedPane)basicPane).update(editCellElement); |
||||
} |
||||
} |
@ -0,0 +1,88 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.dscolumn.DSColumnBasicPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.core.SheetUtils; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
public class DSColumnBasicAction extends CellSelectionAction { |
||||
|
||||
public DSColumnBasicAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Basic")); |
||||
// this.setMnemonic('B');
|
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
final ElementCasePane reportPane = this.getEditingComponent(); |
||||
final DSColumnBasicPane dsColumnBasicPane = new DSColumnBasicPane(); |
||||
|
||||
BasicDialog dSColumnBasicDialog = dsColumnBasicPane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
|
||||
// Got editCellElement.
|
||||
TemplateCellElement editCellElement = null; |
||||
|
||||
// got simple cell element from column and row.
|
||||
final TemplateElementCase report = reportPane.getEditingElementCase(); |
||||
editCellElement = report.getTemplateCellElement(cs.getColumn(), cs.getRow()); |
||||
|
||||
dsColumnBasicPane.putElementcase(getEditingComponent()); |
||||
dsColumnBasicPane.putCellElement(editCellElement); |
||||
|
||||
// alex:如果是线性报表,这时还要计算一下默认父格是什么z
|
||||
if (report != null) { |
||||
SheetUtils.calculateDefaultParent(report); |
||||
} |
||||
dsColumnBasicPane.populate(null, editCellElement); |
||||
final CellSelection finalCS = cs; |
||||
dSColumnBasicDialog.addDialogActionListener(new CellElementDialogActionListenr(editCellElement) { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
// 需要先行后列地增加新元素。
|
||||
for (int j = 0; j < finalCS.getRowSpan(); j++) { |
||||
for (int i = 0; i < finalCS.getColumnSpan(); i++) { |
||||
int column = i + finalCS.getColumn(); |
||||
int row = j + finalCS.getRow(); |
||||
|
||||
editCellElement = report.getTemplateCellElement(column, row); |
||||
if (editCellElement == null) { |
||||
editCellElement = new DefaultTemplateCellElement(column, row); |
||||
report.addCellElement(editCellElement); |
||||
} |
||||
// update cell attributes
|
||||
dsColumnBasicPane.update(editCellElement); |
||||
} |
||||
} |
||||
|
||||
reportPane.fireTargetModified(); |
||||
} |
||||
}); |
||||
|
||||
dSColumnBasicDialog.setVisible(true); |
||||
return false; |
||||
} |
||||
|
||||
public static class CellElementDialogActionListenr extends DialogActionAdapter { |
||||
|
||||
TemplateCellElement editCellElement; |
||||
|
||||
public CellElementDialogActionListenr(TemplateCellElement editCellElement) { |
||||
this.editCellElement = editCellElement; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.data.DesignTableDataManager; |
||||
import com.fr.design.actions.cell.AbstractCellElementAction; |
||||
import com.fr.design.dscolumn.DSColumnConditionsPane; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
|
||||
public class DSColumnConditionAction extends AbstractCellElementAction { |
||||
|
||||
private boolean returnValue = false; |
||||
private TemplateCellElement editCellElement; |
||||
|
||||
public DSColumnConditionAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Filter")); |
||||
this.setMnemonic('E'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/expand/cellAttr.gif")); |
||||
} |
||||
|
||||
@Override |
||||
protected BasicPane populateBasicPane(TemplateCellElement cellElement) { |
||||
DSColumnConditionsPane dSColumnConditionsPane = new DSColumnConditionsPane(); |
||||
dSColumnConditionsPane.populate(DesignTableDataManager.getEditingTableDataSource(), cellElement); |
||||
return dSColumnConditionsPane; |
||||
} |
||||
|
||||
@Override |
||||
protected void updateBasicPane(BasicPane bp, TemplateCellElement cellElement) { |
||||
((DSColumnConditionsPane) bp).update(cellElement); |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Delete Column |
||||
*/ |
||||
public class DeleteColumnAction extends CellSelectionAction { |
||||
|
||||
public DeleteColumnAction(ElementCasePane t) { |
||||
this(t, DELETE_COLUMN.getMenuName()); |
||||
} |
||||
|
||||
public DeleteColumnAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
this.setName(name); |
||||
this.setMnemonic(DELETE_COLUMN.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/deleteColumn.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
// 删掉多行
|
||||
int[] columns = cs.getSelectedColumns(); |
||||
for (int i = 0; i < columns.length; i++) { |
||||
report.removeColumn(columns[i] - i); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static final MenuKeySet DELETE_COLUMN= new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'D'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Column"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,63 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Delete Row |
||||
*/ |
||||
public class DeleteRowAction extends CellSelectionAction { |
||||
|
||||
public DeleteRowAction(ElementCasePane t) { |
||||
this(t, DELETE_ROW.getMenuName()); |
||||
} |
||||
|
||||
public DeleteRowAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
|
||||
this.setName(name); |
||||
this.setMnemonic(DELETE_ROW.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/deleteRow.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
// 删掉多行
|
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.removeRow(rows[i] - i); |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static final MenuKeySet DELETE_ROW = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'D'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Row"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class FootColumnAction extends ColumnRowRepeatAction { |
||||
|
||||
public FootColumnAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Column_Title_End")); |
||||
// this.setMnemonic('F');
|
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class FootRowAction extends ColumnRowRepeatAction { |
||||
public FootRowAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Row_Title_End")); |
||||
// this.setMnemonic('F');
|
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class HeadColumnAction extends ColumnRowRepeatAction { |
||||
|
||||
public HeadColumnAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Column_Title_Start")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
public class HeadRowAction extends ColumnRowRepeatAction { |
||||
|
||||
public HeadRowAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Set_Row_Title_Start")); |
||||
// this.setMnemonic('H');
|
||||
} |
||||
|
||||
@Override |
||||
protected boolean isColumn() { |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
protected boolean isFoot() { |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Insert Column |
||||
*/ |
||||
public class InsertColumnAction extends CellSelectionAction { |
||||
|
||||
public InsertColumnAction(ElementCasePane t) { |
||||
this(t, INSERT_COLUMN.getMenuName()); |
||||
} |
||||
|
||||
public InsertColumnAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
|
||||
this.setName(name); |
||||
this.setMnemonic(INSERT_COLUMN.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/insertColumn.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_COLUMN = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'I'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Column"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] columns = cs.getSelectedColumns(); |
||||
for (int i = 0; i < columns.length; i++) { |
||||
report.insertColumn(columns[i]); |
||||
} |
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,62 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* Insert Row |
||||
*/ |
||||
public class InsertRowAction extends CellSelectionAction { |
||||
|
||||
public InsertRowAction(ElementCasePane t) { |
||||
this(t,INSERT_ROW.getMenuName()); |
||||
} |
||||
|
||||
public InsertRowAction(ElementCasePane t, String name) { |
||||
super(t); |
||||
this.setName(name); |
||||
this.setMnemonic(INSERT_ROW.getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/insertRow.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_ROW = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'I'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("Row"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
|
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.insertRow(rows[i]); |
||||
} |
||||
|
||||
return true; |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNITConstants; |
||||
|
||||
public class ResetColumnHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public ResetColumnHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText(new String[]{"MConfig-CancelButton", "Hide"})); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] columns = cs.getSelectedColumns(); |
||||
boolean ischanged = false; |
||||
for (int column : columns) { |
||||
if (report.getColumnWidth(column).equal_zero()) { |
||||
report.setColumnWidth(column, UNITConstants.DEFAULT_COL_WIDTH); |
||||
ischanged = true; |
||||
} |
||||
} |
||||
if (ischanged) { |
||||
ePane.repaint(); |
||||
ePane.fireTargetModified(); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
Selection s = ePane.getSelection(); |
||||
if (s instanceof CellSelection) { |
||||
CellSelection cs = (CellSelection)s; |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
if (report.getColumnWidth(i).equal_zero()) { |
||||
this.setEnabled(true); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
this.setEnabled(false); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNITConstants; |
||||
|
||||
public class ResetRowHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public ResetRowHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText(new String[]{"MConfig-CancelButton", "Hide"})); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
int[] rows = cs.getSelectedRows(); |
||||
boolean ischanged = false; |
||||
for (int row : rows) { |
||||
if (report.getRowHeight(row).equal_zero()) { |
||||
report.setRowHeight(row, UNITConstants.DEFAULT_ROW_HEIGHT); |
||||
ischanged = true; |
||||
} |
||||
} |
||||
if (ischanged) { |
||||
ePane.repaint(); |
||||
ePane.fireTargetModified(); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
Selection s = ePane.getSelection(); |
||||
if (s instanceof CellSelection) { |
||||
CellSelection cs = (CellSelection)s; |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
if (report.getRowHeight(i).equal_zero()) { |
||||
this.setEnabled(true); |
||||
return; |
||||
} |
||||
} |
||||
} |
||||
this.setEnabled(false); |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* Row height |
||||
*/ |
||||
public class RowHeightAction extends ColumnRowSizingAction { |
||||
|
||||
public RowHeightAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
|
||||
this.setName(Inter.getLocText("Utils-Row_Height") + "..."); |
||||
this.setMnemonic('R'); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4UnitInputPane() { |
||||
return Inter.getLocText("Utils-Row_Height"); |
||||
} |
||||
|
||||
@Override |
||||
protected void updateAction(ElementCase report, UNIT len, CellSelection cs) { |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.setRowHeight(rows[i], len); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected UNIT getShowLen(ElementCase report, CellSelection cs) { |
||||
int[] rows = cs.getSelectedRows(); |
||||
return getSelectedCellsLen(rows, report); |
||||
} |
||||
|
||||
protected UNIT getIndexLen(int index, ElementCase report){ |
||||
return report.getRowHeight(index); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,29 @@
|
||||
package com.fr.design.actions.columnrow; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
public class RowHideAction extends AbstractColumnRowIndexAction { |
||||
|
||||
public RowHideAction(ElementCasePane t, int indexOfColumnOrRow) { |
||||
super(t, indexOfColumnOrRow); |
||||
this.setName(Inter.getLocText("Hide")); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
int[] rows = cs.getSelectedRows(); |
||||
for (int i = 0; i < rows.length; i++) { |
||||
report.setRowHeight(rows[i], UNIT.ZERO); |
||||
} |
||||
ePane.fireTargetModified(); |
||||
ePane.repaint(); |
||||
return false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Delete Row, Column or FloatElement.. |
||||
*/ |
||||
public class DeleteAction extends ElementCaseAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public DeleteAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Delete") + "..."); |
||||
this.setMnemonic('D'); |
||||
//Richie:删除菜单图标
|
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/delete.png")); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane ePane = getEditingComponent(); |
||||
|
||||
return ePane.getSelection().triggerDeleteAction(ePane); |
||||
} |
||||
} |
@ -0,0 +1,70 @@
|
||||
package com.fr.design.actions.edit; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.design.actions.FloatSelectionAction; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
public class EditFloatElementNameAction extends FloatSelectionAction { |
||||
|
||||
public EditFloatElementNameAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText(new String[]{"Set", "Float_Element_Name"})); |
||||
} |
||||
|
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithFloatSelection( |
||||
FloatSelection fs) { |
||||
final ElementCasePane reportPane = getEditingComponent(); |
||||
final ElementCase report = reportPane.getEditingElementCase(); |
||||
|
||||
//p:获得最后一个选中的悬浮元素.
|
||||
final FloatElement selectedFloatElement = report.getFloatElement(fs.getSelectedFloatName()); |
||||
|
||||
final NamePane pane = new NamePane(); |
||||
pane.populate(selectedFloatElement.getName()); |
||||
BasicDialog nameDialog = pane.showSmallWindow(SwingUtilities.getWindowAncestor(reportPane),new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
String name = pane.update(); |
||||
if (report.getFloatElement(name) == null) { |
||||
selectedFloatElement.setName(name); |
||||
} |
||||
reportPane.setSelection(new FloatSelection(name)); |
||||
} |
||||
}); |
||||
nameDialog.setVisible(true); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
class NamePane extends BasicPane{ |
||||
private UITextField jtext; |
||||
public NamePane() { |
||||
jtext = new UITextField(15); |
||||
this.add(jtext); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText(new String[]{"Set", "Float_Element_Name"}); |
||||
} |
||||
|
||||
public void populate(String name) { |
||||
jtext.setText(name); |
||||
} |
||||
|
||||
public String update() { |
||||
return jtext.getText(); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,113 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.actions.utils.ReportActionUtils; |
||||
import com.fr.design.actions.utils.ReportActionUtils.IterAction; |
||||
import com.fr.design.gui.frpane.HyperlinkGroupPane; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.grid.selection.Selection; |
||||
import com.fr.js.NameJavaScriptGroup; |
||||
import com.fr.report.cell.CellElement; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
import com.fr.stable.Constants; |
||||
|
||||
/** |
||||
* HyperlinkAction. |
||||
*/ |
||||
public class HyperlinkAction extends ElementCaseAction { |
||||
private boolean b; |
||||
|
||||
public HyperlinkAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.HYPER_LINK); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png")); |
||||
} |
||||
|
||||
/** |
||||
* 计算Action, |
||||
* @return 返回是否需要记录undo |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
b = true; |
||||
ElementCasePane reportPane = this.getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
|
||||
final TemplateElementCase report = reportPane.getEditingElementCase(); |
||||
NameJavaScriptGroup nameHyperlinks = getNameJSGroup(reportPane, report); |
||||
final HyperlinkGroupPane pane = DesignerContext.getDesignerFrame().getSelectedJTemplate().getHyperLinkPane(); |
||||
pane.populate(nameHyperlinks); |
||||
|
||||
final Selection sel = reportPane.getSelection(); |
||||
BasicDialog dialog = pane.showWindow(SwingUtilities.getWindowAncestor(reportPane)); |
||||
dialog.addDialogActionListener(new DialogActionAdapter() { |
||||
public void doOk() { |
||||
super.doOk(); |
||||
final NameJavaScriptGroup updateNameHyperlinks = pane.updateJSGroup(); |
||||
if (sel instanceof FloatSelection) { |
||||
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); |
||||
selectedFloatElement.setNameHyperlinkGroup(updateNameHyperlinks); |
||||
} else { |
||||
ReportActionUtils.actionIterateWithCellSelection((CellSelection)sel, report, new IterAction() { |
||||
public void dealWith(CellElement editCellElement) { |
||||
Style elementStyle = editCellElement.getStyle(); |
||||
FRFont frFont = elementStyle.getFRFont(); |
||||
if (updateNameHyperlinks.size() > 0) { |
||||
frFont = frFont.applyForeground(Color.blue); |
||||
frFont = frFont.applyUnderline(Constants.LINE_THIN); |
||||
} else { |
||||
frFont = frFont.applyForeground(Color.black); |
||||
frFont = frFont.applyUnderline(Constants.LINE_NONE); |
||||
} |
||||
editCellElement.setStyle(elementStyle.deriveFRFont(frFont)); |
||||
editCellElement.setNameHyperlinkGroup(updateNameHyperlinks); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
public void doCancel() { |
||||
b = false; |
||||
} |
||||
}); |
||||
dialog.setVisible(true); |
||||
|
||||
return b; |
||||
} |
||||
|
||||
private NameJavaScriptGroup getNameJSGroup(ElementCasePane reportPane, final TemplateElementCase report) { |
||||
NameJavaScriptGroup nameHyperlinks = null; |
||||
final Selection sel = reportPane.getSelection(); |
||||
if (sel instanceof FloatSelection) { |
||||
FloatElement selectedFloatElement = report.getFloatElement(((FloatSelection)sel).getSelectedFloatName()); |
||||
nameHyperlinks = selectedFloatElement.getNameHyperlinkGroup(); |
||||
} else { |
||||
CellElement editCellElement = report.getCellElement(((CellSelection)sel).getColumn(), ((CellSelection)sel).getRow()); |
||||
if (editCellElement != null) { |
||||
nameHyperlinks = editCellElement.getNameHyperlinkGroup(); |
||||
} |
||||
} |
||||
|
||||
return nameHyperlinks; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* @author richer |
||||
* @since 6.5.3 |
||||
*/ |
||||
public abstract class ClearAction extends ElementCaseAction { |
||||
protected ClearAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Clear all. |
||||
*/ |
||||
public class ClearAllAction extends ClearAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearAllAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Clear_All")); |
||||
this.setMnemonic('A'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearAll(); |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Clear contents. |
||||
*/ |
||||
public class ClearContentsAction extends ClearAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearContentsAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Clear_Contents")); |
||||
this.setMnemonic('C'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearContents(); |
||||
} |
||||
} |
@ -0,0 +1,31 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* Clear formats. |
||||
*/ |
||||
public class ClearFormatsAction extends ClearAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearFormatsAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Clear_Formats")); |
||||
this.setMnemonic('F'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearFormats(); |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.design.actions.edit.clear; |
||||
|
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
//:jackie 用于清除控件
|
||||
public class ClearWidgetAction extends ClearAction { |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ClearWidgetAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("Widget")); |
||||
this.setMnemonic('W'); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.clearWidget(); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.merge; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* merge cell.. |
||||
*/ |
||||
public class MergeCellAction extends ElementCaseAction { |
||||
|
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public MergeCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.MERGE_CELL); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/merge.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是则返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.mergeCell(); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
this.setEnabled(reportPane.canMergeCell()); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.merge; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.ElementCaseAction; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
|
||||
/** |
||||
* unmerge cell.. |
||||
*/ |
||||
public class UnmergeCellAction extends ElementCaseAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public UnmergeCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.UNMERGE_CELL); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/unmerge.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
this.setEnabled(reportPane.canUnMergeCell()); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是则返回true |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
ElementCasePane reportPane = getEditingComponent(); |
||||
if (reportPane == null) { |
||||
return false; |
||||
} |
||||
return reportPane.unMergeCell(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.design.actions.FloatSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.FloatSelection; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
/** |
||||
* FloatElement order. |
||||
*/ |
||||
public abstract class AbstractFloatElementOrderAction extends FloatSelectionAction { |
||||
protected AbstractFloatElementOrderAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeededWithFloatSelection(FloatSelection fs) { |
||||
ElementCasePane ePane = getEditingComponent(); |
||||
|
||||
ElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
//p:获得最后一个选中的悬浮元素.
|
||||
FloatElement selectedFloatElement = report.getFloatElement(fs.getSelectedFloatName()); |
||||
orderWithSelectedFloatElement(report, selectedFloatElement); |
||||
|
||||
return true; |
||||
} |
||||
|
||||
public abstract void orderWithSelectedFloatElement(ElementCase report, FloatElement floatElement); |
||||
} |
@ -0,0 +1,32 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
/** |
||||
* Bring FloatElement forward. |
||||
*/ |
||||
public class BringFloatElementForwardAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor. |
||||
*/ |
||||
public BringFloatElementForwardAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Bring_Forward")); |
||||
this.setMnemonic('F'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/bringForward.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.bringFloatElementForward(floatElement); |
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
/** |
||||
* Bring FloatElement to front. |
||||
*/ |
||||
public class BringFloatElementToFrontAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor. |
||||
*/ |
||||
public BringFloatElementToFrontAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Bring_to_Front")); |
||||
this.setMnemonic('t'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/bringToFront.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.bringFloatElementToFront(floatElement); |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
/** |
||||
* Send FloatElement backward. |
||||
*/ |
||||
public class SendFloatElementBackwardAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public SendFloatElementBackwardAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Send_Backward")); |
||||
this.setMnemonic('B'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/sendBackward.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.sendFloatElementBackward(floatElement); |
||||
|
||||
} |
||||
} |
@ -0,0 +1,32 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.edit.order; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.FloatElement; |
||||
import com.fr.report.elementcase.ElementCase; |
||||
|
||||
/** |
||||
* Send FloatElement to back. |
||||
*/ |
||||
public class SendFloatElementToBackAction extends AbstractFloatElementOrderAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public SendFloatElementToBackAction(ElementCasePane t) { |
||||
super(t); |
||||
|
||||
this.setName(Inter.getLocText("M_Edit-Send_to_Back")); |
||||
this.setMnemonic('K'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_edit/sendToBack.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void orderWithSelectedFloatElement(ElementCase report, |
||||
FloatElement floatElement) { |
||||
report.sendFloatElementToBack(floatElement); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.ExcelUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
|
||||
/** |
||||
* Export excel. |
||||
*/ |
||||
public abstract class AbstractExcelExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
protected AbstractExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new ChooseFileFilter(new String[]{"zip"}, "ZIP"); |
||||
} else { |
||||
return new ChooseFileFilter(new String[]{"xls", "xlsx"}, Inter.getLocText("Export-Excel")); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return "zip"; |
||||
} else { |
||||
return ExcelUtils.checkPOIJarExist() ? "xlsx" : "xls"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,184 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.FRContext; |
||||
import com.fr.base.Parameter; |
||||
import com.fr.page.PageSetProvider; |
||||
import com.fr.design.actions.JWorkBookAction; |
||||
import com.fr.design.gui.iprogressbar.FRProgressBar; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.DesignerFrame; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.parameter.ParameterInputPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.file.FILE; |
||||
import com.fr.file.FILEChooserPane; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.FRLogger; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.*; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.main.impl.WorkBook; |
||||
import com.fr.report.ReportHelper; |
||||
import com.fr.report.core.ReportUtils; |
||||
import com.fr.report.report.Report; |
||||
import com.fr.report.worksheet.WorkSheet; |
||||
import com.fr.stable.ActorConstants; |
||||
import com.fr.stable.ActorFactory; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.io.FileOutputStream; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* Abstract export action. |
||||
*/ |
||||
public abstract class AbstractExportAction extends JWorkBookAction { |
||||
protected AbstractExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
} |
||||
|
||||
private FRProgressBar progressbar; |
||||
|
||||
protected WorkBook getTemplateWorkBook() { |
||||
return this.getEditingComponent().getTarget(); |
||||
} |
||||
|
||||
/** |
||||
* 执行方法 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
JWorkBook jwb = this.getEditingComponent(); |
||||
FILE editingFILE = jwb.getEditingFILE(); |
||||
DesignerFrame designerFrame = DesignerContext.getDesignerFrame(); |
||||
|
||||
// 弹出参数
|
||||
final java.util.Map parameterMap = new java.util.HashMap(); |
||||
final TemplateWorkBook tpl = getTemplateWorkBook(); |
||||
Parameter[] parameters = tpl.getParameters(); |
||||
if (parameters != null && parameters.length > 0) {// 检查Parameter.
|
||||
final ParameterInputPane pPane = new ParameterInputPane( |
||||
parameters); |
||||
pPane.showSmallWindow(designerFrame, new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
parameterMap.putAll(pPane.update()); |
||||
} |
||||
}).setVisible(true); |
||||
} |
||||
|
||||
// Choose a file name....
|
||||
FILEChooserPane fileChooserPane = FILEChooserPane.getInstance(false, true); |
||||
fileChooserPane.setFILEFilter(this.getChooseFileFilter()); |
||||
|
||||
// 打开文件后输出文件名修改,eg:w.cpt.doc / w.svg.doc,去掉中间的后缀名~~ w.doc
|
||||
String filenName = editingFILE.getName(); |
||||
if (filenName.indexOf('.') != -1) { |
||||
filenName = filenName.substring(0, editingFILE.getName().lastIndexOf('.')); |
||||
} |
||||
fileChooserPane.setFileNameTextField(filenName, "." + this.getDefaultExtension()); |
||||
int saveValue = fileChooserPane.showSaveDialog(designerFrame, "." + this.getDefaultExtension()); |
||||
if (saveValue == FILEChooserPane.CANCEL_OPTION || saveValue == FILEChooserPane.JOPTIONPANE_CANCEL_OPTION) { |
||||
fileChooserPane = null; |
||||
return; |
||||
} else if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { |
||||
FILE file = fileChooserPane.getSelectedFILE(); |
||||
try { |
||||
file.mkfile(); |
||||
} catch (Exception e1) { |
||||
FRLogger.getLogger().error("Error In Make New File"); |
||||
} |
||||
fileChooserPane = null; |
||||
FRContext.getLogger().info("\"" + file.getName() + "\"" + Inter.getLocText("Prepare_Export") + "!"); |
||||
|
||||
(progressbar = new FRProgressBar(createExportWork(file, tpl, parameterMap), designerFrame, |
||||
Inter.getLocText("Exporting"), "", 0, 100)).start(); |
||||
} |
||||
} |
||||
|
||||
private SwingWorker createExportWork(FILE file, final TemplateWorkBook tpl, final Map parameterMap) { |
||||
final String filePath = file.getPath(); |
||||
final String fileGetName = file.getName(); |
||||
|
||||
SwingWorker exportWorker = new SwingWorker<Void, Void>() { |
||||
protected Void doInBackground() throws Exception { |
||||
Thread.sleep(100); //bug 10516
|
||||
try { |
||||
final FileOutputStream fileOutputStream = new FileOutputStream(filePath); |
||||
|
||||
this.setProgress(10); |
||||
dealExporter(fileOutputStream, tpl, parameterMap); |
||||
this.setProgress(80); |
||||
fileOutputStream.close(); |
||||
this.setProgress(100); |
||||
|
||||
FRContext.getLogger().info("\"" + fileGetName + "\"" + Inter.getLocText("Finish_Export") + "!"); |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), |
||||
Inter.getLocText("Exported_successfully") + "\n" + filePath); |
||||
} catch (Exception exp) { |
||||
this.setProgress(100); |
||||
FRContext.getLogger().errorWithServerLevel(exp.getMessage(), exp); |
||||
JOptionPane.showMessageDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("Export_failed") + "\n" + filePath); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public void done() { |
||||
progressbar.close(); |
||||
} |
||||
}; |
||||
return exportWorker; |
||||
} |
||||
|
||||
private void dealExporter(FileOutputStream fileOutputStream, final TemplateWorkBook tpl, final Map parameterMap) throws Exception { |
||||
final Exporter exporter = AbstractExportAction.this.getExporter(); |
||||
if (exporter instanceof AppExporter) { |
||||
AppExporter appExporter = (AppExporter) exporter; |
||||
if (exporter instanceof ExcelExporter || exporter instanceof CSVExporter |
||||
|| exporter instanceof PDFExporter || exporter instanceof WordExporter) { |
||||
ReportHelper.clearFormulaResult(tpl);// 清空rpt中的公式计算结果
|
||||
|
||||
appExporter.export(fileOutputStream, tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE) |
||||
)); |
||||
} else { |
||||
ReportHelper.clearFormulaResult(tpl);// 清空currentReport中的公式计算结果
|
||||
|
||||
PageSetProvider pageSet = tpl.execute(parameterMap, ActorFactory.getActor(ActorConstants.TYPE_PAGE)).generateReportPageSet( |
||||
ReportUtils.getPaperSettingListFromWorkBook(tpl)).traverse4Export(); |
||||
appExporter.export(fileOutputStream, pageSet); |
||||
pageSet.release(); |
||||
} |
||||
} else if (exporter instanceof EmbeddedTableDataExporter) { |
||||
((EmbeddedTableDataExporter) exporter).export(fileOutputStream, (WorkBook) tpl, parameterMap); |
||||
} |
||||
} |
||||
|
||||
/* |
||||
* 这边判断是否有层式报表,有层式需要使用大数据量导出 |
||||
*/ |
||||
protected boolean hasLayerReport(TemplateWorkBook tpl) { |
||||
if (tpl == null) { |
||||
return false; |
||||
} |
||||
for (int i = 0; i < tpl.getReportCount(); i++) { |
||||
Report r = tpl.getReport(i); |
||||
if (r instanceof WorkSheet) { |
||||
if (((WorkSheet) r).getLayerReportAttr() != null) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
protected abstract ChooseFileFilter getChooseFileFilter(); |
||||
|
||||
protected abstract String getDefaultExtension(); |
||||
|
||||
protected abstract Exporter getExporter(); |
||||
} |
@ -0,0 +1,55 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.CSVExporter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.LargeDataPageCSVExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
|
||||
/** |
||||
* Export CSV. |
||||
*/ |
||||
public class CSVExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public CSVExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.CSV_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/csv.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new LargeDataPageCSVExporter(); |
||||
} else { |
||||
return new CSVExporter(); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"csv"}, Inter.getLocText("Export-CSV")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return "zip"; |
||||
} else { |
||||
return "csv"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.EmbeddedTableDataExporter; |
||||
import com.fr.io.exporter.Exporter; |
||||
|
||||
/** |
||||
* Export Embedded. |
||||
*/ |
||||
public class EmbeddedExportExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public EmbeddedExportExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.EMBEDDED_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/base/images/oem/logo.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new EmbeddedTableDataExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"cpt"}, |
||||
Inter.getLocText("Export-Template(embedded_data)")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "cpt"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.io.exporter.ExcelExporter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.LargeDataPageExcelExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
public class ExcelExportAction extends AbstractExcelExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public ExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.SIMPLE_EXCEL_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), false); |
||||
} else { |
||||
return new ExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.PDFExporter; |
||||
|
||||
/** |
||||
* Export pdf |
||||
*/ |
||||
public class PDFExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public PDFExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.PDF_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new PDFExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"pdf"}, Inter.getLocText("Export-PDF")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "pdf"; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.LargeDataPageExcelExporter; |
||||
import com.fr.io.exporter.PageExcelExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
public class PageExcelExportAction extends AbstractExcelExportAction { |
||||
|
||||
public PageExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.PAGE_EXCEL_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
if (hasLayerReport(tpl)) { |
||||
return new LargeDataPageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl), true); |
||||
} else { |
||||
return new PageExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.PageToSheetExcelExporter; |
||||
import com.fr.main.TemplateWorkBook; |
||||
import com.fr.report.core.ReportUtils; |
||||
|
||||
public class PageToSheetExcelExportAction extends AbstractExcelExportAction { |
||||
|
||||
public PageToSheetExcelExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
|
||||
this.setMenuKeySet(KeySetUtils.PAGETOSHEET_EXCEL_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
TemplateWorkBook tpl = this.getTemplateWorkBook(); |
||||
return new PageToSheetExcelExporter(ReportUtils.getPaperSettingListFromWorkBook(tpl)); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"xls"}, Inter.getLocText("Export-Excel")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "xls"; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.SVGExporter; |
||||
|
||||
/** |
||||
* Export SVG |
||||
*/ |
||||
public class SVGExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public SVGExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
|
||||
this.setMenuKeySet(KeySetUtils.SVG_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+"..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/svg.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new SVGExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"svg"}, Inter.getLocText("Export-SVG")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "svg"; |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.TextExporter; |
||||
|
||||
/** |
||||
* Export Text. |
||||
*/ |
||||
public class TextExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public TextExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.TEXT_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/text.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new TextExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"txt"}, Inter.getLocText("Export-Text")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "txt"; |
||||
} |
||||
} |
@ -0,0 +1,43 @@
|
||||
/* |
||||
* * Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.file.export; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.file.filter.ChooseFileFilter; |
||||
import com.fr.general.Inter; |
||||
import com.fr.io.exporter.Exporter; |
||||
import com.fr.io.exporter.WordExporter; |
||||
|
||||
/** |
||||
* Export excel. |
||||
*/ |
||||
public class WordExportAction extends AbstractExportAction { |
||||
/** |
||||
* Constructor |
||||
*/ |
||||
public WordExportAction(JWorkBook jwb) { |
||||
super(jwb); |
||||
this.setMenuKeySet(KeySetUtils.WORD_EXPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/word.png")); |
||||
} |
||||
|
||||
@Override |
||||
protected Exporter getExporter() { |
||||
return new WordExporter(); |
||||
} |
||||
|
||||
@Override |
||||
protected ChooseFileFilter getChooseFileFilter() { |
||||
return new ChooseFileFilter(new String[]{"doc"}, Inter.getLocText("Export-Word")); |
||||
} |
||||
|
||||
@Override |
||||
protected String getDefaultExtension() { |
||||
return "doc"; |
||||
} |
||||
} |
@ -0,0 +1,18 @@
|
||||
package com.fr.design.actions.file.newReport; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* @author richie |
||||
* @date 2015-06-16 |
||||
* @since 8.0 |
||||
*/ |
||||
public class NewOEMWorkBookAction extends NewWorkBookAction { |
||||
|
||||
@Override |
||||
protected Icon icon() { |
||||
return BaseUtils.readIcon("/com/fr/plugin/oem/images/newoemcpt.png"); |
||||
} |
||||
} |
@ -0,0 +1,34 @@
|
||||
package com.fr.design.actions.file.newReport; |
||||
|
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JPolyWorkBook; |
||||
import com.fr.general.Inter; |
||||
|
||||
public class NewPolyReportAction extends UpdateAction { |
||||
|
||||
public NewPolyReportAction() { |
||||
this.setName(Inter.getLocText("M-New_Multi_Report")); |
||||
this.setMnemonic('F'); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_file/formExport.png")); |
||||
this.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, KeyEvent.CTRL_MASK)); |
||||
} |
||||
|
||||
/** |
||||
* Action触发后 |
||||
* |
||||
* @param e 触发的事件 |
||||
* |
||||
* @date 2015-2-5-上午11:43:13 |
||||
* |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JPolyWorkBook()); |
||||
} |
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.fr.design.actions.file.newReport; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JWorkBook; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.InputEvent; |
||||
import java.awt.event.KeyEvent; |
||||
|
||||
public class NewWorkBookAction extends UpdateAction { |
||||
|
||||
public NewWorkBookAction() { |
||||
this.setMenuKeySet(NEW_WORK_BOOK); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(icon()); |
||||
this.setAccelerator(getMenuKeySet().getKeyStroke()); |
||||
} |
||||
|
||||
protected Icon icon() { |
||||
return BaseUtils.readIcon("/com/fr/design/images/buttonicon/newcpts.png"); |
||||
} |
||||
|
||||
/** |
||||
* 动作 |
||||
* @param e 事件 |
||||
*/ |
||||
public void actionPerformed(ActionEvent e) { |
||||
DesignerContext.getDesignerFrame().addAndActivateJTemplate(new JWorkBook()); |
||||
} |
||||
|
||||
public static final MenuKeySet NEW_WORK_BOOK = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'N'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M-New_WorkBook"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK); |
||||
} |
||||
}; |
||||
|
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.actions.form; |
||||
|
||||
import com.fr.design.actions.TemplateComponentAction; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
|
||||
public class AbastractFormECAction <T extends FormElementCasePaneDelegate> extends TemplateComponentAction<T>{ |
||||
|
||||
protected AbastractFormECAction(T t) { |
||||
super(t); |
||||
} |
||||
|
||||
@Override |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
return false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.form; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.ReportBackgroundPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
|
||||
/** |
||||
* Background action. |
||||
*/ |
||||
public class FormECBackgroundAction extends AbastractFormECAction<FormElementCasePaneDelegate>{ |
||||
|
||||
public FormECBackgroundAction(FormElementCasePaneDelegate rc) { |
||||
super(rc); |
||||
this.setMenuKeySet(KeySetUtils.REPORT_BACKGROUND); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/background.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final FormElementCasePaneDelegate elementCasePane = this.getEditingComponent(); |
||||
if (elementCasePane == null) { |
||||
return false; |
||||
} |
||||
final ReportBackgroundPane bPane = new ReportBackgroundPane(); |
||||
bPane.populate(elementCasePane.getReportSettings()); |
||||
bPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
bPane.update(elementCasePane.getReportSettings()); |
||||
elementCasePane.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,52 @@
|
||||
package com.fr.design.actions.form; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.ReportColumnsPane; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.report.stable.WorkSheetAttr; |
||||
import com.fr.report.worksheet.FormElementCase; |
||||
|
||||
public class FormECColumnsAction extends AbastractFormECAction<FormElementCasePaneDelegate>{ |
||||
|
||||
public FormECColumnsAction(FormElementCasePaneDelegate t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.EC_COLUMNS); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/form/toolbar/ec_columns.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
final FormElementCasePaneDelegate jws = this.getEditingComponent(); |
||||
if (jws == null) { |
||||
return false; |
||||
} |
||||
final FormElementCase elementCase = jws.getTarget(); |
||||
|
||||
final ReportColumnsPane cPane = new ReportColumnsPane(); |
||||
WorkSheetAttr attr = elementCase.getWorkSheetAttr(); |
||||
int rowCount = elementCase.getRowCount(); |
||||
int colCount = elementCase.getColumnCount(); |
||||
cPane.populate(attr, rowCount, colCount); |
||||
cPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
// bug:64173 重新生成一个workSheetAttr,否则会受到之前属性的干扰
|
||||
WorkSheetAttr attr = new WorkSheetAttr(); |
||||
elementCase.setWorkSheetAttr(attr); |
||||
cPane.update(attr); |
||||
jws.fireTargetModified(); |
||||
} |
||||
}).setVisible(true); |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,55 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.form; |
||||
|
||||
import javax.swing.SwingUtilities; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.form.FormElementCasePaneDelegate; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.report.freeze.FormECRepeatAndFreezeSettingPane; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.report.worksheet.FormElementCase; |
||||
|
||||
/** |
||||
* 表单报表块冻结 |
||||
*/ |
||||
public class FormECFrozenAction extends AbastractFormECAction<FormElementCasePaneDelegate>{ |
||||
private boolean returnValue; |
||||
|
||||
public FormECFrozenAction(FormElementCasePaneDelegate t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.EC_FROZEN); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/form/toolbar/ec_frozen.png")); |
||||
} |
||||
|
||||
/** |
||||
* 执行动作 |
||||
* |
||||
* @return 是否执行成功 |
||||
*/ |
||||
public boolean executeActionReturnUndoRecordNeeded() { |
||||
FormElementCasePaneDelegate jws = getEditingComponent(); |
||||
if (jws == null) { |
||||
return false; |
||||
} |
||||
final FormElementCase fc = jws.getTarget(); |
||||
final FormECRepeatAndFreezeSettingPane attrPane = new FormECRepeatAndFreezeSettingPane(); |
||||
attrPane.populate(fc.getReportPageAttr()); |
||||
BasicDialog dlg = attrPane.showWindow(SwingUtilities.getWindowAncestor(jws)); |
||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
fc.setReportPageAttr(attrPane.update()); |
||||
returnValue = true; |
||||
} |
||||
}); |
||||
dlg.setVisible(true); |
||||
return returnValue; |
||||
} |
||||
} |
@ -0,0 +1,51 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.design.actions.CellSelectionAction; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.grid.selection.CellSelection; |
||||
import com.fr.report.core.SheetUtils; |
||||
import com.fr.report.elementcase.TemplateElementCase; |
||||
|
||||
/** |
||||
* Cell. |
||||
*/ |
||||
public abstract class AbstractCellAction extends CellSelectionAction { |
||||
protected AbstractCellAction(ElementCasePane t) { |
||||
super(t); |
||||
} |
||||
|
||||
public abstract Class getCellValueClass(); |
||||
|
||||
/* |
||||
* TODO ALEX_SEP 这里的返回boolean量表示模板是否改变,导致很多很多的方法的boolean返回值都是这个意思 |
||||
* |
||||
* 感觉有点浪费 |
||||
*/ |
||||
@Override |
||||
protected boolean executeActionReturnUndoRecordNeededWithCellSelection( |
||||
CellSelection cs) { |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
//got simple cell element from column and row.
|
||||
TemplateElementCase report = ePane.getEditingElementCase(); |
||||
|
||||
//alex:如果是线性报表,这时还要计算一下默认父格是什么
|
||||
if (report != null && this instanceof DSColumnCellAction) { |
||||
SheetUtils.calculateDefaultParent(report); |
||||
} |
||||
|
||||
return ePane.getGrid().startCellEditingAt_DEC( |
||||
cs.getColumn(), |
||||
cs.getRow(), |
||||
this.getCellValueClass(), false |
||||
); |
||||
} |
||||
@Override |
||||
public void update() { |
||||
super.update(); |
||||
ElementCasePane ePane = this.getEditingComponent(); |
||||
this.setEnabled(ePane.isSelectedOneCell()); |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.cell.painter.BiasTextPainter; |
||||
|
||||
/** |
||||
* Bias |
||||
*/ |
||||
public class BiasCellAction extends AbstractCellAction { |
||||
public BiasCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_SLOPE_LINE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_SLOPE_LINE = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
//之前是S, 跟子报表subreport重复了
|
||||
return 'X'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Slope_Line"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return BiasTextPainter.class; |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.core.ActionUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* . |
||||
*/ |
||||
public class ChartCellAction extends AbstractCellAction { |
||||
public ChartCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_CHART); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_CHART = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'C'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Chart"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return ActionUtils.getChartCollectionClass(); |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.menu.KeySetUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.report.cell.cellattr.core.group.DSColumn; |
||||
|
||||
public class DSColumnCellAction extends AbstractCellAction { |
||||
public DSColumnCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png")); |
||||
} |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return DSColumn.class; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Formula; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
public class FormulaCellAction extends AbstractCellAction { |
||||
public FormulaCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_FORMULA); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_FORMULA = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'F'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Formula"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return Formula.class; |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
|
||||
/** |
||||
* |
||||
*/ |
||||
public class GeneralCellAction extends AbstractCellAction { |
||||
public GeneralCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_TEXT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_TEXT = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'T'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Text"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return String.class; |
||||
} |
||||
} |
@ -0,0 +1,47 @@
|
||||
/* |
||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||
*/ |
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* Image |
||||
*/ |
||||
public class ImageCellAction extends AbstractCellAction { |
||||
public ImageCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_IMAGE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_IMAGE = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'I'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Image"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return Image.class; |
||||
} |
||||
} |
@ -0,0 +1,61 @@
|
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.cell.cellattr.core.RichText; |
||||
|
||||
public class RichTextCellAction extends AbstractCellAction { |
||||
|
||||
public RichTextCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_RICHTEXT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon( |
||||
"/com/fr/design/images/m_insert/richtext.png")); |
||||
} |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return RichText.class; |
||||
} |
||||
|
||||
/** |
||||
* equals 比较 |
||||
* @param object |
||||
* @return true false |
||||
*/ |
||||
@Override |
||||
public boolean equals(Object object) { |
||||
if (this == object){ |
||||
return true; |
||||
} |
||||
if (!(object instanceof RichTextCellAction)){ |
||||
return false; |
||||
} |
||||
|
||||
return ComparatorUtils.equals(this.getEditingComponent(),((RichTextCellAction)object).getEditingComponent()); |
||||
} |
||||
|
||||
private static final MenuKeySet INSERT_RICHTEXT = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'R'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("FR-Designer_RichText"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,62 @@
|
||||
package com.fr.design.actions.insert.cell; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.mainframe.ElementCasePane; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.Inter; |
||||
import com.fr.report.cell.cellattr.core.SubReport; |
||||
|
||||
public class SubReportCellAction extends AbstractCellAction { |
||||
|
||||
public SubReportCellAction(ElementCasePane t) { |
||||
super(t); |
||||
this.setMenuKeySet(INSERT_SUB_REPORT); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()+ "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon( |
||||
"/com/fr/design/images/m_insert/subReport.png")); |
||||
} |
||||
|
||||
public static final MenuKeySet INSERT_SUB_REPORT = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'S'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return Inter.getLocText("M_Insert-Sub_Report"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
|
||||
/** |
||||
* equals 比较 |
||||
* @param object |
||||
* @return true false |
||||
*/ |
||||
@Override |
||||
public boolean equals(Object object) { |
||||
if (this == object){ |
||||
return true; |
||||
} |
||||
if (!(object instanceof SubReportCellAction)){ |
||||
return false; |
||||
} |
||||
|
||||
return ComparatorUtils.equals(this.getEditingComponent(),((SubReportCellAction)object).getEditingComponent()); |
||||
} |
||||
|
||||
@Override |
||||
public Class getCellValueClass() { |
||||
return SubReport.class; |
||||
} |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue