kerry 7 years ago
parent
commit
b688bb519b
  1. 55
      designer/src/com/fr/design/actions/CellSelectionAction.java
  2. 16
      designer/src/com/fr/design/actions/ElementCaseAction.java
  3. 5
      designer/src/com/fr/design/actions/SelectionListenerAction.java
  4. 38
      designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java
  5. 17
      designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java
  6. 14
      designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java
  7. 16
      designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java
  8. 16
      designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java
  9. 16
      designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java
  10. 16
      designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java
  11. 93
      designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java
  12. 99
      designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java
  13. 4
      designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java
  14. 4
      designer/src/com/fr/design/module/DesignerModule.java
  15. 199
      designer/src/com/fr/quickeditor/CellQuickEditor.java
  16. 18
      designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java
  17. 47
      designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java
  18. 82
      designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java
  19. 18
      designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java
  20. 18
      designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java
  21. 55
      designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java
  22. 18
      designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java
  23. 42
      designer_base/src/com/fr/design/actions/TemplateComponentAction.java
  24. 34
      designer_base/src/com/fr/design/actions/core/ActionFactory.java
  25. 9
      designer_base/src/com/fr/design/menu/ToolBarDef.java
  26. 6
      designer_base/src/com/fr/start/BaseDesigner.java

55
designer/src/com/fr/design/actions/CellSelectionAction.java

@ -5,30 +5,33 @@ 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);
}
}
protected CellSelectionAction() {
}
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);
}
}
}

16
designer/src/com/fr/design/actions/ElementCaseAction.java

@ -3,17 +3,15 @@ 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 SelectionListenerAction {
protected ElementCaseAction(ElementCasePane t) {
super(t);
t.addSelectionChangeListener(createSelectionListener());
}
protected ElementCaseAction() {
}
protected ElementCaseAction(ElementCasePane t) {
super(t);
t.addSelectionChangeListener(createSelectionListener());
}
}

5
designer/src/com/fr/design/actions/SelectionListenerAction.java

