neil 9 years ago
parent
commit
7b9331d99b
  1. 70
      designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java
  2. 12
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  3. 10
      designer_base/src/com/fr/design/dialog/BasicScrollPane.java
  4. 4
      designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java
  5. 10
      designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java
  6. 7
      designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java
  7. 25
      designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java
  8. 21
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java
  9. 48
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  10. 20
      designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java
  11. 7
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  12. 83
      designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java
  13. 111
      designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java
  14. 62
      designer_form/src/com/fr/design/designer/properties/FRFitLayoutPropertiesGroupModel.java
  15. 30
      designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java
  16. 72
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  17. 2
      designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java
  18. 59
      designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java
  19. 31
      designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java

70
designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java

@ -0,0 +1,70 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class MobileRadioCheckPane extends BasicBeanPane<Boolean> {
private List<UICheckBox> checkBoxes = new ArrayList<UICheckBox>();
public MobileRadioCheckPane(String title) {
initComponents(title);
}
private void initComponents(String title) {
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p,p};
UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open"));
checkBox.setSelected(true);
checkBoxes.add(checkBox);
Component[][] components = new Component[][]{
new Component[]{new UILabel(title), checkBox}
};
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(fitOpsPane);
}
public int getCurrentState() {
return checkBoxes.get(0).isSelected() ? 0 : 1;
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UICheckBox checkBox : checkBoxes) {
checkBox.setEnabled(enabled);
}
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
@Override
public void populateBean(Boolean ob) {
checkBoxes.get(0).setSelected(ob);
}
@Override
public Boolean updateBean() {
int state = getCurrentState();
return state == 0 ? true : false;
}
}

12
designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java

@ -18,6 +18,8 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioGroupPane horizionPane;
//竖屏设置面板
private MobileRadioGroupPane verticalPane;
//缩放设置面板
private MobileRadioCheckPane radioCheckPane;
public ReportMobileAttrPane() {
initComponents();
@ -30,9 +32,10 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal"));
verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical"));
radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom"));
fitOpsPane.add(horizionPane, BorderLayout.NORTH);
fitOpsPane.add(verticalPane, BorderLayout.SOUTH);
fitOpsPane.add(verticalPane, BorderLayout.CENTER);
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane);
this.add(borderPane);
}
@ -45,14 +48,15 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr> {
horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.isZoom());
}
@Override
public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState);
boolean isZoom = radioCheckPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
}
@Override

10
designer_base/src/com/fr/design/dialog/BasicScrollPane.java

