Browse Source

REPORT-750 表单共创内测问题

bugfix4
master
zhouping 8 years ago
parent
commit
e537b799f3
  1. 10
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java
  2. 76
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  3. 19
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

10
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java

@ -308,19 +308,23 @@ public class FRAbsoluteLayoutAdapter extends FRBodyLayoutAdapter {
* @param y 坐标y * @param y 坐标y
*/ */
public void fix(XCreator creator ,int x, int y) { public void fix(XCreator creator ,int x, int y) {
int height = creator.getHeight();
int width = creator.getWidth();
if (x < 0) { if (x < 0) {
width += x;
x = 0; x = 0;
} else if (x + creator.getWidth() > container.getWidth()) { } else if (x + creator.getWidth() > container.getWidth()) {
x = container.getWidth() - creator.getWidth(); width = container.getWidth() - x;
} }
if (y < 0) { if (y < 0) {
height += y;
y = 0; y = 0;
} else if (y + creator.getHeight() > container.getHeight()) { } else if (y + creator.getHeight() > container.getHeight()) {
y = container.getHeight() - creator.getHeight(); height = container.getHeight() - y;
} }
creator.setLocation(x, y); creator.setBounds(x, y, width, height);
} }
@Override @Override

76
designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java

@ -9,6 +9,7 @@ import com.fr.design.mainframe.widget.editors.LayoutTypeEditor;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.general.FRLogger;
import com.fr.general.FRScreen; import com.fr.general.FRScreen;
import com.fr.general.Inter; import com.fr.general.Inter;
@ -92,6 +93,43 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
} else { } else {
if (row == 0) { if (row == 0) {
if (state == WBodyLayoutType.FIT.getTypeValue()) { if (state == WBodyLayoutType.FIT.getTypeValue()) {
return switch2FitBodyLayout();
}
}
if (row == 1) {
layout.setCompState(state);
return true;
}
return false;
}
}
int state = 0;
if(value instanceof Integer) {
state = (Integer)value;
}
if (column == 0 || state < 0) {
return false;
} else {
if (row == 0) {
layout.setCompState(state);
return true;
}
return false;
}
}
/**
* 是否可编辑
* @param row
* @return
*/
@Override
public boolean isEditable(int row) {
return true;
}
private boolean switch2FitBodyLayout() {
try {
XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent(); XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent();
//备份一下组件间隔 //备份一下组件间隔
int compInterval = xfl.toData().getCompInterval(); int compInterval = xfl.toData().getCompInterval();
@ -103,8 +141,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
xfl.remove(xwAbsoluteLayout); xfl.remove(xwAbsoluteLayout);
for (Component comp : components) { for (Component comp : components) {
XCreator xCreator = (XCreator)comp; XCreator xCreator = (XCreator) comp;
if (xCreator.shouldScaleCreator()){ if (xCreator.shouldScaleCreator()) {
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight()); XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight());
xfl.add(parentPanel, xCreator.toData().getWidgetName()); xfl.add(parentPanel, xCreator.toData().getWidgetName());
parentPanel.updateChildBound(xfl.getActualMinHeight()); parentPanel.updateChildBound(xfl.getActualMinHeight());
@ -133,40 +171,14 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
xfl.toData().setLayoutType(WBodyLayoutType.FIT); xfl.toData().setLayoutType(WBodyLayoutType.FIT);
return true; return true;
} }
} catch (Exception e){
if (row == 1) { FRLogger.getLogger().error(e.getMessage());
layout.setCompState(state);
return true;
}
return false; return false;
} }
} }
int state = 0;
if(value instanceof Integer) {
state = (Integer)value;
}
if (column == 0 || state < 0) {
return false;
} else {
if (row == 0) {
layout.setCompState(state);
return true;
}
return false;
}
}
/**
* 是否可编辑
* @param row
* @return
*/
@Override
public boolean isEditable(int row) {
return true;
}
//把绝对布局中的元素按规则移动到自适应布局中 // 把绝对布局中的元素按规则移动到自适应布局中
// 规则:各元素按顺序放置,其中每行最多4个元素,超出则换行,各元素均分body的高度和宽度
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) { private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
int eachRowCount = 4; int eachRowCount = 4;
Component[] components = xwFitLayout.getComponents(); Component[] components = xwFitLayout.getComponents();

19
designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java

@ -17,6 +17,7 @@ import com.fr.form.ui.container.WAbsoluteBodyLayout;
import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout;
import com.fr.form.ui.container.WBodyLayoutType; import com.fr.form.ui.container.WBodyLayoutType;
import com.fr.form.ui.container.WFitLayout; import com.fr.form.ui.container.WFitLayout;
import com.fr.general.FRLogger;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.DefaultTableCellRenderer;
@ -145,19 +146,19 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
layout.setCompState(state); layout.setCompState(state);
return true; return true;
}else if (row == 0) { }else if (row == 0) {
layout.setLayoutType(WBodyLayoutType.parse(state)); try {
if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) { if (state == WBodyLayoutType.ABSOLUTE.getTypeValue()) {
WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body"); WAbsoluteBodyLayout wAbsoluteBodyLayout = new WAbsoluteBodyLayout("body");
wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED); wAbsoluteBodyLayout.setCompState(WAbsoluteLayout.STATE_FIXED);
Component[] components = xfl.getComponents(); Component[] components = xfl.getComponents();
xfl.removeAll(); xfl.removeAll();
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0,0)); XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0, 0));
xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0); xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) { for (Component component : components) {
XCreator xCreator = (XCreator)component; XCreator xCreator = (XCreator) component;
//部分控件被ScaleLayout包裹着,绝对布局里面要放出来 //部分控件被ScaleLayout包裹着,绝对布局里面要放出来
if (xCreator.acceptType(XWScaleLayout.class)){ if (xCreator.acceptType(XWScaleLayout.class)) {
if (xCreator.getComponentCount() > 0 && ((XCreator)xCreator.getComponent(0)).shouldScaleCreator()) { if (xCreator.getComponentCount() > 0 && ((XCreator) xCreator.getComponent(0)).shouldScaleCreator()) {
component = xCreator.getComponent(0); component = xCreator.getComponent(0);
component.setBounds(xCreator.getBounds()); component.setBounds(xCreator.getBounds());
} }
@ -167,12 +168,16 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators( formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xfl, new Widget[]{wAbsoluteBodyLayout})); FormSelectionUtils.rebuildSelection(xfl, new Widget[]{wAbsoluteBodyLayout}));
} } else {
else {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner(); FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators( formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()})); FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()}));
} }
}catch (Exception e){
FRLogger.getLogger().error(e.getMessage());
return false;
}
layout.setLayoutType(WBodyLayoutType.parse(state));
return true; return true;
} }
return false; return false;

Loading…
Cancel
Save