@ -12,11 +12,14 @@ import com.fr.grid.selection.Selection;
*/
public abstract class SelectionListenerAction extends TemplateComponentAction<ElementCasePane> {
protected SelectionListenerAction() {
}
protected SelectionListenerAction(ElementCasePane elementCasePane) {
super(elementCasePane);
}
protected SelectionListener createSelectionListener () {
protected SelectionListener createSelectionListener() {
return new SelectionListener() {
@Override

38
designer/src/com/fr/design/actions/insert/cell/AbstractCellAction.java

@ -13,12 +13,15 @@ import com.fr.report.elementcase.TemplateElementCase;
* Cell.
*/
public abstract class AbstractCellAction extends CellSelectionAction {
protected AbstractCellAction(ElementCasePane t) {
super(t);
}
protected AbstractCellAction() {
}
protected AbstractCellAction(ElementCasePane t) {
super(t);
}
public abstract Class getCellValueClass();
/*
* TODO ALEX_SEP 这里的返回boolean量表示模板是否改变,导致很多很多的方法的boolean返回值都是这个意思
*
@ -26,8 +29,8 @@ public abstract class AbstractCellAction extends CellSelectionAction {
*/
@Override
protected boolean executeActionReturnUndoRecordNeededWithCellSelection(
CellSelection cs) {
ElementCasePane ePane = this.getEditingComponent();
CellSelection cs) {
ElementCasePane ePane = this.getEditingComponent();
//got simple cell element from column and row.
TemplateElementCase report = ePane.getEditingElementCase();
@ -35,17 +38,18 @@ public abstract class AbstractCellAction extends CellSelectionAction {
if (report != null && this instanceof DSColumnCellAction) {
SheetUtils.calculateDefaultParent(report);
}
return ePane.getGrid().startCellEditingAt_DEC(
cs.getColumn(),
cs.getRow(),
this.getCellValueClass(), false
cs.getColumn(),
cs.getRow(),
this.getCellValueClass(), false
);
}
@Override
public void update() {
super.update();
ElementCasePane ePane = this.getEditingComponent();
this.setEnabled(ePane.isSelectedOneCell());
}
@Override
public void update() {
super.update();
ElementCasePane ePane = this.getEditingComponent();
this.setEnabled(ePane.isSelectedOneCell());
}
}

17
designer/src/com/fr/design/actions/insert/cell/BiasCellAction.java

@ -3,8 +3,6 @@
*/
package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane;
@ -12,12 +10,23 @@ import com.fr.design.menu.MenuKeySet;
import com.fr.general.Inter;
import com.fr.report.cell.painter.BiasTextPainter;
import javax.swing.KeyStroke;
/**
* Bias
*/
public class BiasCellAction extends AbstractCellAction implements WorkBookSupportable {
public BiasCellAction(ElementCasePane t) {
super(t);
public BiasCellAction() {
initAction();
}
public BiasCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_SLOPE_LINE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());

14
designer/src/com/fr/design/actions/insert/cell/ChartCellAction.java

@ -16,11 +16,19 @@ import javax.swing.*;
* .
*/
public class ChartCellAction extends AbstractCellAction implements WorkBookSupportable {
public ChartCellAction(){
initAction();
}
public ChartCellAction(ElementCasePane t) {
super(t);
this.setMenuKeySet(INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_CHART);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"));
}

16
designer/src/com/fr/design/actions/insert/cell/DSColumnCellAction.java

@ -8,13 +8,21 @@ import com.fr.general.IOUtils;
import com.fr.report.cell.cellattr.core.group.DSColumn;
public class DSColumnCellAction extends AbstractCellAction implements WorkBookSupportable {
public DSColumnCellAction(ElementCasePane t) {
super(t);
public DSColumnCellAction() {
initAction();
}
public DSColumnCellAction(ElementCasePane t) {
super(t);
initAction();
this.setSearchText(new DSColumnPane());
}
private void initAction() {
this.setMenuKeySet(KeySetUtils.INSERT_DATA_COLUMN);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png"));
this.setSearchText(new DSColumnPane());
}
@Override

16
designer/src/com/fr/design/actions/insert/cell/FormulaCellAction.java

@ -13,10 +13,18 @@ import com.fr.general.Inter;
import javax.swing.*;
public class FormulaCellAction extends AbstractCellAction implements WorkBookSupportable {
public FormulaCellAction(ElementCasePane t) {
super(t);
public FormulaCellAction() {
initAction();
}
public FormulaCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_FORMULA);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
}
@ -39,7 +47,7 @@ public class FormulaCellAction extends AbstractCellAction implements WorkBookSup
};
@Override
public Class getCellValueClass() {
public Class getCellValueClass() {
return Formula.class;
}
}

16
designer/src/com/fr/design/actions/insert/cell/GeneralCellAction.java

@ -15,10 +15,18 @@ import javax.swing.*;
*
*/
public class GeneralCellAction extends AbstractCellAction implements WorkBookSupportable {
public GeneralCellAction(ElementCasePane t) {
super(t);
public GeneralCellAction() {
initAction();
}
public GeneralCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_TEXT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png"));
}
@ -41,7 +49,7 @@ public class GeneralCellAction extends AbstractCellAction implements WorkBookSup
};
@Override
public Class getCellValueClass() {
public Class getCellValueClass() {
return String.class;
}
}

16
designer/src/com/fr/design/actions/insert/cell/ImageCellAction.java

@ -16,10 +16,18 @@ import java.awt.*;
* Image
*/
public class ImageCellAction extends AbstractCellAction implements WorkBookSupportable {
public ImageCellAction(ElementCasePane t) {
super(t);
public ImageCellAction() {
initAction();
}
public ImageCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_IMAGE);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
}
@ -42,7 +50,7 @@ public class ImageCellAction extends AbstractCellAction implements WorkBookSuppo
};
@Override
public Class getCellValueClass() {
public Class getCellValueClass() {
return Image.class;
}
}

93
designer/src/com/fr/design/actions/insert/cell/RichTextCellAction.java

@ -1,7 +1,5 @@
package com.fr.design.actions.insert.cell;
import javax.swing.KeyStroke;
import com.fr.base.BaseUtils;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.mainframe.ElementCasePane;
@ -10,53 +8,64 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.report.cell.cellattr.core.RichText;
import javax.swing.KeyStroke;
public class RichTextCellAction extends AbstractCellAction implements WorkBookSupportable {
public RichTextCellAction(ElementCasePane t) {
super(t);
public RichTextCellAction() {
initAction();
}
public RichTextCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_RICHTEXT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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());
}
}
@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;
}
@Override
public char getMnemonic() {
return 'R';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_RichText");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}

99
designer/src/com/fr/design/actions/insert/cell/SubReportCellAction.java

@ -1,7 +1,5 @@
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;
@ -9,54 +7,65 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.report.cell.cellattr.core.SubReport;
import javax.swing.KeyStroke;
public class SubReportCellAction extends AbstractCellAction {
public SubReportCellAction(ElementCasePane t) {
super(t);
public SubReportCellAction() {
initAction();
}
public SubReportCellAction(ElementCasePane t) {
super(t);
initAction();
}
private void initAction() {
this.setMenuKeySet(INSERT_SUB_REPORT);
this.setName(getMenuKeySet().getMenuKeySetName()+ "...");
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;
}
}
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;
}
}

4
designer/src/com/fr/design/dscolumn/SelectedDataColumnPane.java

@ -279,8 +279,8 @@ public class SelectedDataColumnPane extends BasicPane {
});
}
private void initWithParameterButton(ElementCasePane casePane, TemplateCellElement cellElement) {
SelectedDataColumnPane that = this;
private void initWithParameterButton(final ElementCasePane casePane, final TemplateCellElement cellElement) {
final SelectedDataColumnPane that = this;
editorPane = new UITableEditorPane<ParameterProvider>(new ParameterTableModel());
paramButton = new UIButton(Inter.getLocText("TableData_Dynamic_Parameter_Setting"));
paramButton.addActionListener(new ActionListener() {

4
designer/src/com/fr/design/module/DesignerModule.java

@ -169,7 +169,7 @@ public class DesignerModule extends DesignModule {
}
@Override
/**
/*
* 针对不同的对象在读取Object对象的xml的时候需要使用不同的对象生成器
* @return 返回对象生成器
*/
@ -242,7 +242,7 @@ public class DesignerModule extends DesignModule {
}
@Override
/**
/*
* 返回设计器能打开的模板类型的一个数组列表
* @return 可以打开的模板类型的数组
*/

199
designer/src/com/fr/quickeditor/CellQuickEditor.java

@ -1,27 +1,30 @@
package com.fr.quickeditor;
import com.fr.design.actions.utils.DeprecatedActionManager;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.actions.UpdateAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.iscrollbar.UIScrollBar;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.CellElementPropertyPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.ElementCasePane;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.menu.ShortCut;
import com.fr.design.selection.QuickEditor;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.report.cell.TemplateCellElement;
import com.fr.stable.ColumnRow;
import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.*;
import java.util.ArrayList;
/**
* @author zhou, yaoh.wu
@ -30,22 +33,78 @@ import java.awt.event.MouseEvent;
*/
public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
/*滚动条相关配置*/
private static final int MAXVALUE = 100;
private static final int TITLE_HEIGHT = 50;
private static final int MOUSE_WHEEL_SPEED = 5;
private static final int CONTENT_PANE_WIDTH_GAP = 4;
private static final int SCROLLBAR_WIDTH = 8;
private int maxHeight = 280;
/*面板配置*/
protected UITextField columnRowTextField;
protected TemplateCellElement cellElement;
private UIComboBox comboBox;
private UpdateAction[] cellInsertActions;
private int selectedIndex;
private JPanel leftContentPane;
private UIScrollBar scrollBar;
/*占位label*/
protected static UILabel emptyLabel = new UILabel();
static {
emptyLabel.setPreferredSize(new Dimension(60, 20));
}
public CellQuickEditor() {
scrollBar = new UIScrollBar(UIScrollBar.VERTICAL) {
@Override
public int getVisibleAmount() {
int preferredHeight = leftContentPane.getPreferredSize().height;
int e = MAXVALUE * (maxHeight) / preferredHeight;
setVisibleAmount(e);
return e;
}
@Override
public int getMaximum() {
return MAXVALUE;
}
};
scrollBar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
doLayout();
}
});
this.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e) {
int value = scrollBar.getValue();
value += MOUSE_WHEEL_SPEED * e.getWheelRotation();
scrollBar.setValue(value);
doLayout();
}
});
double p = TableLayout.PREFERRED;
double f = TableLayout.FILL;
double[] columnSize = {p, f};
double[] rowSize = {p, p};
JComponent centerBody = createCenterBody();
centerBody.setBorder(BorderFactory.createMatteBorder(0, 10, 0, 0, this.getBackground()));
Component[][] components = new Component[][]{
new Component[]{initTopContent(), null},
new Component[]{createCenterBody(), null}
new Component[]{centerBody, null}
};
JPanel panel = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
this.add(panel, BorderLayout.CENTER);
leftContentPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.setLayout(new BarLayout());
this.add(scrollBar);
this.add(leftContentPane);
}
@ -58,33 +117,70 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
cellLabel.setPreferredSize(new Dimension(60, 20));
UILabel insertContentLabel = new UILabel(Inter.getLocText("HF-Insert_Content"));
insertContentLabel.setPreferredSize(new Dimension(60, 20));
UIButton cellElementEditButton = initCellElementEditButton();
UIComboBox cellElementEditButton = initCellElementEditComboBox();
Component[][] components = new Component[][]{
new Component[]{cellLabel, columnRowTextField = initColumnRowTextField()},
new Component[]{insertContentLabel, cellElementEditButton},
};
JPanel topContent = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
topContent.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0));
return topContent;
}
/**
* 初始化添加按钮
* TODO 9.0 换成下拉菜单后原来的快捷键不好处理先跳过
*
* @return UIButton
*/
private UIButton initCellElementEditButton() {
final UIButton cellElementEditButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/buttonicon/add.png"));
cellElementEditButton.addMouseListener(new MouseAdapter() {
private UIComboBox initCellElementEditComboBox() {
final String[] items = getDefaultComboBoxItems();
comboBox = new UIComboBox(items);
final Object comboBoxSelected = getComboBoxSelected();
if (comboBoxSelected != null) {
comboBox.setSelectedItem(((ShortCut) comboBoxSelected).getMenuKeySet().getMenuKeySetName());
} else {
comboBox.setSelectedIndex(1);
}
comboBox.addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
if (cellInsertActions == null) {
cellInsertActions = ActionFactory.createCellInsertAction(ElementCasePane.class, tc);
}
// 这边重新获取是因为要根据JTemplate做一个过滤
ArrayList<String> arrayList = new ArrayList<String>();
for (UpdateAction action : cellInsertActions) {
arrayList.add(action.getMenuKeySet().getMenuKeySetName());
}
comboBox.setModel(new DefaultComboBoxModel<>(arrayList.toArray(new String[arrayList.size()])));
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
}
@Override
public void mousePressed(MouseEvent evt) {
GUICoreUtils.showPopMenuWithParentWidth(DeprecatedActionManager.getCellMenu(tc).createJPopupMenu(), cellElementEditButton, 0, cellElementEditButton.getY() - 6);
public void popupMenuCanceled(PopupMenuEvent e) {
}
});
return cellElementEditButton;
comboBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
selectedIndex = comboBox.getSelectedIndex();
cellInsertActions[selectedIndex].actionPerformed(e);
}
});
return comboBox;
}
private String[] getDefaultComboBoxItems() {
MenuKeySet[] cellInsertActionNames = ActionFactory.createCellInsertActionName();
ArrayList<String> names = new ArrayList<>();
for (MenuKeySet cellInsertActionName : cellInsertActionNames) {
names.add(cellInsertActionName.getMenuKeySetName());
}
return names.toArray(new String[names.size()]);
}
/**
@ -130,6 +226,14 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
*/
public abstract JComponent createCenterBody();
/**
* 初始化下拉框中的类型
*
* @return JComponent 待显示的详细信息面板
*/
public abstract Object getComboBoxSelected();
/**
* 刷新
*/
@ -146,4 +250,55 @@ public abstract class CellQuickEditor extends QuickEditor<ElementCasePane> {
* 刷新详细信息
*/
protected abstract void refreshDetails();
/**
* 属性面板的滚动条和内容区域的布局管理类
* yaoh.wu 由于这边不能继承{@link com.fr.design.mainframe.AbstractAttrPane.BarLayout}所以冗余了一份滚动条代码进来
*
* @see com.fr.design.mainframe.AbstractAttrPane.BarLayout
*/
protected class BarLayout implements LayoutManager {
@Override
public void addLayoutComponent(String name, Component comp) {
}
@Override
public void removeLayoutComponent(Component comp) {
}
@Override
public Dimension preferredLayoutSize(Container parent) {
return leftContentPane.getPreferredSize();
}
@Override
public Dimension minimumLayoutSize(Container parent) {
return leftContentPane.getMinimumSize();
}
@Override
public void layoutContainer(Container parent) {
maxHeight = CellElementPropertyPane.getInstance().getHeight() - TITLE_HEIGHT;
int beginY;
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
beginY = 0;
} else {
int preferredHeight = leftContentPane.getPreferredSize().height;
int value = scrollBar.getValue();
beginY = value * (preferredHeight - maxHeight) / (MAXVALUE - scrollBar.getVisibleAmount());
}
int width = parent.getWidth();
int height = parent.getHeight();
if (leftContentPane.getPreferredSize().height > maxHeight) {
leftContentPane.setBounds(0, -beginY, width - scrollBar.getWidth() - CONTENT_PANE_WIDTH_GAP, height + beginY);
scrollBar.setBounds(width - scrollBar.getWidth() - 1, 0, scrollBar.getWidth(), height);
} else {
leftContentPane.setBounds(0, 0, width - SCROLLBAR_WIDTH - CONTENT_PANE_WIDTH_GAP, height);
}
leftContentPane.validate();
}
}
}