@ -153,8 +153,9 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
scrollBar.setEnabled(false);
scrollBar.setVisible(false);
} else {
scrollBar.setEnabled(true);
scrollBar.setVisible(true);
boolean show = isShowScrollBar();
scrollBar.setEnabled(show);
scrollBar.setVisible(show);
}
maxheight = getHeight() - DET_HEIGHT;
if ((MAXVALUE - scrollBar.getVisibleAmount()) == 0) {
@ -179,8 +180,13 @@ public abstract class BasicScrollPane<T> extends BasicBeanPane<T>{
}
leftcontentPane.validate();
}
}
protected boolean isShowScrollBar() {
return true;
}
@Override
public T updateBean() {
return null;

4
designer_base/src/com/fr/design/editor/editor/ColumnSelectedEditor.java

@ -13,6 +13,7 @@ import com.fr.stable.StringUtils;
import java.awt.*;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.List;
import java.util.regex.Pattern;
/**
@ -35,6 +36,9 @@ public class ColumnSelectedEditor extends Editor<SimpleDSColumn> {
@Override
public void itemStateChanged(ItemEvent e) {
//这边需要重新初始化columnNames, 否则nameList长度和columnNames长度不同导致出錯。
List<String> nameList = tableDataComboBox.getSelectedItem().calculateColumnNameList();
columnNames = new String[nameList.size()];
columnNames = tableDataComboBox.getSelectedItem().calculateColumnNameList().toArray(columnNames);
columnNameComboBox.removeAllItems();
for (int i = 0; i < columnNames.length; i++) {

10
designer_base/src/com/fr/design/gui/ibutton/UIButtonGroup.java

@ -1,12 +1,6 @@
package com.fr.design.gui.ibutton;
import java.awt.BorderLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.Shape;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@ -174,7 +168,7 @@ public class UIButtonGroup<T> extends JPanel implements GlobalNameObserver {
return BorderFactory.createEmptyBorder(1, 1, 1, 1);
}
protected GridLayout getGridLayout(int number) {
protected LayoutManager getGridLayout(int number) {
return new GridLayout(0, number, 1, 0);
}

7
designer_base/src/com/fr/design/gui/ibutton/UITabGroup.java

@ -1,9 +1,6 @@
package com.fr.design.gui.ibutton;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.RenderingHints;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.Icon;
@ -38,7 +35,7 @@ public class UITabGroup extends UIButtonGroup<Integer> {
}
@Override
protected GridLayout getGridLayout(int number) {
protected LayoutManager getGridLayout(int number) {
if (number < BUTTON_NUMBER || isOneLineTab) {
return super.getGridLayout(number);
} else if (number == BUTTON_NUMBER || number == SEVEN_NUMBER) {

25
designer_base/src/com/fr/design/mainframe/widget/editors/FormattedEditor.java

@ -4,6 +4,7 @@ import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.text.Format;
import java.text.ParseException;
@ -32,17 +33,21 @@ public class FormattedEditor extends AbstractPropertyEditor {
textField = new JFormattedTextField(format);
panel.add(textField, BorderLayout.CENTER);
textField.setBorder(null);
textField.addKeyListener(new KeyAdapter() {
textField.addKeyListener(createKeyListener());
}
protected KeyListener createKeyListener() {
return new KeyAdapter() {
public void keyReleased(KeyEvent e) {
try {
textField.commitEdit();
} catch (ParseException e1) {
return;
}
firePropertyChanged();
}
});
public void keyReleased(KeyEvent e) {
try {
textField.commitEdit();
} catch (ParseException e1) {
return;
}
firePropertyChanged();
}
};
}
@Override

21
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java

@ -0,0 +1,21 @@
package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.BodyMobileLayoutPropertiesGroupModel;
public class FRBodyFitLayoutAdapter extends FRFitLayoutAdapter {
public FRBodyFitLayoutAdapter(XLayoutContainer container) {
super(container);
}
/**
* 返回布局自身属性方便一些特有设置在layout刷新时处理
*/
@Override
public GroupModel getLayoutProperties() {
XWFitLayout xfl = (XWFitLayout) container;
return new BodyMobileLayoutPropertiesGroupModel(xfl);
}
}

