Browse Source

代码规范

master
plough 7 years ago
parent
commit
c9a21400fa
  1. 84
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  2. 37
      designer/src/com/fr/design/write/submit/SmartInsertDBManipulationPane.java
  3. 2
      designer/src/com/fr/poly/creator/ECBlockPane.java
  4. 3
      designer_base/src/com/fr/design/actions/ExitAuthorityEditAction.java

84
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -45,51 +45,12 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
public ElementCasePaneDelegate(WorkSheet sheet) { public ElementCasePaneDelegate(WorkSheet sheet) {
super(sheet); super(sheet);
this.addSelectionChangeListener(new SelectionListener() { this.addSelectionChangeListener(new SelectionListener() {
@Override @Override
public void selectionChanged(SelectionEvent e) { public void selectionChanged(SelectionEvent e) {
if (!isEditable()) { if (!isEditable()) {
return; return;
} }
//在编辑权限,所以要更新权限编辑面板 doOnSelectionChanged();
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return;
}
CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = ((ElementCasePaneDelegate)e.getSource()).getSelection();
// 模板初始化完成后,才能初始化超级链接面板
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout());
floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
}
EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
EastRegionContainerPane.getInstance().removeParameterPane();
}
} }
}); });
this.addTargetModifiedListener(new TargetModifiedListener() { this.addTargetModifiedListener(new TargetModifiedListener() {
@ -100,6 +61,48 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
}); });
} }
private void doOnSelectionChanged() {
//在编辑权限,所以要更新权限编辑面板
if (BaseUtils.isAuthorityEditing()) {
AuthorityPropertyPane authorityPropertyPane = new AuthorityPropertyPane(ElementCasePaneDelegate.this);
authorityPropertyPane.populate();
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.AUTHORITY_EDITION);
EastRegionContainerPane.getInstance().replaceAuthorityEditionPane(authorityPropertyPane);
EastRegionContainerPane.getInstance().replaceConfiguredRolesPane(RolesAlreadyEditedPane.getInstance());
return;
}
CellWidgetPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
CellElementPropertyPane.getInstance().populate(ElementCasePaneDelegate.this);
QuickEditorRegion.getInstance().populate(getCurrentEditor());
JTemplate editingTemplate = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate();
if (editingTemplate != null && !editingTemplate.isUpMode()) {
Selection editingSelection = ((ElementCasePaneDelegate)e.getSource()).getSelection();
// 模板初始化完成后,才能初始化超级链接面板
HyperlinkGroupPane hyperlinkGroupPane = editingTemplate.getHyperLinkPane(HyperlinkGroupPaneActionImpl.getInstance());
hyperlinkGroupPane.populate(ElementCasePaneDelegate.this);
if (editingSelection instanceof FloatSelection) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT_FLOAT);
JPanel floatPane = new JPanel(new BorderLayout());
floatPane.add(ReportFloatPane.getInstance(), BorderLayout.NORTH);
floatPane.add(QuickEditorRegion.getInstance(), BorderLayout.CENTER);
EastRegionContainerPane.getInstance().replaceFloatElementPane(floatPane);
} else {
// 条件属性
ConditionAttributesGroupPane conditionAttributesGroupPane = ConditionAttributesGroupPane.getInstance();
conditionAttributesGroupPane.populate(ElementCasePaneDelegate.this);
EastRegionContainerPane.getInstance().replaceFloatElementPane(ReportFloatPane.getInstance());
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.REPORT);
EastRegionContainerPane.getInstance().replaceCellAttrPane(CellElementPropertyPane.getInstance());
EastRegionContainerPane.getInstance().replaceCellElementPane(QuickEditorRegion.getInstance());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(conditionAttributesGroupPane);
EastRegionContainerPane.getInstance().replaceWidgetSettingsPane(CellWidgetPropertyPane.getInstance());
}
EastRegionContainerPane.getInstance().replaceHyperlinkPane(hyperlinkGroupPane);
EastRegionContainerPane.getInstance().removeParameterPane();
}
}
@Override @Override
protected boolean supportRepeatedHeaderFooter() { protected boolean supportRepeatedHeaderFooter() {
return true; return true;
@ -126,6 +129,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
* *
* @return 不是必须在可见范围. * @return 不是必须在可见范围.
*/ */
@Override
public boolean mustInVisibleRange() { public boolean mustInVisibleRange() {
return false; return false;
} }

37
designer/src/com/fr/design/write/submit/SmartInsertDBManipulationPane.java

@ -8,9 +8,7 @@ import java.awt.event.ActionEvent;
import javax.swing.BorderFactory; import javax.swing.BorderFactory;
import javax.swing.JDialog; import javax.swing.JDialog;
import javax.swing.JLayeredPane;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRootPane;
import javax.swing.JTable; import javax.swing.JTable;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
@ -43,12 +41,15 @@ import com.fr.grid.selection.FloatSelection;
import com.fr.grid.selection.Selection; import com.fr.grid.selection.Selection;
import com.fr.stable.ColumnRow; import com.fr.stable.ColumnRow;
import com.fr.stable.ColumnRowGroup; import com.fr.stable.ColumnRowGroup;
import com.fr.stable.StringUtils;
import com.fr.write.DMLConfigJob; import com.fr.write.DMLConfigJob;
public class SmartInsertDBManipulationPane extends DBManipulationPane { public class SmartInsertDBManipulationPane extends DBManipulationPane {
private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1); private static final Selection NO_SELECTION = new CellSelection(-1, -1, -1, -1);
private ElementCasePane ePane; private ElementCasePane ePane;
private static int CELL_GROUP_LIMIT = 6; private static int CELL_GROUP_LIMIT = 6;
private static int TOP_PADDING = 30;
private static int LEFT_COLUMN_MAX_WIDTH = 40;
public SmartInsertDBManipulationPane(ElementCasePane ePane) { public SmartInsertDBManipulationPane(ElementCasePane ePane) {
super(ValueEditorPaneFactory.extendedCellGroupEditors()); super(ValueEditorPaneFactory.extendedCellGroupEditors());
@ -57,10 +58,14 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
public SmartInsertDBManipulationPane() { public SmartInsertDBManipulationPane() {
super(ValueEditorPaneFactory.extendedCellGroupEditors()); super(ValueEditorPaneFactory.extendedCellGroupEditors());
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate(); init();
this.ePane = ((JWorkBook) jTemplate).getEditingElementCasePane();
} }
private void init() {
JTemplate jTemplate = DesignerContext.getDesignerFrame().getSelectedJTemplate();
this.ePane = ((JWorkBook) jTemplate).getEditingElementCasePane();
}
@Override @Override
protected SubmitJobListPane createSubmitJobListPane() { protected SubmitJobListPane createSubmitJobListPane() {
return new SmartInsertSubmitJobListPane(); return new SmartInsertSubmitJobListPane();
@ -123,7 +128,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
} }
}; };
bPane.setLayout(FRGUIPaneFactory.createBorderLayout()); bPane.setLayout(FRGUIPaneFactory.createBorderLayout());
bPane.setBorder(BorderFactory.createEmptyBorder(30, 0, 0, 0)); bPane.setBorder(BorderFactory.createEmptyBorder(TOP_PADDING, 0, 0, 0));
final UIBasicSpinner columnSpinner = new UIBasicSpinner(); final UIBasicSpinner columnSpinner = new UIBasicSpinner();
final UIBasicSpinner rowSpinner = new UIBasicSpinner(); final UIBasicSpinner rowSpinner = new UIBasicSpinner();
Component[][] coms = new Component[][] { { new UILabel(Inter.getLocText("RWA-Row_Offset")), rowSpinner },{ new UILabel(Inter.getLocText("RWA-Column_Offset")), columnSpinner } }; Component[][] coms = new Component[][] { { new UILabel(Inter.getLocText("RWA-Row_Offset")), rowSpinner },{ new UILabel(Inter.getLocText("RWA-Column_Offset")), columnSpinner } };
@ -289,11 +294,6 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
} }
} }
private boolean possibleParentContainer(Container p) {
return p instanceof Dialog || p instanceof BasicPane ||
p instanceof JPanel || p instanceof JRootPane || p instanceof JLayeredPane;
}
private class SmartJTablePane4DB extends SmartJTablePane { private class SmartJTablePane4DB extends SmartJTablePane {
// 是否是单元格组 // 是否是单元格组
@ -329,7 +329,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
* set Width * set Width
*/ */
TableColumn column0 = table.getColumnModel().getColumn(0); TableColumn column0 = table.getColumnModel().getColumn(0);
column0.setMaxWidth(40); column0.setMaxWidth(LEFT_COLUMN_MAX_WIDTH);
/* /*
* 设置Column 1的Renderer * 设置Column 1的Renderer
*/ */
@ -410,7 +410,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
// 要考虑多选的情况 要结合之前的看看 可能是增加 也可能需要减少 // 要考虑多选的情况 要结合之前的看看 可能是增加 也可能需要减少
ColumnRowGroup add = new ColumnRowGroup(); ColumnRowGroup add = new ColumnRowGroup();
int removeCount = 0; int removeCount = 0;
if (oriCellSelection != null && sameStartPoint(cellselection, oriCellSelection)) { if (oriCellSelection != null && isSameStartPoint(cellselection, oriCellSelection)) {
removeCount = dealDragSelection(add, cellselection); removeCount = dealDragSelection(add, cellselection);
} else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) { } else if (cellselection.getSelectedType() == CellSelection.CHOOSE_ROW || cellselection.getSelectedType() == CellSelection.CHOOSE_COLUMN) {
dealSelectColRow(add, cellselection); dealSelectColRow(add, cellselection);
@ -441,7 +441,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
return newValue; return newValue;
} }
private boolean sameStartPoint(CellSelection cs1, CellSelection cs2) { private boolean isSameStartPoint(CellSelection cs1, CellSelection cs2) {
return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow(); return cs1.getColumn() == cs2.getColumn() && cs1.getRow() == cs2.getRow();
} }
@ -479,6 +479,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
private SmartJTablePaneAction a = new AbstractSmartJTablePaneAction(this, SmartInsertDBManipulationPane.this) { private SmartJTablePaneAction a = new AbstractSmartJTablePaneAction(this, SmartInsertDBManipulationPane.this) {
@Override @Override
public void doOk() { public void doOk() {
// 遗留代码
} }
@Override @Override
@ -507,7 +508,7 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
if (((ColumnValue)value).obj != null) { if (((ColumnValue)value).obj != null) {
this.setText(((ColumnValue)value).obj.toString()); this.setText(((ColumnValue)value).obj.toString());
} else { } else {
this.setText(""); this.setText(StringUtils.EMPTY);
} }
} }
@ -535,12 +536,12 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
Object cv = ((ColumnValue) value).obj; Object cv = ((ColumnValue) value).obj;
if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) { if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) {
text.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, text.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"},
new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); new String[]{((ColumnRowGroup)cv).getSize()+StringUtils.EMPTY, StringUtils.EMPTY}) + "]");
tip = cv.toString() + " " + tip; tip = cv.toString() + " " + tip;
} else if (cv != null) { } else if (cv != null) {
text.setText(cv.toString()); text.setText(cv.toString());
} else { } else {
text.setText(""); text.setText(StringUtils.EMPTY);
} }
} }
@ -568,12 +569,12 @@ public class SmartInsertDBManipulationPane extends DBManipulationPane {
Object cv = ((ColumnValue) value).obj; Object cv = ((ColumnValue) value).obj;
if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) { if (cv instanceof ColumnRowGroup && ((ColumnRowGroup)cv).getSize() >= CELL_GROUP_LIMIT) {
this.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"}, this.setText("[" + Inter.getLocText(new String[]{"Has_Selected", "Classifier-Ge", "Cell"},
new String[]{((ColumnRowGroup)cv).getSize()+"", ""}) + "]"); new String[]{((ColumnRowGroup)cv).getSize()+StringUtils.EMPTY, StringUtils.EMPTY}) + "]");
tip = cv.toString() + " " + tip; tip = cv.toString() + " " + tip;
} else if (cv != null) { } else if (cv != null) {
this.setText(cv.toString()); this.setText(cv.toString());
} else { } else {
this.setText(""); this.setText(StringUtils.EMPTY);
} }
} }

2
designer/src/com/fr/poly/creator/ECBlockPane.java

@ -119,7 +119,7 @@ public class ECBlockPane extends PolyElementCasePane {
// 插入菜单 // 插入菜单
private MenuDef createInsertMenuDef() { private MenuDef createInsertMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("M-Insert"), 'I'); MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Insert"), 'I');
// 单元格菜单 // 单元格菜单
menuDef.addShortCut(DeprecatedActionManager.getCellMenu(this)); menuDef.addShortCut(DeprecatedActionManager.getCellMenu(this));

3
designer_base/src/com/fr/design/actions/ExitAuthorityEditAction.java

@ -23,9 +23,10 @@ public class ExitAuthorityEditAction extends TemplateComponentAction {
public void prepare4Undo() { public void prepare4Undo() {
// 遗留代码
} }
@Override
public boolean executeActionReturnUndoRecordNeeded() { public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent(); TargetComponent tc = getEditingComponent();
if (tc == null) { if (tc == null) {

Loading…
Cancel
Save