|
|
@ -20,8 +20,11 @@ import com.fr.grid.selection.CellSelection; |
|
|
|
import com.fr.quickeditor.CellQuickEditor; |
|
|
|
import com.fr.quickeditor.CellQuickEditor; |
|
|
|
import com.fr.report.ReportHelper; |
|
|
|
import com.fr.report.ReportHelper; |
|
|
|
import com.fr.report.cell.DefaultTemplateCellElement; |
|
|
|
import com.fr.report.cell.DefaultTemplateCellElement; |
|
|
|
|
|
|
|
import com.fr.report.cell.TemplateCellElement; |
|
|
|
|
|
|
|
import com.fr.report.elementcase.TemplateElementCase; |
|
|
|
import com.fr.stable.ColumnRow; |
|
|
|
import com.fr.stable.ColumnRow; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
|
|
|
import com.fr.web.core.A.S; |
|
|
|
|
|
|
|
|
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.BorderFactory; |
|
|
|
import javax.swing.JComponent; |
|
|
|
import javax.swing.JComponent; |
|
|
@ -56,6 +59,9 @@ public class CellFormulaQuickEditor extends CellQuickEditor { |
|
|
|
//默认值
|
|
|
|
//默认值
|
|
|
|
private static final String DEFAULT_FORMULA = "="; |
|
|
|
private static final String DEFAULT_FORMULA = "="; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//正在编辑的单元格
|
|
|
|
|
|
|
|
private TemplateCellElement editingCellElement; |
|
|
|
|
|
|
|
|
|
|
|
private DocumentListener documentListener = new DocumentListener() { |
|
|
|
private DocumentListener documentListener = new DocumentListener() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
|
public void insertUpdate(DocumentEvent e) { |
|
|
@ -102,9 +108,11 @@ public class CellFormulaQuickEditor extends CellQuickEditor { |
|
|
|
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height)); |
|
|
|
formulaButton.setPreferredSize(new Dimension(20, formulaTextField.getPreferredSize().height)); |
|
|
|
formulaButton.addActionListener(new ActionListener() { |
|
|
|
formulaButton.addActionListener(new ActionListener() { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
public void actionPerformed(ActionEvent evt) { |
|
|
|
String text = formulaTextField.getText(); |
|
|
|
|
|
|
|
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); |
|
|
|
final UIFormula formulaPane = FormulaFactory.createFormulaPaneWhenReserveFormula(); |
|
|
|
formulaPane.populate(BaseFormula.createFormulaBuilder().build(text)); |
|
|
|
CellSelection cellSelection = (CellSelection)tc.getSelection(); |
|
|
|
|
|
|
|
editingCellElement = tc.getEditingElementCase().getTemplateCellElement(cellSelection.getColumn(),cellSelection.getRow()); |
|
|
|
|
|
|
|
BaseFormula baseFormula = (BaseFormula) editingCellElement.getValue(); |
|
|
|
|
|
|
|
formulaPane.populate(baseFormula); |
|
|
|
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
|
|
|
formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void doOk() { |
|
|
|
public void doOk() { |
|
|
@ -113,8 +121,8 @@ public class CellFormulaQuickEditor extends CellQuickEditor { |
|
|
|
formulaTextField.setText(DEFAULT_FORMULA); |
|
|
|
formulaTextField.setText(DEFAULT_FORMULA); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
formulaTextField.setText(fm.getContent()); |
|
|
|
formulaTextField.setText(fm.getContent()); |
|
|
|
|
|
|
|
editingCellElement.setValue(fm); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
}).setVisible(true); |
|
|
|
}).setVisible(true); |
|
|
|
} |
|
|
|
} |
|
|
|