48
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -25,8 +25,6 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.List;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable;
@ -56,23 +54,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* @throws IntrospectionException 异常
*/
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = ((ElementCaseEditor) data).isHeightRestrict() ? revealHeightLimit() : getDefault();
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor();
if (processor == null) {
return crp;
}
PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass());
return (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, extraEditor);
}
protected List<CRPropertyDescriptor> createNonListenerProperties() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = {
CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{
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(
Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced").
setPropertyChangeListener(new PropertyChangeAdapter() {
Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() {
@Override
public void propertyChange() {
@ -85,34 +74,15 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("heightRestrict", this.data.getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
List<CRPropertyDescriptor> defaultList = new ArrayList<>();
};
for (CRPropertyDescriptor propertyDescriptor : propertyTableEditor) {
defaultList.add(propertyDescriptor);
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor();
if (processor == null){
return propertyTableEditor;
}
return defaultList;
}
protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException {
CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.data.getClass())
.setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightpercent"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
defaultList.add(heightLimitProperty);
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass());
return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
}

20
designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java

@ -0,0 +1,20 @@
package com.fr.design.designer.creator;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRBodyFitLayoutAdapter;
import com.fr.form.ui.container.WFitLayout;
import java.awt.Dimension;
public class XWBodyFitLayout extends XWFitLayout {
public XWBodyFitLayout() {
this(new WFitLayout(), new Dimension());
}
public XWBodyFitLayout(WFitLayout widget, Dimension initSize) {
super(widget, initSize);
}
@Override
public LayoutAdapter getLayoutAdapter() {
return new FRBodyFitLayoutAdapter(this);
}
}

7
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -13,7 +13,9 @@ import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRFitLayoutAdapter;
import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.creator.cardlayout.XWTabFitLayout;
import com.fr.design.designer.properties.mobile.BodyMobilePropertyUI;
import com.fr.design.form.layout.FRFitLayout;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.FormArea;
import com.fr.design.utils.gui.LayoutUtils;
import com.fr.form.ui.PaddingMargin;
@ -1156,4 +1158,9 @@ public class XWFitLayout extends XLayoutContainer {
return this;
}
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(new XWBodyFitLayout())};
}
}

83
designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java

@ -0,0 +1,83 @@
package com.fr.design.designer.properties;
import java.awt.event.MouseEvent;
import java.util.ArrayList;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.*;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.designer.beans.LayoutAdapter;
public class BodyAppRelayoutTable extends AbstractPropertyTable {
private XWBodyFitLayout xwBodyFitLayout;
public BodyAppRelayoutTable(XWBodyFitLayout xwBodyFitLayout) {
super();
setDesigner(xwBodyFitLayout);
}
public static ArrayList<PropertyGroup> getCreatorPropertyGroup(XCreator source) {
ArrayList<PropertyGroup> groups = new ArrayList<PropertyGroup>();
if (source instanceof XLayoutContainer) {
LayoutAdapter layoutAdapter = ((XLayoutContainer)source).getLayoutAdapter();
if(layoutAdapter != null){
GroupModel m = layoutAdapter.getLayoutProperties();
if (m != null) {
groups.add(new PropertyGroup(m));
}
}
}
return groups;
}
/**
* 初始化属性表组
* @param source 控件
*/
public void initPropertyGroups(Object source) {
groups = getCreatorPropertyGroup(xwBodyFitLayout);
TableModel model = new BeanTableModel();
setModel(model);
this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setPreferredWidth(30);
this.repaint();
}
private void setDesigner(XWBodyFitLayout xwBodyFitLayout) {
this.xwBodyFitLayout = xwBodyFitLayout;
}
/**
* 单元格tooltip
* 属性名悬浮提示
*
* @param 鼠标点击事件
* @return 单元格tooltip
*/
public String getToolTipText(MouseEvent event) {
int row = BodyAppRelayoutTable.super.rowAtPoint(event.getPoint());
int column = BodyAppRelayoutTable.super.columnAtPoint(event.getPoint());
if(row != -1 && column == 0){
return String.valueOf(this.getValueAt(row, column));
}
return null;
}
/**
* 待说明
*/
public void firePropertyEdit() {
}
}

111
designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java

@ -0,0 +1,111 @@
package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
import com.fr.form.ui.container.WFitLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
public class BodyMobileLayoutPropertiesGroupModel implements GroupModel {
private PropertyCellEditor reLayoutEditor;
private CheckBoxCellRenderer reLayoutrenderer;
private WFitLayout layout;
private XWFitLayout xfl;
public BodyMobileLayoutPropertiesGroupModel(XWFitLayout xfl) {
this.xfl = xfl;
this.layout = xfl.toData();
reLayoutrenderer = new CheckBoxCellRenderer();
reLayoutEditor = new PropertyCellEditor(new BooleanEditor());
}
@Override
public String getGroupName() {
return Inter.getLocText("FR-Designer-Layout_Adaptive_Layout");
}
@Override
public int getRowCount() {
return 1;
}
@Override
public TableCellRenderer getRenderer(int row) {
return reLayoutrenderer;
}
@Override
public TableCellEditor getEditor(int row) {
return reLayoutEditor;
}
@Override
public Object getValue(int row, int column) {
if (column == 0) {
return Inter.getLocText("FR-Designer-App_ReLayout");
}else {
return layout.getAppRelayout();
}
}
@Override
public boolean setValue(Object value, int row, int column) {
int state = 0;
boolean appRelayoutState = true;
if(value instanceof Integer) {
state = (Integer)value;
}else if (value instanceof Boolean) {
appRelayoutState = (boolean)value;
}
if (column == 0 || state < 0) {
return false;
} else {
layout.setAppRelayout(appRelayoutState);
return true;
}
}
/**
* 是否可编辑
* @param row
* @return
*/
@Override
public boolean isEditable(int row) {
return true;
}
private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer {
public CheckBoxCellRenderer() {
super();
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Boolean) {
setSelected(((Boolean) value).booleanValue());
setEnabled(table.isCellEditable(row, column));
if (isSelected) {
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
} else {
return null;
}
return this;
}
}
}

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

@ -5,19 +5,15 @@ package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.FitLayoutDirectionEditor;
import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
/**
* 自适应布局自身的属性表
@ -32,8 +28,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
private DefaultTableCellRenderer renderer;
private FitLayoutDirectionEditor stateEditor;
private FitStateRenderer stateRenderer;
private PropertyCellEditor reLayoutEditor;
private CheckBoxCellRenderer reLayoutrenderer;
private WFitLayout layout;
private XWFitLayout xfl;
@ -44,8 +38,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
editor = new PropertyCellEditor(new IntegerPropertyEditor());
stateEditor = new FitLayoutDirectionEditor();
stateRenderer = new FitStateRenderer();
reLayoutrenderer = new CheckBoxCellRenderer();
reLayoutEditor = new PropertyCellEditor(new BooleanEditor());
}
/**
@ -58,7 +50,7 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
@Override
public int getRowCount() {
return 3;
return 2;
}
@Override
@ -66,11 +58,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
switch (row) {
case 0:
return renderer;
case 1:
return stateRenderer;
default:
return reLayoutrenderer;
return stateRenderer;
}
}
@ -79,10 +68,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
switch (row) {
case 0:
return editor;
case 1:
return stateEditor;
default:
return reLayoutEditor;
return stateEditor;
}
}
@ -92,19 +79,15 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
switch (row) {
case 0:
return Inter.getLocText("FR-Designer_Component_Interval");
case 1 :
return Inter.getLocText("FR-Designer_Component_Scale");
default:
return Inter.getLocText("FR-Designer-App_ReLayout");
return Inter.getLocText("FR-Designer_Component_Scale");
}
} else {
switch (row) {
case 0:
return layout.getCompInterval();
case 1 :
return layout.getCompState();
default:
return layout.getAppRelayout();
return layout.getCompState();
}
}
}
@ -112,11 +95,8 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
@Override
public boolean setValue(Object value, int row, int column) {
int state = 0;
boolean appRelayoutState = true;
if(value instanceof Integer) {
state = (Integer)value;
} else if (value instanceof Boolean) {
appRelayoutState = (boolean) value;
}
if (column == 0 || state < 0) {
return false;
@ -128,9 +108,6 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
}else if (row == 1) {
layout.setCompState(state);
return true;
} else if (row == 2) {
layout.setAppRelayout(appRelayoutState);
return true;
}
return false;
}
@ -155,33 +132,4 @@ public class FRFitLayoutPropertiesGroupModel implements GroupModel {
public boolean isEditable(int row) {
return true;
}
private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer {
public CheckBoxCellRenderer() {
super();
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Boolean) {
setSelected(((Boolean) value).booleanValue());
setEnabled(table.isCellEditable(row, column));
if (isSelected) {
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
} else {
return null;
}
return this;
}
}
}

30
designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java

@ -0,0 +1,30 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWBodyFitLayout;
import com.fr.design.designer.properties.BodyAppRelayoutTable;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.general.Inter;
/**
* Created by Administrator on 2016/5/16/0016.
*/
public class BodyMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public BodyMobilePropertyUI(XWBodyFitLayout xWBodyFitLayout) {
this.xCreator = xWBodyFitLayout;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return new BodyAppRelayoutTable((XWBodyFitLayout) xCreator);
}
@Override
public String tableTitle() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

72
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

@ -1,24 +1,29 @@
package com.fr.design.designer.properties.mobile;
import com.fr.base.FRContext;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.gui.xtable.PropertyGroupModel;
import com.fr.design.gui.xtable.ReportAppPropertyGroupModel;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.WidgetPropertyPane;;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
import com.fr.design.mainframe.widget.editors.RefinedDoubleEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter;
import javax.swing.table.TableModel;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import java.util.List;
/**
* Created by Administrator on 2016/5/16/0016.
*/
public class ElementCasePropertyTable extends AbstractPropertyTable {
public class ElementCasePropertyTable extends AbstractPropertyTable{
private XCreator xCreator;
private FormDesigner designer;
@ -27,6 +32,52 @@ public class ElementCasePropertyTable extends AbstractPropertyTable {
this.xCreator = xCreator;
}
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
if (((ElementCaseEditor ) xCreator.toData()).getVerticalAttr().getState() == 2 && !((ElementCaseEditor ) xCreator.toData()).isHeightRestrict()) {
((ElementCaseEditor ) xCreator.toData()).setHeightRestrict(true);
return revealHeightLimit();
}
CRPropertyDescriptor[] crp = ((ElementCaseEditor) xCreator.toData()).isHeightRestrict() ? revealHeightLimit() : getDefault();
return crp;
}
protected List<CRPropertyDescriptor> createNonListenerProperties() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = {
new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App"))
};
List<CRPropertyDescriptor> defaultList = new ArrayList<>();
for (CRPropertyDescriptor propertyDescriptor: propertyTableEditor) {
defaultList.add(propertyDescriptor);
}
return defaultList;
}
protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException {
CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.xCreator.toData().getClass())
.setEditorClass(RefinedDoubleEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightpercent"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
defaultList.add(heightLimitProperty);
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
@Override
public void initPropertyGroups(Object source) {
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
@ -34,23 +85,13 @@ public class ElementCasePropertyTable extends AbstractPropertyTable {
groups = new ArrayList<PropertyGroup>();
CRPropertyDescriptor[] propertyTableEditor = null;
try {
propertyTableEditor = new CRPropertyDescriptor[]{
new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App"))
};
propertyTableEditor = supportedDescriptor();
} catch (IntrospectionException e) {
FRContext.getLogger().error(e.getMessage());
}
groups.add(new PropertyGroup(new PropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer)));
groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer_Fit-App"), xCreator, propertyTableEditor, designer)));
TableModel model = new BeanTableModel();
setModel(model);
@ -59,6 +100,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable {
@Override
public void firePropertyEdit() {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
public void populate(FormDesigner designer) {

2
designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java

@ -45,6 +45,6 @@ public class MobileFitEditor extends ComboEditor {
*/
@Override
public boolean refreshInTime() {
return false;
return true;
}
}

59
designer_form/src/com/fr/design/gui/xtable/ReportAppPropertyGroupModel.java

@ -0,0 +1,59 @@
package com.fr.design.gui.xtable;
import com.fr.base.FRContext;
import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.mainframe.FormDesigner;
import com.fr.general.Inter;
import java.lang.reflect.Method;
import com.fr.general.ComparatorUtils;
import com.fr.report.stable.FormConstants;
import javax.swing.*;
public class ReportAppPropertyGroupModel extends PropertyGroupModel {
private static final double MAX_HEIGHT = 0.8;
public ReportAppPropertyGroupModel(String name, XCreator creator, CRPropertyDescriptor[] propArray,
FormDesigner designer) {
super(name, creator, propArray, designer);
}
@Override
public boolean setValue(Object value, int row, int column) {
double state = 0;
if (column == 0) {
return false;
}
if (value instanceof Double) {
state = (Double) value;
}
try {
Method m = properties[row].getWriteMethod();
if (state > MAX_HEIGHT) {
//弹窗提示
JOptionPane.showMessageDialog(null,
Inter.getLocText("FR-Designer_Mobile-Warning"),
Inter.getLocText("FR-Designer_Tooltips"),
JOptionPane.PLAIN_MESSAGE);
return false;
}
m.invoke(dealCreatorData(), value);
//属性名称为控件名时,单独处理下
if(ComparatorUtils.equals(FormConstants.NAME, properties[row].getName())){
creator.resetCreatorName(value.toString());
}
properties[row].firePropertyChanged();
return true;
} catch (Exception e) {
FRContext.getLogger().error(e.getMessage(), e);
return false;
}
}
private Object dealCreatorData() {
return creator.getPropertyDescriptorCreator().toData();
}
}

31
designer_form/src/com/fr/design/mainframe/widget/editors/RefinedDoubleEditor.java

@ -0,0 +1,31 @@
package com.fr.design.mainframe.widget.editors;
import javax.swing.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.text.ParseException;
public class RefinedDoubleEditor extends DoubleEditor {
private JFormattedTextField textField;
public RefinedDoubleEditor() {
super();
textField = (JFormattedTextField) super.getCustomEditor();
}
@Override
public KeyListener createKeyListener() {
return new KeyAdapter() {
public void keyReleased(KeyEvent e) {
try {
textField.commitEdit();
return;
} catch (ParseException e1) {
}
}
};
}
}
Loading…
Cancel
Save