18
designer/src/com/fr/quickeditor/cellquick/CellBiasTextPainterEditor.java

@ -1,11 +1,14 @@
package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.BiasCellAction;
import com.fr.design.cell.editor.BiasTextPainterCellEditor.BiasTextPainterPane;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.painter.BiasTextPainter;
@ -23,8 +26,7 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/bias.png"));
UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -32,10 +34,18 @@ public class CellBiasTextPainterEditor extends CellQuickEditor {
}
});
editButton.setOpaque(false);
content.add(editButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, editButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(BiasCellAction.class);
}
private void showEditingDialog() {
final BiasTextPainter oldbiasTextPainter = (BiasTextPainter) cellElement.getValue();
final BiasTextPainterPane biasTextPainterPane = new BiasTextPainterPane();

47
designer/src/com/fr/quickeditor/cellquick/CellDSColumnEditor.java

@ -2,6 +2,8 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.Formula;
import com.fr.design.actions.columnrow.DSColumnConditionAction;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.DSColumnCellAction;
import com.fr.design.data.DesignTableDataManager;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.dscolumn.DSColumnAdvancedPane;
@ -133,7 +135,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
String[] iconArray = new String[paneList.size()];
card = new CardLayout();
cardContainer = new JPanel(card);
cardContainer.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
for (int i = 0; i < paneList.size(); i++) {
CellEditorPane pane = paneList.get(i);
iconArray[i] = pane.getIconPath();
@ -225,9 +226,8 @@ public class CellDSColumnEditor extends CellQuickEditor {
new Component[]{uiLabel, uiButton}
};
conditionPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
this.add(this.createContentPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@ -279,8 +279,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
class DSColumnAdvancedEditorPane extends CellEditorPane {
private static final String INSET_TEXT = " ";
//排列顺序
private ResultSetSortConfigPane sortPane;
//结果集筛选
@ -293,14 +291,16 @@ public class CellDSColumnEditor extends CellQuickEditor {
private UICheckBox veCheckBox;
//补充空白数据
private UICheckBox useMultiplyNumCheckBox;
//补充空白数据目输入框
//补充空白数据目输入框
private UISpinner multiNumSpinner;
//补充空白数据数目面板 可隐藏
private JPanel multiPane;
public DSColumnAdvancedEditorPane() {
this.setLayout(new BorderLayout());
this.add(this.createContentPane(), BorderLayout.CENTER);
this.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
}
@ -323,13 +323,11 @@ public class CellDSColumnEditor extends CellQuickEditor {
filterPane.update(cellElement);
//更新单元格扩展属性
updateExtendConfig();
//更新补充空白设置
updateMultipleConfig();
}
}
@SuppressWarnings("Duplicates")
@Override
public void populate() {
if (cellElement != null) {
@ -373,7 +371,6 @@ public class CellDSColumnEditor extends CellQuickEditor {
/**
* 更新单元格扩展属性
*/
@SuppressWarnings("Duplicates")
private void updateExtendConfig() {
CellExpandAttr cellExpandAttr = cellElement.getCellExpandAttr();
if (cellExpandAttr == null) {
@ -458,7 +455,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
});
//可扩展性
JPanel extendableDirectionPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
JPanel extendableDirectionPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
extendableDirectionPane.add(heCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Horizontal_Extendable")));
extendableDirectionPane.add(veCheckBox = new UICheckBox(Inter.getLocText("ExpandD-Vertical_Extendable")));
heCheckBox.addChangeListener(new ChangeListener() {
@ -476,13 +473,23 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
});
JPanel multiNumPane = FRGUIPaneFactory.createYBoxEmptyBorderPane();
//补充空白数据
JPanel multiNumPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Column_Multiple"));
multiNumPane.add(useMultiplyNumCheckBox);
multiNumPane.add(new UILabel(INSET_TEXT));
useMultiplyNumCheckBox = new UICheckBox(Inter.getLocText("Fill_blank_Data"));
JPanel checkBoxPane = new JPanel(new BorderLayout());
checkBoxPane.add(useMultiplyNumCheckBox, BorderLayout.WEST);
multiNumPane.add(checkBoxPane);
multiNumSpinner = new UISpinner(1, 10000, 1, 1);
multiNumPane.add(multiNumSpinner);
//数据倍数
UILabel multipleLabel = new UILabel(Inter.getLocText("Column_Multiple"));
multipleLabel.setPreferredSize(new Dimension(60, 20));
multiPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{
multipleLabel, multiNumSpinner
}
}, new double[]{P}, new double[]{P, F}
);
multiNumPane.add(multiPane);
useMultiplyNumCheckBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkButtonEnabled();
@ -516,8 +523,10 @@ public class CellDSColumnEditor extends CellQuickEditor {
private void checkButtonEnabled() {
if (useMultiplyNumCheckBox.isSelected()) {
multiNumSpinner.setEnabled(true);
multiPane.setVisible(true);
} else {
multiNumSpinner.setEnabled(false);
multiPane.setVisible(false);
}
}
@ -586,6 +595,7 @@ public class CellDSColumnEditor extends CellQuickEditor {
if (cellElement != null) {
Object value = cellElement.getValue();
if (value != null && value instanceof DSColumn) {
this.formulaField.populateElement(cellElement);
DSColumn dSColumn = (DSColumn) value;
int sort = dSColumn.getOrder();
this.sortTypePane.setSelectedIndex(sort);
@ -981,4 +991,9 @@ public class CellDSColumnEditor extends CellQuickEditor {
}
}
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(DSColumnCellAction.class);
}
}

82
designer/src/com/fr/quickeditor/cellquick/CellFormulaQuickEditor.java

@ -3,7 +3,18 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.Formula;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.FormulaCellAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.formula.FormulaFactory;
import com.fr.design.formula.UIFormula;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper;
@ -15,6 +26,8 @@ import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
@ -27,7 +40,7 @@ import java.awt.event.KeyEvent;
*/
public class CellFormulaQuickEditor extends CellQuickEditor {
//文本域
private UITextField stringTextField;
private UITextField formulaTextField;
//编辑状态
private boolean isEditing = false;
@ -35,20 +48,23 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
//默认值
private static final String DEFAULT_FORMULA = "=";
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(formulaTextField.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(formulaTextField.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(formulaTextField.getText().trim());
}
};
@ -63,9 +79,8 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
stringTextField = new UITextField();
stringTextField.addKeyListener(new KeyAdapter() {
formulaTextField = new UITextField();
formulaTextField.addKeyListener(new KeyAdapter() {
@Override
public void keyReleased(KeyEvent e) {
if (tc != null) {
@ -73,8 +88,47 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
}
}
});
content.add(stringTextField, BorderLayout.CENTER);
return content;
JPanel textFieldPane = new JPanel(new BorderLayout());
textFieldPane.add(formulaTextField, BorderLayout.CENTER);
textFieldPane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 5));
UIButton formulaButton = new UIButton(IOUtils.readIcon("/com/fr/design/images/m_insert/formula.png"));
formulaButton.setToolTipText(Inter.getLocText("Formula") + "...");
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height));
formulaButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent evt) {
String text = formulaTextField.getText();
final UIFormula formulaPane = FormulaFactory.createFormulaPane();
formulaPane.populate(new Formula(text));
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
Formula fm = formulaPane.update();
if (fm.getContent().length() <= 1) {
formulaTextField.setText(DEFAULT_FORMULA);
} else {
formulaTextField.setText(fm.getContent());
}
}
}).setVisible(true);
}
});
JPanel pane = new JPanel(new BorderLayout());
pane.add(textFieldPane, BorderLayout.CENTER);
pane.add(formulaButton, BorderLayout.EAST);
content.add(pane, BorderLayout.NORTH);
return TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, content}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL});
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(FormulaCellAction.class);
}
@ -105,7 +159,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
}
}
fireTargetModified();
stringTextField.requestFocus();
formulaTextField.requestFocus();
isEditing = false;
}
@ -131,7 +185,7 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
}
}
showText(str);
stringTextField.setEditable(tc.isSelectedOneCell());
formulaTextField.setEditable(tc.isSelectedOneCell());
}
/**
@ -144,9 +198,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor {
if (isEditing) {
return;
}
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
formulaTextField.getDocument().removeDocumentListener(documentListener);
formulaTextField.setText(str);
formulaTextField.getDocument().addDocumentListener(documentListener);
}
}

18
designer/src/com/fr/quickeditor/cellquick/CellImageQuickEditor.java

@ -1,12 +1,15 @@
package com.fr.quickeditor.cellquick;
import com.fr.base.Style;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.ImageCellAction;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.report.SelectImagePane;
import com.fr.general.ComparatorUtils;
import com.fr.general.IOUtils;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.cell.cellattr.CellImage;
@ -31,8 +34,7 @@ public class CellImageQuickEditor extends CellQuickEditor {
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
UIButton editButton = new UIButton(Inter.getLocText("Edit"), IOUtils.readIcon("/com/fr/design/images/m_insert/image.png"));
UIButton editButton = new UIButton(Inter.getLocText("Edit"));
editButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@ -40,11 +42,13 @@ public class CellImageQuickEditor extends CellQuickEditor {
}
});
editButton.setOpaque(false);
content.add(editButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, editButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@SuppressWarnings("Duplicates")
private void showEditingDialog() {
final SelectImagePane imageEditorPane = new SelectImagePane();
imageEditorPane.populate(cellElement);
@ -68,4 +72,8 @@ public class CellImageQuickEditor extends CellQuickEditor {
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(ImageCellAction.class);
}
}

18
designer/src/com/fr/quickeditor/cellquick/CellRichTextEditor.java

@ -1,7 +1,10 @@
package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.RichTextCellAction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
@ -21,21 +24,28 @@ public class CellRichTextEditor extends CellQuickEditor {
super();
}
@SuppressWarnings("Duplicates")
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
richTextButton = new UIButton();
richTextButton.setOpaque(false);
content.add(richTextButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, richTextButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(RichTextCellAction.class);
}
@Override
protected void refreshDetails() {
RichTextCellAction subReportCellAction = new RichTextCellAction(tc);
subReportCellAction.setName(Inter.getLocText("FR-Designer_RichTextEditor"));
subReportCellAction.setName(Inter.getLocText("Edit"));
subReportCellAction.setSmallIcon(null);
richTextButton.setAction(subReportCellAction);
}

55
designer/src/com/fr/quickeditor/cellquick/CellStringQuickEditor.java

@ -3,7 +3,8 @@ package com.fr.quickeditor.cellquick;
import com.fr.base.Formula;
import com.fr.base.Style;
import com.fr.base.TextFormat;
import com.fr.design.gui.itextfield.UITextField;
import com.fr.design.gui.itextarea.UITextArea;
import com.fr.grid.GridKeyListener;
import com.fr.grid.selection.CellSelection;
import com.fr.quickeditor.CellQuickEditor;
import com.fr.report.ReportHelper;
@ -22,13 +23,11 @@ import java.awt.event.KeyEvent;
*
*/
public class CellStringQuickEditor extends CellQuickEditor {
//文本域
//TODO 9.0 文本域要根据具体文本数量自适应大小,比较难搞,先跳过。
private UITextField stringTextField;
//文本域 直接可以自适应大小
private UITextArea stringTextArea;
//编辑状态
private boolean isEditing = false;
//august:如果是原来编辑的是公式,要保留公式里的这些属性,不然在公式和字符串转化时,就会丢失这些属性设置。
private boolean reserveInResult = false;
private boolean reserveOnWriteOrAnaly = true;
@ -36,17 +35,17 @@ public class CellStringQuickEditor extends CellQuickEditor {
private DocumentListener documentListener = new DocumentListener() {
@Override
public void insertUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(stringTextArea.getText().trim());
}
@Override
public void removeUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(stringTextArea.getText().trim());
}
@Override
public void changedUpdate(DocumentEvent e) {
changeReportPaneCell(stringTextField.getText().trim());
changeReportPaneCell(stringTextArea.getText().trim());
}
};
@ -57,22 +56,37 @@ public class CellStringQuickEditor extends CellQuickEditor {
/**
* 详细信息面板
* todo 文本框可自适应大小公式编辑新写一个
*/
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
stringTextField = new UITextField();
stringTextField.addKeyListener(new KeyAdapter() {
stringTextArea = new UITextArea();
stringTextArea.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (tc == null) {
return;
}
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
//todo 按enter键换至下一个单元格 yaoh.wu虽然模仿选中单元格按enter这种场景可以做到,但是原理没有弄清楚。
GridKeyListener dispatchListener = new GridKeyListener(tc.getGrid());
dispatchListener.keyPressed(e);
dispatchListener.keyTyped(e);
}
}
@Override
public void keyReleased(KeyEvent e) {
if (tc != null) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
return;
}
tc.getGrid().dispatchEvent(e);
}
}
});
content.add(stringTextField, BorderLayout.CENTER);
content.add(stringTextArea, BorderLayout.CENTER);
return content;
}
@ -104,7 +118,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
}
fireTargetModified();
stringTextField.requestFocus();
stringTextArea.requestFocus();
isEditing = false;
}
@ -130,7 +144,7 @@ public class CellStringQuickEditor extends CellQuickEditor {
}
}
showText(str);
stringTextField.setEditable(tc.isSelectedOneCell());
stringTextArea.setEditable(tc.isSelectedOneCell());
}
/**
@ -143,9 +157,14 @@ public class CellStringQuickEditor extends CellQuickEditor {
if (isEditing) {
return;
}
stringTextField.getDocument().removeDocumentListener(documentListener);
stringTextField.setText(str);
stringTextField.getDocument().addDocumentListener(documentListener);
stringTextArea.getDocument().removeDocumentListener(documentListener);
stringTextArea.setText(str);
stringTextArea.getDocument().addDocumentListener(documentListener);
}
@Override
public Object getComboBoxSelected() {
return null;
}
}

18
designer/src/com/fr/quickeditor/cellquick/CellSubReportEditor.java

@ -1,7 +1,10 @@
package com.fr.quickeditor.cellquick;
import com.fr.design.actions.core.ActionFactory;
import com.fr.design.actions.insert.cell.SubReportCellAction;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.quickeditor.CellQuickEditor;
@ -22,22 +25,29 @@ public class CellSubReportEditor extends CellQuickEditor {
super();
}
@SuppressWarnings("Duplicates")
@Override
public JComponent createCenterBody() {
JPanel content = new JPanel(new BorderLayout());
content.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15));
subReportButton = new UIButton();
subReportButton.setOpaque(false);
content.add(subReportButton, BorderLayout.CENTER);
content.add(TableLayoutHelper.createTableLayoutPane(new Component[][]{
new Component[]{emptyLabel, subReportButton}},
new double[]{TableLayout.PREFERRED},
new double[]{TableLayout.PREFERRED, TableLayout.FILL}), BorderLayout.CENTER);
return content;
}
@Override
protected void refreshDetails() {
SubReportCellAction subReportCellAction = new SubReportCellAction(tc);
subReportCellAction.setName(Inter.getLocText(new String[]{"Edit", "Sub_Report"}));
subReportCellAction.setName(Inter.getLocText("Edit"));
subReportCellAction.setSmallIcon(null);
subReportButton.setAction(subReportCellAction);
}
@Override
public Object getComboBoxSelected() {
return ActionFactory.createAction(SubReportCellAction.class);
}
}

42
designer_base/src/com/fr/design/actions/TemplateComponentAction.java

@ -4,30 +4,34 @@ package com.fr.design.actions;
import com.fr.design.designer.TargetComponent;
public abstract class TemplateComponentAction<T extends TargetComponent> extends UndoableAction implements TemplateComponentActionInterface<T> {
private T t;
protected TemplateComponentAction(T t) {
this.t = t;
}
protected void setEditingComponent(T t) {
this.t = t;
}
@Override
public T getEditingComponent() {
return t;
}
@Override
public void prepare4Undo() {
this.getEditingComponent().fireTargetModified();
private T t;
protected TemplateComponentAction() {
}
protected TemplateComponentAction(T t) {
this.t = t;
}
protected void setEditingComponent(T t) {
this.t = t;
}
@Override
public T getEditingComponent() {
return t;
}
@Override
public void prepare4Undo() {
this.getEditingComponent().fireTargetModified();
T component = getEditingComponent();
if (component == null) {
return;
}
component.requestFocus();
}
}
/**
* update enable
@ -35,6 +39,6 @@ public abstract class TemplateComponentAction<T extends TargetComponent> extends
*/
@Override
public void update() {
this.setEnabled(this.getEditingComponent() != null);
this.setEnabled(this.getEditingComponent() != null);
}
}

