Browse Source

REPORT-578 表单组件样式属性小改良

master
kerry 8 years ago
parent
commit
fbbaab5055
  1. 1825
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java
  2. 2
      designer_form/src/com/fr/design/designer/creator/XChartEditor.java
  3. 4
      designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java
  4. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java
  5. 2
      designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java
  6. 42
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutConstraints.java
  7. 2
      designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java

1825
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRFitLayoutAdapter.java

File diff suppressed because it is too large Load Diff

2
designer_form/src/com/fr/design/designer/creator/XChartEditor.java

@ -86,7 +86,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName(
WLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("Chart-Style_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {

4
designer_form/src/com/fr/design/designer/creator/XLayoutContainer.java

@ -66,7 +66,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName(
WLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@ -76,7 +76,7 @@ public abstract class XLayoutContainer extends XBorderStyleWidgetCreator impleme
}
}),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setRendererClass(PaddingMarginCellRenderer.class).setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
};
}

2
designer_form/src/com/fr/design/designer/creator/cardlayout/XWCardLayout.java

@ -283,7 +283,7 @@ public class XWCardLayout extends XLayoutContainer {
}
}),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
CardTagWLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName(
CardTagWLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("FR-Engine_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {

2
designer_form/src/com/fr/design/designer/creator/cardlayout/XWTabFitLayout.java

@ -64,7 +64,7 @@ public class XWTabFitLayout extends XWFitLayout {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("FR-Designer_Form-Widget_Name")),
new CRPropertyDescriptor("margin", this.data.getClass()).setEditorClass(PaddingMarginEditor.class)
.setRendererClass(PaddingMarginCellRenderer.class).setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.setI18NName(Inter.getLocText("FR-Designer_Layout-Padding"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
};
}

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

@ -1,10 +1,18 @@
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;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
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.container.WFitLayout;
import com.fr.general.Inter;
@ -23,6 +31,7 @@ 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 ROWNUM = 2;
private DefaultTableCellRenderer renderer;
@ -80,12 +89,18 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
public boolean setValue(Object value, int row, int column) {
if (column == 1) {
int v = value == null ? 0 : ((Number) value).intValue();
Rectangle bounds = new Rectangle(xCreator.getBounds());
int difference = 0;
Rectangle bounds = getBounds();
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;
}
difference = bounds.width - v;
bounds.width = v;
break;
case 1:
@ -96,25 +111,44 @@ public class FRFitLayoutConstraints implements ConstraintsGroupModel {
if (bounds.height == v){
return false;
}
difference = bounds.height - v;
bounds.height = v;
break;
}
WFitLayout wFitLayout = parent.toData();
wFitLayout.setBounds(xCreator.toData(),bounds);
xCreator.setBounds(bounds);
FormDesigner formDesigner = WidgetPropertyPane.getInstance().getEditingFormDesigner();
Rectangle backupBounds = getBounds();
FRFitLayoutAdapter layoutAdapter = (FRFitLayoutAdapter) AdapterBus.searchLayoutAdapter(formDesigner, xCreator);
if (layoutAdapter != null) {
layoutAdapter.calculateBounds(backupBounds, bounds, xCreator, row, difference);
}
return true;
} else {
return false;
}
}
public Rectangle getBounds(){
Rectangle bounds = new Rectangle(xCreator.getBounds());
XLayoutContainer parent = XCreatorUtils.getParentXLayoutContainer(xCreator);
if (parent == null) {
return bounds;
}
Rectangle rec = ComponentUtils.getRelativeBounds(parent);
bounds.x += rec.x;
bounds.y += rec.y;
return bounds;
}
/**
* 该行是否可编辑
* @param row
* @return 第row行可编辑返回true否则返回false
*/
public boolean isEditable(int row) {
return false;
return true;
}
}

2
designer_form/src/com/fr/design/gui/xpane/LayoutBorderPane.java

@ -280,7 +280,7 @@ public class LayoutBorderPane extends BasicPane {
Constants.LINE_THICK, //3px
};
public final static String[] BORDER_TYPE = new String[]{Inter.getLocText("FR-Designer-Widget-Style_Standard"), Inter.getLocText("FR-Designer-Widget-Style_Title")};
public final static String[] BORDER_TYPE = new String[]{Inter.getLocText("FR-Designer-Widget-Style_Standard"), Inter.getLocText("FR-Designer-Widget-Style_Custom")};
public final static String[] BORDER_STYLE= new String[]{Inter.getLocText("FR-Designer-Widget-Style_Common"), Inter.getLocText("FR-Designer-Widget-Style_Shadow")};
private final static Dimension BUTTON_SIZE = new Dimension(24, 20);

Loading…
Cancel
Save