105 changed files with 5401 additions and 5076 deletions
@ -1,135 +1,128 @@ |
|||||||
/* |
/* |
||||||
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
* Copyright(c) 2001-2010, FineReport Inc, All Rights Reserved. |
||||||
*/ |
*/ |
||||||
package com.fr.design.actions.insert.flot; |
package com.fr.design.actions.insert.flot; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.base.DynamicUnitList; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.base.Formula; |
import com.fr.base.DynamicUnitList; |
||||||
import com.fr.design.actions.ElementCaseAction; |
import com.fr.design.actions.ElementCaseAction; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.file.HistoryTemplateListPane; |
import com.fr.design.file.HistoryTemplateListPane; |
||||||
import com.fr.design.formula.FormulaFactory; |
import com.fr.design.formula.FormulaFactory; |
||||||
import com.fr.design.formula.UIFormula; |
import com.fr.design.formula.UIFormula; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.mainframe.DesignerContext; |
||||||
import com.fr.design.mainframe.ElementCasePane; |
import com.fr.design.mainframe.ElementCasePane; |
||||||
import com.fr.design.menu.MenuKeySet; |
import com.fr.design.menu.MenuKeySet; |
||||||
import com.fr.design.report.SelectImagePane; |
import com.fr.general.Inter; |
||||||
import com.fr.general.Inter; |
import com.fr.grid.Grid; |
||||||
import com.fr.grid.Grid; |
import com.fr.grid.selection.FloatSelection; |
||||||
import com.fr.grid.selection.FloatSelection; |
import com.fr.report.ReportHelper; |
||||||
import com.fr.report.ReportHelper; |
import com.fr.report.cell.FloatElement; |
||||||
import com.fr.report.cell.FloatElement; |
import com.fr.report.elementcase.TemplateElementCase; |
||||||
import com.fr.report.cell.cellattr.CellImage; |
import com.fr.stable.unit.FU; |
||||||
import com.fr.report.elementcase.TemplateElementCase; |
|
||||||
import com.fr.stable.CoreGraphHelper; |
import javax.swing.*; |
||||||
import com.fr.stable.StringUtils; |
|
||||||
import com.fr.stable.unit.FU; |
/** |
||||||
|
* Insert formula. |
||||||
import javax.swing.*; |
*/ |
||||||
import java.awt.*; |
public class FormulaFloatAction extends ElementCaseAction { |
||||||
import java.awt.event.ActionEvent; |
|
||||||
import java.io.File; |
private boolean returnValue = false; |
||||||
|
|
||||||
/** |
public FormulaFloatAction(ElementCasePane t) { |
||||||
* Insert formula. |
super(t); |
||||||
*/ |
this.setMenuKeySet(FLOAT_INSERT_FORMULA); |
||||||
public class FormulaFloatAction extends ElementCaseAction { |
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||||
|
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||||
private boolean returnValue = false; |
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
||||||
|
} |
||||||
public FormulaFloatAction(ElementCasePane t) { |
|
||||||
super(t); |
public static final MenuKeySet FLOAT_INSERT_FORMULA = new MenuKeySet() { |
||||||
this.setMenuKeySet(FLOAT_INSERT_FORMULA); |
@Override |
||||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
public char getMnemonic() { |
||||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
return 'F'; |
||||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png")); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
public static final MenuKeySet FLOAT_INSERT_FORMULA = new MenuKeySet() { |
public String getMenuName() { |
||||||
@Override |
return Inter.getLocText("FR-Designer_Insert_Formula"); |
||||||
public char getMnemonic() { |
} |
||||||
return 'F'; |
|
||||||
} |
@Override |
||||||
|
public KeyStroke getKeyStroke() { |
||||||
@Override |
return null; |
||||||
public String getMenuName() { |
} |
||||||
return Inter.getLocText("FR-Designer_Insert_Formula"); |
}; |
||||||
} |
|
||||||
|
private void doWithDrawingFloatElement() { |
||||||
@Override |
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
||||||
public KeyStroke getKeyStroke() { |
Grid grid = jws.getGrid(); |
||||||
return null; |
|
||||||
} |
ElementCasePane reportPane = grid.getElementCasePane(); |
||||||
}; |
TemplateElementCase report = reportPane.getEditingElementCase(); |
||||||
|
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); |
||||||
private void doWithDrawingFloatElement() { |
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); |
||||||
ElementCasePane jws = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
|
||||||
Grid grid = jws.getGrid(); |
int horizentalScrollValue = grid.getHorizontalValue(); |
||||||
|
int verticalScrollValue = grid.getVerticalValue(); |
||||||
ElementCasePane reportPane = grid.getElementCasePane(); |
|
||||||
TemplateElementCase report = reportPane.getEditingElementCase(); |
int resolution = grid.getResolution(); |
||||||
DynamicUnitList columnWidthList = ReportHelper.getColumnWidthList(report); |
int floatWdith = grid.getDrawingFloatElement().getWidth().toPixI(resolution); |
||||||
DynamicUnitList rowHeightList = ReportHelper.getRowHeightList(report); |
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution); |
||||||
|
|
||||||
int horizentalScrollValue = grid.getHorizontalValue(); |
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution); |
||||||
int verticalScrollValue = grid.getVerticalValue(); |
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 2, resolution); |
||||||
|
|
||||||
int resolution = grid.getResolution(); |
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU()); |
||||||
int floatWdith = grid.getDrawingFloatElement().getWidth().toPixI(resolution); |
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU()); |
||||||
int floatHeight = grid.getDrawingFloatElement().getWidth().toPixI(resolution); |
|
||||||
|
grid.getDrawingFloatElement().setLeftDistance(leftDistance); |
||||||
FU evtX_fu = FU.valueOfPix((grid.getWidth() - floatWdith) / 2, resolution); |
grid.getDrawingFloatElement().setTopDistance(topDistance); |
||||||
FU evtY_fu = FU.valueOfPix((grid.getHeight() - floatHeight) / 2, resolution); |
|
||||||
|
report.addFloatElement(grid.getDrawingFloatElement()); |
||||||
FU leftDistance = FU.getInstance(evtX_fu.toFU() + columnWidthList.getRangeValue(0, horizentalScrollValue).toFU()); |
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); |
||||||
FU topDistance = FU.getInstance(evtY_fu.toFU() + rowHeightList.getRangeValue(0, verticalScrollValue).toFU()); |
} |
||||||
|
|
||||||
grid.getDrawingFloatElement().setLeftDistance(leftDistance); |
/** |
||||||
grid.getDrawingFloatElement().setTopDistance(topDistance); |
* 执行动作 |
||||||
|
* |
||||||
report.addFloatElement(grid.getDrawingFloatElement()); |
* @return 成功返回true |
||||||
reportPane.setSelection(new FloatSelection(grid.getDrawingFloatElement().getName())); |
*/ |
||||||
} |
@Override |
||||||
|
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
/** |
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
||||||
* 执行动作 |
if (reportPane == null) { |
||||||
* |
return false; |
||||||
* @return 成功返回true |
} |
||||||
*/ |
|
||||||
@Override |
reportPane.stopEditing(); |
||||||
public boolean executeActionReturnUndoRecordNeeded() { |
final FloatElement floatElement = new FloatElement(); |
||||||
final ElementCasePane reportPane = (ElementCasePane) HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().getCurrentElementCasePane(); |
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
||||||
if (reportPane == null) { |
formulaPane.populate(BaseFormula.createFormulaBuilder().build()); |
||||||
return false; |
|
||||||
} |
BasicDialog dialog = formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
||||||
|
|
||||||
reportPane.stopEditing(); |
@Override |
||||||
final FloatElement floatElement = new FloatElement(); |
public void doOk() { |
||||||
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
floatElement.setValue(formulaPane.update()); |
||||||
formulaPane.populate(new Formula(StringUtils.EMPTY)); |
if (reportPane == null) { |
||||||
|
return; |
||||||
BasicDialog dialog = formulaPane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { |
} |
||||||
|
reportPane.getGrid().setDrawingFloatElement(floatElement); |
||||||
@Override |
doWithDrawingFloatElement(); |
||||||
public void doOk() { |
returnValue = true; |
||||||
floatElement.setValue(formulaPane.update()); |
} |
||||||
if (reportPane == null) { |
|
||||||
return; |
@Override |
||||||
} |
public void doCancel() { |
||||||
reportPane.getGrid().setDrawingFloatElement(floatElement); |
returnValue = false; |
||||||
doWithDrawingFloatElement(); |
} |
||||||
returnValue = true; |
}); |
||||||
} |
dialog.setVisible(true); |
||||||
|
return returnValue; |
||||||
@Override |
} |
||||||
public void doCancel() { |
|
||||||
returnValue = false; |
|
||||||
} |
|
||||||
}); |
|
||||||
dialog.setVisible(true); |
|
||||||
return returnValue; |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
@ -1,71 +1,71 @@ |
|||||||
package com.fr.design.report; |
package com.fr.design.report; |
||||||
|
|
||||||
import com.fr.base.Formula; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.data.VerifyItem; |
import com.fr.data.VerifyItem; |
||||||
import com.fr.design.gui.itableeditorpane.ActionStyle; |
import com.fr.design.gui.itableeditorpane.ActionStyle; |
||||||
import com.fr.design.gui.itableeditorpane.UIArrayFormulaTableModel; |
import com.fr.design.gui.itableeditorpane.UIArrayFormulaTableModel; |
||||||
import com.fr.design.gui.itableeditorpane.UITableEditorPane; |
import com.fr.design.gui.itableeditorpane.UITableEditorPane; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.general.GeneralUtils; |
import com.fr.general.GeneralUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.report.write.ValueVerifier; |
import com.fr.report.write.ValueVerifier; |
||||||
import com.fr.stable.FormulaProvider; |
import com.fr.stable.FormulaProvider; |
||||||
import com.fr.stable.StableUtils; |
import com.fr.stable.StableUtils; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
|
|
||||||
public class ValueVerifierEditPane extends JPanel { |
public class ValueVerifierEditPane extends JPanel { |
||||||
private UITableEditorPane<Object[]> tableEditorPane; |
private UITableEditorPane<Object[]> tableEditorPane; |
||||||
private final String[] columnNames = new String[] { |
private final String[] columnNames = new String[] { |
||||||
Inter.getLocText(new String[] {"Verify-Verify_Formula", "Verify-ToolTips"}, new String[] {"(", ")"}), |
Inter.getLocText(new String[] {"Verify-Verify_Formula", "Verify-ToolTips"}, new String[] {"(", ")"}), |
||||||
Inter.getLocText("Verify-Error_Information") }; |
Inter.getLocText("Verify-Error_Information") }; |
||||||
|
|
||||||
public ValueVerifierEditPane() { |
public ValueVerifierEditPane() { |
||||||
// ben:UITableEditorPane;
|
// ben:UITableEditorPane;
|
||||||
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
||||||
tableEditorPane = new UITableEditorPane(new UIArrayFormulaTableModel(columnNames, new int[] { |
tableEditorPane = new UITableEditorPane(new UIArrayFormulaTableModel(columnNames, new int[] { |
||||||
ActionStyle.ADDSTYLE, ActionStyle.DELETESTYLE, |
ActionStyle.ADDSTYLE, ActionStyle.DELETESTYLE, |
||||||
ActionStyle.MOVEUPSTYLE, ActionStyle.MOVEDOWNSTYLE})); |
ActionStyle.MOVEUPSTYLE, ActionStyle.MOVEDOWNSTYLE})); |
||||||
this.add(tableEditorPane, BorderLayout.CENTER); |
this.add(tableEditorPane, BorderLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* populate |
* populate |
||||||
*/ |
*/ |
||||||
public void populate(ValueVerifier valueVerifier) { |
public void populate(ValueVerifier valueVerifier) { |
||||||
if (valueVerifier == null) { |
if (valueVerifier == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
int rowCount = valueVerifier.getVerifyItemsCount(); |
int rowCount = valueVerifier.getVerifyItemsCount(); |
||||||
Object[][] os = new Object[rowCount][]; |
Object[][] os = new Object[rowCount][]; |
||||||
int tableDataCount = 0; |
int tableDataCount = 0; |
||||||
for (int i = 0; i < rowCount; i ++) { |
for (int i = 0; i < rowCount; i ++) { |
||||||
VerifyItem item = valueVerifier.getVerifyItem(i); |
VerifyItem item = valueVerifier.getVerifyItem(i); |
||||||
FormulaProvider formula = item.getFormula(); |
FormulaProvider formula = item.getFormula(); |
||||||
if (formula == null) { |
if (formula == null) { |
||||||
continue; |
continue; |
||||||
} |
} |
||||||
String msg = item.getMessage(); |
String msg = item.getMessage(); |
||||||
if (!StableUtils.canBeFormula(msg)) { |
if (!StableUtils.canBeFormula(msg)) { |
||||||
msg = "\"" + msg + "\"";//如果报错信息是以前的写法(字符串)就拼上""
|
msg = "\"" + msg + "\"";//如果报错信息是以前的写法(字符串)就拼上""
|
||||||
} |
} |
||||||
os[tableDataCount++] = new Object[]{formula, new Formula(msg)}; |
os[tableDataCount++] = new Object[]{formula, BaseFormula.createFormulaBuilder().build(msg)}; |
||||||
} |
} |
||||||
this.tableEditorPane.populate(os); |
this.tableEditorPane.populate(os); |
||||||
} |
} |
||||||
|
|
||||||
public ValueVerifier update() { |
public ValueVerifier update() { |
||||||
ValueVerifier valueVerifier = new ValueVerifier(); |
ValueVerifier valueVerifier = new ValueVerifier(); |
||||||
java.util.List<Object[]> list = tableEditorPane.update(); |
java.util.List<Object[]> list = tableEditorPane.update(); |
||||||
for (int i = 0; i < list.size(); i++) { |
for (int i = 0; i < list.size(); i++) { |
||||||
Object[] o = list.get(i); |
Object[] o = list.get(i); |
||||||
if (o == null || o[0] == null) { |
if (o == null || o[0] == null) { |
||||||
continue; |
continue; |
||||||
} |
} |
||||||
VerifyItem item = new VerifyItem(new Formula(GeneralUtils.objectToString(o[0])), GeneralUtils.objectToString(o[1])); |
VerifyItem item = new VerifyItem(BaseFormula.createFormulaBuilder().build(o[0]), GeneralUtils.objectToString(o[1])); |
||||||
valueVerifier.addVerifyItem(item); |
valueVerifier.addVerifyItem(item); |
||||||
} |
} |
||||||
return valueVerifier; |
return valueVerifier; |
||||||
} |
} |
||||||
} |
} |
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -1,178 +1,176 @@ |
|||||||
package com.fr.design.data.tabledata.tabledatapane; |
package com.fr.design.data.tabledata.tabledatapane; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.base.BaseFormula; |
||||||
import java.awt.Component; |
import com.fr.base.StoreProcedureParameter; |
||||||
import java.util.Date; |
import com.fr.data.impl.storeproc.StoreProcedureConstants; |
||||||
import java.util.HashMap; |
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.editor.ValueEditorPane; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.editor.ValueEditorPaneFactory; |
||||||
import javax.swing.JPanel; |
import com.fr.design.editor.editor.CursorEditor; |
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
import com.fr.base.Formula; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.general.NameObject; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.base.StoreProcedureParameter; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.data.impl.storeproc.StoreProcedureConstants; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.general.Inter; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.general.NameObject; |
||||||
import com.fr.design.layout.TableLayout; |
|
||||||
import com.fr.design.layout.TableLayoutHelper; |
import javax.swing.*; |
||||||
import com.fr.design.dialog.BasicPane; |
import java.awt.*; |
||||||
import com.fr.design.editor.ValueEditorPane; |
import java.util.Date; |
||||||
import com.fr.design.editor.ValueEditorPaneFactory; |
import java.util.HashMap; |
||||||
import com.fr.design.editor.editor.CursorEditor; |
|
||||||
import com.fr.general.Inter; |
|
||||||
|
public class StoreProcedureParameterPane extends BasicPane { |
||||||
|
|
||||||
public class StoreProcedureParameterPane extends BasicPane { |
private static String[] schemaName = new String[]{ |
||||||
|
"IN", "OUT", "INOUT" |
||||||
private static String[] schemaName = new String[]{ |
}; |
||||||
"IN", "OUT", "INOUT" |
|
||||||
}; |
private static NameObject[] nameAndValue = new NameObject[]{ |
||||||
|
new NameObject(Inter.getLocText("Cursor"), StoreProcedureConstants.CURSOR), |
||||||
private static NameObject[] nameAndValue = new NameObject[]{ |
new NameObject(Inter.getLocText("Parameter-String"), StoreProcedureConstants.VARCHAR), |
||||||
new NameObject(Inter.getLocText("Cursor"), StoreProcedureConstants.CURSOR), |
new NameObject(Inter.getLocText("Integer"), StoreProcedureConstants.INTEGER), |
||||||
new NameObject(Inter.getLocText("Parameter-String"), StoreProcedureConstants.VARCHAR), |
new NameObject(Inter.getLocText("Double"), StoreProcedureConstants.DECIMAL), |
||||||
new NameObject(Inter.getLocText("Integer"), StoreProcedureConstants.INTEGER), |
new NameObject(Inter.getLocText("Date"), StoreProcedureConstants.DATE), |
||||||
new NameObject(Inter.getLocText("Double"), StoreProcedureConstants.DECIMAL), |
new NameObject(Inter.getLocText("Parameter-Boolean"), StoreProcedureConstants.BOOLEAN), |
||||||
new NameObject(Inter.getLocText("Date"), StoreProcedureConstants.DATE), |
new NameObject(Inter.getLocText("Formula"), StoreProcedureConstants.FORMULA), |
||||||
new NameObject(Inter.getLocText("Parameter-Boolean"), StoreProcedureConstants.BOOLEAN), |
new NameObject("IN",StoreProcedureConstants.IN), |
||||||
new NameObject(Inter.getLocText("Formula"), StoreProcedureConstants.FORMULA), |
new NameObject("OUT",StoreProcedureConstants.OUT), |
||||||
new NameObject("IN",StoreProcedureConstants.IN), |
new NameObject("INOUT",StoreProcedureConstants.INOUT) |
||||||
new NameObject("OUT",StoreProcedureConstants.OUT), |
}; |
||||||
new NameObject("INOUT",StoreProcedureConstants.INOUT) |
|
||||||
}; |
private static HashMap<String, Integer> infoMap = new HashMap<String, Integer>(); |
||||||
|
static { |
||||||
private static HashMap<String, Integer> infoMap = new HashMap<String, Integer>(); |
for(int i = 0; i < nameAndValue.length; i ++){ |
||||||
static { |
infoMap.put(nameAndValue[i].getName(), (Integer) nameAndValue[i].getObject()); |
||||||
for(int i = 0; i < nameAndValue.length; i ++){ |
} |
||||||
infoMap.put(nameAndValue[i].getName(), (Integer) nameAndValue[i].getObject()); |
} |
||||||
} |
|
||||||
} |
private UITextField nameField; |
||||||
|
private UIComboBox schemaCombo; |
||||||
private UITextField nameField; |
private ValueEditorPane valueEditPane; |
||||||
private UIComboBox schemaCombo; |
private JPanel valuePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
private ValueEditorPane valueEditPane; |
|
||||||
private JPanel valuePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
public StoreProcedureParameterPane(){ |
||||||
|
valueEditPane = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); |
||||||
public StoreProcedureParameterPane(){ |
this.initComponents(); |
||||||
valueEditPane = ValueEditorPaneFactory.createStoreProcedValueEditorPane(); |
} |
||||||
this.initComponents(); |
|
||||||
} |
public void checkValid() throws Exception{ |
||||||
|
StoreProcedureParameter spp=this.update(); |
||||||
public void checkValid() throws Exception{ |
if(spp.getSchema()!= StoreProcedureConstants.OUT && spp.getType() == StoreProcedureConstants.CURSOR){ |
||||||
StoreProcedureParameter spp=this.update(); |
throw new Exception(Inter.getLocText("IN_and_INOUT_type_not_as_cursor")); |
||||||
if(spp.getSchema()!= StoreProcedureConstants.OUT && spp.getType() == StoreProcedureConstants.CURSOR){ |
} |
||||||
throw new Exception(Inter.getLocText("IN_and_INOUT_type_not_as_cursor")); |
} |
||||||
} |
|
||||||
} |
private void initComponents(){ |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
private void initComponents(){ |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
schemaCombo = new UIComboBox(); |
||||||
|
initUIComboBox(schemaCombo, schemaName); |
||||||
schemaCombo = new UIComboBox(); |
JPanel namePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
initUIComboBox(schemaCombo, schemaName); |
namePane.add(new UILabel(" " + Inter.getLocText("Name") + ":"), BorderLayout.WEST); |
||||||
JPanel namePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
nameField = new UITextField(10); |
||||||
namePane.add(new UILabel(" " + Inter.getLocText("Name") + ":"), BorderLayout.WEST); |
namePane.add(nameField, BorderLayout.CENTER); |
||||||
nameField = new UITextField(10); |
namePane.add(new UILabel(" "), BorderLayout.EAST); |
||||||
namePane.add(nameField, BorderLayout.CENTER); |
valuePane.add(new UILabel(" " + Inter.getLocText("CellWrite-InsertRow_DEFAULT") + ":"), BorderLayout.WEST); |
||||||
namePane.add(new UILabel(" "), BorderLayout.EAST); |
valuePane.add(valueEditPane, BorderLayout.CENTER); |
||||||
valuePane.add(new UILabel(" " + Inter.getLocText("CellWrite-InsertRow_DEFAULT") + ":"), BorderLayout.WEST); |
valuePane.add(new UILabel(" "), BorderLayout.EAST); |
||||||
valuePane.add(valueEditPane, BorderLayout.CENTER); |
Component[][] components = {{null}, |
||||||
valuePane.add(new UILabel(" "), BorderLayout.EAST); |
{namePane}, |
||||||
Component[][] components = {{null}, |
{addPane("Model", 1, schemaCombo)}, |
||||||
{namePane}, |
{valuePane}, |
||||||
{addPane("Model", 1, schemaCombo)}, |
{null} |
||||||
{valuePane}, |
}; |
||||||
{null} |
double p = TableLayout.PREFERRED; |
||||||
}; |
double[] rowSize = {p, p, p, p, p, p}; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {p}; |
||||||
double[] rowSize = {p, p, p, p, p, p}; |
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane( |
||||||
double[] columnSize = {p}; |
components, rowSize, columnSize, 20, 10); |
||||||
JPanel centerPane = TableLayoutHelper.createGapTableLayoutPane( |
this.add(centerPane, BorderLayout.CENTER); |
||||||
components, rowSize, columnSize, 20, 10); |
|
||||||
this.add(centerPane, BorderLayout.CENTER); |
} |
||||||
|
|
||||||
} |
private JPanel addPane(String s, int i, UIComboBox combo){ |
||||||
|
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
private JPanel addPane(String s, int i, UIComboBox combo){ |
pane.add(new UILabel(" " + Inter.getLocText(s) + ":"), BorderLayout.WEST); |
||||||
JPanel pane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
combo.setSelectedIndex(i); |
||||||
pane.add(new UILabel(" " + Inter.getLocText(s) + ":"), BorderLayout.WEST); |
pane.add(combo, BorderLayout.CENTER); |
||||||
combo.setSelectedIndex(i); |
pane.add(new UILabel(" "), BorderLayout.EAST); |
||||||
pane.add(combo, BorderLayout.CENTER); |
|
||||||
pane.add(new UILabel(" "), BorderLayout.EAST); |
return pane; |
||||||
|
} |
||||||
return pane; |
|
||||||
} |
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
@Override |
return Inter.getLocText("Parameter"); |
||||||
protected String title4PopupWindow() { |
} |
||||||
return Inter.getLocText("Parameter"); |
|
||||||
} |
public void populate(StoreProcedureParameter stpParameter) { |
||||||
|
if(stpParameter == null) |
||||||
public void populate(StoreProcedureParameter stpParameter) { |
return; |
||||||
if(stpParameter == null) |
this.nameField.setText(stpParameter.getName()); |
||||||
return; |
String schema = getInfo4Name(stpParameter.getSchema()); |
||||||
this.nameField.setText(stpParameter.getName()); |
this.schemaCombo.setSelectedItem(schema); |
||||||
String schema = getInfo4Name(stpParameter.getSchema()); |
this.valueEditPane.populate(stpParameter.getValue()); |
||||||
this.schemaCombo.setSelectedItem(schema); |
|
||||||
this.valueEditPane.populate(stpParameter.getValue()); |
} |
||||||
|
|
||||||
} |
public StoreProcedureParameter update(){ |
||||||
|
StoreProcedureParameter p = new StoreProcedureParameter(); |
||||||
public StoreProcedureParameter update(){ |
p.setName(nameField.getText()); |
||||||
StoreProcedureParameter p = new StoreProcedureParameter(); |
Object value = valueEditPane.update(); |
||||||
p.setName(nameField.getText()); |
String type = ""; |
||||||
Object value = valueEditPane.update(); |
if(value instanceof CursorEditor) |
||||||
String type = ""; |
type=Inter.getLocText("Cursor"); |
||||||
if(value instanceof CursorEditor) |
else if(value instanceof String ){ |
||||||
type=Inter.getLocText("Cursor"); |
if(((String) value).length() > 0 && ((String) value).charAt(0) == '=') |
||||||
else if(value instanceof String ){ |
type = Inter.getLocText("Formula"); |
||||||
if(((String) value).length() > 0 && ((String) value).charAt(0) == '=') |
else |
||||||
type = Inter.getLocText("Formula"); |
type = Inter.getLocText("Parameter-String"); |
||||||
else |
}else if(value instanceof Integer) |
||||||
type = Inter.getLocText("Parameter-String"); |
type = Inter.getLocText("Integer"); |
||||||
}else if(value instanceof Integer) |
else if(value instanceof Double) |
||||||
type = Inter.getLocText("Integer"); |
type = Inter.getLocText("Double"); |
||||||
else if(value instanceof Double) |
else if(value instanceof Date) |
||||||
type = Inter.getLocText("Double"); |
type = Inter.getLocText("Date"); |
||||||
else if(value instanceof Date) |
else if(value instanceof Boolean) |
||||||
type = Inter.getLocText("Date"); |
type = Inter.getLocText("Parameter-Boolean"); |
||||||
else if(value instanceof Boolean) |
else if(value instanceof BaseFormula) |
||||||
type = Inter.getLocText("Parameter-Boolean"); |
type = Inter.getLocText("Formula"); |
||||||
else if(value instanceof Formula) |
else |
||||||
type = Inter.getLocText("Formula"); |
type = Inter.getLocText("Parameter-String"); |
||||||
else |
int typeVl = getInfo4Value(type); |
||||||
type = Inter.getLocText("Parameter-String"); |
p.setType(typeVl); |
||||||
int typeVl = getInfo4Value(type); |
String schema = (String)schemaCombo.getSelectedItem(); |
||||||
p.setType(typeVl); |
int schemaVl = getInfo4Value(schema); |
||||||
String schema = (String)schemaCombo.getSelectedItem(); |
p.setSchema(schemaVl); |
||||||
int schemaVl = getInfo4Value(schema); |
p.setValue(value); |
||||||
p.setSchema(schemaVl); |
|
||||||
p.setValue(value); |
return p; |
||||||
|
} |
||||||
return p; |
|
||||||
} |
private void initUIComboBox(UIComboBox combo, String[] p){ |
||||||
|
for(int i = 0; i < p.length; i ++) |
||||||
private void initUIComboBox(UIComboBox combo, String[] p){ |
combo.addItem(p[i]); |
||||||
for(int i = 0; i < p.length; i ++) |
} |
||||||
combo.addItem(p[i]); |
|
||||||
} |
public static int getInfo4Value(String name){ |
||||||
|
return infoMap.get(name); |
||||||
public static int getInfo4Value(String name){ |
} |
||||||
return infoMap.get(name); |
|
||||||
} |
public static String getInfo4Name(int value){ |
||||||
|
java.util.Set<String> set = infoMap.keySet(); |
||||||
public static String getInfo4Name(int value){ |
for(String s : set){ |
||||||
java.util.Set<String> set = infoMap.keySet(); |
if(infoMap.get(s) == value) |
||||||
for(String s : set){ |
return s; |
||||||
if(infoMap.get(s) == value) |
} |
||||||
return s; |
return null; |
||||||
} |
} |
||||||
return null; |
/** |
||||||
} |
* |
||||||
/** |
*/ |
||||||
* |
private static final long serialVersionUID = 1L; |
||||||
*/ |
|
||||||
private static final long serialVersionUID = 1L; |
|
||||||
} |
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.fr.design.dialog; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2017/10/25. |
||||||
|
*/ |
||||||
|
public abstract class AttrScrollPane extends BasicScrollPane { |
||||||
|
private static final int OVER_WIDTH = 10; |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(Object ob) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected int getOverWidth() { |
||||||
|
return OVER_WIDTH; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean hideBarWidth() { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -1,405 +1,408 @@ |
|||||||
package com.fr.design.editor; |
package com.fr.design.editor; |
||||||
|
|
||||||
import com.fr.base.Formula; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.design.DesignerEnvManager; |
import com.fr.design.DesignerEnvManager; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.editor.editor.*; |
import com.fr.design.editor.editor.ColumnNameEditor; |
||||||
import com.fr.design.event.GlobalNameListener; |
import com.fr.design.editor.editor.Editor; |
||||||
import com.fr.design.event.GlobalNameObserver; |
import com.fr.design.editor.editor.FormulaEditor; |
||||||
import com.fr.design.event.UIObserver; |
import com.fr.design.editor.editor.TextEditor; |
||||||
import com.fr.design.event.UIObserverListener; |
import com.fr.design.editor.editor.XMLANameEditor; |
||||||
import com.fr.design.gui.ibutton.UIButton; |
import com.fr.design.event.GlobalNameListener; |
||||||
import com.fr.design.gui.imenu.UIMenuEastAttrItem; |
import com.fr.design.event.GlobalNameObserver; |
||||||
import com.fr.design.gui.imenu.UIPopupEastAttrMenu; |
import com.fr.design.event.UIObserver; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.event.UIObserverListener; |
||||||
import com.fr.design.mainframe.DesignerContext; |
import com.fr.design.gui.ibutton.UIButton; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.design.gui.imenu.UIMenuEastAttrItem; |
||||||
import com.fr.general.Inter; |
import com.fr.design.gui.imenu.UIPopupEastAttrMenu; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
import javax.swing.*; |
import com.fr.general.ComparatorUtils; |
||||||
import java.awt.*; |
import com.fr.general.Inter; |
||||||
import java.awt.event.ActionEvent; |
import com.fr.stable.StringUtils; |
||||||
import java.awt.event.ActionListener; |
|
||||||
import java.awt.event.MouseAdapter; |
import javax.swing.*; |
||||||
import java.awt.event.MouseEvent; |
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
public class ValueEditorPane extends BasicPane implements UIObserver, GlobalNameObserver { |
import java.awt.event.ActionListener; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
private Editor[] cards; |
import java.awt.event.MouseEvent; |
||||||
|
|
||||||
private Editor currentEditor; |
public class ValueEditorPane extends BasicPane implements UIObserver, GlobalNameObserver { |
||||||
|
|
||||||
private UIButton arrowButton; |
private Editor[] cards; |
||||||
private JPopupMenu menu; |
|
||||||
private JPanel centerPane; |
private Editor currentEditor; |
||||||
|
|
||||||
private Object value; |
private UIButton arrowButton; |
||||||
|
private JPopupMenu menu; |
||||||
private GlobalNameListener globalNameListener = null; |
private JPanel centerPane; |
||||||
private UIObserverListener uiObserverListener = null; |
|
||||||
|
private Object value; |
||||||
public ValueEditorPane(Editor[] cards) { |
|
||||||
this(cards, null, null); |
private GlobalNameListener globalNameListener = null; |
||||||
} |
private UIObserverListener uiObserverListener = null; |
||||||
|
|
||||||
public ValueEditorPane(Editor[] cards, String popupName, String textEditorValue) { |
public ValueEditorPane(Editor[] cards) { |
||||||
initComponents(cards, popupName, textEditorValue, 200); |
this(cards, null, null); |
||||||
} |
} |
||||||
|
|
||||||
public ValueEditorPane(Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) { |
public ValueEditorPane(Editor[] cards, String popupName, String textEditorValue) { |
||||||
initComponents(cards, popupName, textEditorValue, centerPaneWidth); |
initComponents(cards, popupName, textEditorValue, 200); |
||||||
} |
} |
||||||
|
|
||||||
private void initComponents(final Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) { |
public ValueEditorPane(Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) { |
||||||
|
initComponents(cards, popupName, textEditorValue, centerPaneWidth); |
||||||
this.cards = cards; |
} |
||||||
|
|
||||||
// Frank:布局
|
private void initComponents(final Editor[] cards, String popupName, String textEditorValue, int centerPaneWidth) { |
||||||
this.setLayout(new BorderLayout(2, 0)); |
|
||||||
centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
this.cards = cards; |
||||||
arrowButton = new UIButton(); |
|
||||||
arrowButton.set4ToolbarButton(); |
// Frank:布局
|
||||||
setCurrentEditor(0); |
this.setLayout(new BorderLayout(2, 0)); |
||||||
centerPane.setPreferredSize(new Dimension(centerPaneWidth, centerPane.getPreferredSize().height)); |
centerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||||
arrowButton.setPreferredSize(new Dimension(20, centerPane.getPreferredSize().height)); |
arrowButton = new UIButton(); |
||||||
final Color beforeColor = arrowButton.getBackground(); |
arrowButton.set4ToolbarButton(); |
||||||
menu = createPopMenu(); |
setCurrentEditor(0); |
||||||
|
centerPane.setPreferredSize(new Dimension(centerPaneWidth, centerPane.getPreferredSize().height)); |
||||||
arrowButton.addMouseListener(new MouseAdapter() { |
arrowButton.setPreferredSize(new Dimension(20, centerPane.getPreferredSize().height)); |
||||||
public void mouseEntered(MouseEvent a) { |
final Color beforeColor = arrowButton.getBackground(); |
||||||
if (cards != null && cards.length > 1) { |
menu = createPopMenu(); |
||||||
arrowButton.setBackground(new Color(228, 246, 255)); |
|
||||||
arrowButton.repaint(); |
arrowButton.addMouseListener(new MouseAdapter() { |
||||||
} |
public void mouseEntered(MouseEvent a) { |
||||||
} |
if (cards != null && cards.length > 1) { |
||||||
|
arrowButton.setBackground(new Color(228, 246, 255)); |
||||||
public void mouseExited(MouseEvent a) { |
arrowButton.repaint(); |
||||||
arrowButton.setBackground(beforeColor); |
} |
||||||
arrowButton.setBorder(null); |
} |
||||||
} |
|
||||||
}); |
public void mouseExited(MouseEvent a) { |
||||||
arrowButton.addActionListener(new ActionListener() { |
arrowButton.setBackground(beforeColor); |
||||||
public void actionPerformed(ActionEvent e) { |
arrowButton.setBorder(null); |
||||||
if (cards != null && cards.length > 1) { // 如果只有“列”的话,就不需要弹出菜单了
|
} |
||||||
Rectangle re = centerPane.getBounds(); |
}); |
||||||
menu.setPopupSize(re.width + arrowButton.getWidth(), menu.getPreferredSize().height); |
arrowButton.addActionListener(new ActionListener() { |
||||||
menu.show(centerPane, -arrowButton.getWidth(), re.height); |
public void actionPerformed(ActionEvent e) { |
||||||
} |
if (cards != null && cards.length > 1) { // 如果只有“列”的话,就不需要弹出菜单了
|
||||||
} |
Rectangle re = centerPane.getBounds(); |
||||||
}); |
menu.setPopupSize(re.width + arrowButton.getWidth(), menu.getPreferredSize().height); |
||||||
|
menu.show(centerPane, -arrowButton.getWidth(), re.height); |
||||||
this.add(centerPane, BorderLayout.CENTER); |
} |
||||||
if (cards.length > 1) { |
} |
||||||
this.add(arrowButton, BorderLayout.WEST); |
}); |
||||||
} |
|
||||||
} |
this.add(centerPane, BorderLayout.CENTER); |
||||||
|
if (cards.length > 1) { |
||||||
@Override |
this.add(arrowButton, BorderLayout.WEST); |
||||||
protected String title4PopupWindow() { |
} |
||||||
return Inter.getLocText("FR-Designer_Values-Editor"); |
} |
||||||
} |
|
||||||
|
@Override |
||||||
public Editor getCurrentEditor() { |
protected String title4PopupWindow() { |
||||||
return currentEditor; |
return Inter.getLocText("FR-Designer_Values-Editor"); |
||||||
} |
} |
||||||
|
|
||||||
public int getCurrentEditorIndex() { |
public Editor getCurrentEditor() { |
||||||
for (int i = 0;i < cards.length; i++){ |
return currentEditor; |
||||||
if (cards[i].getClass() == currentEditor.getClass()){ |
} |
||||||
return i; |
|
||||||
} |
public int getCurrentEditorIndex() { |
||||||
} |
for (int i = 0;i < cards.length; i++){ |
||||||
return 0; |
if (cards[i].getClass() == currentEditor.getClass()){ |
||||||
} |
return i; |
||||||
|
} |
||||||
public void setCurrentEditor(int i) { |
} |
||||||
this.add(arrowButton, BorderLayout.WEST); |
return 0; |
||||||
currentEditor = this.cards[i]; |
} |
||||||
centerPane.removeAll(); |
|
||||||
centerPane.add(currentEditor); |
public void setCurrentEditor(int i) { |
||||||
centerPane.validate(); |
this.add(arrowButton, BorderLayout.WEST); |
||||||
centerPane.repaint(); |
currentEditor = this.cards[i]; |
||||||
arrowButton.setIcon(cards[i].getIcon()); |
centerPane.removeAll(); |
||||||
if (this.cards.length == 1) { |
centerPane.add(currentEditor); |
||||||
this.remove(arrowButton); |
centerPane.validate(); |
||||||
} |
centerPane.repaint(); |
||||||
} |
arrowButton.setIcon(cards[i].getIcon()); |
||||||
|
if (this.cards.length == 1) { |
||||||
public void setCurrentEditor(Class editorClass) { |
this.remove(arrowButton); |
||||||
for (int i = 0; i < cards.length; i++) { |
} |
||||||
if (cards[i].getClass() == editorClass) { |
} |
||||||
setCurrentEditor(i); |
|
||||||
break; |
public void setCurrentEditor(Class editorClass) { |
||||||
} |
for (int i = 0; i < cards.length; i++) { |
||||||
} |
if (cards[i].getClass() == editorClass) { |
||||||
} |
setCurrentEditor(i); |
||||||
|
break; |
||||||
|
} |
||||||
private JPopupMenu createPopMenu() { |
} |
||||||
JPopupMenu scate = new UIPopupEastAttrMenu(); |
} |
||||||
|
|
||||||
if (this.cards == null) { |
|
||||||
return scate; |
private JPopupMenu createPopMenu() { |
||||||
} |
JPopupMenu scate = new UIPopupEastAttrMenu(); |
||||||
|
|
||||||
for (int i = 0; i < this.cards.length; i++) { |
if (this.cards == null) { |
||||||
JMenuItem item = new UIMenuEastAttrItem(cards[i].getName()); |
return scate; |
||||||
final int j = i; |
} |
||||||
item.addActionListener(new ActionListener() { |
|
||||||
public void actionPerformed(ActionEvent e) { |
for (int i = 0; i < this.cards.length; i++) { |
||||||
if (globalNameListener != null) { |
JMenuItem item = new UIMenuEastAttrItem(cards[i].getName()); |
||||||
globalNameListener.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy")); |
final int j = i; |
||||||
} |
item.addActionListener(new ActionListener() { |
||||||
Object oldValue = currentEditor.getValue(); |
public void actionPerformed(ActionEvent e) { |
||||||
setCurrentEditor(j); |
if (globalNameListener != null) { |
||||||
currentEditor.selected(); |
globalNameListener.setGlobalName(Inter.getLocText("CellWrite-InsertRow_Policy")); |
||||||
value = currentEditor.getValue(); |
} |
||||||
if (uiObserverListener != null) { |
Object oldValue = currentEditor.getValue(); |
||||||
uiObserverListener.doChange(); |
setCurrentEditor(j); |
||||||
} |
currentEditor.selected(); |
||||||
|
value = currentEditor.getValue(); |
||||||
ValueEditorPane.this.firePropertyChange("value", oldValue, value); |
if (uiObserverListener != null) { |
||||||
} |
uiObserverListener.doChange(); |
||||||
}); |
} |
||||||
scate.add(item); |
|
||||||
} |
ValueEditorPane.this.firePropertyChange("value", oldValue, value); |
||||||
return scate; |
} |
||||||
} |
}); |
||||||
|
scate.add(item); |
||||||
public void populate(Object object) { |
} |
||||||
for (int i = 0; i < cards.length; i++) { |
return scate; |
||||||
if (cards[i].accept(object)) { |
} |
||||||
setCardValue(i,object); |
|
||||||
break; |
public void populate(Object object) { |
||||||
} |
for (int i = 0; i < cards.length; i++) { |
||||||
} |
if (cards[i].accept(object)) { |
||||||
} |
setCardValue(i,object); |
||||||
|
break; |
||||||
public void populate(Object object,String name) { |
} |
||||||
for (int i = 0; i < cards.length; i++) { |
} |
||||||
if (cards[i].accept(object) && ComparatorUtils.equals(cards[i].getName(),name)) { |
} |
||||||
setCardValue(i,object); |
|
||||||
break; |
public void populate(Object object,String name) { |
||||||
} |
for (int i = 0; i < cards.length; i++) { |
||||||
} |
if (cards[i].accept(object) && ComparatorUtils.equals(cards[i].getName(),name)) { |
||||||
} |
setCardValue(i,object); |
||||||
|
break; |
||||||
private void setCardValue(int i,Object object){ |
} |
||||||
setCurrentEditor(i); |
} |
||||||
cards[i].setValue(object); |
} |
||||||
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
|
|
||||||
// 一定是最后的Editor哦.
|
private void setCardValue(int i,Object object){ |
||||||
for (int j = 0; j < cards.length; j++) { |
setCurrentEditor(i); |
||||||
if (i == j) { |
cards[i].setValue(object); |
||||||
continue; |
// kunsnat: bug7861 所有的Editor值都要跟随改变, 因为populate的editor 从""
|
||||||
} |
// 一定是最后的Editor哦.
|
||||||
this.cards[j].setValue(null); |
for (int j = 0; j < cards.length; j++) { |
||||||
} |
if (i == j) { |
||||||
} |
continue; |
||||||
|
} |
||||||
public Object update() { |
this.cards[j].setValue(null); |
||||||
String name = currentEditor.getName(); |
} |
||||||
Object columnIndex = currentEditor.getValue(); |
} |
||||||
//bug86542,这边为啥要new一个公式出来,只保留content,其他属性全不要了?
|
|
||||||
//MoMeak:我也想注释了,但是有bug啊。。。
|
public Object update() { |
||||||
if (columnIndex == null && ComparatorUtils.equals(name, Inter.getLocText("Formula"))) { |
String name = currentEditor.getName(); |
||||||
columnIndex = ((FormulaEditor) currentEditor).getFormula(); |
Object columnIndex = currentEditor.getValue(); |
||||||
} |
//bug86542,这边为啥要new一个公式出来,只保留content,其他属性全不要了?
|
||||||
|
//MoMeak:我也想注释了,但是有bug啊。。。
|
||||||
return columnIndex; |
if (columnIndex == null && ComparatorUtils.equals(name, Inter.getLocText("Formula"))) { |
||||||
} |
columnIndex = ((FormulaEditor) currentEditor).getFormula(); |
||||||
|
} |
||||||
public Object update(String makeAdiff) { |
|
||||||
String name = currentEditor.getName(); |
return columnIndex; |
||||||
Object columnIndex = currentEditor.getValue(); |
} |
||||||
Object columnName = StringUtils.EMPTY; |
|
||||||
|
public Object update(String makeAdiff) { |
||||||
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { |
String name = currentEditor.getName(); |
||||||
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString()); |
Object columnIndex = currentEditor.getValue(); |
||||||
} |
Object columnName = StringUtils.EMPTY; |
||||||
|
|
||||||
if (currentEditor instanceof ColumnNameEditor) { |
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { |
||||||
columnName = ((ColumnNameEditor) currentEditor).getColumnName(); |
columnIndex = BaseFormula.createFormulaBuilder().build(columnIndex == null ? "" : columnIndex.toString()); |
||||||
} |
} |
||||||
|
|
||||||
return new Object[]{columnIndex, columnName}; |
if (currentEditor instanceof ColumnNameEditor) { |
||||||
} |
columnName = ((ColumnNameEditor) currentEditor).getColumnName(); |
||||||
|
} |
||||||
public Object update(boolean isXMLA) { |
|
||||||
String name = currentEditor.getName(); |
return new Object[]{columnIndex, columnName}; |
||||||
Object columnIndex = currentEditor.getValue(); |
} |
||||||
Object columnName = StringUtils.EMPTY; |
|
||||||
|
public Object update(boolean isXMLA) { |
||||||
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { |
String name = currentEditor.getName(); |
||||||
columnIndex = new Formula(columnIndex == null ? "" : columnIndex.toString()); |
Object columnIndex = currentEditor.getValue(); |
||||||
} |
Object columnName = StringUtils.EMPTY; |
||||||
|
|
||||||
if (isXMLA) { |
if (ComparatorUtils.equals(name, Inter.getLocText("FR-Designer_Formula"))) { |
||||||
columnName = ((XMLANameEditor) currentEditor).getColumnName(); |
columnIndex = BaseFormula.createFormulaBuilder().build(columnIndex == null ? "" : columnIndex.toString()); |
||||||
} |
} |
||||||
|
|
||||||
return new Object[]{columnIndex, columnName}; |
if (isXMLA) { |
||||||
} |
columnName = ((XMLANameEditor) currentEditor).getColumnName(); |
||||||
|
} |
||||||
public void setEditors(Editor[] editors, Object obj) { |
|
||||||
this.cards = editors; |
return new Object[]{columnIndex, columnName}; |
||||||
this.populate(obj); |
} |
||||||
} |
|
||||||
|
public void setEditors(Editor[] editors, Object obj) { |
||||||
/** |
this.cards = editors; |
||||||
* 检查是否有效 |
this.populate(obj); |
||||||
* |
} |
||||||
* @throws Exception 异常 |
|
||||||
*/ |
/** |
||||||
public void checkValid() throws Exception { |
* 检查是否有效 |
||||||
if (!(currentEditor instanceof TextEditor)) { |
* |
||||||
return; |
* @throws Exception 异常 |
||||||
} |
*/ |
||||||
|
public void checkValid() throws Exception { |
||||||
int i; |
if (!(currentEditor instanceof TextEditor)) { |
||||||
boolean containFormulaType = false; |
return; |
||||||
for (i = 0; i < cards.length; i++) { |
} |
||||||
if (ComparatorUtils.equals(cards[i].getName(), Inter.getLocText("FR-Engine_Parameter-Formula"))) { |
|
||||||
containFormulaType = true; |
int i; |
||||||
break; |
boolean containFormulaType = false; |
||||||
} |
for (i = 0; i < cards.length; i++) { |
||||||
} |
if (ComparatorUtils.equals(cards[i].getName(), Inter.getLocText("FR-Engine_Parameter-Formula"))) { |
||||||
if (!containFormulaType) { |
containFormulaType = true; |
||||||
return; |
break; |
||||||
} |
} |
||||||
|
} |
||||||
final int j = i; |
if (!containFormulaType) { |
||||||
|
return; |
||||||
if (!(currentEditor instanceof TextEditor)) { |
} |
||||||
return; |
|
||||||
} |
final int j = i; |
||||||
String string = (String) currentEditor.getValue(); |
|
||||||
if (isFormula(string)) { |
if (!(currentEditor instanceof TextEditor)) { |
||||||
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); |
return; |
||||||
if (designerEnvManager.isSupportStringToFormula()) { |
} |
||||||
if (!designerEnvManager.isDefaultStringToFormula()) { |
String string = (String) currentEditor.getValue(); |
||||||
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Edit_String_To_Formula") |
if (isFormula(string)) { |
||||||
+ "?", Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.YES_NO_OPTION); |
DesignerEnvManager designerEnvManager = DesignerEnvManager.getEnvManager(); |
||||||
if (returnValue == JOptionPane.OK_OPTION) { |
if (designerEnvManager.isSupportStringToFormula()) { |
||||||
|
if (!designerEnvManager.isDefaultStringToFormula()) { |
||||||
setCurrentEditor(j); |
int returnValue = JOptionPane.showConfirmDialog(DesignerContext.getDesignerFrame(), Inter.getLocText("FR-Designer_Edit_String_To_Formula") |
||||||
Formula formula = new Formula(string); |
+ "?", Inter.getLocText("FR-Designer_Tooltips"), JOptionPane.YES_NO_OPTION); |
||||||
currentEditor.setValue(formula); |
if (returnValue == JOptionPane.OK_OPTION) { |
||||||
} |
|
||||||
} else { |
setCurrentEditor(j); |
||||||
setCurrentEditor(j); |
BaseFormula formula = BaseFormula.createFormulaBuilder().build(string); |
||||||
Formula formula = new Formula(string); |
currentEditor.setValue(formula); |
||||||
currentEditor.setValue(formula); |
} |
||||||
} |
} else { |
||||||
} |
setCurrentEditor(j); |
||||||
} |
BaseFormula formula = BaseFormula.createFormulaBuilder().build(string); |
||||||
|
currentEditor.setValue(formula); |
||||||
} |
} |
||||||
|
} |
||||||
private boolean isFormula(String string) { |
} |
||||||
return StringUtils.isNotBlank(string) && (string.length() > 0 && string.charAt(0) == '='); |
} |
||||||
} |
|
||||||
|
private boolean isFormula(String string) { |
||||||
@Override |
return StringUtils.isNotBlank(string) && (string.length() > 0 && string.charAt(0) == '='); |
||||||
public void setEnabled(boolean enabled) { |
} |
||||||
arrowButton.setEnabled(enabled); |
|
||||||
for (Editor card : cards) { |
@Override |
||||||
card.setEnabled(enabled); |
public void setEnabled(boolean enabled) { |
||||||
} |
arrowButton.setEnabled(enabled); |
||||||
} |
for (Editor card : cards) { |
||||||
|
card.setEnabled(enabled); |
||||||
/** |
} |
||||||
* 重置组件 |
} |
||||||
*/ |
|
||||||
public void resetComponets() { |
/** |
||||||
for (Editor card : cards) { |
* 重置组件 |
||||||
card.reset(); |
*/ |
||||||
} |
public void resetComponets() { |
||||||
} |
for (Editor card : cards) { |
||||||
|
card.reset(); |
||||||
/** |
} |
||||||
* 清除组件数据 |
} |
||||||
*/ |
|
||||||
public void clearComponentsData() { |
/** |
||||||
for (Editor card : cards) { |
* 清除组件数据 |
||||||
card.clearData(); |
*/ |
||||||
} |
public void clearComponentsData() { |
||||||
} |
for (Editor card : cards) { |
||||||
|
card.clearData(); |
||||||
public Editor[] getCards() { |
} |
||||||
return this.cards; |
} |
||||||
} |
|
||||||
|
public Editor[] getCards() { |
||||||
public JPopupMenu getMenu() { |
return this.cards; |
||||||
return this.menu; |
} |
||||||
} |
|
||||||
|
public JPopupMenu getMenu() { |
||||||
|
return this.menu; |
||||||
/** |
} |
||||||
* 注册全局名字监听事件 |
|
||||||
* |
|
||||||
* @param listener 观察者监听事件 |
/** |
||||||
*/ |
* 注册全局名字监听事件 |
||||||
public void registerNameListener(GlobalNameListener listener) { |
* |
||||||
globalNameListener = listener; |
* @param listener 观察者监听事件 |
||||||
} |
*/ |
||||||
|
public void registerNameListener(GlobalNameListener listener) { |
||||||
/** |
globalNameListener = listener; |
||||||
* 是否对名字listener监听器做出响应 |
} |
||||||
* |
|
||||||
* @return 如果要做出响应,则返回true |
/** |
||||||
*/ |
* 是否对名字listener监听器做出响应 |
||||||
public boolean shouldResponseNameListener() { |
* |
||||||
return false; |
* @return 如果要做出响应,则返回true |
||||||
} |
*/ |
||||||
|
public boolean shouldResponseNameListener() { |
||||||
public void setGlobalName(String name) { |
return false; |
||||||
for (Editor card : cards) { |
} |
||||||
setComponentGlobalName(card, name); |
|
||||||
} |
public void setGlobalName(String name) { |
||||||
} |
for (Editor card : cards) { |
||||||
|
setComponentGlobalName(card, name); |
||||||
private void setComponentGlobalName(Container card, String name) { |
} |
||||||
for (int i = 0, len = card.getComponentCount(); i < len; i++) { |
} |
||||||
Component component = card.getComponent(i); |
|
||||||
if (component instanceof GlobalNameObserver) { |
private void setComponentGlobalName(Container card, String name) { |
||||||
((GlobalNameObserver) component).setGlobalName(name); |
for (int i = 0, len = card.getComponentCount(); i < len; i++) { |
||||||
} else { |
Component component = card.getComponent(i); |
||||||
setComponentGlobalName((Container) component, name); |
if (component instanceof GlobalNameObserver) { |
||||||
} |
((GlobalNameObserver) component).setGlobalName(name); |
||||||
} |
} else { |
||||||
} |
setComponentGlobalName((Container) component, name); |
||||||
|
} |
||||||
/** |
} |
||||||
* 给组件登记一个观察者监听事件 |
} |
||||||
* |
|
||||||
* @param listener 观察者监听事件 |
/** |
||||||
*/ |
* 给组件登记一个观察者监听事件 |
||||||
public void registerChangeListener(UIObserverListener listener) { |
* |
||||||
uiObserverListener = listener; |
* @param listener 观察者监听事件 |
||||||
for (Editor card : cards) { |
*/ |
||||||
doLoop(card, listener); |
public void registerChangeListener(UIObserverListener listener) { |
||||||
} |
uiObserverListener = listener; |
||||||
} |
for (Editor card : cards) { |
||||||
|
doLoop(card, listener); |
||||||
private void doLoop(Container card, UIObserverListener listener) { |
} |
||||||
for (int i = 0, len = card.getComponentCount(); i < len; i++) { |
} |
||||||
Component component = card.getComponent(i); |
|
||||||
if (component instanceof UIObserver) { |
private void doLoop(Container card, UIObserverListener listener) { |
||||||
((UIObserver) component).registerChangeListener(listener); |
for (int i = 0, len = card.getComponentCount(); i < len; i++) { |
||||||
} else { |
Component component = card.getComponent(i); |
||||||
doLoop((Container) component, listener); |
if (component instanceof UIObserver) { |
||||||
} |
((UIObserver) component).registerChangeListener(listener); |
||||||
} |
} else { |
||||||
} |
doLoop((Container) component, listener); |
||||||
|
} |
||||||
/** |
} |
||||||
* 组件是否需要响应添加的观察者事件 |
} |
||||||
* |
|
||||||
* @return 如果需要响应观察者事件则返回true,否则返回false |
/** |
||||||
*/ |
* 组件是否需要响应添加的观察者事件 |
||||||
public boolean shouldResponseChangeListener() { |
* |
||||||
return true; |
* @return 如果需要响应观察者事件则返回true,否则返回false |
||||||
} |
*/ |
||||||
|
public boolean shouldResponseChangeListener() { |
||||||
|
return true; |
||||||
|
} |
||||||
} |
} |
@ -1,229 +1,233 @@ |
|||||||
package com.fr.design.gui.frpane; |
package com.fr.design.gui.frpane; |
||||||
|
|
||||||
import com.fr.base.Formula; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.design.data.BasicTableDataTreePane; |
import com.fr.data.impl.NameTableData; |
||||||
import com.fr.design.data.DesignTableDataManager; |
import com.fr.data.impl.RecursionTableData; |
||||||
import com.fr.design.data.datapane.EditOrNewLabel; |
import com.fr.data.impl.TableDataDictionary; |
||||||
import com.fr.design.data.datapane.TableDataTreePane; |
import com.fr.design.DesignModelAdapter; |
||||||
import com.fr.design.data.datapane.TreeTableDataComboBox; |
import com.fr.design.data.BasicTableDataTreePane; |
||||||
import com.fr.design.data.datapane.preview.PreviewLabel; |
import com.fr.design.data.DesignTableDataManager; |
||||||
import com.fr.data.impl.NameTableData; |
import com.fr.design.data.datapane.EditOrNewLabel; |
||||||
import com.fr.data.impl.RecursionTableData; |
import com.fr.design.data.datapane.TableDataTreePane; |
||||||
import com.fr.data.impl.TableDataDictionary; |
import com.fr.design.data.datapane.TreeTableDataComboBox; |
||||||
import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; |
import com.fr.design.data.datapane.preview.PreviewLabel; |
||||||
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
import com.fr.design.data.tabledata.wrapper.AbstractTableDataWrapper; |
||||||
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
||||||
import com.fr.design.DesignModelAdapter; |
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.dialog.BasicPane; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.editor.ValueEditorPane; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.editor.ValueEditorPaneFactory; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.design.editor.editor.ColumnIndexEditor; |
||||||
import com.fr.design.dialog.BasicPane; |
import com.fr.design.editor.editor.ColumnNameEditor; |
||||||
import com.fr.design.editor.ValueEditorPane; |
import com.fr.design.editor.editor.Editor; |
||||||
import com.fr.design.editor.ValueEditorPaneFactory; |
import com.fr.design.editor.editor.FormulaEditor; |
||||||
import com.fr.design.editor.editor.*; |
import com.fr.design.editor.editor.OldColumnIndexEditor; |
||||||
import com.fr.general.Inter; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
import javax.swing.*; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import java.awt.*; |
import com.fr.general.Inter; |
||||||
import java.awt.event.ItemEvent; |
import com.fr.stable.StringUtils; |
||||||
import java.awt.event.ItemListener; |
|
||||||
import java.util.List; |
import javax.swing.*; |
||||||
|
import java.awt.*; |
||||||
public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable { |
import java.awt.event.ItemEvent; |
||||||
private TreeTableDataComboBox treeTableDataComboBox; |
import java.awt.event.ItemListener; |
||||||
private ValueEditorPane valuePane; |
import java.util.List; |
||||||
private ValueEditorPane textPane; |
|
||||||
private JPanel centerPane; |
public class JTreeAutoBuildPane extends BasicPane implements PreviewLabel.Previewable, EditOrNewLabel.Editable { |
||||||
private JPanel selectTreeDataPanel; |
private TreeTableDataComboBox treeTableDataComboBox; |
||||||
|
private ValueEditorPane valuePane; |
||||||
public JTreeAutoBuildPane() { |
private ValueEditorPane textPane; |
||||||
this.initComponent(); |
private JPanel centerPane; |
||||||
} |
private JPanel selectTreeDataPanel; |
||||||
|
|
||||||
/** |
public JTreeAutoBuildPane() { |
||||||
* 初始化 |
this.initComponent(); |
||||||
*/ |
} |
||||||
public void initComponent() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
/** |
||||||
UILabel selectTreeDataLabel = new UILabel(Inter.getLocText("Select_A_Tree_DataSource_To_Build") + ": "); |
* 初始化 |
||||||
treeTableDataComboBox = new TreeTableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); |
*/ |
||||||
treeTableDataComboBox.setPreferredSize(new Dimension(180, 20)); |
public void initComponent() { |
||||||
selectTreeDataPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); |
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
||||||
selectTreeDataPanel.add(selectTreeDataLabel); |
UILabel selectTreeDataLabel = new UILabel(Inter.getLocText("Select_A_Tree_DataSource_To_Build") + ": "); |
||||||
treeTableDataComboBox.addItemListener(new ItemListener() { |
treeTableDataComboBox = new TreeTableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); |
||||||
public void itemStateChanged(ItemEvent e) { |
treeTableDataComboBox.setPreferredSize(new Dimension(180, 20)); |
||||||
tdChange(); |
selectTreeDataPanel = FRGUIPaneFactory.createBoxFlowInnerContainer_S_Pane(); |
||||||
} |
selectTreeDataPanel.add(selectTreeDataLabel); |
||||||
}); |
treeTableDataComboBox.addItemListener(new ItemListener() { |
||||||
selectTreeDataPanel.add(treeTableDataComboBox); |
public void itemStateChanged(ItemEvent e) { |
||||||
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25)); |
tdChange(); |
||||||
treeTableDataComboBox.setSelectedIndex(-1); |
} |
||||||
PreviewLabel pl = new PreviewLabel(this); |
}); |
||||||
pl.setPreferredSize(new Dimension(25, 25)); |
selectTreeDataPanel.add(treeTableDataComboBox); |
||||||
EditOrNewLabel enl = new EditOrNewLabel(this, this); |
treeTableDataComboBox.setPreferredSize(new Dimension(200, 25)); |
||||||
enl.setPreferredSize(new Dimension(25, 25)); |
treeTableDataComboBox.setSelectedIndex(-1); |
||||||
selectTreeDataPanel.add(pl); |
PreviewLabel pl = new PreviewLabel(this); |
||||||
selectTreeDataPanel.add(enl); |
pl.setPreferredSize(new Dimension(25, 25)); |
||||||
|
EditOrNewLabel enl = new EditOrNewLabel(this, this); |
||||||
this.add(selectTreeDataPanel, BorderLayout.NORTH); |
enl.setPreferredSize(new Dimension(25, 25)); |
||||||
|
selectTreeDataPanel.add(pl); |
||||||
valuePane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); |
selectTreeDataPanel.add(enl); |
||||||
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
|
||||||
formulaEditor.setEnabled(true); |
this.add(selectTreeDataPanel, BorderLayout.NORTH); |
||||||
textPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); |
|
||||||
Component[][] coms = { |
valuePane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); |
||||||
{new UILabel(Inter.getLocText("Actual_Value") + ":"), |
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
||||||
valuePane}, |
formulaEditor.setEnabled(true); |
||||||
{new UILabel(Inter.getLocText("Display_Value") + ":"), |
textPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); |
||||||
textPane}}; |
Component[][] coms = { |
||||||
|
{new UILabel(Inter.getLocText("Actual_Value") + ":"), |
||||||
double p = TableLayout.PREFERRED; |
valuePane}, |
||||||
|
{new UILabel(Inter.getLocText("Display_Value") + ":"), |
||||||
double[] rowSize = {p, p, p}; |
textPane}}; |
||||||
double[] columnSize = {p, p}; |
|
||||||
centerPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, |
double p = TableLayout.PREFERRED; |
||||||
columnSize); |
|
||||||
|
double[] rowSize = {p, p, p}; |
||||||
this.add(centerPane, BorderLayout.CENTER); |
double[] columnSize = {p, p}; |
||||||
tdChange(); |
centerPane = TableLayoutHelper.createTableLayoutPane(coms, rowSize, |
||||||
} |
columnSize); |
||||||
|
|
||||||
private void tdChange() { |
this.add(centerPane, BorderLayout.CENTER); |
||||||
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem(); |
tdChange(); |
||||||
if (tableDataWrappe == null) { |
} |
||||||
return; |
|
||||||
} |
private void tdChange() { |
||||||
try { |
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem(); |
||||||
List<String> namelist = tableDataWrappe.calculateColumnNameList(); |
if (tableDataWrappe == null) { |
||||||
String[] columnNames = new String[namelist.size()]; |
return; |
||||||
namelist.toArray(columnNames); |
} |
||||||
valuePane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length)}, columnNames[0]); |
try { |
||||||
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
List<String> namelist = tableDataWrappe.calculateColumnNameList(); |
||||||
formulaEditor.setEnabled(true); |
String[] columnNames = new String[namelist.size()]; |
||||||
textPane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length), formulaEditor}, columnNames[0]); |
namelist.toArray(columnNames); |
||||||
} catch (Exception e) { |
valuePane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length)}, columnNames[0]); |
||||||
valuePane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName"))}, 1); |
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
||||||
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
formulaEditor.setEnabled(true); |
||||||
formulaEditor.setEnabled(true); |
textPane.setEditors(new Editor[]{new ColumnNameEditor(columnNames), new ColumnIndexEditor(columnNames.length), formulaEditor}, columnNames[0]); |
||||||
textPane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName")), formulaEditor}, 1); |
} catch (Exception e) { |
||||||
} |
valuePane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName"))}, 1); |
||||||
} |
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
||||||
|
formulaEditor.setEnabled(true); |
||||||
public void populate(TableDataDictionary tableDataDict) { |
textPane.setEditors(new Editor[]{new OldColumnIndexEditor(100, Inter.getLocText("ColumnName")), formulaEditor}, 1); |
||||||
if (tableDataDict == null) { |
} |
||||||
this.treeTableDataComboBox.setSelectedItem(""); |
} |
||||||
this.textPane.populate(1); |
|
||||||
this.valuePane.populate(1); |
public void populate(TableDataDictionary tableDataDict) { |
||||||
return; |
if (tableDataDict == null) { |
||||||
} else { |
this.treeTableDataComboBox.setSelectedItem(""); |
||||||
String _name = ""; |
this.textPane.populate(1); |
||||||
if (tableDataDict.getTableData() instanceof NameTableData) { |
this.valuePane.populate(1); |
||||||
_name = ((NameTableData) tableDataDict.getTableData()).getName(); |
return; |
||||||
} |
} else { |
||||||
this.treeTableDataComboBox.setSelectedTableDataByName(_name); |
String _name = ""; |
||||||
tdChange(); |
if (tableDataDict.getTableData() instanceof NameTableData) { |
||||||
// alex:因为显示到界面上的index是以1为始的,所以要加1
|
_name = ((NameTableData) tableDataDict.getTableData()).getName(); |
||||||
if (!StringUtils.isEmpty(tableDataDict.getKeyColumnName())) { |
} |
||||||
this.valuePane.populate(tableDataDict.getKeyColumnName()); |
this.treeTableDataComboBox.setSelectedTableDataByName(_name); |
||||||
} else { |
tdChange(); |
||||||
this.valuePane.populate(tableDataDict.getKeyColumnIndex() + 1); |
// alex:因为显示到界面上的index是以1为始的,所以要加1
|
||||||
} |
if (!StringUtils.isEmpty(tableDataDict.getKeyColumnName())) { |
||||||
Object value = null; |
this.valuePane.populate(tableDataDict.getKeyColumnName()); |
||||||
if ((tableDataDict).getFormula() != null) { |
} else { |
||||||
value = (tableDataDict).getFormula(); |
this.valuePane.populate(tableDataDict.getKeyColumnIndex() + 1); |
||||||
} else { |
} |
||||||
if (!StringUtils.isEmpty(tableDataDict.getValueColumnName())) { |
Object value = null; |
||||||
value = tableDataDict.getValueColumnName(); |
if ((tableDataDict).getFormula() != null) { |
||||||
} else { |
value = (tableDataDict).getFormula(); |
||||||
value = tableDataDict.getValueColumnIndex() + 1; |
} else { |
||||||
} |
if (!StringUtils.isEmpty(tableDataDict.getValueColumnName())) { |
||||||
} |
value = tableDataDict.getValueColumnName(); |
||||||
|
} else { |
||||||
this.textPane.populate(value); |
value = tableDataDict.getValueColumnIndex() + 1; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
public TableDataDictionary update() { |
this.textPane.populate(value); |
||||||
TableDataDictionary tableDataDict = new TableDataDictionary(); |
} |
||||||
Object object = this.valuePane.update(StringUtils.EMPTY); |
} |
||||||
// alex:因为显示到界面上的index是以1为始的,所以要减1
|
|
||||||
// carl:假如这里的序号要变,请考虑6.2的兼容
|
public TableDataDictionary update() { |
||||||
|
TableDataDictionary tableDataDict = new TableDataDictionary(); |
||||||
if (object instanceof Object[]) { |
Object object = this.valuePane.update(StringUtils.EMPTY); |
||||||
Object[] temp = (Object[]) object; |
// alex:因为显示到界面上的index是以1为始的,所以要减1
|
||||||
tableDataDict.setKeyColumnIndex(((Integer) temp[0]).intValue() - 1); |
// carl:假如这里的序号要变,请考虑6.2的兼容
|
||||||
tableDataDict.setKeyColumnName((String) temp[1]); |
|
||||||
} else if (object instanceof Integer) { |
if (object instanceof Object[]) { |
||||||
tableDataDict.setKeyColumnIndex((Integer) object - 1); |
Object[] temp = (Object[]) object; |
||||||
} else if (object instanceof String) { |
tableDataDict.setKeyColumnIndex(((Integer) temp[0]).intValue() - 1); |
||||||
tableDataDict.setKeyColumnName((String) object); |
tableDataDict.setKeyColumnName((String) temp[1]); |
||||||
} |
} else if (object instanceof Integer) { |
||||||
Object object_text = this.textPane.update(StringUtils.EMPTY); |
tableDataDict.setKeyColumnIndex((Integer) object - 1); |
||||||
if (object_text instanceof Object[]) { |
} else if (object instanceof String) { |
||||||
Object[] temp = (Object[]) object_text; |
tableDataDict.setKeyColumnName((String) object); |
||||||
if (temp[0] instanceof Formula) { |
} |
||||||
tableDataDict.setFormula((Formula) temp[0]); |
Object object_text = this.textPane.update(StringUtils.EMPTY); |
||||||
} else { |
if (object_text instanceof Object[]) { |
||||||
tableDataDict.setValueColumnIndex(((Integer) temp[0]).intValue() - 1); |
Object[] temp = (Object[]) object_text; |
||||||
tableDataDict.setValueColumnName((String) temp[1]); |
if (temp[0] instanceof BaseFormula) { |
||||||
} |
tableDataDict.setFormula((BaseFormula) temp[0]); |
||||||
} else if (object_text instanceof Integer) { |
} else { |
||||||
tableDataDict.setValueColumnIndex((Integer) this.textPane.update() - 1); |
tableDataDict.setValueColumnIndex(((Integer) temp[0]).intValue() - 1); |
||||||
} else if (object_text instanceof String) { |
tableDataDict.setValueColumnName((String) temp[1]); |
||||||
tableDataDict.setValueColumnName((String) object_text); |
} |
||||||
} else { |
} else if (object_text instanceof Integer) { |
||||||
tableDataDict.setFormula(((Formula) object)); |
tableDataDict.setValueColumnIndex((Integer) this.textPane.update() - 1); |
||||||
} |
} else if (object_text instanceof String) { |
||||||
|
tableDataDict.setValueColumnName((String) object_text); |
||||||
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem(); |
} else { |
||||||
if (tableDataWrappe != null) { |
tableDataDict.setFormula(((BaseFormula) object)); |
||||||
tableDataDict.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); |
} |
||||||
} |
|
||||||
|
TableDataWrapper tableDataWrappe = this.treeTableDataComboBox.getSelectedItem(); |
||||||
return tableDataDict; |
if (tableDataWrappe != null) { |
||||||
} |
tableDataDict.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); |
||||||
|
} |
||||||
@Override |
|
||||||
protected String title4PopupWindow() { |
return tableDataDict; |
||||||
return "Auto Build Tree"; |
} |
||||||
} |
|
||||||
|
@Override |
||||||
/** |
protected String title4PopupWindow() { |
||||||
* 预览 |
return "Auto Build Tree"; |
||||||
*/ |
} |
||||||
public void preview() { |
|
||||||
TableDataWrapper tableDataWrappe = treeTableDataComboBox.getSelectedItem(); |
/** |
||||||
if (tableDataWrappe == null) { |
* 预览 |
||||||
return; |
*/ |
||||||
} |
public void preview() { |
||||||
tableDataWrappe.previewData(); |
TableDataWrapper tableDataWrappe = treeTableDataComboBox.getSelectedItem(); |
||||||
} |
if (tableDataWrappe == null) { |
||||||
|
return; |
||||||
/** |
} |
||||||
* 编辑 |
tableDataWrappe.previewData(); |
||||||
* @param jPanel 面板 |
} |
||||||
*/ |
|
||||||
public void edit(JPanel jPanel) { |
/** |
||||||
RecursionTableData rtd = null; |
* 编辑 |
||||||
String name = ""; |
* @param jPanel 面板 |
||||||
BasicTableDataTreePane tdtp = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
*/ |
||||||
if (treeTableDataComboBox.getSelectedItem() == null) { |
public void edit(JPanel jPanel) { |
||||||
//新建
|
RecursionTableData rtd = null; |
||||||
rtd = new RecursionTableData(); |
String name = ""; |
||||||
name = TableDataTreePane.createUnrepeatedName(tdtp.getDataTree(), "Tree"); |
BasicTableDataTreePane tdtp = TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
||||||
} else { |
if (treeTableDataComboBox.getSelectedItem() == null) { |
||||||
//编辑
|
//新建
|
||||||
rtd = treeTableDataComboBox.getSelcetedTableData(); |
rtd = new RecursionTableData(); |
||||||
name = treeTableDataComboBox.getSelectedItem().getTableDataName(); |
name = TableDataTreePane.createUnrepeatedName(tdtp.getDataTree(), "Tree"); |
||||||
} |
} else { |
||||||
AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, ""); |
//编辑
|
||||||
tdtp.dgEdit(atdw.creatTableDataPane(), name); |
rtd = treeTableDataComboBox.getSelcetedTableData(); |
||||||
treeTableDataComboBox.refresh(); |
name = treeTableDataComboBox.getSelectedItem().getTableDataName(); |
||||||
treeTableDataComboBox.setSelectedTableDataByName(name); |
} |
||||||
textPane.populate(1); |
AbstractTableDataWrapper atdw = new TemplateTableDataWrapper(rtd, ""); |
||||||
valuePane.populate(1); |
tdtp.dgEdit(atdw.creatTableDataPane(), name); |
||||||
} |
treeTableDataComboBox.refresh(); |
||||||
|
treeTableDataComboBox.setSelectedTableDataByName(name); |
||||||
|
textPane.populate(1); |
||||||
|
valuePane.populate(1); |
||||||
|
} |
||||||
|
|
||||||
} |
} |
@ -1,118 +1,116 @@ |
|||||||
package com.fr.design.present.dict; |
package com.fr.design.present.dict; |
||||||
|
|
||||||
import com.fr.base.BaseUtils; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.base.Formula; |
import com.fr.base.BaseUtils; |
||||||
import com.fr.data.impl.FormulaDictionary; |
import com.fr.data.impl.FormulaDictionary; |
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.constants.UIConstants; |
import com.fr.design.editor.editor.FormulaEditor; |
||||||
import com.fr.design.editor.editor.FormulaEditor; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.general.Inter; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.stable.StringUtils; |
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.stable.StringUtils; |
import javax.swing.*; |
||||||
|
import javax.swing.event.DocumentListener; |
||||||
import javax.swing.*; |
import java.awt.*; |
||||||
import javax.swing.event.DocumentListener; |
|
||||||
import java.awt.*; |
public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> { |
||||||
|
|
||||||
public class FormulaDictPane extends FurtherBasicBeanPane<FormulaDictionary> { |
private static final int EDITOR_COLUMN = 15; |
||||||
|
private static final int LEFT_BORDER = 5; |
||||||
private static final int EDITOR_COLUMN = 15; |
private FormulaEditor keyFormulaEditor; |
||||||
private static final int LEFT_BORDER = 5; |
private FormulaEditor valueFormulaEditor; |
||||||
private FormulaEditor keyFormulaEditor; |
|
||||||
private FormulaEditor valueFormulaEditor; |
public FormulaDictPane() { |
||||||
|
initComponents(); |
||||||
public FormulaDictPane() { |
} |
||||||
initComponents(); |
|
||||||
} |
private void initComponents() { |
||||||
|
keyFormulaEditor = new FormulaEditor(); |
||||||
private void initComponents() { |
keyFormulaEditor.setColumns(EDITOR_COLUMN); |
||||||
keyFormulaEditor = new FormulaEditor(); |
JPanel keyFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
||||||
keyFormulaEditor.setColumns(EDITOR_COLUMN); |
keyFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
||||||
JPanel keyFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
keyFormulaEditor.setPreferredSize(new Dimension(144, 20)); |
||||||
keyFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
Icon icon = BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"); |
||||||
keyFormulaEditor.setPreferredSize(new Dimension(144, 20)); |
keyFormulaContainer.add(new JLabel(icon)); |
||||||
Icon icon = BaseUtils.readIcon("/com/fr/design/images/m_insert/formula.png"); |
keyFormulaContainer.add(keyFormulaEditor); |
||||||
keyFormulaContainer.add(new JLabel(icon)); |
|
||||||
keyFormulaContainer.add(keyFormulaEditor); |
valueFormulaEditor = new FormulaEditor(); |
||||||
|
valueFormulaEditor.setColumns(EDITOR_COLUMN); |
||||||
valueFormulaEditor = new FormulaEditor(); |
|
||||||
valueFormulaEditor.setColumns(EDITOR_COLUMN); |
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {p, f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p, p, p}; |
||||||
double[] columnSize = {p, f}; |
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
||||||
double[] rowSize = {p, p, p}; |
|
||||||
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}}; |
UILabel tag = new UILabel(Inter.getLocText("FR-Designer-Formula_Dictionary_Display_Examples_Html")); |
||||||
|
tag.setForeground(new Color(143, 143, 146)); |
||||||
UILabel tag = new UILabel(Inter.getLocText("FR-Designer-Formula_Dictionary_Display_Examples_Html")); |
tag.setPreferredSize(new Dimension(225, 80)); |
||||||
tag.setForeground(new Color(143, 143, 146)); |
JPanel t = new JPanel(new BorderLayout()); |
||||||
tag.setPreferredSize(new Dimension(225, 80)); |
t.add(tag, BorderLayout.CENTER); |
||||||
JPanel t = new JPanel(new BorderLayout()); |
|
||||||
t.add(tag, BorderLayout.CENTER); |
BaseFormula vf = BaseFormula.createFormulaBuilder().build("$$$"); |
||||||
|
valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf); |
||||||
Formula vf = new Formula("$$$"); |
|
||||||
valueFormulaEditor = new FormulaEditor(StringUtils.EMPTY, vf); |
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
||||||
|
valueFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
||||||
JPanel valueFormulaContainer = new JPanel(new FlowLayout(FlowLayout.RIGHT, LEFT_BORDER, 0)); |
valueFormulaEditor.setPreferredSize(new Dimension(144, 20)); |
||||||
valueFormulaContainer.setBorder(BorderFactory.createEmptyBorder(0, -LEFT_BORDER, 0, -LEFT_BORDER)); |
valueFormulaContainer.add(new JLabel(icon)); |
||||||
valueFormulaEditor.setPreferredSize(new Dimension(144, 20)); |
valueFormulaContainer.add(valueFormulaEditor); |
||||||
valueFormulaContainer.add(new JLabel(icon)); |
|
||||||
valueFormulaContainer.add(valueFormulaEditor); |
|
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value"), UILabel.LEFT), keyFormulaContainer}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value"), UILabel.LEFT), valueFormulaContainer}, |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value"), UILabel.LEFT), keyFormulaContainer}, |
new Component[]{tag, null} |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value"), UILabel.LEFT), valueFormulaContainer}, |
}; |
||||||
new Component[]{tag, null} |
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
||||||
}; |
|
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_LARGE); |
this.setLayout(new BorderLayout()); |
||||||
|
this.add(panel, BorderLayout.CENTER); |
||||||
this.setLayout(new BorderLayout()); |
|
||||||
this.add(panel, BorderLayout.CENTER); |
} |
||||||
|
|
||||||
} |
public void addChangeListener(DocumentListener l) { |
||||||
|
keyFormulaEditor.addDocumentListener(l); |
||||||
public void addChangeListener(DocumentListener l) { |
valueFormulaEditor.addDocumentListener(l); |
||||||
keyFormulaEditor.addDocumentListener(l); |
} |
||||||
valueFormulaEditor.addDocumentListener(l); |
|
||||||
} |
@Override |
||||||
|
public String title4PopupWindow() { |
||||||
@Override |
return Inter.getLocText("FR-Designer_Formula"); |
||||||
public String title4PopupWindow() { |
} |
||||||
return Inter.getLocText("FR-Designer_Formula"); |
|
||||||
} |
@Override |
||||||
|
public void populateBean(FormulaDictionary dict) { |
||||||
@Override |
keyFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula())); |
||||||
public void populateBean(FormulaDictionary dict) { |
valueFormulaEditor.setValue(BaseFormula.createFormulaBuilder().build(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula())); |
||||||
keyFormulaEditor.setValue(new Formula(dict.getProduceFormula() == null ? StringUtils.EMPTY : dict.getProduceFormula())); |
} |
||||||
valueFormulaEditor.setValue(new Formula(dict.getExcuteFormula() == null ? StringUtils.EMPTY : dict.getExcuteFormula())); |
|
||||||
} |
@Override |
||||||
|
public FormulaDictionary updateBean() { |
||||||
@Override |
FormulaDictionary dict = new FormulaDictionary(); |
||||||
public FormulaDictionary updateBean() { |
if (keyFormulaEditor.getValue() != null) { |
||||||
FormulaDictionary dict = new FormulaDictionary(); |
dict.setProduceFormula(keyFormulaEditor.getValue().getContent()); |
||||||
if (keyFormulaEditor.getValue() != null) { |
} |
||||||
dict.setProduceFormula(keyFormulaEditor.getValue().getContent()); |
if (valueFormulaEditor.getValue() != null) { |
||||||
} |
dict.setExcuteFormula(valueFormulaEditor.getValue().getContent()); |
||||||
if (valueFormulaEditor.getValue() != null) { |
} |
||||||
dict.setExcuteFormula(valueFormulaEditor.getValue().getContent()); |
|
||||||
} |
return dict; |
||||||
|
} |
||||||
return dict; |
|
||||||
} |
@Override |
||||||
|
public boolean accept(Object ob) { |
||||||
@Override |
return ob instanceof FormulaDictionary; |
||||||
public boolean accept(Object ob) { |
} |
||||||
return ob instanceof FormulaDictionary; |
|
||||||
} |
@Override |
||||||
|
public void reset() { |
||||||
@Override |
keyFormulaEditor.reset(); |
||||||
public void reset() { |
valueFormulaEditor.reset(); |
||||||
keyFormulaEditor.reset(); |
} |
||||||
valueFormulaEditor.reset(); |
|
||||||
} |
|
||||||
} |
} |
@ -1,371 +1,371 @@ |
|||||||
package com.fr.design.present.dict; |
package com.fr.design.present.dict; |
||||||
|
|
||||||
import com.fr.base.Formula; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.base.TableData; |
import com.fr.base.TableData; |
||||||
import com.fr.data.TableDataSource; |
import com.fr.data.TableDataSource; |
||||||
import com.fr.data.impl.DBTableData; |
import com.fr.data.impl.DBTableData; |
||||||
import com.fr.data.impl.DynamicSQLDict; |
import com.fr.data.impl.DynamicSQLDict; |
||||||
import com.fr.data.impl.NameTableData; |
import com.fr.data.impl.NameTableData; |
||||||
import com.fr.data.impl.TableDataDictionary; |
import com.fr.data.impl.TableDataDictionary; |
||||||
import com.fr.design.DesignModelAdapter; |
import com.fr.design.DesignModelAdapter; |
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.constants.LayoutConstants; |
||||||
import com.fr.design.constants.UIConstants; |
import com.fr.design.constants.UIConstants; |
||||||
import com.fr.design.data.DesignTableDataManager; |
import com.fr.design.data.DesignTableDataManager; |
||||||
import com.fr.design.data.datapane.TableDataComboBox; |
import com.fr.design.data.datapane.TableDataComboBox; |
||||||
import com.fr.design.data.datapane.TableDataTreePane; |
import com.fr.design.data.datapane.TableDataTreePane; |
||||||
import com.fr.design.data.datapane.preview.PreviewLabel; |
import com.fr.design.data.datapane.preview.PreviewLabel; |
||||||
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; |
import com.fr.design.data.datapane.preview.PreviewLabel.Previewable; |
||||||
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
import com.fr.design.data.tabledata.wrapper.TableDataWrapper; |
||||||
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
import com.fr.design.data.tabledata.wrapper.TemplateTableDataWrapper; |
||||||
import com.fr.design.editor.DoubleDeckValueEditorPane; |
import com.fr.design.editor.DoubleDeckValueEditorPane; |
||||||
import com.fr.design.editor.editor.ColumnIndexEditor; |
import com.fr.design.editor.editor.ColumnIndexEditor; |
||||||
import com.fr.design.editor.editor.ColumnNameEditor; |
import com.fr.design.editor.editor.ColumnNameEditor; |
||||||
import com.fr.design.editor.editor.Editor; |
import com.fr.design.editor.editor.Editor; |
||||||
import com.fr.design.editor.editor.FormulaEditor; |
import com.fr.design.editor.editor.FormulaEditor; |
||||||
import com.fr.design.event.UIObserver; |
import com.fr.design.event.UIObserver; |
||||||
import com.fr.design.event.UIObserverListener; |
import com.fr.design.event.UIObserverListener; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.utils.gui.GUICoreUtils; |
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
import com.fr.general.ComparatorUtils; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.stable.ArrayUtils; |
import com.fr.stable.ArrayUtils; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
||||||
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.awt.event.ItemEvent; |
import java.awt.event.ItemEvent; |
||||||
import java.awt.event.ItemListener; |
import java.awt.event.ItemListener; |
||||||
import java.util.List; |
import java.util.List; |
||||||
|
|
||||||
/** |
/** |
||||||
* 数据字典的数据查询面板 |
* 数据字典的数据查询面板 |
||||||
* |
* |
||||||
* @editor zhou |
* @editor zhou |
||||||
* @since 2012-3-29下午1:49:24 |
* @since 2012-3-29下午1:49:24 |
||||||
*/ |
*/ |
||||||
public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> implements Previewable, UIObserver { |
public class TableDataDictPane extends FurtherBasicBeanPane<TableDataDictionary> implements Previewable, UIObserver { |
||||||
private static final int BEGIN = 1; |
private static final int BEGIN = 1; |
||||||
private static final int END = 10; |
private static final int END = 10; |
||||||
private static final int VGAP = 24; |
private static final int VGAP = 24; |
||||||
private static final long serialVersionUID = -5469742115988153206L; |
private static final long serialVersionUID = -5469742115988153206L; |
||||||
private static final int SELECTED_NO_TABLEDATA = -2; |
private static final int SELECTED_NO_TABLEDATA = -2; |
||||||
public TableDataComboBox tableDataNameComboBox; |
public TableDataComboBox tableDataNameComboBox; |
||||||
private DoubleDeckValueEditorPane keyColumnPane; |
private DoubleDeckValueEditorPane keyColumnPane; |
||||||
private DoubleDeckValueEditorPane valueDictPane; |
private DoubleDeckValueEditorPane valueDictPane; |
||||||
private ItemListener itemListener; |
private ItemListener itemListener; |
||||||
private UIObserverListener uiObserverListener; |
private UIObserverListener uiObserverListener; |
||||||
|
|
||||||
public TableDataDictPane() { |
public TableDataDictPane() { |
||||||
initBasicComponets(); |
initBasicComponets(); |
||||||
initComponents(); |
initComponents(); |
||||||
iniListener(); |
iniListener(); |
||||||
} |
} |
||||||
|
|
||||||
public static void main(String[] args) { |
public static void main(String[] args) { |
||||||
JFrame jf = new JFrame("test"); |
JFrame jf = new JFrame("test"); |
||||||
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||||
JPanel content = (JPanel) jf.getContentPane(); |
JPanel content = (JPanel) jf.getContentPane(); |
||||||
content.setLayout(new BorderLayout()); |
content.setLayout(new BorderLayout()); |
||||||
content.add(new TableDataDictPane(), BorderLayout.NORTH); |
content.add(new TableDataDictPane(), BorderLayout.NORTH); |
||||||
GUICoreUtils.centerWindow(jf); |
GUICoreUtils.centerWindow(jf); |
||||||
jf.setSize(290, 400); |
jf.setSize(290, 400); |
||||||
jf.setVisible(true); |
jf.setVisible(true); |
||||||
} |
} |
||||||
|
|
||||||
private void initBasicComponets() { |
private void initBasicComponets() { |
||||||
tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); |
tableDataNameComboBox = new TableDataComboBox(DesignTableDataManager.getEditingTableDataSource()); |
||||||
tableDataNameComboBox.addItemListener(new ItemListener() { |
tableDataNameComboBox.addItemListener(new ItemListener() { |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||||
tdChange(e); |
tdChange(e); |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
// keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
|
// keyColumnPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()});
|
||||||
keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); |
keyColumnPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor()}); |
||||||
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); |
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); |
||||||
formulaEditor.setEnabled(true); |
formulaEditor.setEnabled(true); |
||||||
// valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
|
// valueDictPane = ValueEditorPaneFactory.createValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor});
|
||||||
valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); |
valueDictPane = new DoubleDeckValueEditorPane(new Editor[]{new ColumnNameEditor(), new ColumnIndexEditor(), formulaEditor}); |
||||||
} |
} |
||||||
|
|
||||||
private void initComponents() { |
private void initComponents() { |
||||||
|
|
||||||
double p = TableLayout.PREFERRED; |
double p = TableLayout.PREFERRED; |
||||||
double f = TableLayout.FILL; |
double f = TableLayout.FILL; |
||||||
double[] columnSize = {p, f}; |
double[] columnSize = {p, f}; |
||||||
double[] rowSize = {p, p, p, p, p}; |
double[] rowSize = {p, p, p, p, p}; |
||||||
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}}; |
int[][] rowCount = {{1, 1}, {1, 3}, {1, 3}}; |
||||||
|
|
||||||
JPanel firstLine = new JPanel(new BorderLayout(4, 0)); |
JPanel firstLine = new JPanel(new BorderLayout(4, 0)); |
||||||
firstLine.add(tableDataNameComboBox, BorderLayout.CENTER); |
firstLine.add(tableDataNameComboBox, BorderLayout.CENTER); |
||||||
firstLine.add(new PreviewLabel(this), BorderLayout.EAST); |
firstLine.add(new PreviewLabel(this), BorderLayout.EAST); |
||||||
|
|
||||||
Component[][] components = new Component[][]{ |
Component[][] components = new Component[][]{ |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS_TableData") + " ", UILabel.LEFT), firstLine}, |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_DS_TableData") + " ", UILabel.LEFT), firstLine}, |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + " ", UILabel.LEFT), keyColumnPane}, |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Actual_Value") + " ", UILabel.LEFT), keyColumnPane}, |
||||||
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + " ", UILabel.LEFT), valueDictPane}, |
new Component[]{new UILabel(Inter.getLocText("FR-Designer_Display_Value") + " ", UILabel.LEFT), valueDictPane}, |
||||||
}; |
}; |
||||||
|
|
||||||
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, VGAP, LayoutConstants.VGAP_MEDIUM); |
JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, VGAP, LayoutConstants.VGAP_MEDIUM); |
||||||
this.setLayout(new BorderLayout()); |
this.setLayout(new BorderLayout()); |
||||||
this.add(panel, BorderLayout.CENTER); |
this.add(panel, BorderLayout.CENTER); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
private void iniListener() { |
private void iniListener() { |
||||||
if (shouldResponseChangeListener()) { |
if (shouldResponseChangeListener()) { |
||||||
this.addItemListener(new ItemListener() { |
this.addItemListener(new ItemListener() { |
||||||
@Override |
@Override |
||||||
public void itemStateChanged(ItemEvent e) { |
public void itemStateChanged(ItemEvent e) { |
||||||
if (uiObserverListener == null) { |
if (uiObserverListener == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (e.getStateChange() == ItemEvent.SELECTED) { |
if (e.getStateChange() == ItemEvent.SELECTED) { |
||||||
uiObserverListener.doChange(); |
uiObserverListener.doChange(); |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 增加Listener |
* 增加Listener |
||||||
* |
* |
||||||
* @param aListener 将本对象的Listener指向该listener |
* @param aListener 将本对象的Listener指向该listener |
||||||
*/ |
*/ |
||||||
public void addItemListener(ItemListener aListener) { |
public void addItemListener(ItemListener aListener) { |
||||||
this.itemListener = aListener; |
this.itemListener = aListener; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 该面板标题 |
* 该面板标题 |
||||||
* |
* |
||||||
* @return 返回是窗口显示的标题 |
* @return 返回是窗口显示的标题 |
||||||
*/ |
*/ |
||||||
public String title4PopupWindow() { |
public String title4PopupWindow() { |
||||||
return Inter.getLocText("FR-Designer_Dic_Data_Query"); |
return Inter.getLocText("FR-Designer_Dic_Data_Query"); |
||||||
} |
} |
||||||
|
|
||||||
private void tdChange(final ItemEvent e) { |
private void tdChange(final ItemEvent e) { |
||||||
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
||||||
if (tableDataWrappe == null) { |
if (tableDataWrappe == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
|
|
||||||
List<String> namelist = tableDataWrappe.calculateColumnNameList(); |
List<String> namelist = tableDataWrappe.calculateColumnNameList(); |
||||||
String[] columnNames = null; |
String[] columnNames = null; |
||||||
if (!namelist.isEmpty()) { |
if (!namelist.isEmpty()) { |
||||||
columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); |
columnNames = namelist.toArray(ArrayUtils.EMPTY_STRING_ARRAY); |
||||||
} else { |
} else { |
||||||
columnNames = new String[]{""}; |
columnNames = new String[]{""}; |
||||||
} |
} |
||||||
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames); |
ColumnNameEditor columnNameEditor1 = new ColumnNameEditor(columnNames); |
||||||
columnNameEditor1.addItemListener(itemListener); |
columnNameEditor1.addItemListener(itemListener); |
||||||
ColumnIndexEditor columnIndexEditor1 = new ColumnIndexEditor(columnNames.length); |
ColumnIndexEditor columnIndexEditor1 = new ColumnIndexEditor(columnNames.length); |
||||||
columnIndexEditor1.addItemListener(itemListener); |
columnIndexEditor1.addItemListener(itemListener); |
||||||
keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNames[0]); |
keyColumnPane.setEditors(new Editor[]{columnNameEditor1, columnIndexEditor1}, columnNames[0]); |
||||||
|
|
||||||
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); |
FormulaEditor formulaEditor = new FormulaEditor(Inter.getLocText("FR-Designer_Parameter-Formula")); |
||||||
formulaEditor.setEnabled(true); |
formulaEditor.setEnabled(true); |
||||||
formulaEditor.addChangeListener(new ChangeListener() { |
formulaEditor.addChangeListener(new ChangeListener() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void stateChanged(ChangeEvent ee) { |
public void stateChanged(ChangeEvent ee) { |
||||||
if (itemListener != null) { |
if (itemListener != null) { |
||||||
itemListener.itemStateChanged(e); |
itemListener.itemStateChanged(e); |
||||||
} |
} |
||||||
} |
} |
||||||
}); |
}); |
||||||
ColumnNameEditor columnNameEditor2 = new ColumnNameEditor(columnNames); |
ColumnNameEditor columnNameEditor2 = new ColumnNameEditor(columnNames); |
||||||
columnNameEditor2.addItemListener(itemListener); |
columnNameEditor2.addItemListener(itemListener); |
||||||
ColumnIndexEditor columnIndexEditor2 = new ColumnIndexEditor(columnNames.length); |
ColumnIndexEditor columnIndexEditor2 = new ColumnIndexEditor(columnNames.length); |
||||||
columnIndexEditor2.addItemListener(itemListener); |
columnIndexEditor2.addItemListener(itemListener); |
||||||
valueDictPane.setEditors(new Editor[]{columnNameEditor2, columnIndexEditor2, formulaEditor}, columnNames[0]); |
valueDictPane.setEditors(new Editor[]{columnNameEditor2, columnIndexEditor2, formulaEditor}, columnNames[0]); |
||||||
if (itemListener != null) { |
if (itemListener != null) { |
||||||
itemListener.itemStateChanged(e); |
itemListener.itemStateChanged(e); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
* |
* |
||||||
*/ |
*/ |
||||||
public void populateBean(TableDataDictionary tableDataDict) { |
public void populateBean(TableDataDictionary tableDataDict) { |
||||||
populate(tableDataDict, ""); |
populate(tableDataDict, ""); |
||||||
} |
} |
||||||
|
|
||||||
private void populate(TableDataDictionary tableDataDict, String name) { |
private void populate(TableDataDictionary tableDataDict, String name) { |
||||||
if (tableDataDict == null || tableDataDict.getTableData() == TableData.EMPTY_TABLEDATA) { |
if (tableDataDict == null || tableDataDict.getTableData() == TableData.EMPTY_TABLEDATA) { |
||||||
this.tableDataNameComboBox.setSelectedIndex(-1); |
this.tableDataNameComboBox.setSelectedIndex(-1); |
||||||
this.keyColumnPane.populate(StringUtils.EMPTY); |
this.keyColumnPane.populate(StringUtils.EMPTY); |
||||||
this.valueDictPane.populate(StringUtils.EMPTY); |
this.valueDictPane.populate(StringUtils.EMPTY); |
||||||
return; |
return; |
||||||
} |
} |
||||||
if (tableDataDict.getTableData() instanceof DBTableData && !"".equals(name)) { |
if (tableDataDict.getTableData() instanceof DBTableData && !"".equals(name)) { |
||||||
this.tableDataNameComboBox.putTableDataIntoMap(name, new TemplateTableDataWrapper( |
this.tableDataNameComboBox.putTableDataIntoMap(name, new TemplateTableDataWrapper( |
||||||
(DBTableData) tableDataDict.getTableData(), name)); |
(DBTableData) tableDataDict.getTableData(), name)); |
||||||
this.tableDataNameComboBox.setSelectedTableDataByName(name); |
this.tableDataNameComboBox.setSelectedTableDataByName(name); |
||||||
} else if (tableDataDict.getTableData() instanceof NameTableData) { |
} else if (tableDataDict.getTableData() instanceof NameTableData) { |
||||||
this.tableDataNameComboBox.setSelectedTableDataByName(((NameTableData) tableDataDict.getTableData()) |
this.tableDataNameComboBox.setSelectedTableDataByName(((NameTableData) tableDataDict.getTableData()) |
||||||
.getName()); |
.getName()); |
||||||
} |
} |
||||||
// alex:因为显示到界面上的index是以1为始的,所以要加1
|
// alex:因为显示到界面上的index是以1为始的,所以要加1
|
||||||
|
|
||||||
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
||||||
if (tableDataWrappe == null) { |
if (tableDataWrappe == null) { |
||||||
keyColumnPane.resetComponets(); |
keyColumnPane.resetComponets(); |
||||||
valueDictPane.resetComponets(); |
valueDictPane.resetComponets(); |
||||||
} else { |
} else { |
||||||
if (StringUtils.isNotEmpty(tableDataDict.getKeyColumnName())) { |
if (StringUtils.isNotEmpty(tableDataDict.getKeyColumnName())) { |
||||||
this.keyColumnPane.populate(tableDataDict.getKeyColumnName()); |
this.keyColumnPane.populate(tableDataDict.getKeyColumnName()); |
||||||
} else { |
} else { |
||||||
this.keyColumnPane.populate(tableDataDict.getKeyColumnIndex() + 1); |
this.keyColumnPane.populate(tableDataDict.getKeyColumnIndex() + 1); |
||||||
} |
} |
||||||
|
|
||||||
Object value = null; |
Object value = null; |
||||||
if (tableDataDict.getFormula() != null) { |
if (tableDataDict.getFormula() != null) { |
||||||
value = tableDataDict.getFormula(); |
value = tableDataDict.getFormula(); |
||||||
} else { |
} else { |
||||||
if (StringUtils.isNotEmpty(tableDataDict.getValueColumnName())) { |
if (StringUtils.isNotEmpty(tableDataDict.getValueColumnName())) { |
||||||
value = tableDataDict.getValueColumnName(); |
value = tableDataDict.getValueColumnName(); |
||||||
} else { |
} else { |
||||||
value = tableDataDict.getValueColumnIndex() + 1; |
value = tableDataDict.getValueColumnIndex() + 1; |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
this.valueDictPane.populate(value); |
this.valueDictPane.populate(value); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* @param dsql |
* @param dsql |
||||||
*/ |
*/ |
||||||
public void populateBean(DynamicSQLDict dsql) { |
public void populateBean(DynamicSQLDict dsql) { |
||||||
DBTableData db = new DBTableData(dsql.getDatabaseConnection(), dsql.getSqlFormula()); |
DBTableData db = new DBTableData(dsql.getDatabaseConnection(), dsql.getSqlFormula()); |
||||||
String name = ""; |
String name = ""; |
||||||
TableDataSource dataSource = DesignTableDataManager.getEditingTableDataSource(); |
TableDataSource dataSource = DesignTableDataManager.getEditingTableDataSource(); |
||||||
if (dataSource != null) { |
if (dataSource != null) { |
||||||
for (int i = BEGIN; i < END; i++) { |
for (int i = BEGIN; i < END; i++) { |
||||||
TableData td = dataSource.getTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i); |
TableData td = dataSource.getTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i); |
||||||
if (td == null) { |
if (td == null) { |
||||||
name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i; |
name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i; |
||||||
dataSource.putTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i, db); |
dataSource.putTableData(Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i, db); |
||||||
break; |
break; |
||||||
} else { |
} else { |
||||||
if (ComparatorUtils.equals(td, db)) { |
if (ComparatorUtils.equals(td, db)) { |
||||||
name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i; |
name = Inter.getLocText("FR-Designer_Dictionary_Dynamic_SQL") + i; |
||||||
break; |
break; |
||||||
} else { |
} else { |
||||||
continue; |
continue; |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
TableDataDictionary tdd = new TableDataDictionary(db, dsql.getKeyColumnIndex(), dsql.getValueColumnIndex()); |
TableDataDictionary tdd = new TableDataDictionary(db, dsql.getKeyColumnIndex(), dsql.getValueColumnIndex()); |
||||||
if (dsql.getFormula() != null) { |
if (dsql.getFormula() != null) { |
||||||
tdd.setFormula(dsql.getFormula()); |
tdd.setFormula(dsql.getFormula()); |
||||||
} |
} |
||||||
this.populate(tdd, name); |
this.populate(tdd, name); |
||||||
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()); |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* @return |
* @return |
||||||
*/ |
*/ |
||||||
public TableDataDictionary updateBean() { |
public TableDataDictionary updateBean() { |
||||||
TableDataDictionary tableDataDict = new TableDataDictionary(); |
TableDataDictionary tableDataDict = new TableDataDictionary(); |
||||||
Object object = this.valueDictPane.update(); |
Object object = this.valueDictPane.update(); |
||||||
// alex:因为显示到界面上的index是以1为始的,所以要减1
|
// alex:因为显示到界面上的index是以1为始的,所以要减1
|
||||||
// carl:假如这里的序号要变,请考虑6.2的兼容
|
// carl:假如这里的序号要变,请考虑6.2的兼容
|
||||||
if (object instanceof Integer) { |
if (object instanceof Integer) { |
||||||
int valuleColumnIndex = (Integer) object - 1; |
int valuleColumnIndex = (Integer) object - 1; |
||||||
String valueColumnName = StringUtils.EMPTY; |
String valueColumnName = StringUtils.EMPTY; |
||||||
|
|
||||||
if (this.valueDictPane.getCurrentEditor() instanceof ColumnNameEditor) { |
if (this.valueDictPane.getCurrentEditor() instanceof ColumnNameEditor) { |
||||||
valueColumnName = ((ColumnNameEditor) this.valueDictPane.getCurrentEditor()).getColumnName(); |
valueColumnName = ((ColumnNameEditor) this.valueDictPane.getCurrentEditor()).getColumnName(); |
||||||
valuleColumnIndex = -1; |
valuleColumnIndex = -1; |
||||||
} |
} |
||||||
tableDataDict.setValueColumnIndex(valuleColumnIndex); |
tableDataDict.setValueColumnIndex(valuleColumnIndex); |
||||||
tableDataDict.setValueColumnName(valueColumnName); |
tableDataDict.setValueColumnName(valueColumnName); |
||||||
} else { |
} else { |
||||||
tableDataDict.setFormula(((Formula) object)); |
tableDataDict.setFormula(((BaseFormula) object)); |
||||||
} |
} |
||||||
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
TableDataWrapper tableDataWrappe = this.tableDataNameComboBox.getSelectedItem(); |
||||||
if (tableDataWrappe != null) { |
if (tableDataWrappe != null) { |
||||||
tableDataDict.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); |
tableDataDict.setTableData(new NameTableData(tableDataWrappe.getTableDataName())); |
||||||
int keyColumnIndex = (Integer) this.keyColumnPane.update() - 1; |
int keyColumnIndex = (Integer) this.keyColumnPane.update() - 1; |
||||||
String keyColumnName = StringUtils.EMPTY; |
String keyColumnName = StringUtils.EMPTY; |
||||||
|
|
||||||
if (keyColumnPane.getCurrentEditor() instanceof ColumnNameEditor) { |
if (keyColumnPane.getCurrentEditor() instanceof ColumnNameEditor) { |
||||||
keyColumnName = ((ColumnNameEditor) this.keyColumnPane.getCurrentEditor()).getColumnName(); |
keyColumnName = ((ColumnNameEditor) this.keyColumnPane.getCurrentEditor()).getColumnName(); |
||||||
keyColumnIndex = -1; |
keyColumnIndex = -1; |
||||||
} |
} |
||||||
|
|
||||||
tableDataDict.setKeyColumnIndex(keyColumnIndex); |
tableDataDict.setKeyColumnIndex(keyColumnIndex); |
||||||
tableDataDict.setKeyColumnName(keyColumnName); |
tableDataDict.setKeyColumnName(keyColumnName); |
||||||
} |
} |
||||||
|
|
||||||
return tableDataDict; |
return tableDataDict; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 预览 |
* 预览 |
||||||
*/ |
*/ |
||||||
public void preview() { |
public void preview() { |
||||||
TableDataWrapper tableDataWrappe = tableDataNameComboBox.getSelectedItem(); |
TableDataWrapper tableDataWrappe = tableDataNameComboBox.getSelectedItem(); |
||||||
if (tableDataWrappe == null) { |
if (tableDataWrappe == null) { |
||||||
return; |
return; |
||||||
} |
} |
||||||
Object object = this.valueDictPane.update(); |
Object object = this.valueDictPane.update(); |
||||||
if (object instanceof Integer) { |
if (object instanceof Integer) { |
||||||
tableDataWrappe.previewData((Integer) this.keyColumnPane.update() - 1, (Integer) object - 1); |
tableDataWrappe.previewData((Integer) this.keyColumnPane.update() - 1, (Integer) object - 1); |
||||||
} |
} |
||||||
|
|
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 判断ob是否是TableDataDictionary类型 |
* 判断ob是否是TableDataDictionary类型 |
||||||
* |
* |
||||||
* @param ob 用于判断的Object |
* @param ob 用于判断的Object |
||||||
* @return 如果是TableDataDictionary类型,则返回true |
* @return 如果是TableDataDictionary类型,则返回true |
||||||
*/ |
*/ |
||||||
public boolean accept(Object ob) { |
public boolean accept(Object ob) { |
||||||
return ob instanceof TableDataDictionary; |
return ob instanceof TableDataDictionary; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
/** |
/** |
||||||
*重置 |
*重置 |
||||||
*/ |
*/ |
||||||
public void reset() { |
public void reset() { |
||||||
GUICoreUtils.setSelectedItemQuietly(tableDataNameComboBox, UIConstants.PENDING); |
GUICoreUtils.setSelectedItemQuietly(tableDataNameComboBox, UIConstants.PENDING); |
||||||
keyColumnPane.clearComponentsData(); |
keyColumnPane.clearComponentsData(); |
||||||
valueDictPane.clearComponentsData(); |
valueDictPane.clearComponentsData(); |
||||||
} |
} |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* 给组件登记一个观察者监听事件 |
* 给组件登记一个观察者监听事件 |
||||||
* |
* |
||||||
* @param listener 观察者监听事件 |
* @param listener 观察者监听事件 |
||||||
*/ |
*/ |
||||||
public void registerChangeListener(UIObserverListener listener) { |
public void registerChangeListener(UIObserverListener listener) { |
||||||
uiObserverListener = listener; |
uiObserverListener = listener; |
||||||
} |
} |
||||||
|
|
||||||
/** |
/** |
||||||
* 是否应该相应listener事件 |
* 是否应该相应listener事件 |
||||||
* |
* |
||||||
* @return 要是响应listener事件,则返回true |
* @return 要是响应listener事件,则返回true |
||||||
*/ |
*/ |
||||||
public boolean shouldResponseChangeListener() { |
public boolean shouldResponseChangeListener() { |
||||||
return true; |
return true; |
||||||
} |
} |
||||||
} |
} |
@ -1,301 +1,297 @@ |
|||||||
package com.fr.design.chart.report; |
package com.fr.design.chart.report; |
||||||
|
|
||||||
import java.awt.*; |
import com.fr.base.BaseFormula; |
||||||
import java.awt.event.FocusAdapter; |
import com.fr.base.Utils; |
||||||
import java.awt.event.FocusEvent; |
import com.fr.chart.chartdata.BaseSeriesDefinition; |
||||||
import java.util.ArrayList; |
import com.fr.chart.chartdata.GisMapReportDefinition; |
||||||
import java.util.List; |
import com.fr.chart.chartdata.SeriesDefinition; |
||||||
|
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import javax.swing.JComponent; |
import com.fr.design.constants.LayoutConstants; |
||||||
import javax.swing.JPanel; |
import com.fr.design.constants.UIConstants; |
||||||
import javax.swing.JTable; |
import com.fr.design.event.UIObserver; |
||||||
import javax.swing.SwingConstants; |
import com.fr.design.event.UIObserverListener; |
||||||
import javax.swing.event.ChangeEvent; |
import com.fr.design.formula.TinyFormulaPane; |
||||||
import javax.swing.event.ChangeListener; |
import com.fr.design.gui.frpane.UICorrelationPane; |
||||||
|
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
import com.fr.base.Formula; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.base.Utils; |
import com.fr.design.gui.itable.UITableEditor; |
||||||
import com.fr.chart.chartdata.BaseSeriesDefinition; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.chart.chartdata.GisMapReportDefinition; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.chart.chartdata.SeriesDefinition; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.general.Inter; |
||||||
import com.fr.design.constants.UIConstants; |
import com.fr.stable.StableUtils; |
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.stable.StringUtils; |
||||||
import com.fr.design.event.UIObserver; |
|
||||||
import com.fr.design.event.UIObserverListener; |
import javax.swing.*; |
||||||
import com.fr.design.formula.TinyFormulaPane; |
import javax.swing.event.ChangeEvent; |
||||||
import com.fr.design.gui.frpane.UICorrelationPane; |
import javax.swing.event.ChangeListener; |
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
import java.awt.*; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import java.awt.event.FocusAdapter; |
||||||
import com.fr.design.gui.itable.UITableEditor; |
import java.awt.event.FocusEvent; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import java.util.ArrayList; |
||||||
import com.fr.design.layout.TableLayout; |
import java.util.List; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
|
||||||
import com.fr.general.Inter; |
/** |
||||||
import com.fr.stable.StableUtils; |
* 属性表gis地图单元格数据源设置界面 |
||||||
import com.fr.stable.StringUtils; |
* |
||||||
|
* @author eason |
||||||
/** |
*/ |
||||||
* 属性表gis地图单元格数据源设置界面 |
public class GisMapReportDataContentPane extends FurtherBasicBeanPane<GisMapReportDefinition> implements UIObserver { |
||||||
* |
private UIButtonGroup<String> addressType; |
||||||
* @author eason |
private UIButtonGroup<String> lnglatOrder; |
||||||
*/ |
private TinyFormulaPane addressPane; |
||||||
public class GisMapReportDataContentPane extends FurtherBasicBeanPane<GisMapReportDefinition> implements UIObserver { |
private TinyFormulaPane addressNamePane; |
||||||
private UIButtonGroup<String> addressType; |
private UICorrelationPane seriesPane; |
||||||
private UIButtonGroup<String> lnglatOrder; |
private JPanel orderPane; |
||||||
private TinyFormulaPane addressPane; |
private ArrayList<ChangeListener> changeListeners = new ArrayList<ChangeListener>(); |
||||||
private TinyFormulaPane addressNamePane; |
|
||||||
private UICorrelationPane seriesPane; |
public GisMapReportDataContentPane() { |
||||||
private JPanel orderPane; |
initCom(); |
||||||
private ArrayList<ChangeListener> changeListeners = new ArrayList<ChangeListener>(); |
} |
||||||
|
|
||||||
public GisMapReportDataContentPane() { |
private void initCom() { |
||||||
initCom(); |
this.setLayout(new BorderLayout(0, 0)); |
||||||
} |
addressType = new UIButtonGroup<String>(new String[]{Inter.getLocText("Chart-Address"), Inter.getLocText("Chart-LngLat")}); |
||||||
|
lnglatOrder = new UIButtonGroup<String>(new String[]{Inter.getLocText("Chart-LngFirst"), Inter.getLocText("Chart-LatFirst")}); |
||||||
private void initCom() { |
addressPane = new TinyFormulaPane(); |
||||||
this.setLayout(new BorderLayout(0, 0)); |
addressNamePane = new TinyFormulaPane(); |
||||||
addressType = new UIButtonGroup<String>(new String[]{Inter.getLocText("Chart-Address"), Inter.getLocText("Chart-LngLat")}); |
double p = TableLayout.PREFERRED; |
||||||
lnglatOrder = new UIButtonGroup<String>(new String[]{Inter.getLocText("Chart-LngFirst"), Inter.getLocText("Chart-LatFirst")}); |
double f = TableLayout.FILL; |
||||||
addressPane = new TinyFormulaPane(); |
double[] columnSize = new double[]{p, f}; |
||||||
addressNamePane = new TinyFormulaPane(); |
double[] rowSize = new double[]{p, p, p}; |
||||||
double p = TableLayout.PREFERRED; |
|
||||||
double f = TableLayout.FILL; |
orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) { |
||||||
double[] columnSize = new double[]{p, f}; |
@Override |
||||||
double[] rowSize = new double[]{p, p, p}; |
public Dimension getPreferredSize() { |
||||||
|
if (this.isVisible()) { |
||||||
orderPane = new JPanel(new BorderLayout(LayoutConstants.VGAP_MEDIUM, 0)) { |
return super.getPreferredSize(); |
||||||
@Override |
} else { |
||||||
public Dimension getPreferredSize() { |
return new Dimension(0, 0); |
||||||
if (this.isVisible()) { |
} |
||||||
return super.getPreferredSize(); |
} |
||||||
} else { |
}; |
||||||
return new Dimension(0, 0); |
orderPane.add(new UILabel(Inter.getLocText("Chart-LatLngOrder")), BorderLayout.WEST); |
||||||
} |
orderPane.add(lnglatOrder, BorderLayout.CENTER); |
||||||
} |
orderPane.setVisible(false); |
||||||
}; |
lnglatOrder.setSelectedIndex(0); |
||||||
orderPane.add(new UILabel(Inter.getLocText("Chart-LatLngOrder")), BorderLayout.WEST); |
addressType.setSelectedIndex(0); |
||||||
orderPane.add(lnglatOrder, BorderLayout.CENTER); |
Component[][] components = new Component[][]{ |
||||||
orderPane.setVisible(false); |
new Component[]{addressType, addressPane}, |
||||||
lnglatOrder.setSelectedIndex(0); |
new Component[]{orderPane, null}, |
||||||
addressType.setSelectedIndex(0); |
new Component[]{new UILabel(" " +Inter.getLocText("Chart-Address-Name")+":", SwingConstants.RIGHT), addressNamePane}, |
||||||
Component[][] components = new Component[][]{ |
}; |
||||||
new Component[]{addressType, addressPane}, |
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
new Component[]{orderPane, null}, |
|
||||||
new Component[]{new UILabel(" " +Inter.getLocText("Chart-Address-Name")+":", SwingConstants.RIGHT), addressNamePane}, |
this.add(northPane, BorderLayout.NORTH); |
||||||
}; |
|
||||||
JPanel northPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
String[] columnNames = new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}; |
||||||
|
seriesPane = new UICorrelationPane(columnNames) { |
||||||
this.add(northPane, BorderLayout.NORTH); |
public UITableEditor createUITableEditor() { |
||||||
|
return new InnerTableEditor(); |
||||||
String[] columnNames = new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}; |
} |
||||||
seriesPane = new UICorrelationPane(columnNames) { |
}; |
||||||
public UITableEditor createUITableEditor() { |
|
||||||
return new InnerTableEditor(); |
this.add(seriesPane, BorderLayout.CENTER); |
||||||
} |
} |
||||||
}; |
|
||||||
|
/** |
||||||
this.add(seriesPane, BorderLayout.CENTER); |
* 界面接入. |
||||||
} |
* @param ob 对象 |
||||||
|
* @return true表示接受 |
||||||
/** |
*/ |
||||||
* 界面接入. |
public boolean accept(Object ob) { |
||||||
* @param ob 对象 |
return true; |
||||||
* @return true表示接受 |
} |
||||||
*/ |
|
||||||
public boolean accept(Object ob) { |
/** |
||||||
return true; |
* 重置 |
||||||
} |
*/ |
||||||
|
public void reset() { |
||||||
/** |
|
||||||
* 重置 |
} |
||||||
*/ |
|
||||||
public void reset() { |
/** |
||||||
|
* 界面弹出标题. |
||||||
} |
* @return 标题 |
||||||
|
*/ |
||||||
/** |
public String title4PopupWindow() { |
||||||
* 界面弹出标题. |
return Inter.getLocText("Cell"); |
||||||
* @return 标题 |
} |
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
@Override |
||||||
return Inter.getLocText("Cell"); |
public void populateBean(GisMapReportDefinition ob) { |
||||||
} |
if (ob.getCategoryName() != null) { |
||||||
|
if (ob.isAddress()) { |
||||||
@Override |
addressType.setSelectedIndex(0); |
||||||
public void populateBean(GisMapReportDefinition ob) { |
orderPane.setVisible(false); |
||||||
if (ob.getCategoryName() != null) { |
} else { |
||||||
if (ob.isAddress()) { |
addressType.setSelectedIndex(1); |
||||||
addressType.setSelectedIndex(0); |
orderPane.setVisible(true); |
||||||
orderPane.setVisible(false); |
} |
||||||
} else { |
|
||||||
addressType.setSelectedIndex(1); |
if (ob.isLngFirst()) { |
||||||
orderPane.setVisible(true); |
lnglatOrder.setSelectedIndex(0); |
||||||
} |
} else { |
||||||
|
lnglatOrder.setSelectedIndex(1); |
||||||
if (ob.isLngFirst()) { |
} |
||||||
lnglatOrder.setSelectedIndex(0); |
|
||||||
} else { |
addressPane.populateBean(Utils.objectToString(ob.getCategoryName())); |
||||||
lnglatOrder.setSelectedIndex(1); |
if (ob.getAddressName() != null) { |
||||||
} |
addressNamePane.populateBean(Utils.objectToString(ob.getAddressName())); |
||||||
|
} |
||||||
addressPane.populateBean(Utils.objectToString(ob.getCategoryName())); |
int size = ob.getTitleValueSize(); |
||||||
if (ob.getAddressName() != null) { |
List paneList = new ArrayList(); |
||||||
addressNamePane.populateBean(Utils.objectToString(ob.getAddressName())); |
for (int i = 0; i < size; i++) { |
||||||
} |
BaseSeriesDefinition first = ob.getTitleValueWithIndex(i); |
||||||
int size = ob.getTitleValueSize(); |
if (first != null && first.getSeriesName() != null && first.getValue() != null) { |
||||||
List paneList = new ArrayList(); |
paneList.add(new Object[]{first.getSeriesName(), first.getValue()}); |
||||||
for (int i = 0; i < size; i++) { |
} |
||||||
BaseSeriesDefinition first = ob.getTitleValueWithIndex(i); |
} |
||||||
if (first != null && first.getSeriesName() != null && first.getValue() != null) { |
if (!paneList.isEmpty()) { |
||||||
paneList.add(new Object[]{first.getSeriesName(), first.getValue()}); |
seriesPane.populateBean(paneList); |
||||||
} |
} |
||||||
} |
} |
||||||
if (!paneList.isEmpty()) { |
} |
||||||
seriesPane.populateBean(paneList); |
|
||||||
} |
@Override |
||||||
} |
public GisMapReportDefinition updateBean() { |
||||||
} |
GisMapReportDefinition reportDefinition = new GisMapReportDefinition(); |
||||||
|
if (this.addressType.getSelectedIndex() == 0) { |
||||||
@Override |
reportDefinition.setAddressType(true); |
||||||
public GisMapReportDefinition updateBean() { |
orderPane.setVisible(false); |
||||||
GisMapReportDefinition reportDefinition = new GisMapReportDefinition(); |
} else { |
||||||
if (this.addressType.getSelectedIndex() == 0) { |
reportDefinition.setAddressType(false); |
||||||
reportDefinition.setAddressType(true); |
orderPane.setVisible(true); |
||||||
orderPane.setVisible(false); |
} |
||||||
} else { |
|
||||||
reportDefinition.setAddressType(false); |
if (this.lnglatOrder.getSelectedIndex() == 0) { |
||||||
orderPane.setVisible(true); |
reportDefinition.setLnglatOrder(true); |
||||||
} |
} else { |
||||||
|
reportDefinition.setLnglatOrder(false); |
||||||
if (this.lnglatOrder.getSelectedIndex() == 0) { |
} |
||||||
reportDefinition.setLnglatOrder(true); |
|
||||||
} else { |
String address = addressPane.updateBean(); |
||||||
reportDefinition.setLnglatOrder(false); |
if (StringUtils.isBlank(address)) { |
||||||
} |
return null; |
||||||
|
} |
||||||
String address = addressPane.updateBean(); |
if (StableUtils.canBeFormula(address)) { |
||||||
if (StringUtils.isBlank(address)) { |
reportDefinition.setCategoryName(BaseFormula.createFormulaBuilder().build(address)); |
||||||
return null; |
} else { |
||||||
} |
reportDefinition.setCategoryName(address); |
||||||
if (StableUtils.canBeFormula(address)) { |
} |
||||||
reportDefinition.setCategoryName(new Formula(address)); |
|
||||||
} else { |
String addressName = addressNamePane.updateBean(); |
||||||
reportDefinition.setCategoryName(address); |
if (addressName != null && !StringUtils.isBlank(addressName)) { |
||||||
} |
if (StableUtils.canBeFormula(addressName)) { |
||||||
|
reportDefinition.setAddressName(addressName); |
||||||
String addressName = addressNamePane.updateBean(); |
} else { |
||||||
if (addressName != null && !StringUtils.isBlank(addressName)) { |
reportDefinition.setAddressName(addressName); |
||||||
if (StableUtils.canBeFormula(addressName)) { |
} |
||||||
reportDefinition.setAddressName(addressName); |
} |
||||||
} else { |
List values = seriesPane.updateBean(); |
||||||
reportDefinition.setAddressName(addressName); |
if (values != null && !values.isEmpty()) { |
||||||
} |
for (int i = 0, size = values.size(); i < size; i++) { |
||||||
} |
Object[] objects = (Object[]) values.get(i); |
||||||
List values = seriesPane.updateBean(); |
Object name = objects[0]; |
||||||
if (values != null && !values.isEmpty()) { |
Object value = objects[1]; |
||||||
for (int i = 0, size = values.size(); i < size; i++) { |
|
||||||
Object[] objects = (Object[]) values.get(i); |
if (StableUtils.canBeFormula(value)) { |
||||||
Object name = objects[0]; |
value = BaseFormula.createFormulaBuilder().build(value); |
||||||
Object value = objects[1]; |
} |
||||||
|
SeriesDefinition definition = new SeriesDefinition(name, value); |
||||||
if (StableUtils.canBeFormula(value)) { |
reportDefinition.addTitleValue(definition); |
||||||
value = new Formula(Utils.objectToString(value)); |
} |
||||||
} |
} |
||||||
SeriesDefinition definition = new SeriesDefinition(name, value); |
return reportDefinition; |
||||||
reportDefinition.addTitleValue(definition); |
} |
||||||
} |
|
||||||
} |
/** |
||||||
return reportDefinition; |
* 给组件登记一个观察者监听事件 |
||||||
} |
* |
||||||
|
* @param listener 观察者监听事件 |
||||||
/** |
*/ |
||||||
* 给组件登记一个观察者监听事件 |
public void registerChangeListener(final UIObserverListener listener) { |
||||||
* |
changeListeners.add(new ChangeListener() { |
||||||
* @param listener 观察者监听事件 |
public void stateChanged(ChangeEvent e) { |
||||||
*/ |
listener.doChange(); |
||||||
public void registerChangeListener(final UIObserverListener listener) { |
} |
||||||
changeListeners.add(new ChangeListener() { |
}); |
||||||
public void stateChanged(ChangeEvent e) { |
} |
||||||
listener.doChange(); |
|
||||||
} |
/** |
||||||
}); |
* 组件是否需要响应添加的观察者事件 |
||||||
} |
* |
||||||
|
* @return 如果需要响应观察者事件则返回true,否则返回false |
||||||
/** |
*/ |
||||||
* 组件是否需要响应添加的观察者事件 |
public boolean shouldResponseChangeListener() { |
||||||
* |
return true; |
||||||
* @return 如果需要响应观察者事件则返回true,否则返回false |
} |
||||||
*/ |
|
||||||
public boolean shouldResponseChangeListener() { |
private class InnerTableEditor extends UITableEditor { |
||||||
return true; |
private JComponent editorComponent; |
||||||
} |
|
||||||
|
/** |
||||||
private class InnerTableEditor extends UITableEditor { |
* 返回当前编辑器的值 |
||||||
private JComponent editorComponent; |
*/ |
||||||
|
public Object getCellEditorValue() { |
||||||
/** |
if (editorComponent instanceof TinyFormulaPane) { |
||||||
* 返回当前编辑器的值 |
return ((TinyFormulaPane) editorComponent).getUITextField().getText(); |
||||||
*/ |
} else if (editorComponent instanceof UITextField) { |
||||||
public Object getCellEditorValue() { |
return ((UITextField) editorComponent).getText(); |
||||||
if (editorComponent instanceof TinyFormulaPane) { |
} |
||||||
return ((TinyFormulaPane) editorComponent).getUITextField().getText(); |
|
||||||
} else if (editorComponent instanceof UITextField) { |
return super.getCellEditorValue(); |
||||||
return ((UITextField) editorComponent).getText(); |
} |
||||||
} |
|
||||||
|
/** |
||||||
return super.getCellEditorValue(); |
* 返回当前编辑器.. |
||||||
} |
*/ |
||||||
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
||||||
/** |
if (column == table.getModel().getColumnCount()) { |
||||||
* 返回当前编辑器.. |
return null; |
||||||
*/ |
} |
||||||
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
return getEditorComponent(column, value); |
||||||
if (column == table.getModel().getColumnCount()) { |
} |
||||||
return null; |
|
||||||
} |
private JComponent getEditorComponent(int column, Object value) { |
||||||
return getEditorComponent(column, value); |
if (column == 0) { |
||||||
} |
UITextField field = new UITextField(); |
||||||
|
addListener4UITextFiled(field); |
||||||
private JComponent getEditorComponent(int column, Object value) { |
|
||||||
if (column == 0) { |
if (value != null) { |
||||||
UITextField field = new UITextField(); |
field.setText(Utils.objectToString(value)); |
||||||
addListener4UITextFiled(field); |
} |
||||||
|
editorComponent = field; |
||||||
if (value != null) { |
} else { |
||||||
field.setText(Utils.objectToString(value)); |
TinyFormulaPane tinyPane = new TinyFormulaPane() { |
||||||
} |
@Override |
||||||
editorComponent = field; |
public void okEvent() { |
||||||
} else { |
seriesPane.stopCellEditing(); |
||||||
TinyFormulaPane tinyPane = new TinyFormulaPane() { |
seriesPane.fireTargetChanged(); |
||||||
@Override |
} |
||||||
public void okEvent() { |
}; |
||||||
seriesPane.stopCellEditing(); |
tinyPane.setBackground(UIConstants.FLESH_BLUE); |
||||||
seriesPane.fireTargetChanged(); |
|
||||||
} |
addListener4UITextFiled(tinyPane.getUITextField()); |
||||||
}; |
|
||||||
tinyPane.setBackground(UIConstants.FLESH_BLUE); |
if (value != null) { |
||||||
|
tinyPane.getUITextField().setText(Utils.objectToString(value)); |
||||||
addListener4UITextFiled(tinyPane.getUITextField()); |
} |
||||||
|
|
||||||
if (value != null) { |
editorComponent = tinyPane; |
||||||
tinyPane.getUITextField().setText(Utils.objectToString(value)); |
} |
||||||
} |
return editorComponent; |
||||||
|
} |
||||||
editorComponent = tinyPane; |
|
||||||
} |
private void addListener4UITextFiled(UITextField textField) { |
||||||
return editorComponent; |
|
||||||
} |
textField.addFocusListener(new FocusAdapter() { |
||||||
|
@Override |
||||||
private void addListener4UITextFiled(UITextField textField) { |
public void focusLost(FocusEvent e) { |
||||||
|
// seriesPane.stopCellEditing(); //kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出.
|
||||||
textField.addFocusListener(new FocusAdapter() { |
seriesPane.fireTargetChanged(); |
||||||
@Override |
} |
||||||
public void focusLost(FocusEvent e) { |
}); |
||||||
// seriesPane.stopCellEditing(); //kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出.
|
} |
||||||
seriesPane.fireTargetChanged(); |
} |
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
} |
@ -1,202 +1,196 @@ |
|||||||
package com.fr.design.chart.report; |
package com.fr.design.chart.report; |
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.base.BaseFormula; |
||||||
import java.awt.Component; |
import com.fr.base.Utils; |
||||||
import java.awt.Dimension; |
import com.fr.chart.chartdata.BaseSeriesDefinition; |
||||||
import java.awt.FlowLayout; |
import com.fr.chart.chartdata.MapSingleLayerReportDefinition; |
||||||
import java.awt.event.FocusAdapter; |
import com.fr.chart.chartdata.SeriesDefinition; |
||||||
import java.awt.event.FocusEvent; |
import com.fr.design.beans.BasicBeanPane; |
||||||
import java.util.ArrayList; |
import com.fr.design.constants.UIConstants; |
||||||
import java.util.List; |
import com.fr.design.event.UIObserver; |
||||||
|
import com.fr.design.event.UIObserverListener; |
||||||
import javax.swing.JComponent; |
import com.fr.design.formula.TinyFormulaPane; |
||||||
import javax.swing.JPanel; |
import com.fr.design.gui.frpane.UICorrelationPane; |
||||||
import javax.swing.JTable; |
import com.fr.design.gui.ilable.UILabel; |
||||||
|
import com.fr.design.gui.itable.UITableEditor; |
||||||
import com.fr.base.Formula; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.base.Utils; |
import com.fr.general.Inter; |
||||||
import com.fr.chart.chartdata.BaseSeriesDefinition; |
import com.fr.stable.StableUtils; |
||||||
import com.fr.chart.chartdata.MapSingleLayerReportDefinition; |
import com.fr.stable.StringUtils; |
||||||
import com.fr.chart.chartdata.SeriesDefinition; |
|
||||||
import com.fr.design.constants.UIConstants; |
import javax.swing.*; |
||||||
import com.fr.design.beans.BasicBeanPane; |
import java.awt.*; |
||||||
import com.fr.design.event.UIObserver; |
import java.awt.event.FocusAdapter; |
||||||
import com.fr.design.event.UIObserverListener; |
import java.awt.event.FocusEvent; |
||||||
import com.fr.design.formula.TinyFormulaPane; |
import java.util.ArrayList; |
||||||
import com.fr.design.gui.frpane.UICorrelationPane; |
import java.util.List; |
||||||
import com.fr.design.gui.ilable.UILabel; |
|
||||||
import com.fr.design.gui.itable.UITableEditor; |
/** |
||||||
import com.fr.design.gui.itextfield.UITextField; |
* 多层地图, 单元格, 多层切换 单界面. |
||||||
import com.fr.general.Inter; |
* @author kunsnat E-mail:kunsnat@gmail.com |
||||||
import com.fr.stable.StableUtils; |
* @version 创建时间:2013-4-22 下午04:26:10 |
||||||
import com.fr.stable.StringUtils; |
*/ |
||||||
|
public class MapMoreReportIndexPane extends BasicBeanPane<MapSingleLayerReportDefinition> implements UIObserver{ |
||||||
/** |
private String title = StringUtils.EMPTY; |
||||||
* 多层地图, 单元格, 多层切换 单界面. |
|
||||||
* @author kunsnat E-mail:kunsnat@gmail.com |
private TinyFormulaPane areaNamePane; |
||||||
* @version 创建时间:2013-4-22 下午04:26:10 |
private UICorrelationPane tabPane; |
||||||
*/ |
|
||||||
public class MapMoreReportIndexPane extends BasicBeanPane<MapSingleLayerReportDefinition> implements UIObserver{ |
public MapMoreReportIndexPane() { |
||||||
private String title = StringUtils.EMPTY; |
initPane(); |
||||||
|
} |
||||||
private TinyFormulaPane areaNamePane; |
|
||||||
private UICorrelationPane tabPane; |
public MapMoreReportIndexPane(String titleName) { |
||||||
|
title = titleName; |
||||||
public MapMoreReportIndexPane() { |
initPane(); |
||||||
initPane(); |
} |
||||||
} |
|
||||||
|
private void initPane() { |
||||||
public MapMoreReportIndexPane(String titleName) { |
this.setLayout(new BorderLayout(0, 0)); |
||||||
title = titleName; |
|
||||||
initPane(); |
JPanel northPane = new JPanel(); |
||||||
} |
this.add(northPane, BorderLayout.NORTH); |
||||||
|
northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); |
||||||
private void initPane() { |
|
||||||
this.setLayout(new BorderLayout(0, 0)); |
northPane.add(new UILabel(Inter.getLocText("Area_Name") + ":")); |
||||||
|
|
||||||
JPanel northPane = new JPanel(); |
areaNamePane = new TinyFormulaPane(); |
||||||
this.add(northPane, BorderLayout.NORTH); |
areaNamePane.setPreferredSize(new Dimension(120, 20)); |
||||||
northPane.setLayout(new FlowLayout(FlowLayout.LEFT)); |
northPane.add(areaNamePane); |
||||||
|
|
||||||
northPane.add(new UILabel(Inter.getLocText("Area_Name") + ":")); |
tabPane = new UICorrelationPane(new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}){ |
||||||
|
public UITableEditor createUITableEditor() { |
||||||
areaNamePane = new TinyFormulaPane(); |
return new InnerTableEditor(); |
||||||
areaNamePane.setPreferredSize(new Dimension(120, 20)); |
} |
||||||
northPane.add(areaNamePane); |
}; |
||||||
|
|
||||||
tabPane = new UICorrelationPane(new String[]{Inter.getLocText(new String[]{"Filed", "Title"}), Inter.getLocText("Area_Value")}){ |
this.add(tabPane, BorderLayout.CENTER); |
||||||
public UITableEditor createUITableEditor() { |
} |
||||||
return new InnerTableEditor(); |
|
||||||
} |
@Override |
||||||
}; |
public void populateBean(MapSingleLayerReportDefinition definition) { |
||||||
|
if(definition != null && definition.getCategoryName() != null) { |
||||||
this.add(tabPane, BorderLayout.CENTER); |
areaNamePane.populateBean(Utils.objectToString(definition.getCategoryName())); |
||||||
} |
|
||||||
|
List paneList = new ArrayList(); |
||||||
@Override |
int titleValueSize = definition.getTitleValueSize(); |
||||||
public void populateBean(MapSingleLayerReportDefinition definition) { |
for(int i = 0; i < titleValueSize; i++) { |
||||||
if(definition != null && definition.getCategoryName() != null) { |
BaseSeriesDefinition sd = definition.getTitleValueWithIndex(i); |
||||||
areaNamePane.populateBean(Utils.objectToString(definition.getCategoryName())); |
if(sd != null && sd.getSeriesName() != null && sd.getValue() != null) { |
||||||
|
paneList.add(new Object[]{sd.getSeriesName(), sd.getValue()}); |
||||||
List paneList = new ArrayList(); |
} |
||||||
int titleValueSize = definition.getTitleValueSize(); |
} |
||||||
for(int i = 0; i < titleValueSize; i++) { |
|
||||||
BaseSeriesDefinition sd = definition.getTitleValueWithIndex(i); |
if(!paneList.isEmpty()) { |
||||||
if(sd != null && sd.getSeriesName() != null && sd.getValue() != null) { |
tabPane.populateBean(paneList); |
||||||
paneList.add(new Object[]{sd.getSeriesName(), sd.getValue()}); |
} |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
if(!paneList.isEmpty()) { |
public MapSingleLayerReportDefinition updateBean() { |
||||||
tabPane.populateBean(paneList); |
MapSingleLayerReportDefinition definition = new MapSingleLayerReportDefinition(); |
||||||
} |
|
||||||
} |
String areaName = areaNamePane.updateBean(); |
||||||
} |
if(StableUtils.canBeFormula(areaName)) { |
||||||
|
definition.setCategoryName(BaseFormula.createFormulaBuilder().build(areaName)); |
||||||
public MapSingleLayerReportDefinition updateBean() { |
} else { |
||||||
MapSingleLayerReportDefinition definition = new MapSingleLayerReportDefinition(); |
definition.setCategoryName(areaName); |
||||||
|
} |
||||||
String areaName = areaNamePane.updateBean(); |
|
||||||
if(StableUtils.canBeFormula(areaName)) { |
List paneList = tabPane.updateBean(); |
||||||
definition.setCategoryName(new Formula(areaName)); |
for(int i = 0, size = paneList.size(); i < size; i++) { |
||||||
} else { |
Object[] values = (Object[])paneList.get(i); |
||||||
definition.setCategoryName(areaName); |
if(values.length == 2) { |
||||||
} |
SeriesDefinition seriesDefinition = new SeriesDefinition(); |
||||||
|
seriesDefinition.setSeriesName(values[0]); |
||||||
List paneList = tabPane.updateBean(); |
seriesDefinition.setValue(values[1]); |
||||||
for(int i = 0, size = paneList.size(); i < size; i++) { |
definition.addTitleValue(seriesDefinition); |
||||||
Object[] values = (Object[])paneList.get(i); |
} |
||||||
if(values.length == 2) { |
} |
||||||
SeriesDefinition seriesDefinition = new SeriesDefinition(); |
|
||||||
seriesDefinition.setSeriesName(values[0]); |
return definition; |
||||||
seriesDefinition.setValue(values[1]); |
} |
||||||
definition.addTitleValue(seriesDefinition); |
|
||||||
} |
@Override |
||||||
} |
protected String title4PopupWindow() { |
||||||
|
return title; |
||||||
return definition; |
} |
||||||
} |
|
||||||
|
private class InnerTableEditor extends UITableEditor { |
||||||
@Override |
private JComponent editorComponent; |
||||||
protected String title4PopupWindow() { |
|
||||||
return title; |
/** |
||||||
} |
* 返回当前编辑器的值 |
||||||
|
*/ |
||||||
private class InnerTableEditor extends UITableEditor { |
public Object getCellEditorValue() { |
||||||
private JComponent editorComponent; |
if(editorComponent instanceof TinyFormulaPane) { |
||||||
|
return ((TinyFormulaPane)editorComponent).getUITextField().getText(); |
||||||
/** |
} else if(editorComponent instanceof UITextField) { |
||||||
* 返回当前编辑器的值 |
return ((UITextField)editorComponent).getText(); |
||||||
*/ |
} |
||||||
public Object getCellEditorValue() { |
|
||||||
if(editorComponent instanceof TinyFormulaPane) { |
return super.getCellEditorValue(); |
||||||
return ((TinyFormulaPane)editorComponent).getUITextField().getText(); |
} |
||||||
} else if(editorComponent instanceof UITextField) { |
|
||||||
return ((UITextField)editorComponent).getText(); |
/** |
||||||
} |
* 返回当前编辑器.. |
||||||
|
*/ |
||||||
return super.getCellEditorValue(); |
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
||||||
} |
if (column == table.getModel().getColumnCount()) { |
||||||
|
return null; |
||||||
/** |
} |
||||||
* 返回当前编辑器.. |
return getEditorComponent(column, value); |
||||||
*/ |
} |
||||||
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { |
|
||||||
if (column == table.getModel().getColumnCount()) { |
private JComponent getEditorComponent(int column, Object value) { |
||||||
return null; |
if(column == 0) { |
||||||
} |
UITextField field = new UITextField(); |
||||||
return getEditorComponent(column, value); |
editorComponent = field; |
||||||
} |
|
||||||
|
if(value != null) { |
||||||
private JComponent getEditorComponent(int column, Object value) { |
field.setText(Utils.objectToString(value)); |
||||||
if(column == 0) { |
} |
||||||
UITextField field = new UITextField(); |
} else { |
||||||
editorComponent = field; |
TinyFormulaPane tinyPane = new TinyFormulaPane() { |
||||||
|
@Override |
||||||
if(value != null) { |
public void okEvent() { |
||||||
field.setText(Utils.objectToString(value)); |
tabPane.stopCellEditing(); |
||||||
} |
tabPane.fireTargetChanged(); |
||||||
} else { |
} |
||||||
TinyFormulaPane tinyPane = new TinyFormulaPane() { |
}; |
||||||
@Override |
tinyPane.setBackground(UIConstants.FLESH_BLUE); |
||||||
public void okEvent() { |
|
||||||
tabPane.stopCellEditing(); |
tinyPane.getUITextField().addFocusListener(new FocusAdapter() { |
||||||
tabPane.fireTargetChanged(); |
@Override |
||||||
} |
public void focusLost(FocusEvent e) { |
||||||
}; |
// tabPane.stopCellEditing();//kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出.
|
||||||
tinyPane.setBackground(UIConstants.FLESH_BLUE); |
tabPane.fireTargetChanged(); |
||||||
|
} |
||||||
tinyPane.getUITextField().addFocusListener(new FocusAdapter() { |
}); |
||||||
@Override |
|
||||||
public void focusLost(FocusEvent e) { |
if(value != null) { |
||||||
// tabPane.stopCellEditing();//kunsnat: 不stop是因为可能直接点击公式编辑按钮, 否则需要点击两次才能弹出.
|
tinyPane.getUITextField().setText(Utils.objectToString(value)); |
||||||
tabPane.fireTargetChanged(); |
} |
||||||
} |
|
||||||
}); |
editorComponent = tinyPane; |
||||||
|
} |
||||||
if(value != null) { |
return editorComponent; |
||||||
tinyPane.getUITextField().setText(Utils.objectToString(value)); |
} |
||||||
} |
} |
||||||
|
|
||||||
editorComponent = tinyPane; |
@Override |
||||||
} |
public void registerChangeListener(UIObserverListener listener) { |
||||||
return editorComponent; |
if(tabPane != null) { |
||||||
} |
tabPane.registerChangeListener(listener); |
||||||
} |
} |
||||||
|
if(areaNamePane != null) { |
||||||
@Override |
areaNamePane.registerChangeListener(listener); |
||||||
public void registerChangeListener(UIObserverListener listener) { |
} |
||||||
if(tabPane != null) { |
} |
||||||
tabPane.registerChangeListener(listener); |
|
||||||
} |
@Override |
||||||
if(areaNamePane != null) { |
public boolean shouldResponseChangeListener() { |
||||||
areaNamePane.registerChangeListener(listener); |
return true; |
||||||
} |
} |
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public boolean shouldResponseChangeListener() { |
|
||||||
return true; |
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
@ -1,471 +1,469 @@ |
|||||||
package com.fr.design.mainframe.chart.gui.style; |
package com.fr.design.mainframe.chart.gui.style; |
||||||
|
|
||||||
import java.awt.*; |
import com.fr.base.BaseFormula; |
||||||
import java.awt.event.ActionEvent; |
import com.fr.base.Style; |
||||||
import java.awt.event.ActionListener; |
import com.fr.base.Utils; |
||||||
import java.awt.event.ItemEvent; |
import com.fr.chart.base.ChartBaseUtils; |
||||||
import java.awt.event.ItemListener; |
import com.fr.chart.base.TextAttr; |
||||||
|
import com.fr.chart.chartattr.Axis; |
||||||
import javax.swing.JPanel; |
import com.fr.design.constants.LayoutConstants; |
||||||
import javax.swing.SpinnerNumberModel; |
import com.fr.design.dialog.BasicPane; |
||||||
import javax.swing.event.ChangeEvent; |
import com.fr.design.event.UIObserver; |
||||||
import javax.swing.event.ChangeListener; |
import com.fr.design.event.UIObserverListener; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.base.Formula; |
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
import com.fr.base.Style; |
import com.fr.design.gui.ilable.UILabel; |
||||||
import com.fr.base.Utils; |
import com.fr.design.gui.ispinner.UIBasicSpinner; |
||||||
import com.fr.chart.base.ChartBaseUtils; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.chart.base.TextAttr; |
import com.fr.design.gui.style.NumberDragBar; |
||||||
import com.fr.chart.chartattr.Axis; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.event.UIObserver; |
import com.fr.general.Inter; |
||||||
import com.fr.design.event.UIObserverListener; |
|
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import javax.swing.*; |
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
import javax.swing.event.ChangeEvent; |
||||||
import com.fr.design.gui.ilable.UILabel; |
import javax.swing.event.ChangeListener; |
||||||
import com.fr.design.gui.ispinner.UIBasicSpinner; |
import java.awt.*; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import java.awt.event.ActionEvent; |
||||||
import com.fr.design.gui.style.NumberDragBar; |
import java.awt.event.ActionListener; |
||||||
import com.fr.design.layout.TableLayout; |
import java.awt.event.ItemEvent; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import java.awt.event.ItemListener; |
||||||
import com.fr.design.dialog.BasicPane; |
|
||||||
import com.fr.general.Inter; |
public class ChartAxisLabelPane extends BasicPane implements UIObserver{ |
||||||
|
private static final int LABEL_INTERVAL = 0; |
||||||
public class ChartAxisLabelPane extends BasicPane implements UIObserver{ |
private static final int LABEL_WRAP =1; |
||||||
private static final int LABEL_INTERVAL = 0; |
|
||||||
private static final int LABEL_WRAP =1; |
private static final long serialVersionUID = 6601571951210596823L; |
||||||
|
private static final int NUM90 = 90; |
||||||
private static final long serialVersionUID = 6601571951210596823L; |
private UICheckBox isLabelShow; |
||||||
private static final int NUM90 = 90; |
private UIComboBox showWay;//显示方式
|
||||||
private UICheckBox isLabelShow; |
private UITextField customLabelSamleTime; |
||||||
private UIComboBox showWay;//显示方式
|
private UIComboBox labelOrientationChoose; |
||||||
private UITextField customLabelSamleTime; |
private NumberDragBar orientationBar; |
||||||
private UIComboBox labelOrientationChoose; |
private UIBasicSpinner orientationSpinner; |
||||||
private NumberDragBar orientationBar; |
private ChartTextAttrPane textAttrPane; |
||||||
private UIBasicSpinner orientationSpinner; |
private UICheckBox auto; |
||||||
private ChartTextAttrPane textAttrPane; |
private UICheckBox custom; |
||||||
private UICheckBox auto; |
private UIComboBox labelSampleChoose; |
||||||
private UICheckBox custom; |
|
||||||
private UIComboBox labelSampleChoose; |
private JPanel labelPane; |
||||||
|
private JPanel showWayPane; |
||||||
private JPanel labelPane; |
private UIObserverListener observerListener; |
||||||
private JPanel showWayPane; |
private ActionListener autoActionListener = new ActionListener() { |
||||||
private UIObserverListener observerListener; |
@Override |
||||||
private ActionListener autoActionListener = new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
||||||
@Override |
auto.removeActionListener(autoActionListener); |
||||||
public void actionPerformed(ActionEvent e) { |
custom.removeActionListener(customActionListener); |
||||||
auto.removeActionListener(autoActionListener); |
auto.setSelected(true); |
||||||
custom.removeActionListener(customActionListener); |
custom.setSelected(false); |
||||||
auto.setSelected(true); |
customLabelSamleTime.setEnabled(false); |
||||||
custom.setSelected(false); |
auto.addActionListener(autoActionListener); |
||||||
customLabelSamleTime.setEnabled(false); |
custom.addActionListener(customActionListener); |
||||||
auto.addActionListener(autoActionListener); |
} |
||||||
custom.addActionListener(customActionListener); |
}; |
||||||
} |
|
||||||
}; |
private ActionListener customActionListener = new ActionListener() { |
||||||
|
@Override |
||||||
private ActionListener customActionListener = new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
||||||
@Override |
auto.removeActionListener(autoActionListener); |
||||||
public void actionPerformed(ActionEvent e) { |
custom.removeActionListener(customActionListener); |
||||||
auto.removeActionListener(autoActionListener); |
auto.setSelected(false); |
||||||
custom.removeActionListener(customActionListener); |
custom.setSelected(true); |
||||||
auto.setSelected(false); |
customLabelSamleTime.setEnabled(true); |
||||||
custom.setSelected(true); |
customLabelSamleTime.setText("1"); |
||||||
customLabelSamleTime.setEnabled(true); |
auto.addActionListener(autoActionListener); |
||||||
customLabelSamleTime.setText("1"); |
custom.addActionListener(customActionListener); |
||||||
auto.addActionListener(autoActionListener); |
} |
||||||
custom.addActionListener(customActionListener); |
}; |
||||||
} |
|
||||||
}; |
public ChartAxisLabelPane() { |
||||||
|
initComponents(); |
||||||
public ChartAxisLabelPane() { |
} |
||||||
initComponents(); |
|
||||||
} |
private void initComponents() { |
||||||
|
isLabelShow = new UICheckBox(Inter.getLocText("FR-Utils_Label")); |
||||||
private void initComponents() { |
auto = new UICheckBox(Inter.getLocText(new String[]{"FR-App-All_Auto", "FR-Chart-Axis_labelInterval"})); |
||||||
isLabelShow = new UICheckBox(Inter.getLocText("FR-Utils_Label")); |
custom = new UICheckBox(Inter.getLocText(new String[]{"FR-App-All_Custom", "FR-Chart-Axis_labelInterval"})); |
||||||
auto = new UICheckBox(Inter.getLocText(new String[]{"FR-App-All_Auto", "FR-Chart-Axis_labelInterval"})); |
showWay = new UIComboBox(new String[]{Inter.getLocText("FR-Chart-Axis_labelInterval"),Inter.getLocText("FR-Chart-Axis_labelWrap")}); |
||||||
custom = new UICheckBox(Inter.getLocText(new String[]{"FR-App-All_Custom", "FR-Chart-Axis_labelInterval"})); |
customLabelSamleTime = new UITextField(); |
||||||
showWay = new UIComboBox(new String[]{Inter.getLocText("FR-Chart-Axis_labelInterval"),Inter.getLocText("FR-Chart-Axis_labelWrap")}); |
|
||||||
customLabelSamleTime = new UITextField(); |
String[] nameObjects = {Inter.getLocText("FR-Chart_All_Normal"), Inter.getLocText("FR-Chart-Text_Vertical"), Inter.getLocText("FR-Chart-Text_Rotation")}; |
||||||
|
labelOrientationChoose = new UIComboBox(nameObjects); |
||||||
String[] nameObjects = {Inter.getLocText("FR-Chart_All_Normal"), Inter.getLocText("FR-Chart-Text_Vertical"), Inter.getLocText("FR-Chart-Text_Rotation")}; |
orientationBar = new NumberDragBar(-NUM90, NUM90); |
||||||
labelOrientationChoose = new UIComboBox(nameObjects); |
orientationSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, -NUM90, NUM90, 1)); |
||||||
orientationBar = new NumberDragBar(-NUM90, NUM90); |
|
||||||
orientationSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, -NUM90, NUM90, 1)); |
String[] sampleType = {Inter.getLocText("FR-App-All_Auto"), Inter.getLocText("FR-App-All_Custom")}; |
||||||
|
labelSampleChoose = new UIComboBox(sampleType); |
||||||
String[] sampleType = {Inter.getLocText("FR-App-All_Auto"), Inter.getLocText("FR-App-All_Custom")}; |
customLabelSamleTime = new UITextField(); |
||||||
labelSampleChoose = new UIComboBox(sampleType); |
checkCustomSampleField(); |
||||||
customLabelSamleTime = new UITextField(); |
|
||||||
checkCustomSampleField(); |
checkOrientationField(); |
||||||
|
|
||||||
checkOrientationField(); |
textAttrPane = new ChartTextAttrPane(); |
||||||
|
this.setLayout(new BorderLayout()); |
||||||
textAttrPane = new ChartTextAttrPane(); |
|
||||||
this.setLayout(new BorderLayout()); |
initListener(); |
||||||
|
} |
||||||
initListener(); |
|
||||||
} |
private void initListener(){ |
||||||
|
|
||||||
private void initListener(){ |
showWay.addItemListener(new ItemListener() { |
||||||
|
@Override |
||||||
showWay.addItemListener(new ItemListener() { |
public void itemStateChanged(ItemEvent e) { |
||||||
@Override |
checkShowWay(); |
||||||
public void itemStateChanged(ItemEvent e) { |
} |
||||||
checkShowWay(); |
}); |
||||||
} |
|
||||||
}); |
orientationSpinner.addChangeListener(new ChangeListener() { |
||||||
|
@Override |
||||||
orientationSpinner.addChangeListener(new ChangeListener() { |
public void stateChanged(ChangeEvent e) { |
||||||
@Override |
orientationBar.setValue((Integer) orientationSpinner.getValue()); |
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
orientationBar.setValue((Integer) orientationSpinner.getValue()); |
} |
||||||
|
}); |
||||||
} |
orientationBar.addChangeListener(new ChangeListener() { |
||||||
}); |
@Override |
||||||
orientationBar.addChangeListener(new ChangeListener() { |
public void stateChanged(ChangeEvent e) { |
||||||
@Override |
orientationSpinner.setValue((Integer) orientationBar.getValue()); |
||||||
public void stateChanged(ChangeEvent e) { |
|
||||||
orientationSpinner.setValue((Integer) orientationBar.getValue()); |
} |
||||||
|
}); |
||||||
} |
|
||||||
}); |
|
||||||
|
labelSampleChoose.addActionListener(new ActionListener() { |
||||||
|
@Override |
||||||
labelSampleChoose.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
||||||
@Override |
checkCustomSampleField(); |
||||||
public void actionPerformed(ActionEvent e) { |
} |
||||||
checkCustomSampleField(); |
}); |
||||||
} |
|
||||||
}); |
auto.addActionListener(autoActionListener); |
||||||
|
|
||||||
auto.addActionListener(autoActionListener); |
custom.addActionListener(customActionListener); |
||||||
|
labelOrientationChoose.addActionListener(new ActionListener() { |
||||||
custom.addActionListener(customActionListener); |
@Override |
||||||
labelOrientationChoose.addActionListener(new ActionListener() { |
public void actionPerformed(ActionEvent e) { |
||||||
@Override |
checkOrientationField(); |
||||||
public void actionPerformed(ActionEvent e) { |
} |
||||||
checkOrientationField(); |
}); |
||||||
} |
isLabelShow.addActionListener(new ActionListener() { |
||||||
}); |
public void actionPerformed(ActionEvent e) { |
||||||
isLabelShow.addActionListener(new ActionListener() { |
checkLabelUse(); |
||||||
public void actionPerformed(ActionEvent e) { |
} |
||||||
checkLabelUse(); |
}); |
||||||
} |
} |
||||||
}); |
|
||||||
} |
private JPanel getWrapShowWayPane() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
private JPanel getWrapShowWayPane() { |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p, p, p, p}; |
||||||
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
|
||||||
double[] rowSize = {p, p, p, p}; |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, new UILabel(Inter.getLocText("FR-Chart-Axis_labelShowway")), showWay, null}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{null, new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), labelOrientationChoose, null}, |
||||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Chart-Axis_labelShowway")), showWay, null}, |
new Component[]{null, orientationSpinner, orientationBar, null}, |
||||||
new Component[]{null, new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), labelOrientationChoose, null}, |
new Component[]{null, textAttrPane, null, null}, |
||||||
new Component[]{null, orientationSpinner, orientationBar, null}, |
}; |
||||||
new Component[]{null, textAttrPane, null, null}, |
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
}; |
} |
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
private JPanel getIntervalShowWayPane() { |
||||||
|
|
||||||
private JPanel getIntervalShowWayPane() { |
double p = TableLayout.PREFERRED; |
||||||
|
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p, p, p}; |
||||||
double[] columnSize = {f}; |
|
||||||
double[] rowSize = {p, p, p}; |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{getCombox()}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{getTowChoose()}, |
||||||
new Component[]{getCombox()}, |
new Component[]{getOther()} |
||||||
new Component[]{getTowChoose()}, |
}; |
||||||
new Component[]{getOther()} |
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
}; |
} |
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
private JPanel getTowChoose() { |
||||||
|
auto.registerChangeListener(this.observerListener); |
||||||
private JPanel getTowChoose() { |
custom.registerChangeListener(this.observerListener); |
||||||
auto.registerChangeListener(this.observerListener); |
customLabelSamleTime.registerChangeListener(this.observerListener); |
||||||
custom.registerChangeListener(this.observerListener); |
auto.setSelected(true); |
||||||
customLabelSamleTime.registerChangeListener(this.observerListener); |
custom.setSelected(false); |
||||||
auto.setSelected(true); |
customLabelSamleTime.setVisible(true); |
||||||
custom.setSelected(false); |
customLabelSamleTime.setEnabled(false); |
||||||
customLabelSamleTime.setVisible(true); |
double p = TableLayout.PREFERRED; |
||||||
customLabelSamleTime.setEnabled(false); |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p, p}; |
||||||
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, f}; |
|
||||||
double[] rowSize = {p, p}; |
JPanel customPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ |
||||||
|
new Component[]{custom, customLabelSamleTime, null}, |
||||||
JPanel customPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ |
}, new double[]{p}, new double[]{p, p, f}); |
||||||
new Component[]{custom, customLabelSamleTime, null}, |
|
||||||
}, new double[]{p}, new double[]{p, p, f}); |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, auto,}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{null, customPane} |
||||||
new Component[]{null, auto,}, |
}; |
||||||
new Component[]{null, customPane} |
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
}; |
} |
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
private JPanel getCombox() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
private JPanel getCombox() { |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p}; |
||||||
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
|
||||||
double[] rowSize = {p}; |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, new UILabel(Inter.getLocText("FR-Chart-Axis_labelShowway")), showWay, null} |
||||||
Component[][] components = new Component[][]{ |
}; |
||||||
new Component[]{null, new UILabel(Inter.getLocText("FR-Chart-Axis_labelShowway")), showWay, null} |
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
}; |
} |
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
private JPanel getOther() { |
||||||
|
double p = TableLayout.PREFERRED; |
||||||
private JPanel getOther() { |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p, p, p}; |
||||||
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
|
||||||
double[] rowSize = {p, p, p}; |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null, new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), labelOrientationChoose, null}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{null, orientationSpinner, orientationBar, null}, |
||||||
new Component[]{null, new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), labelOrientationChoose, null}, |
new Component[]{null, textAttrPane, null, null}, |
||||||
new Component[]{null, orientationSpinner, orientationBar, null}, |
}; |
||||||
new Component[]{null, textAttrPane, null, null}, |
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
}; |
} |
||||||
return TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
|
||||||
} |
private void checkShowWay() { |
||||||
|
if (showWayPane != null) { |
||||||
private void checkShowWay() { |
this.remove(showWayPane); |
||||||
if (showWayPane != null) { |
} |
||||||
this.remove(showWayPane); |
showWay.registerChangeListener(this.observerListener); |
||||||
} |
orientationSpinner.registerChangeListener(this.observerListener); |
||||||
showWay.registerChangeListener(this.observerListener); |
labelOrientationChoose.registerChangeListener(this.observerListener); |
||||||
orientationSpinner.registerChangeListener(this.observerListener); |
if (showWay.getSelectedIndex() == LABEL_INTERVAL) { |
||||||
labelOrientationChoose.registerChangeListener(this.observerListener); |
labelPane = getIntervalShowWayPane(); |
||||||
if (showWay.getSelectedIndex() == LABEL_INTERVAL) { |
} else { |
||||||
labelPane = getIntervalShowWayPane(); |
labelPane = getWrapShowWayPane(); |
||||||
} else { |
} |
||||||
labelPane = getWrapShowWayPane(); |
double p = TableLayout.PREFERRED; |
||||||
} |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] row = {p, p}; |
||||||
double f = TableLayout.FILL; |
double[] col = {f}; |
||||||
double[] row = {p, p}; |
showWayPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ |
||||||
double[] col = {f}; |
new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); |
||||||
showWayPane = TableLayoutHelper.createTableLayoutPane(new Component[][]{ |
this.add(showWayPane, BorderLayout.CENTER); |
||||||
new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); |
this.validate(); |
||||||
this.add(showWayPane, BorderLayout.CENTER); |
} |
||||||
this.validate(); |
|
||||||
} |
|
||||||
|
|
||||||
|
private void checkOrientationField() { |
||||||
|
if (labelOrientationChoose.getSelectedIndex() != 2) { |
||||||
private void checkOrientationField() { |
orientationBar.setVisible(false); |
||||||
if (labelOrientationChoose.getSelectedIndex() != 2) { |
orientationSpinner.setVisible(false); |
||||||
orientationBar.setVisible(false); |
} else { |
||||||
orientationSpinner.setVisible(false); |
orientationBar.setVisible(true); |
||||||
} else { |
orientationSpinner.setVisible(true); |
||||||
orientationBar.setVisible(true); |
} |
||||||
orientationSpinner.setVisible(true); |
} |
||||||
} |
|
||||||
} |
private void checkPaneOnlyInterval(){ |
||||||
|
if (showWayPane != null) { |
||||||
private void checkPaneOnlyInterval(){ |
this.remove(showWayPane); |
||||||
if (showWayPane != null) { |
} |
||||||
this.remove(showWayPane); |
showWayPane = getPanel(); |
||||||
} |
this.add(showWayPane, BorderLayout.CENTER); |
||||||
showWayPane = getPanel(); |
this.validate(); |
||||||
this.add(showWayPane, BorderLayout.CENTER); |
} |
||||||
this.validate(); |
|
||||||
} |
|
||||||
|
private JPanel getPanel() { |
||||||
|
labelSampleChoose.registerChangeListener(this.observerListener); |
||||||
private JPanel getPanel() { |
customLabelSamleTime.registerChangeListener(this.observerListener); |
||||||
labelSampleChoose.registerChangeListener(this.observerListener); |
orientationSpinner.registerChangeListener(this.observerListener); |
||||||
customLabelSamleTime.registerChangeListener(this.observerListener); |
labelOrientationChoose.registerChangeListener(this.observerListener); |
||||||
orientationSpinner.registerChangeListener(this.observerListener); |
double p = TableLayout.PREFERRED; |
||||||
labelOrientationChoose.registerChangeListener(this.observerListener); |
double f = TableLayout.FILL; |
||||||
double p = TableLayout.PREFERRED; |
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
||||||
double f = TableLayout.FILL; |
double[] rowSize = {p, p, p, p}; |
||||||
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, p, f}; |
|
||||||
double[] rowSize = {p, p, p, p}; |
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{null,new UILabel(Inter.getLocText("ChartF-Label_Interval")), labelSampleChoose, customLabelSamleTime}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{null,new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), labelOrientationChoose, null}, |
||||||
new Component[]{null,new UILabel(Inter.getLocText("ChartF-Label_Interval")), labelSampleChoose, customLabelSamleTime}, |
new Component[]{null,orientationSpinner, orientationBar, null}, |
||||||
new Component[]{null,new UILabel(Inter.getLocText("StyleAlignment-Text_Rotation")), labelOrientationChoose, null}, |
new Component[]{null,textAttrPane, null, null}, |
||||||
new Component[]{null,orientationSpinner, orientationBar, null}, |
}; |
||||||
new Component[]{null,textAttrPane, null, null}, |
labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
||||||
}; |
|
||||||
labelPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize); |
double[] row = {p,p}; |
||||||
|
double[] col = {f}; |
||||||
double[] row = {p,p}; |
return TableLayoutHelper.createTableLayoutPane(new Component[][]{ |
||||||
double[] col = {f}; |
new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); |
||||||
return TableLayoutHelper.createTableLayoutPane(new Component[][]{ |
} |
||||||
new Component[]{isLabelShow}, new Component[]{labelPane}}, row, col); |
|
||||||
} |
private void checkCustomSampleField() { |
||||||
|
if (labelSampleChoose.getSelectedIndex() == 0) { |
||||||
private void checkCustomSampleField() { |
customLabelSamleTime.setVisible(false); |
||||||
if (labelSampleChoose.getSelectedIndex() == 0) { |
} else { |
||||||
customLabelSamleTime.setVisible(false); |
customLabelSamleTime.setVisible(true); |
||||||
} else { |
customLabelSamleTime.setText("1"); |
||||||
customLabelSamleTime.setVisible(true); |
} |
||||||
customLabelSamleTime.setText("1"); |
} |
||||||
} |
|
||||||
} |
|
||||||
|
/** |
||||||
|
* 界面标签 |
||||||
/** |
*/ |
||||||
* 界面标签 |
protected String title4PopupWindow() { |
||||||
*/ |
return Inter.getLocText("ChartF-Tick_Label"); |
||||||
protected String title4PopupWindow() { |
} |
||||||
return Inter.getLocText("ChartF-Tick_Label"); |
|
||||||
} |
private int getLabelTextOrientationIndex(TextAttr textAttr) { |
||||||
|
if (textAttr.getAlignText() == Style.VERTICALTEXT) { |
||||||
private int getLabelTextOrientationIndex(TextAttr textAttr) { |
return 1; |
||||||
if (textAttr.getAlignText() == Style.VERTICALTEXT) { |
} else if (textAttr.getRotation() != 0) { |
||||||
return 1; |
return 2; |
||||||
} else if (textAttr.getRotation() != 0) { |
} else { |
||||||
return 2; |
return 0; |
||||||
} else { |
} |
||||||
return 0; |
} |
||||||
} |
|
||||||
} |
private int getLabelSampleNumber(BaseFormula formula) { |
||||||
|
Number number = ChartBaseUtils.formula2Number(formula); |
||||||
private int getLabelSampleNumber(Formula formula) { |
if (number != null) { |
||||||
Number number = ChartBaseUtils.formula2Number(formula); |
int num = number.intValue(); |
||||||
if (number != null) { |
return num < 1 ? 0 : 1; |
||||||
int num = number.intValue(); |
} |
||||||
return num < 1 ? 0 : 1; |
return 0; |
||||||
} |
} |
||||||
return 0; |
|
||||||
} |
private boolean isWrapShow(BaseFormula formula){ |
||||||
|
Number number = ChartBaseUtils.formula2Number(formula); |
||||||
private boolean isWrapShow(Formula formula){ |
return number == null; |
||||||
Number number = ChartBaseUtils.formula2Number(formula); |
} |
||||||
return number == null; |
|
||||||
} |
/** |
||||||
|
* 检查 标签界面是否可用. |
||||||
/** |
*/ |
||||||
* 检查 标签界面是否可用. |
private void checkLabelUse() { |
||||||
*/ |
isLabelShow.setEnabled(true); |
||||||
private void checkLabelUse() { |
labelPane.setVisible(isLabelShow.isSelected()); |
||||||
isLabelShow.setEnabled(true); |
} |
||||||
labelPane.setVisible(isLabelShow.isSelected()); |
|
||||||
} |
@Override |
||||||
|
public Dimension getPreferredSize() { |
||||||
@Override |
if (isLabelShow.isSelected()) { |
||||||
public Dimension getPreferredSize() { |
return super.getPreferredSize(); |
||||||
if (isLabelShow.isSelected()) { |
} else { |
||||||
return super.getPreferredSize(); |
return this.isLabelShow.getPreferredSize(); |
||||||
} else { |
} |
||||||
return this.isLabelShow.getPreferredSize(); |
} |
||||||
} |
|
||||||
} |
/** |
||||||
|
* 更新界面内容. |
||||||
/** |
*/ |
||||||
* 更新界面内容. |
public void populate(Axis axis) { |
||||||
*/ |
if(axis.isSupportAxisLabelWrap()){ |
||||||
public void populate(Axis axis) { |
checkShowWay(); |
||||||
if(axis.isSupportAxisLabelWrap()){ |
if (isWrapShow(axis.getLabelNumber())) { |
||||||
checkShowWay(); |
showWay.setSelectedIndex(LABEL_WRAP); |
||||||
if (isWrapShow(axis.getLabelNumber())) { |
} else { |
||||||
showWay.setSelectedIndex(LABEL_WRAP); |
showWay.setSelectedIndex(LABEL_INTERVAL); |
||||||
} else { |
boolean isAuto = getLabelSampleNumber(axis.getLabelNumber()) == 0; |
||||||
showWay.setSelectedIndex(LABEL_INTERVAL); |
auto.setSelected(isAuto); |
||||||
boolean isAuto = getLabelSampleNumber(axis.getLabelNumber()) == 0; |
custom.setSelected(!isAuto); |
||||||
auto.setSelected(isAuto); |
customLabelSamleTime.setText(isAuto ? "" : String.valueOf(ChartBaseUtils.formula2Number(axis.getLabelNumber()))); |
||||||
custom.setSelected(!isAuto); |
customLabelSamleTime.setEnabled(!isAuto); |
||||||
customLabelSamleTime.setText(isAuto ? "" : String.valueOf(ChartBaseUtils.formula2Number(axis.getLabelNumber()))); |
} |
||||||
customLabelSamleTime.setEnabled(!isAuto); |
}else{ |
||||||
} |
checkPaneOnlyInterval(); |
||||||
}else{ |
labelSampleChoose.setSelectedIndex(getLabelSampleNumber(axis.getLabelNumber())); |
||||||
checkPaneOnlyInterval(); |
if (labelSampleChoose.getSelectedIndex() == 1) { |
||||||
labelSampleChoose.setSelectedIndex(getLabelSampleNumber(axis.getLabelNumber())); |
customLabelSamleTime.setText(String.valueOf(ChartBaseUtils.formula2Number(axis.getLabelNumber()))); |
||||||
if (labelSampleChoose.getSelectedIndex() == 1) { |
} |
||||||
customLabelSamleTime.setText(String.valueOf(ChartBaseUtils.formula2Number(axis.getLabelNumber()))); |
} |
||||||
} |
isLabelShow.setSelected(axis.isShowAxisLabel()); |
||||||
} |
textAttrPane.populate(axis.getTextAttr()); |
||||||
isLabelShow.setSelected(axis.isShowAxisLabel()); |
labelOrientationChoose.setSelectedIndex(getLabelTextOrientationIndex(axis.getTextAttr())); |
||||||
textAttrPane.populate(axis.getTextAttr()); |
orientationBar.setValue(axis.getTextAttr().getRotation()); |
||||||
labelOrientationChoose.setSelectedIndex(getLabelTextOrientationIndex(axis.getTextAttr())); |
orientationSpinner.setValue(axis.getTextAttr().getRotation()); |
||||||
orientationBar.setValue(axis.getTextAttr().getRotation()); |
checkLabelUse(); |
||||||
orientationSpinner.setValue(axis.getTextAttr().getRotation()); |
this.initSelfListener(this); |
||||||
checkLabelUse(); |
} |
||||||
this.initSelfListener(this); |
|
||||||
} |
|
||||||
|
/** |
||||||
|
* 保存界面属性. |
||||||
/** |
*/ |
||||||
* 保存界面属性. |
public void update(Axis axis) { |
||||||
*/ |
axis.setShowAxisLabel(isLabelShow.isSelected()); |
||||||
public void update(Axis axis) { |
if (isLabelShow.isSelected()) { |
||||||
axis.setShowAxisLabel(isLabelShow.isSelected()); |
if(axis.isSupportAxisLabelWrap()){ |
||||||
if (isLabelShow.isSelected()) { |
this.update4Wrap(axis); |
||||||
if(axis.isSupportAxisLabelWrap()){ |
}else{ |
||||||
this.update4Wrap(axis); |
update4Normal(axis); |
||||||
}else{ |
} |
||||||
update4Normal(axis); |
|
||||||
} |
TextAttr textAttr = axis.getTextAttr(); |
||||||
|
textAttrPane.update(textAttr); |
||||||
TextAttr textAttr = axis.getTextAttr(); |
if (labelOrientationChoose.getSelectedIndex() == 0) { |
||||||
textAttrPane.update(textAttr); |
textAttr.setRotation(0); |
||||||
if (labelOrientationChoose.getSelectedIndex() == 0) { |
textAttr.setAlignText(Style.HORIZONTALTEXT); |
||||||
textAttr.setRotation(0); |
} else if (labelOrientationChoose.getSelectedIndex() == 1) { |
||||||
textAttr.setAlignText(Style.HORIZONTALTEXT); |
textAttr.setRotation(0); |
||||||
} else if (labelOrientationChoose.getSelectedIndex() == 1) { |
textAttr.setAlignText(Style.VERTICALTEXT); |
||||||
textAttr.setRotation(0); |
} else { |
||||||
textAttr.setAlignText(Style.VERTICALTEXT); |
textAttr.setAlignText(Style.HORIZONTALTEXT); |
||||||
} else { |
textAttr.setRotation(Utils.objectToNumber(orientationSpinner.getValue(), false).intValue()); |
||||||
textAttr.setAlignText(Style.HORIZONTALTEXT); |
} |
||||||
textAttr.setRotation(Utils.objectToNumber(orientationSpinner.getValue(), false).intValue()); |
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
private void update4Normal(Axis axis){ |
||||||
|
if (labelSampleChoose.getSelectedIndex() == 0) { |
||||||
private void update4Normal(Axis axis){ |
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("0")); |
||||||
if (labelSampleChoose.getSelectedIndex() == 0) { |
} else { |
||||||
axis.setLabelIntervalNumber(new Formula("0")); |
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(customLabelSamleTime.getText())); |
||||||
} else { |
} |
||||||
axis.setLabelIntervalNumber(new Formula(customLabelSamleTime.getText())); |
} |
||||||
} |
|
||||||
} |
private void update4Wrap(Axis axis){ |
||||||
|
if (showWay.getSelectedIndex() == LABEL_WRAP) { |
||||||
private void update4Wrap(Axis axis){ |
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build()); |
||||||
if (showWay.getSelectedIndex() == LABEL_WRAP) { |
} else if (showWay.getSelectedIndex() == LABEL_INTERVAL) { |
||||||
axis.setLabelIntervalNumber(new Formula()); |
if (auto.isSelected()) { |
||||||
} else if (showWay.getSelectedIndex() == LABEL_INTERVAL) { |
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build("0")); |
||||||
if (auto.isSelected()) { |
} else if (custom.isSelected()) { |
||||||
axis.setLabelIntervalNumber(new Formula("0")); |
axis.setLabelIntervalNumber(BaseFormula.createFormulaBuilder().build(customLabelSamleTime.getText())); |
||||||
} else if (custom.isSelected()) { |
} |
||||||
axis.setLabelIntervalNumber(new Formula(customLabelSamleTime.getText())); |
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
/** |
||||||
|
* 注册时间监听器 |
||||||
/** |
* @param listener 观察者监听事件 |
||||||
* 注册时间监听器 |
*/ |
||||||
* @param listener 观察者监听事件 |
public void registerChangeListener(UIObserverListener listener) { |
||||||
*/ |
this.observerListener = listener; |
||||||
public void registerChangeListener(UIObserverListener listener) { |
} |
||||||
this.observerListener = listener; |
|
||||||
} |
private void initSelfListener(Container parentComponent) { |
||||||
|
for (int i = 0; i < parentComponent.getComponentCount(); i++) { |
||||||
private void initSelfListener(Container parentComponent) { |
Component tmpComp = parentComponent.getComponent(i); |
||||||
for (int i = 0; i < parentComponent.getComponentCount(); i++) { |
if (tmpComp instanceof Container) { |
||||||
Component tmpComp = parentComponent.getComponent(i); |
initSelfListener((Container) tmpComp); |
||||||
if (tmpComp instanceof Container) { |
} |
||||||
initSelfListener((Container) tmpComp); |
if (tmpComp instanceof UIObserver) { |
||||||
} |
((UIObserver) tmpComp).registerChangeListener(observerListener); |
||||||
if (tmpComp instanceof UIObserver) { |
} |
||||||
((UIObserver) tmpComp).registerChangeListener(observerListener); |
} |
||||||
} |
} |
||||||
} |
|
||||||
} |
/** |
||||||
|
* 是否响应事件监听 |
||||||
/** |
* @return 是则返回true |
||||||
* 是否响应事件监听 |
*/ |
||||||
* @return 是则返回true |
public boolean shouldResponseChangeListener() { |
||||||
*/ |
return true; |
||||||
public boolean shouldResponseChangeListener() { |
} |
||||||
return true; |
|
||||||
} |
|
||||||
} |
} |
@ -1,360 +1,365 @@ |
|||||||
package com.fr.design.mainframe.chart.gui.style; |
package com.fr.design.mainframe.chart.gui.style; |
||||||
|
|
||||||
import com.fr.base.Formula; |
import com.fr.base.BaseFormula; |
||||||
import com.fr.base.Utils; |
import com.fr.base.Utils; |
||||||
import com.fr.chart.base.ChartConstants; |
import com.fr.chart.base.ChartConstants; |
||||||
import com.fr.chart.chartattr.CategoryAxis; |
import com.fr.chart.chartattr.CategoryAxis; |
||||||
import com.fr.design.beans.FurtherBasicBeanPane; |
import com.fr.design.beans.FurtherBasicBeanPane; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.editor.ValueEditorPane; |
import com.fr.design.editor.ValueEditorPane; |
||||||
import com.fr.design.editor.editor.DateEditor; |
import com.fr.design.editor.editor.DateEditor; |
||||||
import com.fr.design.editor.editor.Editor; |
import com.fr.design.editor.editor.Editor; |
||||||
import com.fr.design.editor.editor.FormulaEditor; |
import com.fr.design.editor.editor.FormulaEditor; |
||||||
import com.fr.design.formula.FormulaFactory; |
import com.fr.design.formula.FormulaFactory; |
||||||
import com.fr.design.formula.UIFormula; |
import com.fr.design.formula.UIFormula; |
||||||
import com.fr.design.gui.date.UIDatePicker; |
import com.fr.design.gui.date.UIDatePicker; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.design.gui.icombobox.UIComboBox; |
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
import com.fr.design.gui.itextfield.UITextField; |
import com.fr.design.gui.itextfield.UITextField; |
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.design.style.FormatBox; |
import com.fr.design.style.FormatBox; |
||||||
import com.fr.general.DateUtils; |
import com.fr.general.DateUtils; |
||||||
import com.fr.general.FRLogger; |
import com.fr.general.FRLogger; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
import javax.swing.*; |
import javax.swing.*; |
||||||
import java.awt.*; |
import java.awt.*; |
||||||
import java.awt.event.*; |
import java.awt.event.ActionEvent; |
||||||
import java.text.ParseException; |
import java.awt.event.ActionListener; |
||||||
import java.util.Date; |
import java.awt.event.KeyAdapter; |
||||||
import java.util.HashMap; |
import java.awt.event.KeyEvent; |
||||||
import java.util.Map; |
import java.awt.event.MouseAdapter; |
||||||
import java.util.regex.Pattern; |
import java.awt.event.MouseEvent; |
||||||
|
import java.text.ParseException; |
||||||
/** |
import java.util.Date; |
||||||
* 属性表, 坐标轴, 日期范围定义界面 |
import java.util.HashMap; |
||||||
* @author kunsnat E-mail:kunsnat@gmail.com |
import java.util.Map; |
||||||
* @version 创建时间:2013-1-4 上午10:25:15 |
import java.util.regex.Pattern; |
||||||
*/ |
|
||||||
public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{ |
/** |
||||||
|
* 属性表, 坐标轴, 日期范围定义界面 |
||||||
private static String[] TYPES = new String[]{ |
* @author kunsnat E-mail:kunsnat@gmail.com |
||||||
Inter.getLocText("Year"), Inter.getLocText("Month"), Inter.getLocText("Sun"), |
* @version 创建时间:2013-1-4 上午10:25:15 |
||||||
Inter.getLocText("Sche-Hour"), Inter.getLocText("Sche-Minute"), |
*/ |
||||||
Inter.getLocText("Sche-Second") |
public class DateAxisValuePane extends FurtherBasicBeanPane<CategoryAxis>{ |
||||||
}; |
|
||||||
|
private static String[] TYPES = new String[]{ |
||||||
private static Map<String, Integer> VALUES = new HashMap<String, Integer>(); |
Inter.getLocText("Year"), Inter.getLocText("Month"), Inter.getLocText("Sun"), |
||||||
static { |
Inter.getLocText("Sche-Hour"), Inter.getLocText("Sche-Minute"), |
||||||
VALUES.put(Inter.getLocText("Year"), ChartConstants.YEAR_TYPE); |
Inter.getLocText("Sche-Second") |
||||||
VALUES.put(Inter.getLocText("Month"), ChartConstants.MONTH_TYPE); |
}; |
||||||
VALUES.put(Inter.getLocText("Sun"), ChartConstants.DAY_TYPE); |
|
||||||
VALUES.put(Inter.getLocText("Sche-Hour"), ChartConstants.HOUR_TYPE); |
private static Map<String, Integer> VALUES = new HashMap<String, Integer>(); |
||||||
VALUES.put(Inter.getLocText("Sche-Minute"), ChartConstants.MINUTE_TYPE); |
static { |
||||||
VALUES.put(Inter.getLocText("Sche-Second"), ChartConstants.SECOND_TYPE); |
VALUES.put(Inter.getLocText("Year"), ChartConstants.YEAR_TYPE); |
||||||
} |
VALUES.put(Inter.getLocText("Month"), ChartConstants.MONTH_TYPE); |
||||||
|
VALUES.put(Inter.getLocText("Sun"), ChartConstants.DAY_TYPE); |
||||||
private static Map<Integer, String> INTS = new HashMap<Integer, String>(); |
VALUES.put(Inter.getLocText("Sche-Hour"), ChartConstants.HOUR_TYPE); |
||||||
static { |
VALUES.put(Inter.getLocText("Sche-Minute"), ChartConstants.MINUTE_TYPE); |
||||||
INTS.put(ChartConstants.YEAR_TYPE, Inter.getLocText("Year")); |
VALUES.put(Inter.getLocText("Sche-Second"), ChartConstants.SECOND_TYPE); |
||||||
INTS.put(ChartConstants.MONTH_TYPE, Inter.getLocText("Month")); |
} |
||||||
INTS.put(ChartConstants.DAY_TYPE, Inter.getLocText("Sun")); |
|
||||||
INTS.put(ChartConstants.HOUR_TYPE, Inter.getLocText("Sche-Hour")); |
private static Map<Integer, String> INTS = new HashMap<Integer, String>(); |
||||||
INTS.put(ChartConstants.MINUTE_TYPE, Inter.getLocText("Sche-Minute")); |
static { |
||||||
INTS.put(ChartConstants.SECOND_TYPE, Inter.getLocText("Sche-Second")); |
INTS.put(ChartConstants.YEAR_TYPE, Inter.getLocText("Year")); |
||||||
} |
INTS.put(ChartConstants.MONTH_TYPE, Inter.getLocText("Month")); |
||||||
|
INTS.put(ChartConstants.DAY_TYPE, Inter.getLocText("Sun")); |
||||||
// 最大最小值
|
INTS.put(ChartConstants.HOUR_TYPE, Inter.getLocText("Sche-Hour")); |
||||||
private UICheckBox maxCheckBox; |
INTS.put(ChartConstants.MINUTE_TYPE, Inter.getLocText("Sche-Minute")); |
||||||
private ValueEditorPane maxValueField; |
INTS.put(ChartConstants.SECOND_TYPE, Inter.getLocText("Sche-Second")); |
||||||
private UICheckBox minCheckBox; |
} |
||||||
private ValueEditorPane minValueField; |
|
||||||
|
// 最大最小值
|
||||||
private UICheckBox mainTickBox; |
private UICheckBox maxCheckBox; |
||||||
private UITextField mainUnitField; |
private ValueEditorPane maxValueField; |
||||||
private UIComboBox mainType; |
private UICheckBox minCheckBox; |
||||||
|
private ValueEditorPane minValueField; |
||||||
private FormatBox formatBox; |
|
||||||
public FormatBox getFormatBox() { |
private UICheckBox mainTickBox; |
||||||
return this.formatBox; |
private UITextField mainUnitField; |
||||||
} |
private UIComboBox mainType; |
||||||
|
|
||||||
public DateAxisValuePane() { |
private FormatBox formatBox; |
||||||
this.initComponents(); |
public FormatBox getFormatBox() { |
||||||
} |
return this.formatBox; |
||||||
|
} |
||||||
private void initMin() { |
|
||||||
// 最小值.
|
public DateAxisValuePane() { |
||||||
minCheckBox = new UICheckBox(Inter.getLocText("Min_Value")); |
this.initComponents(); |
||||||
Date tmp = null; |
} |
||||||
DateEditor dateEditor = new DateEditor(tmp, true, Inter.getLocText("Date"), UIDatePicker.STYLE_CN_DATETIME1); |
|
||||||
Editor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
private void initMin() { |
||||||
Editor[] editor = new Editor[]{dateEditor, formulaEditor}; |
// 最小值.
|
||||||
minValueField = new ValueEditorPane(editor); |
minCheckBox = new UICheckBox(Inter.getLocText("Min_Value")); |
||||||
minValueField.setEnabled(false); |
Date tmp = null; |
||||||
minCheckBox.addActionListener(new ActionListener() { |
DateEditor dateEditor = new DateEditor(tmp, true, Inter.getLocText("Date"), UIDatePicker.STYLE_CN_DATETIME1); |
||||||
public void actionPerformed(ActionEvent e) { |
Editor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
||||||
checkBoxUse(); |
Editor[] editor = new Editor[]{dateEditor, formulaEditor}; |
||||||
} |
minValueField = new ValueEditorPane(editor); |
||||||
}); |
minValueField.setEnabled(false); |
||||||
} |
minCheckBox.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
private void initMax() { |
checkBoxUse(); |
||||||
// 最大值
|
} |
||||||
maxCheckBox = new UICheckBox(Inter.getLocText("Max_Value")); |
}); |
||||||
Date tmp = null; |
} |
||||||
DateEditor dateEditor = new DateEditor(tmp, true, Inter.getLocText("Date"), UIDatePicker.STYLE_CN_DATETIME1); |
|
||||||
Editor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
private void initMax() { |
||||||
Editor[] editor = new Editor[]{dateEditor, formulaEditor}; |
// 最大值
|
||||||
maxValueField = new ValueEditorPane(editor); |
maxCheckBox = new UICheckBox(Inter.getLocText("Max_Value")); |
||||||
maxValueField.setEnabled(false); |
Date tmp = null; |
||||||
maxCheckBox.addActionListener(new ActionListener() { |
DateEditor dateEditor = new DateEditor(tmp, true, Inter.getLocText("Date"), UIDatePicker.STYLE_CN_DATETIME1); |
||||||
public void actionPerformed(ActionEvent e) { |
Editor formulaEditor = new FormulaEditor(Inter.getLocText("Parameter-Formula")); |
||||||
checkBoxUse(); |
Editor[] editor = new Editor[]{dateEditor, formulaEditor}; |
||||||
} |
maxValueField = new ValueEditorPane(editor); |
||||||
}); |
maxValueField.setEnabled(false); |
||||||
} |
maxCheckBox.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
private void initMain() { |
checkBoxUse(); |
||||||
// 主要刻度单位
|
} |
||||||
mainTickBox = new UICheckBox(Inter.getLocText("MainGraduationUnit")); |
}); |
||||||
mainUnitField = new UITextField(); |
} |
||||||
mainUnitField.setPreferredSize(new Dimension(30, 20)); |
|
||||||
mainUnitField.setEditable(false); |
private void initMain() { |
||||||
mainType = new UIComboBox(TYPES); |
// 主要刻度单位
|
||||||
mainType.setEnabled(false); |
mainTickBox = new UICheckBox(Inter.getLocText("MainGraduationUnit")); |
||||||
|
mainUnitField = new UITextField(); |
||||||
mainTickBox.addActionListener(new ActionListener() { |
mainUnitField.setPreferredSize(new Dimension(30, 20)); |
||||||
public void actionPerformed(ActionEvent e) { |
mainUnitField.setEditable(false); |
||||||
checkBoxUse(); |
mainType = new UIComboBox(TYPES); |
||||||
} |
mainType.setEnabled(false); |
||||||
}); |
|
||||||
|
mainTickBox.addActionListener(new ActionListener() { |
||||||
addListener(mainTickBox, mainUnitField); |
public void actionPerformed(ActionEvent e) { |
||||||
} |
checkBoxUse(); |
||||||
|
} |
||||||
private void initComponents() { |
}); |
||||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
formatBox = new FormatBox(); |
addListener(mainTickBox, mainUnitField); |
||||||
JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
} |
||||||
add(pane, BorderLayout.NORTH); |
|
||||||
|
private void initComponents() { |
||||||
initMin(); |
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
initMax(); |
formatBox = new FormatBox(); |
||||||
initMain(); |
JPanel pane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); |
||||||
|
add(pane, BorderLayout.NORTH); |
||||||
JPanel mainTickPane = new JPanel(); |
|
||||||
mainTickPane.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0)); |
initMin(); |
||||||
|
initMax(); |
||||||
mainTickPane.add(mainUnitField); |
initMain(); |
||||||
mainTickPane.add(mainType); |
|
||||||
|
JPanel mainTickPane = new JPanel(); |
||||||
JPanel secTickPane = new JPanel(); |
mainTickPane.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0)); |
||||||
secTickPane.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0)); |
|
||||||
|
mainTickPane.add(mainUnitField); |
||||||
double p = TableLayout.PREFERRED; |
mainTickPane.add(mainType); |
||||||
double f = TableLayout.FILL; |
|
||||||
double[] rowSize = {p, p, p}; |
JPanel secTickPane = new JPanel(); |
||||||
double[] columnSize = {p, f}; |
secTickPane.setLayout(new FlowLayout(FlowLayout.CENTER, 4, 0)); |
||||||
Component[][] maxMin = { |
|
||||||
{minCheckBox, minValueField}, |
double p = TableLayout.PREFERRED; |
||||||
{maxCheckBox, maxValueField}, |
double f = TableLayout.FILL; |
||||||
|
double[] rowSize = {p, p, p}; |
||||||
}; |
double[] columnSize = {p, f}; |
||||||
JPanel maxMinPane = TableLayoutHelper.createTableLayoutPane(maxMin, rowSize, columnSize); |
Component[][] maxMin = { |
||||||
Component[][] components = { |
{minCheckBox, minValueField}, |
||||||
{maxMinPane, null}, |
{maxCheckBox, maxValueField}, |
||||||
{mainTickBox, mainTickPane} |
|
||||||
|
}; |
||||||
}; |
JPanel maxMinPane = TableLayoutHelper.createTableLayoutPane(maxMin, rowSize, columnSize); |
||||||
pane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); |
Component[][] components = { |
||||||
} |
{maxMinPane, null}, |
||||||
|
{mainTickBox, mainTickPane} |
||||||
private void addListener(final UICheckBox box, final UITextField textField) { |
|
||||||
textField.addMouseListener(new MouseAdapter() { |
}; |
||||||
public void mousePressed(MouseEvent e) { |
pane.add(TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize)); |
||||||
if (box.isSelected()) { |
} |
||||||
showFormulaPane(textField); |
|
||||||
} |
private void addListener(final UICheckBox box, final UITextField textField) { |
||||||
} |
textField.addMouseListener(new MouseAdapter() { |
||||||
}); |
public void mousePressed(MouseEvent e) { |
||||||
textField.addKeyListener(new KeyAdapter() { |
if (box.isSelected()) { |
||||||
public void keyTyped(KeyEvent e) { |
showFormulaPane(textField); |
||||||
if (box.isSelected()) { |
} |
||||||
e.consume(); |
} |
||||||
showFormulaPane(textField); |
}); |
||||||
} |
textField.addKeyListener(new KeyAdapter() { |
||||||
} |
public void keyTyped(KeyEvent e) { |
||||||
}); |
if (box.isSelected()) { |
||||||
} |
e.consume(); |
||||||
|
showFormulaPane(textField); |
||||||
private void showFormulaPane(final UITextField jTextField) { |
} |
||||||
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
} |
||||||
formulaPane.populate(new Formula(jTextField.getText())); |
}); |
||||||
BasicDialog dlg = formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DateAxisValuePane.this), new DialogActionAdapter() { |
} |
||||||
public void doOk() { |
|
||||||
jTextField.setText(Utils.objectToString(formulaPane.update())); |
private void showFormulaPane(final UITextField jTextField) { |
||||||
} |
final UIFormula formulaPane = FormulaFactory.createFormulaPane(); |
||||||
}); |
formulaPane.populate(BaseFormula.createFormulaBuilder().build(jTextField.getText())); |
||||||
dlg.setVisible(true); |
BasicDialog dlg = formulaPane.showLargeWindow(SwingUtilities.getWindowAncestor(DateAxisValuePane.this), new DialogActionAdapter() { |
||||||
} |
public void doOk() { |
||||||
|
jTextField.setText(Utils.objectToString(formulaPane.update())); |
||||||
private void populateMain(CategoryAxis axis) { |
} |
||||||
if (axis.isCustomMainUnit() && axis.getMainUnit() != null) { |
}); |
||||||
mainTickBox.setSelected(true); |
dlg.setVisible(true); |
||||||
mainUnitField.setText(Utils.objectToString(axis.getMainUnit())); |
} |
||||||
mainType.setSelectedItem(INTS.get(axis.getMainType())); |
|
||||||
} |
private void populateMain(CategoryAxis axis) { |
||||||
} |
if (axis.isCustomMainUnit() && axis.getMainUnit() != null) { |
||||||
|
mainTickBox.setSelected(true); |
||||||
private void updateMain(CategoryAxis axis) { |
mainUnitField.setText(Utils.objectToString(axis.getMainUnit())); |
||||||
if (mainTickBox.isSelected() && StringUtils.isNotEmpty(mainUnitField.getText())) { |
mainType.setSelectedItem(INTS.get(axis.getMainType())); |
||||||
axis.setCustomMainUnit(true); |
} |
||||||
axis.setMainUnit(new Formula(mainUnitField.getText())); |
} |
||||||
axis.setMainType(VALUES.get(mainType.getSelectedItem())); |
|
||||||
} else { |
private void updateMain(CategoryAxis axis) { |
||||||
axis.setCustomMainUnit(false); |
if (mainTickBox.isSelected() && StringUtils.isNotEmpty(mainUnitField.getText())) { |
||||||
} |
axis.setCustomMainUnit(true); |
||||||
} |
axis.setMainUnit(BaseFormula.createFormulaBuilder().build(mainUnitField.getText())); |
||||||
|
axis.setMainType(VALUES.get(mainType.getSelectedItem())); |
||||||
@Override |
} else { |
||||||
public boolean accept(Object ob) { |
axis.setCustomMainUnit(false); |
||||||
return ob instanceof CategoryAxis; |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void reset() { |
public boolean accept(Object ob) { |
||||||
|
return ob instanceof CategoryAxis; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String title4PopupWindow() { |
public void reset() { |
||||||
return Inter.getLocText("Chart_Date_Axis"); |
|
||||||
} |
} |
||||||
|
|
||||||
private void checkBoxUse() { |
@Override |
||||||
minValueField.setEnabled(minCheckBox.isSelected()); |
public String title4PopupWindow() { |
||||||
maxValueField.setEnabled(maxCheckBox.isSelected()); |
return Inter.getLocText("Chart_Date_Axis"); |
||||||
if(minValueField.getCurrentEditor() instanceof FormulaEditor){ |
} |
||||||
FormulaEditor tmpEditor = (FormulaEditor)minValueField.getCurrentEditor(); |
|
||||||
tmpEditor.enableEditor(minCheckBox.isSelected()); |
private void checkBoxUse() { |
||||||
} |
minValueField.setEnabled(minCheckBox.isSelected()); |
||||||
|
maxValueField.setEnabled(maxCheckBox.isSelected()); |
||||||
if(maxValueField.getCurrentEditor() instanceof FormulaEditor){ |
if(minValueField.getCurrentEditor() instanceof FormulaEditor){ |
||||||
FormulaEditor tmpEditor = (FormulaEditor)maxValueField.getCurrentEditor(); |
FormulaEditor tmpEditor = (FormulaEditor)minValueField.getCurrentEditor(); |
||||||
tmpEditor.enableEditor(maxCheckBox.isSelected()); |
tmpEditor.enableEditor(minCheckBox.isSelected()); |
||||||
} |
} |
||||||
|
|
||||||
mainType.setEnabled(mainTickBox.isSelected()); |
if(maxValueField.getCurrentEditor() instanceof FormulaEditor){ |
||||||
mainUnitField.setEnabled(mainTickBox.isSelected()); |
FormulaEditor tmpEditor = (FormulaEditor)maxValueField.getCurrentEditor(); |
||||||
} |
tmpEditor.enableEditor(maxCheckBox.isSelected()); |
||||||
|
} |
||||||
@Override |
|
||||||
public void populateBean(CategoryAxis axis) { |
mainType.setEnabled(mainTickBox.isSelected()); |
||||||
if (axis == null) { |
mainUnitField.setEnabled(mainTickBox.isSelected()); |
||||||
return; |
} |
||||||
} |
|
||||||
if (!axis.isDate()) { |
@Override |
||||||
return; |
public void populateBean(CategoryAxis axis) { |
||||||
} |
if (axis == null) { |
||||||
// 最小值
|
return; |
||||||
if (axis.isCustomMinValue() && axis.getMinValue() != null) { |
} |
||||||
minCheckBox.setSelected(true); |
if (!axis.isDate()) { |
||||||
String dateStr = axis.getMinValue().getPureContent(); |
return; |
||||||
if(!isDateForm(dateStr)){ |
} |
||||||
minValueField.populate(axis.getMinValue()); |
// 最小值
|
||||||
}else{ |
if (axis.isCustomMinValue() && axis.getMinValue() != null) { |
||||||
Date tmpDate = getDateFromFormula(axis.getMinValue()); |
minCheckBox.setSelected(true); |
||||||
minValueField.populate(tmpDate); |
String dateStr = axis.getMinValue().getPureContent(); |
||||||
} |
if(!isDateForm(dateStr)){ |
||||||
|
minValueField.populate(axis.getMinValue()); |
||||||
} |
}else{ |
||||||
|
Date tmpDate = getDateFromFormula(axis.getMinValue()); |
||||||
|
minValueField.populate(tmpDate); |
||||||
// 最大值
|
} |
||||||
if (axis.isCustomMaxValue() && axis.getMaxValue() != null) { |
|
||||||
maxCheckBox.setSelected(true); |
} |
||||||
String dateStr = axis.getMaxValue().getPureContent(); |
|
||||||
if(!isDateForm(dateStr)){ |
|
||||||
maxValueField.populate(axis.getMaxValue()); |
// 最大值
|
||||||
}else{ |
if (axis.isCustomMaxValue() && axis.getMaxValue() != null) { |
||||||
Date tmpDate = getDateFromFormula(axis.getMaxValue()); |
maxCheckBox.setSelected(true); |
||||||
maxValueField.populate(tmpDate); |
String dateStr = axis.getMaxValue().getPureContent(); |
||||||
} |
if(!isDateForm(dateStr)){ |
||||||
} |
maxValueField.populate(axis.getMaxValue()); |
||||||
populateMain(axis); |
}else{ |
||||||
|
Date tmpDate = getDateFromFormula(axis.getMaxValue()); |
||||||
checkBoxUse(); |
maxValueField.populate(tmpDate); |
||||||
} |
} |
||||||
|
} |
||||||
private boolean isDateForm(String form){ |
populateMain(axis); |
||||||
form = Pattern.compile("\"").matcher(form).replaceAll(StringUtils.EMPTY); |
|
||||||
//全部是数字的话直接返回,string2Date会把全部是数字也会转化成日期
|
checkBoxUse(); |
||||||
if(form.matches("^[+-]?[0-9]*[0-9]$")){ |
} |
||||||
return false; |
|
||||||
} |
private boolean isDateForm(String form){ |
||||||
return (DateUtils.string2Date(form, true) != null); |
form = Pattern.compile("\"").matcher(form).replaceAll(StringUtils.EMPTY); |
||||||
} |
//全部是数字的话直接返回,string2Date会把全部是数字也会转化成日期
|
||||||
|
if(form.matches("^[+-]?[0-9]*[0-9]$")){ |
||||||
public void updateBean(CategoryAxis axis) { |
return false; |
||||||
updateMain(axis); |
} |
||||||
//最小值
|
return (DateUtils.string2Date(form, true) != null); |
||||||
if (minCheckBox.isSelected()) { |
} |
||||||
if(minValueField.getCurrentEditor() instanceof FormulaEditor){ |
|
||||||
Formula min = (Formula)minValueField.update(); |
public void updateBean(CategoryAxis axis) { |
||||||
axis.setMinValue(min); |
updateMain(axis); |
||||||
axis.setCustomMinValue(!StringUtils.isEmpty(min.getPureContent())); |
//最小值
|
||||||
}else{ |
if (minCheckBox.isSelected()) { |
||||||
Date datetmp = (Date)minValueField.update(); |
if(minValueField.getCurrentEditor() instanceof FormulaEditor){ |
||||||
DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); |
BaseFormula min = (BaseFormula) minValueField.update(); |
||||||
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); |
axis.setMinValue(min); |
||||||
axis.setCustomMinValue(!StringUtils.isEmpty(dateString)); |
axis.setCustomMinValue(!StringUtils.isEmpty(min.getPureContent())); |
||||||
axis.setMinValue(new Formula(dateString)); |
}else{ |
||||||
} |
Date datetmp = (Date)minValueField.update(); |
||||||
} else { |
DateEditor dateEditor = (DateEditor)minValueField.getCurrentEditor(); |
||||||
axis.setCustomMinValue(false); |
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); |
||||||
} |
axis.setCustomMinValue(!StringUtils.isEmpty(dateString)); |
||||||
|
axis.setMinValue(BaseFormula.createFormulaBuilder().build(dateString)); |
||||||
//最大值
|
} |
||||||
if (maxCheckBox.isSelected()) { |
} else { |
||||||
if(maxValueField.getCurrentEditor() instanceof FormulaEditor){ |
axis.setCustomMinValue(false); |
||||||
Formula max = (Formula)maxValueField.update(); |
} |
||||||
axis.setMaxValue(max); |
|
||||||
axis.setCustomMaxValue(!StringUtils.isEmpty(max.getPureContent())); |
//最大值
|
||||||
}else{ |
if (maxCheckBox.isSelected()) { |
||||||
Date datetmp = (Date)maxValueField.update(); |
if(maxValueField.getCurrentEditor() instanceof FormulaEditor){ |
||||||
DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); |
BaseFormula max = (BaseFormula) maxValueField.update(); |
||||||
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); |
axis.setMaxValue(max); |
||||||
axis.setCustomMaxValue(!StringUtils.isEmpty(dateString)); |
axis.setCustomMaxValue(!StringUtils.isEmpty(max.getPureContent())); |
||||||
axis.setMaxValue(new Formula(dateString)); |
}else{ |
||||||
} |
Date datetmp = (Date)maxValueField.update(); |
||||||
} else { |
DateEditor dateEditor = (DateEditor)maxValueField.getCurrentEditor(); |
||||||
axis.setCustomMaxValue(false); |
String dateString = dateEditor.getUIDatePickerFormat().format(datetmp); |
||||||
} |
axis.setCustomMaxValue(!StringUtils.isEmpty(dateString)); |
||||||
|
axis.setMaxValue(BaseFormula.createFormulaBuilder().build(dateString)); |
||||||
this.checkBoxUse(); |
} |
||||||
} |
} else { |
||||||
|
axis.setCustomMaxValue(false); |
||||||
@Override |
} |
||||||
public CategoryAxis updateBean() { |
|
||||||
return null; |
this.checkBoxUse(); |
||||||
} |
} |
||||||
|
|
||||||
//将从formula读出来的内容转化为指定格式的日期
|
@Override |
||||||
private static final Date getDateFromFormula(Formula dateFormula){ |
public CategoryAxis updateBean() { |
||||||
String dateStr = dateFormula.getPureContent(); |
return null; |
||||||
dateStr = Pattern.compile("\"").matcher(dateStr).replaceAll(StringUtils.EMPTY); |
} |
||||||
Date toDate = DateUtils.string2Date(dateStr, true); |
|
||||||
try { |
//将从formula读出来的内容转化为指定格式的日期
|
||||||
String tmp = DateUtils.getDate2LStr(toDate); |
private static final Date getDateFromFormula(BaseFormula dateFormula){ |
||||||
toDate = DateUtils.DATETIMEFORMAT2.parse(tmp); |
String dateStr = dateFormula.getPureContent(); |
||||||
} catch (ParseException e) { |
dateStr = Pattern.compile("\"").matcher(dateStr).replaceAll(StringUtils.EMPTY); |
||||||
FRLogger.getLogger().error(Inter.getLocText("Cannot_Get_Date")); |
Date toDate = DateUtils.string2Date(dateStr, true); |
||||||
} |
try { |
||||||
return toDate; |
String tmp = DateUtils.getDate2LStr(toDate); |
||||||
} |
toDate = DateUtils.DATETIMEFORMAT2.parse(tmp); |
||||||
|
} catch (ParseException e) { |
||||||
|
FRLogger.getLogger().error(Inter.getLocText("Cannot_Get_Date")); |
||||||
|
} |
||||||
|
return toDate; |
||||||
|
} |
||||||
} |
} |
@ -1,195 +1,191 @@ |
|||||||
package com.fr.design.mainframe.chart.gui.style.title; |
package com.fr.design.mainframe.chart.gui.style.title; |
||||||
|
|
||||||
|
|
||||||
import java.awt.BorderLayout; |
import com.fr.base.BaseFormula; |
||||||
import java.awt.Component; |
import com.fr.base.BaseUtils; |
||||||
import java.awt.event.ActionEvent; |
import com.fr.base.Utils; |
||||||
import java.awt.event.ActionListener; |
import com.fr.chart.base.TextAttr; |
||||||
|
import com.fr.chart.chartattr.Chart; |
||||||
import javax.swing.Icon; |
import com.fr.chart.chartattr.Title; |
||||||
import javax.swing.JPanel; |
import com.fr.design.constants.LayoutConstants; |
||||||
import javax.swing.JSeparator; |
import com.fr.design.dialog.BasicScrollPane; |
||||||
|
import com.fr.design.formula.TinyFormulaPane; |
||||||
import com.fr.base.BaseUtils; |
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||||
import com.fr.base.Formula; |
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
import com.fr.base.Utils; |
import com.fr.design.gui.ilable.BoldFontTextLabel; |
||||||
import com.fr.chart.base.TextAttr; |
import com.fr.design.layout.TableLayout; |
||||||
import com.fr.chart.chartattr.Chart; |
import com.fr.design.layout.TableLayoutHelper; |
||||||
import com.fr.chart.chartattr.Title; |
import com.fr.design.mainframe.chart.PaneTitleConstants; |
||||||
import com.fr.design.constants.LayoutConstants; |
import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; |
||||||
import com.fr.design.formula.TinyFormulaPane; |
import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; |
||||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
||||||
import com.fr.design.gui.icheckbox.UICheckBox; |
import com.fr.general.Inter; |
||||||
import com.fr.design.gui.ilable.BoldFontTextLabel; |
import com.fr.stable.Constants; |
||||||
import com.fr.design.layout.TableLayout; |
import com.fr.stable.StableUtils; |
||||||
import com.fr.design.layout.TableLayoutHelper; |
import com.fr.stable.StringUtils; |
||||||
import com.fr.design.mainframe.chart.PaneTitleConstants; |
|
||||||
import com.fr.design.mainframe.chart.gui.style.ChartBackgroundNoImagePane; |
import javax.swing.*; |
||||||
import com.fr.design.mainframe.chart.gui.style.ChartBorderPane; |
import java.awt.*; |
||||||
import com.fr.design.mainframe.chart.gui.style.ChartTextAttrPane; |
import java.awt.event.ActionEvent; |
||||||
import com.fr.design.dialog.BasicScrollPane; |
import java.awt.event.ActionListener; |
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.stable.Constants; |
public class ChartTitlePane extends BasicScrollPane<Chart> { |
||||||
import com.fr.stable.StableUtils; |
private static final long serialVersionUID = 5748881235830708722L; |
||||||
import com.fr.stable.StringUtils; |
private UICheckBox isTitleVisable; |
||||||
|
|
||||||
public class ChartTitlePane extends BasicScrollPane<Chart> { |
private TinyFormulaPane titleContent; |
||||||
private static final long serialVersionUID = 5748881235830708722L; |
private ChartTextAttrPane textAttrPane; |
||||||
private UICheckBox isTitleVisable; |
private UIButtonGroup<Integer> alignmentPane; |
||||||
|
|
||||||
private TinyFormulaPane titleContent; |
private JPanel chartDefaultAttrPane; |
||||||
private ChartTextAttrPane textAttrPane; |
private ChartBorderPane borderPane; |
||||||
private UIButtonGroup<Integer> alignmentPane; |
private ChartBackgroundNoImagePane backgroundPane; |
||||||
|
|
||||||
private JPanel chartDefaultAttrPane; |
private JPanel titlePane; |
||||||
private ChartBorderPane borderPane; |
|
||||||
private ChartBackgroundNoImagePane backgroundPane; |
private class ContentPane extends JPanel { |
||||||
|
private static final long serialVersionUID = -6455600016731592455L; |
||||||
private JPanel titlePane; |
|
||||||
|
public ContentPane() { |
||||||
private class ContentPane extends JPanel { |
initComponents(); |
||||||
private static final long serialVersionUID = -6455600016731592455L; |
} |
||||||
|
|
||||||
public ContentPane() { |
private void initComponents() { |
||||||
initComponents(); |
isTitleVisable = new UICheckBox(Inter.getLocText("Chart_Title_Is_Visible")); |
||||||
} |
titlePane = createTitlePane(); |
||||||
|
|
||||||
private void initComponents() { |
double p = TableLayout.PREFERRED; |
||||||
isTitleVisable = new UICheckBox(Inter.getLocText("Chart_Title_Is_Visible")); |
double f = TableLayout.FILL; |
||||||
titlePane = createTitlePane(); |
double[] columnSize = {f}; |
||||||
|
double[] rowSize = {p, p}; |
||||||
double p = TableLayout.PREFERRED; |
Component[][] components = new Component[][]{ |
||||||
double f = TableLayout.FILL; |
new Component[]{isTitleVisable}, |
||||||
double[] columnSize = {f}; |
new Component[]{titlePane} |
||||||
double[] rowSize = {p, p}; |
} ; |
||||||
Component[][] components = new Component[][]{ |
|
||||||
new Component[]{isTitleVisable}, |
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
||||||
new Component[]{titlePane} |
this.setLayout(new BorderLayout()); |
||||||
} ; |
this.add(panel,BorderLayout.CENTER); |
||||||
|
|
||||||
JPanel panel = TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
isTitleVisable.addActionListener(new ActionListener() { |
||||||
this.setLayout(new BorderLayout()); |
public void actionPerformed(ActionEvent e) { |
||||||
this.add(panel,BorderLayout.CENTER); |
checkTitlePaneUse(); |
||||||
|
} |
||||||
isTitleVisable.addActionListener(new ActionListener() { |
}); |
||||||
public void actionPerformed(ActionEvent e) { |
} |
||||||
checkTitlePaneUse(); |
} |
||||||
} |
|
||||||
}); |
private JPanel createTitlePane(){ |
||||||
} |
borderPane = new ChartBorderPane(); |
||||||
} |
backgroundPane = new ChartBackgroundNoImagePane(); |
||||||
|
chartDefaultAttrPane = createDefaultAttrPane(); |
||||||
private JPanel createTitlePane(){ |
|
||||||
borderPane = new ChartBorderPane(); |
double p = TableLayout.PREFERRED; |
||||||
backgroundPane = new ChartBackgroundNoImagePane(); |
double f = TableLayout.FILL; |
||||||
chartDefaultAttrPane = createDefaultAttrPane(); |
double[] columnSize = {p, f}; |
||||||
|
double[] rowSize = {p,p,p,p,p}; |
||||||
double p = TableLayout.PREFERRED; |
Component[][] components = new Component[][]{ |
||||||
double f = TableLayout.FILL; |
new Component[]{chartDefaultAttrPane,null}, |
||||||
double[] columnSize = {p, f}; |
new Component[]{new JSeparator(),null}, |
||||||
double[] rowSize = {p,p,p,p,p}; |
new Component[]{borderPane,null}, |
||||||
Component[][] components = new Component[][]{ |
new Component[]{backgroundPane,null} |
||||||
new Component[]{chartDefaultAttrPane,null}, |
} ; |
||||||
new Component[]{new JSeparator(),null}, |
|
||||||
new Component[]{borderPane,null}, |
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
||||||
new Component[]{backgroundPane,null} |
} |
||||||
} ; |
|
||||||
|
private JPanel createDefaultAttrPane(){ |
||||||
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
titleContent = new TinyFormulaPane(); |
||||||
} |
textAttrPane = new ChartTextAttrPane(); |
||||||
|
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
||||||
private JPanel createDefaultAttrPane(){ |
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
||||||
titleContent = new TinyFormulaPane(); |
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; |
||||||
textAttrPane = new ChartTextAttrPane(); |
Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
||||||
Icon[] alignmentIconArray = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
alignmentPane = new UIButtonGroup<Integer>(alignmentIconArray, alignment); |
||||||
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
|
||||||
BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png")}; |
double p = TableLayout.PREFERRED; |
||||||
Integer[] alignment = new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}; |
double f = TableLayout.FILL; |
||||||
alignmentPane = new UIButtonGroup<Integer>(alignmentIconArray, alignment); |
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, f}; |
||||||
|
double[] rowSize = {p, p,p}; |
||||||
double p = TableLayout.PREFERRED; |
Component[][] components = new Component[][]{ |
||||||
double f = TableLayout.FILL; |
new Component[]{null,titleContent,null}, |
||||||
double[] columnSize = {LayoutConstants.CHART_ATTR_TOMARGIN, p, f}; |
new Component[]{null,textAttrPane,null}, |
||||||
double[] rowSize = {p, p,p}; |
new Component[]{null,new BoldFontTextLabel(Inter.getLocText("Alignment-Style") + ":"),alignmentPane} , |
||||||
Component[][] components = new Component[][]{ |
} ; |
||||||
new Component[]{null,titleContent,null}, |
|
||||||
new Component[]{null,textAttrPane,null}, |
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
||||||
new Component[]{null,new BoldFontTextLabel(Inter.getLocText("Alignment-Style") + ":"),alignmentPane} , |
} |
||||||
} ; |
|
||||||
|
// 检查标题界面是否可用.
|
||||||
return TableLayoutHelper.createTableLayoutPane(components,rowSize,columnSize); |
private void checkTitlePaneUse() { |
||||||
} |
isTitleVisable.setVisible(true); |
||||||
|
isTitleVisable.setEnabled(true); |
||||||
// 检查标题界面是否可用.
|
titlePane.setVisible(isTitleVisable.isSelected()); |
||||||
private void checkTitlePaneUse() { |
this.repaint(); |
||||||
isTitleVisable.setVisible(true); |
} |
||||||
isTitleVisable.setEnabled(true); |
|
||||||
titlePane.setVisible(isTitleVisable.isSelected()); |
/** |
||||||
this.repaint(); |
* 弹出框的界面标题 |
||||||
} |
* @return 界面标题 |
||||||
|
*/ |
||||||
/** |
public String title4PopupWindow() { |
||||||
* 弹出框的界面标题 |
return PaneTitleConstants.CHART_STYLE_TITLE_TITLE; |
||||||
* @return 界面标题 |
} |
||||||
*/ |
|
||||||
public String title4PopupWindow() { |
@Override |
||||||
return PaneTitleConstants.CHART_STYLE_TITLE_TITLE; |
protected JPanel createContentPane() { |
||||||
} |
return new ContentPane(); |
||||||
|
} |
||||||
@Override |
|
||||||
protected JPanel createContentPane() { |
@Override |
||||||
return new ContentPane(); |
public void populateBean(Chart chart) { |
||||||
} |
Title title = chart.getTitle(); |
||||||
|
if (title == null) { |
||||||
@Override |
return; |
||||||
public void populateBean(Chart chart) { |
} |
||||||
Title title = chart.getTitle(); |
isTitleVisable.setSelected(title.isTitleVisible()); |
||||||
if (title == null) { |
if (title.getTextObject() instanceof BaseFormula) { |
||||||
return; |
titleContent.populateBean(((BaseFormula) title.getTextObject()).getContent()); |
||||||
} |
} else { |
||||||
isTitleVisable.setSelected(title.isTitleVisible()); |
titleContent.populateBean(Utils.objectToString(title.getTextObject())); |
||||||
if (title.getTextObject() instanceof Formula) { |
} |
||||||
titleContent.populateBean(((Formula) title.getTextObject()).getContent()); |
alignmentPane.setSelectedItem(title.getPosition()); |
||||||
} else { |
TextAttr textAttr = title.getTextAttr(); |
||||||
titleContent.populateBean(Utils.objectToString(title.getTextObject())); |
if (textAttr == null) { |
||||||
} |
textAttr = new TextAttr(); |
||||||
alignmentPane.setSelectedItem(title.getPosition()); |
} |
||||||
TextAttr textAttr = title.getTextAttr(); |
textAttrPane.populate(textAttr); |
||||||
if (textAttr == null) { |
borderPane.populate(title); |
||||||
textAttr = new TextAttr(); |
backgroundPane.populate(title); |
||||||
} |
|
||||||
textAttrPane.populate(textAttr); |
checkTitlePaneUse(); |
||||||
borderPane.populate(title); |
} |
||||||
backgroundPane.populate(title); |
|
||||||
|
@Override |
||||||
checkTitlePaneUse(); |
public void updateBean(Chart chart) { |
||||||
} |
if (chart == null) { |
||||||
|
chart = new Chart(); |
||||||
@Override |
} |
||||||
public void updateBean(Chart chart) { |
Title title = chart.getTitle(); |
||||||
if (chart == null) { |
if (title == null) { |
||||||
chart = new Chart(); |
title = new Title(StringUtils.EMPTY); |
||||||
} |
} |
||||||
Title title = chart.getTitle(); |
title.setTitleVisible(isTitleVisable.isSelected()); |
||||||
if (title == null) { |
String titleString = titleContent.updateBean(); |
||||||
title = new Title(StringUtils.EMPTY); |
Object titleObj; |
||||||
} |
if (StableUtils.maybeFormula(titleString)) { |
||||||
title.setTitleVisible(isTitleVisable.isSelected()); |
titleObj = BaseFormula.createFormulaBuilder().build(titleString); |
||||||
String titleString = titleContent.updateBean(); |
} else { |
||||||
Object titleObj; |
titleObj = titleString; |
||||||
if (StableUtils.maybeFormula(titleString)) { |
} |
||||||
titleObj = new Formula(titleString); |
title.setTextObject(titleObj); |
||||||
} else { |
TextAttr textAttr = title.getTextAttr(); |
||||||
titleObj = titleString; |
if (textAttr == null) { |
||||||
} |
textAttr = new TextAttr(); |
||||||
title.setTextObject(titleObj); |
} |
||||||
TextAttr textAttr = title.getTextAttr(); |
title.setPosition(alignmentPane.getSelectedItem()); |
||||||
if (textAttr == null) { |
textAttrPane.update(textAttr); |
||||||
textAttr = new TextAttr(); |
borderPane.update(title); |
||||||
} |
backgroundPane.update(title); |
||||||
title.setPosition(alignmentPane.getSelectedItem()); |
} |
||||||
textAttrPane.update(textAttr); |
|
||||||
borderPane.update(title); |
|
||||||
backgroundPane.update(title); |
|
||||||
} |
|
||||||
} |
} |
@ -1,156 +1,154 @@ |
|||||||
package com.fr.design.designer.creator; |
package com.fr.design.designer.creator; |
||||||
|
|
||||||
import java.awt.Dimension; |
import com.fr.base.BaseFormula; |
||||||
import java.awt.Insets; |
import com.fr.design.border.UIRoundedBorder; |
||||||
|
import com.fr.form.ui.AbstractBorderStyleWidget; |
||||||
import javax.swing.JComponent; |
import com.fr.form.ui.Label; |
||||||
|
import com.fr.form.ui.LayoutBorderStyle; |
||||||
import com.fr.base.Formula; |
import com.fr.form.ui.PaddingMargin; |
||||||
import com.fr.design.border.UIRoundedBorder; |
import com.fr.form.ui.Widget; |
||||||
import com.fr.form.ui.AbstractBorderStyleWidget; |
import com.fr.form.ui.WidgetTitle; |
||||||
import com.fr.form.ui.Label; |
import com.fr.form.ui.WidgetValue; |
||||||
import com.fr.form.ui.LayoutBorderStyle; |
import com.fr.form.ui.container.WTitleLayout; |
||||||
import com.fr.form.ui.PaddingMargin; |
import com.fr.general.ComparatorUtils; |
||||||
import com.fr.form.ui.Widget; |
import com.fr.stable.Constants; |
||||||
import com.fr.form.ui.WidgetTitle; |
import com.fr.stable.StringUtils; |
||||||
import com.fr.form.ui.WidgetValue; |
|
||||||
import com.fr.form.ui.container.WTitleLayout; |
import javax.swing.*; |
||||||
import com.fr.general.ComparatorUtils; |
import java.awt.*; |
||||||
import com.fr.stable.Constants; |
|
||||||
import com.fr.stable.StringUtils; |
/** |
||||||
|
* Created with IntelliJ IDEA. |
||||||
/** |
* User: zx |
||||||
* Created with IntelliJ IDEA. |
* Date: 14-9-22 |
||||||
* User: zx |
* Time: 上午10:40 |
||||||
* Date: 14-9-22 |
*/ |
||||||
* Time: 上午10:40 |
|
||||||
*/ |
public class XBorderStyleWidgetCreator extends XWidgetCreator{ |
||||||
|
protected static final Dimension BORDER_PREFERRED_SIZE = new Dimension(250, 150); |
||||||
public class XBorderStyleWidgetCreator extends XWidgetCreator{ |
|
||||||
protected static final Dimension BORDER_PREFERRED_SIZE = new Dimension(250, 150); |
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { |
||||||
|
super(widget, initSize); |
||||||
public XBorderStyleWidgetCreator(Widget widget, Dimension initSize) { |
} |
||||||
super(widget, initSize); |
|
||||||
} |
/** |
||||||
|
* 返回容器对应的widget |
||||||
/** |
* @return 同上 |
||||||
* 返回容器对应的widget |
*/ |
||||||
* @return 同上 |
@Override |
||||||
*/ |
public AbstractBorderStyleWidget toData() { |
||||||
@Override |
return (AbstractBorderStyleWidget) data; |
||||||
public AbstractBorderStyleWidget toData() { |
} |
||||||
return (AbstractBorderStyleWidget) data; |
|
||||||
} |
protected void initStyle() { |
||||||
|
LayoutBorderStyle style = toData().getBorderStyle(); |
||||||
protected void initStyle() { |
initBorderStyle(); |
||||||
LayoutBorderStyle style = toData().getBorderStyle(); |
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { |
||||||
initBorderStyle(); |
initTitleStyle(style); |
||||||
if (ComparatorUtils.equals(style.getType(), LayoutBorderStyle.TITLE)) { |
} else { |
||||||
initTitleStyle(style); |
clearTitleWidget(); |
||||||
} else { |
} |
||||||
clearTitleWidget(); |
} |
||||||
} |
|
||||||
} |
// 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框
|
||||||
|
protected void initBorderStyle() { |
||||||
// 边框默认值设为NONE,不然像scalelayout这种只用默认边框的会不显示边框
|
LayoutBorderStyle style = toData().getBorderStyle(); |
||||||
protected void initBorderStyle() { |
if (style != null && style.getBorder() != Constants.LINE_NONE) { |
||||||
LayoutBorderStyle style = toData().getBorderStyle(); |
this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); |
||||||
if (style != null && style.getBorder() != Constants.LINE_NONE) { |
} else { |
||||||
this.setBorder(new UIRoundedBorder(style.getBorder(), style.getColor(), style.getBorderRadius())); |
this.setBorder(DEFALUTBORDER); |
||||||
} else { |
} |
||||||
this.setBorder(DEFALUTBORDER); |
} |
||||||
} |
|
||||||
} |
private void clearTitleWidget() { |
||||||
|
if (acceptType(XWFitLayout.class)) { |
||||||
private void clearTitleWidget() { |
return; |
||||||
if (acceptType(XWFitLayout.class)) { |
} |
||||||
return; |
XWTitleLayout parent = (XWTitleLayout) this.getParent(); |
||||||
} |
if (parent.getComponentCount() > 1) { |
||||||
XWTitleLayout parent = (XWTitleLayout) this.getParent(); |
parent.remove(parent.getTitleCreator()); |
||||||
if (parent.getComponentCount() > 1) { |
} |
||||||
parent.remove(parent.getTitleCreator()); |
} |
||||||
} |
|
||||||
} |
/** |
||||||
|
* 设置样式为标题样式时,对应组件加上标题 |
||||||
/** |
* @param style 样式 |
||||||
* 设置样式为标题样式时,对应组件加上标题 |
*/ |
||||||
* @param style 样式 |
protected void initTitleStyle(LayoutBorderStyle style){ |
||||||
*/ |
if (style.getTitle() == null) { |
||||||
protected void initTitleStyle(LayoutBorderStyle style){ |
return; |
||||||
if (style.getTitle() == null) { |
} |
||||||
return; |
XWTitleLayout parent = (XWTitleLayout) this.getParent(); |
||||||
} |
if (parent.getComponentCount() > 1) { |
||||||
XWTitleLayout parent = (XWTitleLayout) this.getParent(); |
XLabel title = (XLabel) parent.getTitleCreator(); |
||||||
if (parent.getComponentCount() > 1) { |
Label widget = title.toData(); |
||||||
XLabel title = (XLabel) parent.getTitleCreator(); |
updateTitleWidgetStyle(widget, style); |
||||||
Label widget = title.toData(); |
title.initXCreatorProperties(); |
||||||
updateTitleWidgetStyle(widget, style); |
return; |
||||||
title.initXCreatorProperties(); |
} |
||||||
return; |
// 初始化标题控件
|
||||||
} |
XLabel title = new XLabel(new Label(), new Dimension()); |
||||||
// 初始化标题控件
|
Label label = title.toData(); |
||||||
XLabel title = new XLabel(new Label(), new Dimension()); |
updateTitleWidgetStyle(label, style); |
||||||
Label label = title.toData(); |
parent.add(title, WTitleLayout.TITLE); |
||||||
updateTitleWidgetStyle(label, style); |
// 初始化标题边框
|
||||||
parent.add(title, WTitleLayout.TITLE); |
title.initXCreatorProperties(); |
||||||
// 初始化标题边框
|
WTitleLayout layout = parent.toData(); |
||||||
title.initXCreatorProperties(); |
layout.updateChildBounds(layout.getBodyBoundsWidget().getBounds()); |
||||||
WTitleLayout layout = parent.toData(); |
} |
||||||
layout.updateChildBounds(layout.getBodyBoundsWidget().getBounds()); |
|
||||||
} |
/** |
||||||
|
* 更新标题控件所有的样式 |
||||||
/** |
*/ |
||||||
* 更新标题控件所有的样式 |
private void updateTitleWidgetStyle(Label title, LayoutBorderStyle style) { |
||||||
*/ |
//标题的边框样式目前是取对应的控件的边框样式
|
||||||
private void updateTitleWidgetStyle(Label title, LayoutBorderStyle style) { |
title.setBorder(style.getBorder()); |
||||||
//标题的边框样式目前是取对应的控件的边框样式
|
title.setColor(style.getColor()); |
||||||
title.setBorder(style.getBorder()); |
// title.setCorner(style.isCorner());
|
||||||
title.setColor(style.getColor()); |
|
||||||
// title.setCorner(style.isCorner());
|
WidgetTitle wTitle = style.getTitle(); |
||||||
|
//设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个
|
||||||
WidgetTitle wTitle = style.getTitle(); |
title.setWidgetName(wTitle.TITLE_NAME_INDEX + this.toData().getWidgetName()); |
||||||
//设置成随机不重复的, 不然都用一个名字的话, 联动只能联动一个
|
title.setWidgetValue(getTitleValue(wTitle)); |
||||||
title.setWidgetName(wTitle.TITLE_NAME_INDEX + this.toData().getWidgetName()); |
title.setFont(wTitle.getFrFont()); |
||||||
title.setWidgetValue(getTitleValue(wTitle)); |
title.setTextalign(wTitle.getPosition()); |
||||||
title.setFont(wTitle.getFrFont()); |
title.setBackground(wTitle.getBackground()); |
||||||
title.setTextalign(wTitle.getPosition()); |
} |
||||||
title.setBackground(wTitle.getBackground()); |
|
||||||
} |
private WidgetValue getTitleValue(WidgetTitle wTitle){ |
||||||
|
String content = String.valueOf(wTitle.getTextObject()); |
||||||
private WidgetValue getTitleValue(WidgetTitle wTitle){ |
Object vlaue = content.startsWith("=") ? BaseFormula.createFormulaBuilder().build(content) : content; |
||||||
String content = String.valueOf(wTitle.getTextObject()); |
return new WidgetValue(vlaue); |
||||||
Object vlaue = content.startsWith("=") ? new Formula(content) : content; |
} |
||||||
return new WidgetValue(vlaue); |
|
||||||
} |
@Override |
||||||
|
protected String getIconName() { |
||||||
@Override |
return StringUtils.EMPTY; |
||||||
protected String getIconName() { |
} |
||||||
return StringUtils.EMPTY; |
@Override |
||||||
} |
protected JComponent initEditor() { |
||||||
@Override |
return this; |
||||||
protected JComponent initEditor() { |
} |
||||||
return this; |
|
||||||
} |
/** |
||||||
|
* 内边距 |
||||||
/** |
* @return 同上 |
||||||
* 内边距 |
*/ |
||||||
* @return 同上 |
@Override |
||||||
*/ |
public Insets getInsets() { |
||||||
@Override |
PaddingMargin padding = toData().getMargin(); |
||||||
public Insets getInsets() { |
if (padding == null) { |
||||||
PaddingMargin padding = toData().getMargin(); |
return new Insets(0, 0, 0, 0); |
||||||
if (padding == null) { |
} |
||||||
return new Insets(0, 0, 0, 0); |
return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); |
||||||
} |
} |
||||||
return new Insets(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); |
|
||||||
} |
/** |
||||||
|
* data属性改变触发其他操作 |
||||||
/** |
* |
||||||
* data属性改变触发其他操作 |
*/ |
||||||
* |
public void firePropertyChange(){ |
||||||
*/ |
|
||||||
public void firePropertyChange(){ |
} |
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
} |
} |
@ -0,0 +1,38 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.component; |
||||||
|
|
||||||
|
import com.fr.design.gui.icombobox.UIComboBox; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.util.Vector; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by kerry on 2017/10/23. |
||||||
|
*/ |
||||||
|
public class FontSizeComboPane extends JPanel{ |
||||||
|
private static final int MAX_FONT_SIZE = 100; |
||||||
|
private UIComboBox comboBox; |
||||||
|
public FontSizeComboPane(){ |
||||||
|
initComponent(); |
||||||
|
} |
||||||
|
public void initComponent(){ |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
Vector<Integer> integerList = new Vector<Integer>(); |
||||||
|
for (int i = 1; i < MAX_FONT_SIZE; i++) { |
||||||
|
integerList.add(i); |
||||||
|
} |
||||||
|
comboBox = new UIComboBox(integerList); |
||||||
|
comboBox.setEditable(true); |
||||||
|
this.add(comboBox, BorderLayout.CENTER); |
||||||
|
} |
||||||
|
|
||||||
|
public int getValue() { |
||||||
|
return Integer.valueOf(comboBox.getSelectedItem().toString()); |
||||||
|
} |
||||||
|
|
||||||
|
public void setValue(int fontSize) { |
||||||
|
comboBox.setSelectedItem(fontSize); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue