Fangjie Hu 8 years ago
parent
commit
cf670ae8e6
  1. 11
      designer/src/com/fr/design/report/ValueVerifierEditPane.java
  2. 68
      designer_base/src/com/fr/design/gui/itableeditorpane/UIArrayFormulaTableModel.java
  3. 8
      designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

11
designer/src/com/fr/design/report/ValueVerifierEditPane.java

@ -3,13 +3,14 @@ package com.fr.design.report;
import com.fr.base.Formula;
import com.fr.data.VerifyItem;
import com.fr.design.gui.itableeditorpane.ActionStyle;
import com.fr.design.gui.itableeditorpane.UIArrayTableModel;
import com.fr.design.gui.itableeditorpane.UIArrayFormulaTableModel;
import com.fr.design.gui.itableeditorpane.UITableEditorPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.GeneralUtils;
import com.fr.general.Inter;
import com.fr.report.write.ValueVerifier;
import com.fr.stable.FormulaProvider;
import com.fr.stable.StableUtils;
import javax.swing.*;
import java.awt.*;
@ -23,7 +24,7 @@ public class ValueVerifierEditPane extends JPanel {
public ValueVerifierEditPane() {
// ben:UITableEditorPane;
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
tableEditorPane = new UITableEditorPane<Object[]>(new UIArrayTableModel(columnNames, new int[] {
tableEditorPane = new UITableEditorPane(new UIArrayFormulaTableModel(columnNames, new int[] {
ActionStyle.ADDSTYLE, ActionStyle.DELETESTYLE,
ActionStyle.MOVEUPSTYLE, ActionStyle.MOVEDOWNSTYLE}));
this.add(tableEditorPane, BorderLayout.CENTER);
@ -45,7 +46,11 @@ public class ValueVerifierEditPane extends JPanel {
if (formula == null) {
continue;
}
os[tableDataCount++] = new Object[]{formula.getPureContent(), item.getMessage()};
String msg = item.getMessage();
if (!StableUtils.canBeFormula(msg)) {
msg = "\"" + msg + "\"";//如果报错信息是以前的写法(字符串)就拼上""
}
os[tableDataCount++] = new Object[]{formula, new Formula(msg)};
}
this.tableEditorPane.populate(os);
}

68
designer_base/src/com/fr/design/gui/itableeditorpane/UIArrayFormulaTableModel.java

@ -0,0 +1,68 @@
package com.fr.design.gui.itableeditorpane;
import com.fr.design.editor.ValueEditorPane;
import com.fr.design.editor.ValueEditorPaneFactory;
import javax.swing.*;
import javax.swing.event.CellEditorListener;
import javax.swing.event.ChangeEvent;
import javax.swing.table.TableCellEditor;
import java.awt.*;
/**
* 全部是公式编辑的model
* Coder: zack
* Date: 2016/8/31
* Time: 18:58
*/
public class UIArrayFormulaTableModel extends UIArrayTableModel {
public UIArrayFormulaTableModel(String[] s, int[] array) {
super(s, array);
setDefaultEditors();
}
public void setDefaultEditors() {
for (int i = 0; i < getColumnCount(); i++) {
setDefaultEditor(Object.class, new FormulaValueEditor());
}
}
private class FormulaValueEditor extends AbstractCellEditor implements TableCellEditor {
private static final long serialVersionUID = 1L;
private ValueEditorPane editor;
public FormulaValueEditor() {
editor = ValueEditorPaneFactory.createFormulaValueEditorPane();
this.addCellEditorListener(new CellEditorListener() {
@Override
public void editingCanceled(ChangeEvent e) {
}
@Override
public void editingStopped(ChangeEvent e) {
if (table.getSelectedRow() == -1 || table.getSelectedColumn() == -1) {
return;
}
Object[] para = getList().get(table.getSelectedRow());
para[table.getSelectedColumn()] = getCellEditorValue();
fireTableDataChanged();
}
});
}
@Override
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
editor.clearComponentsData();
editor.populate(value == null ? "" : value);
return editor;
}
@Override
public Object getCellEditorValue() {
return editor.update();
}
}
}

8
designer_base/src/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java

@ -284,7 +284,7 @@ public abstract class ToolBarMenuDock {
return processor == null ? new GlobalTableDataAction() : processor.createServerTDAction();
}
private boolean shouldShowPlugin() {
protected boolean shouldShowPlugin() {
return FRContext.isChineseEnv() || ComparatorUtils.equals(GeneralContext.getLocale(), Locale.TAIWAN);
}
@ -326,7 +326,8 @@ public abstract class ToolBarMenuDock {
shortCuts.add(new SignAction());
return shortCuts.toArray(new ShortCut[shortCuts.size()]);
}
private MenuDef createHelpMenuDef() {
public MenuDef createHelpMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_Help"), 'H');
ShortCut[] otherHelpShortCuts = createHelpShortCuts();
for (ShortCut shortCut : otherHelpShortCuts) {
@ -335,7 +336,8 @@ public abstract class ToolBarMenuDock {
insertMenu(menuDef, MenuHandler.HELP);
return menuDef;
}
private MenuDef createCommunityMenuDef() {
public MenuDef createCommunityMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_COMMUNITY"), 'C');
ShortCut[] otherCommunityShortCuts = createCommunityShortCuts();
for (ShortCut shortCut : otherCommunityShortCuts) {

Loading…
Cancel
Save