34
designer_base/src/com/fr/design/actions/core/ActionFactory.java

@ -5,6 +5,7 @@ import com.fr.base.Utils;
import com.fr.design.actions.UpdateAction;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.JTemplate;
import com.fr.design.menu.MenuKeySet;
import com.fr.design.selection.QuickEditor;
import javax.swing.*;
@ -132,6 +133,17 @@ public class ActionFactory {
return createEditor(clazz, cellEditor);
}
public static UpdateAction createAction(Class clazz) {
try {
Constructor<? extends UpdateAction> c = clazz.getDeclaredConstructor();
c.setAccessible(true);
return c.newInstance();
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
return null;
}
/**
* peter:从Action来产生ToolTipText.
*
@ -190,7 +202,7 @@ public class ActionFactory {
}
if (jTemplate.acceptToolbarItem(clazz)) {
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>)clazz.getConstructor(cls);
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
@ -200,6 +212,24 @@ public class ActionFactory {
return actions.toArray(new UpdateAction[actions.size()]);
}
public static MenuKeySet[] createCellInsertActionName() {
List<MenuKeySet> actionNames = new ArrayList<>();
for (Class<?> clazz : actionClasses) {
if (clazz == null) {
continue;
}
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor();
actionNames.add(c.newInstance().getMenuKeySet());
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
}
}
return actionNames.toArray(new MenuKeySet[actionNames.size()]);
}
/**
* 登记悬浮元素插入类型
*
@ -225,7 +255,7 @@ public class ActionFactory {
continue;
}
try {
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>)clazz.getConstructor(cls);
Constructor<? extends UpdateAction> c = (Constructor<? extends UpdateAction>) clazz.getConstructor(cls);
actions.add(c.newInstance(obj));
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);

9
designer_base/src/com/fr/design/menu/ToolBarDef.java

@ -1,14 +1,13 @@
package com.fr.design.menu;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
import javax.swing.*;
import com.fr.design.gui.itoolbar.UIToolBarUI;
import com.fr.design.gui.itoolbar.UIToolbar;
/**
* Define toolbar..
*/

6
designer_base/src/com/fr/start/BaseDesigner.java

@ -12,7 +12,6 @@ import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.file.MutilTempalteTabPane;
import com.fr.design.file.TemplateTreePane;
import com.fr.design.fun.DesignerStartOpenFileProcessor;
import com.fr.design.fun.GlobalListenerProvider;
import com.fr.design.fun.impl.GlobalListenerProviderManager;
import com.fr.design.mainframe.DesignerFrame;
import com.fr.design.mainframe.TemplatePane;
@ -36,7 +35,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.File;
import java.lang.reflect.Method;
import java.util.Set;
/**
* The main class of Report Designer.
@ -84,6 +82,8 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
DesignUtils.initLookAndFeel();
DesignUtils.creatListeningServer(getStartPort(), startFileSuffix());
//初始化插件引擎
PluginManager.init();
// 初始化Log Handler
DesignerEnvManager.loadLogSetting();
DesignerFrame df = createDesignerFrame();
@ -93,7 +93,7 @@ public abstract class BaseDesigner extends ToolBarMenuDock {
initDefaultFont();
//PluginManager要在环境切换和模块启动之前初始化
PluginManager.init();
PluginManager.registerEnvListener();
// 必须先初始化Env再去startModule, 不然会导致lic读取不到
ModuleContext.startModule(module2Start());

Loading…
Cancel
Save