Browse Source

REPORT-4421 改代码规范

master
plough 7 years ago
parent
commit
60e88301be
  1. 24
      designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java

24
designer_form/src/com/fr/design/parameter/ParameterPropertyPane.java

@ -26,16 +26,19 @@ public class ParameterPropertyPane extends JPanel{
private static ParameterPropertyPane THIS; private static ParameterPropertyPane THIS;
private boolean isEditing = false; private boolean isEditing = false;
private static final int HIDE_HEIGHT = 40; private static final int HIDE_HEIGHT = 40;
private static final int PADDING_SMALL = 5;
private static final int PADDING_MIDDLE = 10;
private static final int PADDING_LARGE = 15;
public static final ParameterPropertyPane getInstance() { public static final ParameterPropertyPane getInstance() {
if(THIS == null) { if (THIS == null) {
THIS = new ParameterPropertyPane(); THIS = new ParameterPropertyPane();
} }
return THIS; return THIS;
} }
public static final ParameterPropertyPane getInstance(FormDesigner editor) { public static final ParameterPropertyPane getInstance(FormDesigner editor) {
if(THIS == null) { if (THIS == null) {
THIS = new ParameterPropertyPane(); THIS = new ParameterPropertyPane();
} }
THIS.setEditor(editor); THIS.setEditor(editor);
@ -49,6 +52,10 @@ public class ParameterPropertyPane extends JPanel{
} }
private ParameterPropertyPane() { private ParameterPropertyPane() {
init();
}
private void init() {
toolbarPane = new ParameterToolBarPane(); toolbarPane = new ParameterToolBarPane();
BasicScrollPane basicScrollPane = new BasicScrollPane() { BasicScrollPane basicScrollPane = new BasicScrollPane() {
@Override @Override
@ -58,7 +65,7 @@ public class ParameterPropertyPane extends JPanel{
@Override @Override
public void populateBean(Object ob) { public void populateBean(Object ob) {
// do nothing
} }
@Override @Override
@ -67,16 +74,15 @@ public class ParameterPropertyPane extends JPanel{
} }
}; };
JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout()); JPanel scrollPaneWrapperInner = new JPanel(new BorderLayout());
scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 5)); scrollPaneWrapperInner.setBorder(BorderFactory.createEmptyBorder(0, PADDING_MIDDLE, PADDING_MIDDLE, PADDING_SMALL));
scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER); scrollPaneWrapperInner.add(basicScrollPane, BorderLayout.CENTER);
addParaPane = new JPanel(new BorderLayout()); addParaPane = new JPanel(new BorderLayout());
addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER); addParaPane.add(scrollPaneWrapperInner, BorderLayout.CENTER);
addParaPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.SPLIT_LINE)); addParaPane.setBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, UIConstants.SPLIT_LINE));
initParameterListener(); initParameterListener();
this.setLayout(new BorderLayout(0, 6)); this.setLayout(new BorderLayout(0, 6));
this.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0)); this.setBorder(BorderFactory.createEmptyBorder(PADDING_MIDDLE, 0, PADDING_MIDDLE, 0));
this.add(addParaPane, BorderLayout.CENTER); this.add(addParaPane, BorderLayout.CENTER);
} }
@ -110,7 +116,7 @@ public class ParameterPropertyPane extends JPanel{
private void setEditor(FormDesigner editor) { private void setEditor(FormDesigner editor) {
if (formHierarchyTreePaneWrapper == null) { if (formHierarchyTreePaneWrapper == null) {
formHierarchyTreePaneWrapper = new JPanel(new BorderLayout()); formHierarchyTreePaneWrapper = new JPanel(new BorderLayout());
formHierarchyTreePaneWrapper.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 15)); formHierarchyTreePaneWrapper.setBorder(BorderFactory.createEmptyBorder(0, PADDING_MIDDLE, 0, PADDING_LARGE));
this.add(formHierarchyTreePaneWrapper, BorderLayout.SOUTH); this.add(formHierarchyTreePaneWrapper, BorderLayout.SOUTH);
} }
formHierarchyTreePaneWrapper.remove(FormHierarchyTreePane.getInstance()); formHierarchyTreePaneWrapper.remove(FormHierarchyTreePane.getInstance());
@ -121,7 +127,7 @@ public class ParameterPropertyPane extends JPanel{
toolbarPane.setParaMouseListener(new MouseAdapter() { toolbarPane.setParaMouseListener(new MouseAdapter() {
@Override @Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
if(paraPane == null) { if (paraPane == null) {
return; return;
} }
final UIButton parameterSelectedLabel = (UIButton) e.getSource(); final UIButton parameterSelectedLabel = (UIButton) e.getSource();
@ -142,7 +148,7 @@ public class ParameterPropertyPane extends JPanel{
toolbarPane.addActionListener(new ActionListener() { toolbarPane.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if(paraPane == null) { if (paraPane == null) {
return; return;
} }
paraPane.addingAllParameter2Editor(); paraPane.addingAllParameter2Editor();

Loading…
Cancel
Save