Browse Source

无JIRA任务 release的修改同步一份到dev

master
zhouping 8 years ago
parent
commit
3e68fea047
  1. 6
      designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java
  2. 44
      designer_form/src/com/fr/design/designer/properties/FRAbsoluteBodyLayoutPropertiesGroupModel.java
  3. 26
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java
  4. 14
      designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java
  5. 20
      designer_form/src/com/fr/design/mainframe/JForm.java

6
designer_base/src/com/fr/design/gui/itable/AbstractPropertyTable.java

@ -66,6 +66,9 @@ public abstract class AbstractPropertyTable extends JTable {
public TableCellRenderer getCellRenderer(int row, int column) {
if (groups != null) {
Point pIndex = getGroupIndex(row);
if (pIndex == null){
return super.getCellRenderer(row, column);
}
PropertyGroup group = groups.get(pIndex.x);
if (pIndex.y == 0) {
if (column == 0) {
@ -192,6 +195,9 @@ public abstract class AbstractPropertyTable extends JTable {
@Override
public Object getValueAt(int row, int column) {
Point pIndex = getGroupIndex(row);
if (pIndex == null){
return null;
}
PropertyGroup group = groups.get(pIndex.x);
if (pIndex.y == 0) {
if (column == 0) {

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

@ -1,7 +1,7 @@
package com.fr.design.designer.properties;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.cardlayout.XWCardMainBorderLayout;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane;
@ -93,6 +93,8 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
if (row == 0) {
if (state == WBodyLayoutType.FIT.getTypeValue()) {
XWFitLayout xfl = (XWFitLayout) xwAbsoluteLayout.getBackupParent();
//备份一下组件间隔
int compInterval = xfl.toData().getCompInterval();
Component[] components = xwAbsoluteLayout.getComponents();
Arrays.sort(components, new ComparatorComponentLocation());
@ -102,15 +104,35 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
xfl.toData().setLayoutType(WBodyLayoutType.FIT);
for (Component comp : components) {
xfl.add(comp);
XCreator xCreator = (XCreator)comp;
if (xCreator.shouldScaleCreator()){
XLayoutContainer parentPanel = xCreator.initCreatorWrapper(xCreator.getHeight());
xfl.add(parentPanel, xCreator.toData().getWidgetName());
continue;
}
xfl.add(xCreator);
}
moveComponents2FitLayout(xfl, components);
//这边计算的时候会先把组件间隔去掉
moveComponents2FitLayout(xfl);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xfl, new Widget[]{xfl.toData()}));
formDesigner.getSelectionModel().setSelectedCreator(xfl);
xfl.convert();
LayoutUtils.layoutContainer(xfl);
xfl.adjustCreatorsWhileSlide(xfl.getContainerPercent() - 1.0);
for (int i = 0; i < components.length; i++) {
Component comp = xfl.getComponent(i);
XCreator creator = (XCreator) comp;
creator.setBackupBound(components[i].getBounds());
}
//把组件间隔加上
if (xfl.toData().getCompInterval() != compInterval) {
xfl.moveContainerMargin();
xfl.moveCompInterval(xfl.getAcualInterval());
xfl.toData().setCompInterval(compInterval);
xfl.addCompInterval(xfl.getAcualInterval());
}
return true;
}
}
@ -147,8 +169,9 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
}
//把绝对布局中的元素按规则移动到自适应布局中
private void moveComponents2FitLayout(XWFitLayout xwFitLayout, Component[] components) {
private void moveComponents2FitLayout(XWFitLayout xwFitLayout) {
int eachRowCount = 4;
Component[] components = xwFitLayout.getComponents();
if (components.length <= 1){
return;
}
@ -156,6 +179,7 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
int layoutHeight = xwFitLayout.getHeight() - xwFitLayout.toData().getMargin().getTop() - xwFitLayout.toData().getMargin().getBottom();
int leftMargin = xwFitLayout.toData().getMargin().getLeft();
int topMargin = xwFitLayout.toData().getMargin().getTop();
xwFitLayout.toData().setCompInterval(0);
int row = (components.length / eachRowCount) + (components.length % eachRowCount == 0 ? 0 : 1);
//最后一行的列数不定
int column = components.length % eachRowCount == 0 ? eachRowCount : components.length % eachRowCount;
@ -182,6 +206,12 @@ public class FRAbsoluteBodyLayoutPropertiesGroupModel extends FRAbsoluteLayoutPr
lastRowHeight
);
}
for (int i = 0;i < components.length;i++){
if (components[i] instanceof XWCardMainBorderLayout){
((XWCardMainBorderLayout)components[i]).recalculateChildWidth(components[i].getWidth());
((XWCardMainBorderLayout)components[i]).recalculateChildHeight(components[i].getHeight());
}
}
xwFitLayout.updateBoundsWidget();
}

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

@ -4,8 +4,7 @@
package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.*;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.FormSelectionUtils;
import com.fr.design.mainframe.WidgetPropertyPane;
@ -91,8 +90,23 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
}
}
private XLayoutContainer selectedBodyLayout(FormDesigner formDesigner) {
XLayoutContainer rootLayout = formDesigner.getRootComponent();
if (rootLayout.getComponentCount() == 1 && rootLayout.getXCreator(0).acceptType(XWAbsoluteBodyLayout.class)){
rootLayout = (XWAbsoluteBodyLayout)rootLayout.getXCreator(0);
}
return rootLayout;
}
@Override
public Object getValue(int row, int column) {
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
XLayoutContainer rootLayout = selectedBodyLayout(formDesigner);
if (rootLayout != formDesigner.getRootComponent()
&& formDesigner.getSelectionModel().getSelection().getSelectedCreator() == formDesigner.getRootComponent()) {
formDesigner.getSelectionModel().setSelectedCreators(
FormSelectionUtils.rebuildSelection(xfl, new Widget[]{selectedBodyLayout(formDesigner).toData()}));
}
if (column == 0) {
switch (row) {
case 0:
@ -140,6 +154,14 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
XWAbsoluteBodyLayout xwAbsoluteBodyLayout = new XWAbsoluteBodyLayout(wAbsoluteBodyLayout, new Dimension(0,0));
xfl.getLayoutAdapter().addBean(xwAbsoluteBodyLayout, 0, 0);
for (Component component : components) {
XCreator xCreator = (XCreator)component;
//部分控件被ScaleLayout包裹着,绝对布局里面要放出来
if (xCreator.acceptType(XWScaleLayout.class)){
if (xCreator.getComponentCount() > 0 && ((XCreator)xCreator.getComponent(0)).shouldScaleCreator()) {
component = xCreator.getComponent(0);
component.setBounds(xCreator.getBounds());
}
}
xwAbsoluteBodyLayout.add(component);
}
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();

14
designer_form/src/com/fr/design/mainframe/FormHierarchyTreePane.java

@ -5,7 +5,8 @@ import java.awt.event.ActionEvent;
import javax.swing.BorderFactory;
import javax.swing.Icon;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.actions.community.NeedAction;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.mainframe.widget.UITreeComboBox;
@ -171,10 +172,17 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree
*/
private void adjustPosition(ComponentTreeModel treeModel,FormDesigner formDesigner){
XCreator root = (XCreator)treeModel.getRoot();
if(treeModel.getChild(root,PARA) instanceof XWParameterLayout){
XCreator firstChild = (XCreator)treeModel.getChild(root,PARA);
if(firstChild.acceptType(XWParameterLayout.class)){
return;
}
root.add((Component)(treeModel.getChild(root,PARA)),BODY);
// 绝对布局作为body的时候
// 获取第一个子节点的方法中屏蔽了fit
// 这边另外处理一下
else if (firstChild.acceptType(XWAbsoluteBodyLayout.class) && firstChild.getBackupParent() != null) {
firstChild = firstChild.getBackupParent();
}
root.add(firstChild,BODY);
treeModel.setRoot(root);
componentTree = new ComponentTree(formDesigner,treeModel);
}

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

@ -9,9 +9,7 @@ import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.actions.FormDeleteAction;
import com.fr.design.designer.beans.events.DesignerEditListener;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XComponent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.*;
import com.fr.design.designer.properties.FormWidgetAuthorityEditPane;
import com.fr.design.event.TargetModifiedEvent;
import com.fr.design.event.TargetModifiedListener;
@ -436,6 +434,18 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
return !inECUndoForm && this.getUndoManager().canUndo();
}
// 返回当前的body,
// 假如当前body是自适应的话就沿用,
// 假如当前body是绝对布局的话就返回绝对布局body
private XLayoutContainer selectedBodyLayout() {
XLayoutContainer rootLayout = formDesign.getRootComponent();
for (int i = 0; i < rootLayout.getComponentCount(); i++){
if (rootLayout.getXCreator(i).acceptType(XWAbsoluteBodyLayout.class)){
rootLayout = (XWAbsoluteBodyLayout)rootLayout.getXCreator(i);
}
}
return rootLayout;
}
@Override
/**
* 应用undoState的表单数据
@ -447,7 +457,9 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
if (this.index == FORM_TAB) {
JForm.this.refreshRoot();
this.formDesign.getArea().setAreaSize(u.getAreaSize(), u.getHorizontalValue(), u.getVerticalValue(), u.getWidthValue(), u.getHeightValue(), u.getSlideValue());
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(), u.getSelectWidgets()));
//撤销的时候要重新选择的body布局
this.formDesign.getSelectionModel().setSelectedCreators(FormSelectionUtils.rebuildSelection(formDesign.getRootComponent(),
formDesign.getRootComponent() == selectedBodyLayout() ? u.getSelectWidgets() : new Widget[]{selectedBodyLayout().toData()}));
} else {
String widgetName = this.formDesign.getElementCaseContainerName();
//这儿太坑了,u.getForm() 与 getTarget内容不一样

Loading…
Cancel
Save