Browse Source

Merge pull request #494 in BA/design from ~KERRY/design:release to release

* commit 'be778943f137a69ddc2e7c218070f85196649b71':
  REPORT-578 国际化修改
  REPORT-578 自适应布局下需要考虑分辨率
master
superman 8 years ago
parent
commit
158894b07d
  1. 42
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java

42
designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java

@ -2,8 +2,6 @@ package com.fr.design.designer.properties;
import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor;
@ -12,8 +10,9 @@ import com.fr.design.designer.beans.ConstraintsGroupModel;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.utils.ComponentUtils;
import com.fr.form.ui.Widget;
import com.fr.form.ui.PaddingMargin;
import com.fr.form.ui.container.WFitLayout;
import com.fr.form.ui.container.WLayout;
import com.fr.general.Inter;
import javax.swing.*;
@ -30,8 +29,8 @@ import java.awt.*;
*/
//控件在自适应布局中宽度、高度属性,7.1.1不可编辑
public class FRFitLayoutConstraints implements ConstraintsGroupModel {
private static final int MINHEIGHT = XCreator.SMALL_PREFERRED_SIZE.height;
private static final int MINWIDTH = XCreator.SMALL_PREFERRED_SIZE.width;
private static final int MINHEIGHT = WLayout.MIN_HEIGHT;
private static final int MINWIDTH = WLayout.MIN_WIDTH;
private static final int ROWNUM = 2;
private DefaultTableCellRenderer renderer;
@ -48,7 +47,7 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
@Override
public String getGroupName() {
return Inter.getLocText("Widget-Size");
return Inter.getLocText("FR-Designer-Widget_Size");
}
@Override
@ -71,9 +70,9 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
if (column == 0) {
switch (row) {
case 0:
return Inter.getLocText("Tree-Width");
return Inter.getLocText("FR-Designer-Tree_Width");
default:
return Inter.getLocText("Tree-Height");
return Inter.getLocText("FR-Designer-Tree_Height");
}
} else {
switch (row) {
@ -91,31 +90,39 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
int v = value == null ? 0 : ((Number) value).intValue();
int difference = 0;
Rectangle bounds = getBounds();
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
WFitLayout wFitLayout = parent.toData();
int minHeight = (int)(MINHEIGHT * wFitLayout.getResolutionScaling());
int minWidth = (int)(MINWIDTH * wFitLayout.getResolutionScaling());
PaddingMargin margin= wFitLayout.getMargin();
switch (row) {
case 0:
if(v < MINWIDTH){
JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Width") + Integer.toString(MINWIDTH));
v = xCreator.getWidth();
}
if (bounds.width == v){
return false;
}
if(bounds.width == rec.width - margin.getLeft() - margin.getRight()){
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds"));
}else if(v < minWidth){
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Width") + Integer.toString(minWidth));
v = xCreator.getWidth();
}
difference = bounds.width - v;
bounds.width = v;
break;
case 1:
if(v < MINHEIGHT){
JOptionPane.showMessageDialog(null, Inter.getLocText("Min-Height") + Integer.toString(MINHEIGHT));
v = xCreator.getHeight();
}
if (bounds.height == v){
return false;
}
if(bounds.height == rec.height - margin.getTop() - margin.getBottom()){
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Beyond_Bounds"));
}else if(v < minHeight){
JOptionPane.showMessageDialog(null, Inter.getLocText("FR-Designer-Min_Height") + Integer.toString(minHeight));
v = xCreator.getHeight();
}
difference = bounds.height - v;
bounds.height = v;
break;
}
WFitLayout wFitLayout = parent.toData();
wFitLayout.setBounds(xCreator.toData(),bounds);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle backupBounds = getBounds();
@ -131,7 +138,6 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
public Rectangle getBounds(){
Rectangle bounds = new Rectangle(xCreator.getBounds());
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator);
if (parent == null) {
return bounds;
}

Loading…
Cancel
Save