Browse Source

无JIRA任务,代码规范

master
plough 7 years ago
parent
commit
b82ad6f4a4
  1. 26
      designer_form/src/com/fr/design/mainframe/FormArea.java
  2. 35
      designer_form/src/com/fr/design/mainframe/JForm.java

26
designer_form/src/com/fr/design/mainframe/FormArea.java

@ -35,6 +35,7 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
private static final int ROTATIONS = 50;
private static final int SHOWVALMAX = 400;
private static final int SHOWVALMIN = 10;
private static final int RESIZE_PANE_GAP = 8;
private FormDesigner designer;
private int horizontalValue = 0;
private int verticalValue = 0;
@ -119,11 +120,10 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
slidePane = JFormSliderPane.getInstance();
slidePane.setPreferredSize(new Dimension(200, 20));
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(new JComponent[][]{
{tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"),
heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane}},
rowSize, columnSize, 8);
JPanel resizePane = TableLayoutHelper.createCommonTableLayoutPane(
new JComponent[][]{{ tipsPane, new UILabel(), widthPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel("x"),
heightPane, new UILabel(Inter.getLocText("FR-Designer_Indent-Pixel")), new UILabel(), slidePane }},
rowSize, columnSize, RESIZE_PANE_GAP);
this.add(FormRulerLayout.BOTTOM, resizePane);
setWidgetsConfig();
// 先初始话滑块及对应事件,然后获取分辨率调整容器的显示大小
@ -439,14 +439,13 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
int id = evt.getID();
switch (id) {
case MouseEvent.MOUSE_WHEEL: {
int rotations = evt.getWheelRotation();
int value = this.verScrollBar.getValue() + rotations * ROTATIONS;
value = Math.min(value, verticalMax);
value = Math.max(0, value);
int value = this.verScrollBar.getValue() + evt.getWheelRotation() * ROTATIONS;
value = Math.max(0, Math.min(value, verticalMax));
doLayout(); //加dolayout是因为每次滚动都要重置 Max的大小
this.verScrollBar.setValue(value);
break;
}
default:
}
}
@ -743,9 +742,12 @@ public class FormArea extends JComponent implements ScrollRulerComponent {
}
private class FormRulerLayout extends RulerLayout {
private int DESIGNERWIDTH = 960;
private int DESIGNERHEIGHT = 540;
private int TOPGAP = 8;
private static final int DESIGNER_WIDTH = 960;
private static final int DESIGNER_HEIGHT = 540;
private static final int TOPGAP = 8;
private int DESIGNERWIDTH = DESIGNER_WIDTH;
private int DESIGNERHEIGHT = DESIGNER_HEIGHT;
public FormRulerLayout() {
super();

35
designer_form/src/com/fr/design/mainframe/JForm.java

@ -93,6 +93,8 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public void refreshEastPropertiesPane() {
// 暂时用不到,遇到的时候再加刷新右侧tab面板的代码
return;
}
@Override
@ -126,7 +128,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public void setJTemplateResolution(int resolution) {
return;
}
@Override
@ -270,14 +272,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
}
public void setSheetCovered(boolean isCovered) {
return;
}
/**
* 刷新容器
*/
public void refreshContainer() {
return;
}
/**
@ -289,6 +291,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public void setScale(int resolution) {
return;
}
@Override
@ -464,12 +467,12 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
@Override
public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
return (ShortCut[]) ArrayUtils.addAll( new ShortCut[]{
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, new ShortCut[0]);
} else {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
return (ShortCut[]) ArrayUtils.addAll( new ShortCut[]{
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, this.elementCaseDesign.shortcut4TemplateMenu());
@ -680,16 +683,14 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return;
}
if (formDesign.isReportBlockEditing()) {
if (elementCaseDesign != null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(elementCaseDesign.getConditionAttrPane());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane());
return;
}
if (formDesign.isReportBlockEditing() && elementCaseDesign != null) {
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM_REPORT);
EastRegionContainerPane.getInstance().removeParameterPane();
EastRegionContainerPane.getInstance().replaceCellAttrPane(elementCaseDesign.getEastDownPane());
EastRegionContainerPane.getInstance().replaceCellElementPane(elementCaseDesign.getEastUpPane());
EastRegionContainerPane.getInstance().replaceConditionAttrPane(elementCaseDesign.getConditionAttrPane());
EastRegionContainerPane.getInstance().replaceHyperlinkPane(elementCaseDesign.getHyperlinkPane());
return;
}
EastRegionContainerPane.getInstance().switchMode(EastRegionContainerPane.PropertyMode.FORM);
@ -699,6 +700,10 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
EastRegionContainerPane.getInstance().addParameterPane(parameterPropertyPane);
EastRegionContainerPane.getInstance().setParameterHeight(parameterPropertyPane.getPreferredSize().height);
refreshWidgetLibPane();
}
private void refreshWidgetLibPane() {
if (EastRegionContainerPane.getInstance().getWidgetLibPane() == null) {
new Thread() {
public void run() {

Loading…
Cancel
Save