Browse Source

REPORT-8355 9.0之前开发的功能与bug patch到10.0(部分)

master
plough 7 years ago
parent
commit
fe3a74f680
  1. 6
      designer-base/src/com/fr/design/fun/impl/AbstractCellWidgetOptionProvider.java
  2. 22
      designer-base/src/com/fr/design/gui/ilable/UILabel.java
  3. 145
      designer-form/src/com/fr/design/designer/creator/XChartEditor.java
  4. 47
      designer-form/src/com/fr/design/designer/creator/XWParameterLayout.java
  5. 36
      designer-form/src/com/fr/design/designer/properties/mobile/ChartEditorPropertyUI.java
  6. 36
      designer-form/src/com/fr/design/designer/properties/mobile/ParaMobilePropertyUI.java
  7. 4
      designer-form/src/com/fr/design/mainframe/CoverReportPane.java
  8. 93
      designer-form/src/com/fr/design/mainframe/EditingMouseListener.java
  9. 124
      designer-form/src/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java
  10. 196
      designer-form/src/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java
  11. 110
      designer-form/src/com/fr/design/widget/ui/designer/mobile/MultiFileUploaderDefinePane.java
  12. 81
      designer-form/src/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java
  13. 26
      designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  14. 12
      designer-realize/src/com/fr/design/mainframe/CellWidgetPropertyPane.java
  15. 87
      designer-realize/src/com/fr/design/webattr/EditToolBar.java
  16. 70
      designer-realize/src/com/fr/design/webattr/ToolBarPane.java

6
designer-base/src/com/fr/design/fun/impl/AbstractCellWidgetOptionProvider.java

@ -1,6 +1,7 @@
package com.fr.design.fun.impl; package com.fr.design.fun.impl;
import com.fr.design.fun.CellWidgetOptionProvider; import com.fr.design.fun.CellWidgetOptionProvider;
import com.fr.design.widget.mobile.WidgetMobilePane;
import com.fr.stable.fun.impl.AbstractProvider; import com.fr.stable.fun.impl.AbstractProvider;
import com.fr.stable.fun.mark.API; import com.fr.stable.fun.mark.API;
@ -20,4 +21,9 @@ public abstract class AbstractCellWidgetOptionProvider extends AbstractProvider
public String mark4Provider() { public String mark4Provider() {
return getClass().getName(); return getClass().getName();
} }
@Override
public Class<? extends WidgetMobilePane> classForMobilePane() {
return WidgetMobilePane.class;
}
} }

22
designer-base/src/com/fr/design/gui/ilable/UILabel.java

@ -1,9 +1,16 @@
package com.fr.design.gui.ilable; package com.fr.design.gui.ilable;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.stable.StringUtils;
import javax.swing.*; import com.fr.stable.StringUtils;
import java.awt.*; import javax.swing.Icon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
/** /**
* Created by IntelliJ IDEA. * Created by IntelliJ IDEA.
@ -13,6 +20,7 @@ import java.awt.*;
* Time: 下午3:15 * Time: 下午3:15
*/ */
public class UILabel extends JLabel { public class UILabel extends JLabel {
private static final int HTML_SHIFT_HEIGHT = 3;
public UILabel(String text, Icon image, int horizontalAlignment) { public UILabel(String text, Icon image, int horizontalAlignment) {
super(text, image, horizontalAlignment); super(text, image, horizontalAlignment);
@ -46,6 +54,16 @@ public class UILabel extends JLabel {
super(); super();
} }
@Override
public Dimension getPreferredSize() {
Dimension preferredSize = super.getPreferredSize();
// (Windows 下)使用 html 时,文字内容会略微向下偏移,导致文字底部被截断,所以适当增加 UILabel 的高度
if (StringUtils.isNotEmpty(getText()) && getText().startsWith("<html>")) {
return new Dimension(preferredSize.width, preferredSize.height + HTML_SHIFT_HEIGHT);
}
return preferredSize;
}
public static void main(String[] args) { public static void main(String[] args) {
// UILabel label = new UILabel("shishi",SwingConstants.LEFT); // UILabel label = new UILabel("shishi",SwingConstants.LEFT);

145
designer-form/src/com/fr/design/designer/creator/XChartEditor.java

@ -11,11 +11,13 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.properties.mobile.ChartEditorPropertyUI;
import com.fr.design.designer.properties.mobile.ElementCasePropertyUI;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.gui.chart.BaseChartPropertyPane; import com.fr.design.gui.chart.BaseChartPropertyPane;
import com.fr.design.gui.chart.MiddleChartComponent; import com.fr.design.gui.chart.MiddleChartComponent;
import com.fr.design.mainframe.*; import com.fr.design.mainframe.*;
import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor;
import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer;
import com.fr.design.module.DesignModuleFactory; import com.fr.design.module.DesignModuleFactory;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
import com.fr.form.ui.BaseChartEditor; import com.fr.form.ui.BaseChartEditor;
@ -23,6 +25,7 @@ import com.fr.form.ui.Widget;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import com.fr.stable.GraphDrawHelper;
import com.fr.stable.core.PropertyChangeAdapter; import com.fr.stable.core.PropertyChangeAdapter;
/** /**
@ -35,18 +38,17 @@ import com.fr.stable.core.PropertyChangeAdapter;
public class XChartEditor extends XBorderStyleWidgetCreator { public class XChartEditor extends XBorderStyleWidgetCreator {
private static final long serialVersionUID = -7009439442104836657L; private static final long serialVersionUID = -7009439442104836657L;
private static final int BORDER_WIDTH = 2; private static final int BORDER_WIDTH = 2;
//具体来说是DesignerEditor<SimpleChartComponent> //具体来说是DesignerEditor<SimpleChartComponent>
private DesignerEditor<JComponent> designerEditor; private DesignerEditor<JComponent> designerEditor;
// private DesignerEditor<SimpleChartComponent> designerEditor; // private DesignerEditor<SimpleChartComponent> designerEditor;
//marro:无奈的属性,暂时想不出好办法 //marro:无奈的属性,暂时想不出好办法
private boolean isRefreshing = false; private boolean isRefreshing = false;
private boolean isHovering = false;
private boolean isEditing = false; private boolean isEditing = false;
private boolean isHovering = false;
private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30); private static final Color OUTER_BORDER_COLOR = new Color(65, 155, 249, 30);
private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249); private static final Color INNER_BORDER_COLOR = new Color(65, 155, 249);
private JPanel coverPanel;
public XChartEditor(BaseChartEditor editor) { public XChartEditor(BaseChartEditor editor) {
this(editor, new Dimension(250, 150)); this(editor, new Dimension(250, 150));
@ -67,19 +69,19 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
return "Chart.png"; return "Chart.png";
} }
/** /**
* 返回组件默认名 * 返回组件默认名
* @return 组件类名(小写) * @return 组件类名(小写)
*/ */
public String createDefaultName() { public String createDefaultName() {
return "chart"; return "chart";
} }
/** /**
* 是否支持设置标题 * 是否支持设置标题
* @return 是返回true * @return 是返回true
*/ */
public boolean hasTitleStyle() { public boolean hasTitleStyle() {
return true; return true;
} }
@ -88,15 +90,15 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
isEditing = false; isEditing = false;
} }
/** /**
* 得到属性名 * 得到属性名
* @return 属性名 * @return 属性名
* @throws java.beans.IntrospectionException * @throws java.beans.IntrospectionException
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
return new CRPropertyDescriptor[] { return new CRPropertyDescriptor[] {
new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName(Inter
.getLocText("Form-Widget_Name")), .getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("visible", this.data.getClass()).setI18NName( new CRPropertyDescriptor("visible", this.data.getClass()).setI18NName(
Inter.getLocText("FR-Designer_Widget-Visible")).setPropertyChangeListener(new PropertyChangeAdapter() { Inter.getLocText("FR-Designer_Widget-Visible")).setPropertyChangeListener(new PropertyChangeAdapter() {
@ -104,26 +106,42 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
public void propertyChange() { public void propertyChange() {
makeVisible(toData().isVisible());} makeVisible(toData().isVisible());}
}), }),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setI18NName( WLayoutBorderStyleEditor.class).setI18NName(
Inter.getLocText("Chart-Style_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced") Inter.getLocText("Chart-Style_Name")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
.setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
initStyle(); initStyle();
} }
}), }),
}; };
} }
/** /**
* 该组件是否可以拖入参数面板 * 该组件是否可以拖入参数面板
* @return 是则返回true * @return 是则返回true
*/ */
public boolean canEnterIntoParaPane(){ public boolean canEnterIntoParaPane(){
return false; return false;
} }
/**
* 编辑状态的时候需要重新绘制下边框
*
*/
@Override
public void paintBorder(Graphics g, Rectangle bounds){
if(isEditing){
g.setColor(OUTER_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 1, bounds.height + BORDER_WIDTH + 1), Constants.LINE_LARGE);
}else if(!isHovering){
super.paintBorder(g, bounds);
}
}
/** /**
* 返回设计器的Editor * 返回设计器的Editor
@ -187,22 +205,6 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
return bcc; return bcc;
} }
/**
* 编辑状态的时候需要重新绘制下边框
*
*/
@Override
public void paintBorder(Graphics g, Rectangle bounds){
if(isEditing){
g.setColor(OUTER_BORDER_COLOR);
GraphHelper.draw(g, new Rectangle(bounds.x - BORDER_WIDTH, bounds.y - BORDER_WIDTH, bounds.width + BORDER_WIDTH + 1, bounds.height + BORDER_WIDTH + 1), Constants.LINE_LARGE);
}else if(!isHovering){
super.paintBorder(g, bounds);
}
}
/** /**
* 渲染Painter * 渲染Painter
*/ */
@ -244,6 +246,10 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter); editingMouseListener.startEditing(this, isEditing ? adapter.getDesignerEditor() : null, adapter);
} }
} }
HelpDialogManager.getInstance().setPane(coverPanel);
if (this.isHelpBtnOnFocus()) {
coverPanel.setMsgDisplay(e);
}
} }
@Override @Override
@ -272,7 +278,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
editor.setLayout(null); editor.setLayout(null);
editor.setOpaque(false); editor.setOpaque(false);
coverPanel = new CoverPane(); coverPanel = new CoverReportPane();
coverPanel.setPreferredSize(this.getPreferredSize()); coverPanel.setPreferredSize(this.getPreferredSize());
coverPanel.setBounds(this.getBounds()); coverPanel.setBounds(this.getBounds());
@ -287,6 +293,7 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
* @param display 是否 * @param display 是否
*/ */
public void displayCoverPane(boolean display){ public void displayCoverPane(boolean display){
isHovering = display;
coverPanel.setVisible(display); coverPanel.setVisible(display);
coverPanel.setPreferredSize(editor.getPreferredSize()); coverPanel.setPreferredSize(editor.getPreferredSize());
coverPanel.setBounds(editor.getBounds()); coverPanel.setBounds(editor.getBounds());
@ -313,4 +320,16 @@ public class XChartEditor extends XBorderStyleWidgetCreator {
initStyle(); initStyle();
} }
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new ChartEditorPropertyUI(this)};
}
/**
* 是否支持共享-现只支持报表块图表tab块绝对布局
* @return
*/
public boolean isSupportShared() {
return true;
}
} }

47
designer-form/src/com/fr/design/designer/creator/XWParameterLayout.java

@ -6,7 +6,9 @@ package com.fr.design.designer.creator;
import com.fr.design.ExtraDesignClassManager; import com.fr.design.ExtraDesignClassManager;
import com.fr.design.designer.beans.LayoutAdapter; import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter; import com.fr.design.designer.beans.adapters.layout.FRParameterLayoutAdapter;
import com.fr.design.designer.properties.mobile.ParaMobilePropertyUI;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.fun.WidgetPropertyUIProvider;
import com.fr.design.mainframe.widget.editors.BackgroundEditor; import com.fr.design.mainframe.widget.editors.BackgroundEditor;
import com.fr.design.mainframe.widget.editors.BooleanEditor; import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.WidgetDisplayPosition; import com.fr.design.mainframe.widget.editors.WidgetDisplayPosition;
@ -28,18 +30,18 @@ import java.beans.PropertyDescriptor;
* 表单参数界面container * 表单参数界面container
*/ */
public class XWParameterLayout extends XWAbsoluteLayout { public class XWParameterLayout extends XWAbsoluteLayout {
public XWParameterLayout() {
this(new WParameterLayout(), new Dimension());
}
public XWParameterLayout(WParameterLayout widget) {
this(widget,new Dimension());
}
public XWParameterLayout(WParameterLayout widget, Dimension initSize) { public XWParameterLayout() {
super(widget, initSize); this(new WParameterLayout(), new Dimension());
} }
public XWParameterLayout(WParameterLayout widget) {
this(widget,new Dimension());
}
public XWParameterLayout(WParameterLayout widget, Dimension initSize) {
super(widget, initSize);
}
/** /**
* 初始化尺寸 * 初始化尺寸
@ -74,11 +76,11 @@ public class XWParameterLayout extends XWAbsoluteLayout {
return ArrayUtils.addAll(propertyTableEditor, getExtraTableEditor()); return ArrayUtils.addAll(propertyTableEditor, getExtraTableEditor());
} }
@Override @Override
public LayoutAdapter getLayoutAdapter() { public LayoutAdapter getLayoutAdapter() {
return new FRParameterLayoutAdapter(this); return new FRParameterLayoutAdapter(this);
} }
/** /**
* 获取插件给该控件提供的额外属性表 * 获取插件给该控件提供的额外属性表
@ -214,6 +216,11 @@ public class XWParameterLayout extends XWAbsoluteLayout {
public void updateBoundsWidget() { public void updateBoundsWidget() {
} }
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new ParaMobilePropertyUI(this)};
}
@Override @Override
protected String getIconName() { protected String getIconName() {
return "layout_absolute.png"; return "layout_absolute.png";
@ -237,4 +244,12 @@ public class XWParameterLayout extends XWAbsoluteLayout {
return false; return false;
} }
/**
* 是否支持共享-现只支持报表块图表tab块绝对布局
* @return
*/
public boolean isSupportShared() {
return false;
}
} }

36
designer-form/src/com/fr/design/designer/properties/mobile/ChartEditorPropertyUI.java

@ -0,0 +1,36 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XChartEditor;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.ChartEditorDefinePane;
import com.fr.general.Inter;
/**
* Created by plough on 2018/1/18.
*/
public class ChartEditorPropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public ChartEditorPropertyUI(XChartEditor xChartEditor) {
this.xCreator = xChartEditor;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new ChartEditorDefinePane(xCreator);
}
@Override
public String tableTitle() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

36
designer-form/src/com/fr/design/designer/properties/mobile/ParaMobilePropertyUI.java

@ -0,0 +1,36 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWParameterLayout;
import com.fr.design.dialog.BasicPane;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.widget.ui.designer.mobile.ParaMobileDefinePane;
import com.fr.general.Inter;
/**
* Created by Administrator on 2016/5/16/0016.
*/
public class ParaMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public ParaMobilePropertyUI(XWParameterLayout xwParameterLayout) {
this.xCreator = xwParameterLayout;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return null;
}
@Override
public BasicPane createWidgetAttrPane() {
return new ParaMobileDefinePane(xCreator);
}
@Override
public String tableTitle() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

4
designer-form/src/com/fr/design/mainframe/CoverReportPane.java

@ -35,7 +35,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
private String helpMsg;//帮助信息(后续帮助信息可能会变成标配,就直接放这边了) private String helpMsg;//帮助信息(后续帮助信息可能会变成标配,就直接放这边了)
private ElementCaseHelpDialog helpDialog = null; private WidgetHelpDialog helpDialog = null;
public CoverReportPane() { public CoverReportPane() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
@ -62,7 +62,7 @@ public class CoverReportPane extends CoverPane implements HelpDialogHandler{
if (helpDialog == null) { if (helpDialog == null) {
// controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH); // controlMode = IOUtils.readIcon(IconPathConstants.TD_EL_SHARE_CLOSE_ICON_PATH);
controlButton.setVisible(false); controlButton.setVisible(false);
helpDialog = new ElementCaseHelpDialog(DesignerContext.getDesignerFrame(), helpMsg); helpDialog = new WidgetHelpDialog(DesignerContext.getDesignerFrame(), helpMsg);
double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue(); double screenValue = FRScreen.getByDimension(Toolkit.getDefaultToolkit().getScreenSize()).getValue();
int offsetX = 0; int offsetX = 0;
if (screenValue < FormArea.DEFAULT_SLIDER) { if (screenValue < FormArea.DEFAULT_SLIDER) {

93
designer-form/src/com/fr/design/mainframe/EditingMouseListener.java

@ -1,6 +1,8 @@
package com.fr.design.mainframe; package com.fr.design.mainframe;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.base.vcs.DesignerMode;
import com.fr.common.inputevent.InputEventBaseOnOS;
import com.fr.design.designer.beans.AdapterBus; import com.fr.design.designer.beans.AdapterBus;
import com.fr.design.designer.beans.ComponentAdapter; import com.fr.design.designer.beans.ComponentAdapter;
import com.fr.design.designer.beans.events.DesignerEditor; import com.fr.design.designer.beans.events.DesignerEditor;
@ -9,13 +11,7 @@ import com.fr.design.designer.beans.location.Direction;
import com.fr.design.designer.beans.location.Location; import com.fr.design.designer.beans.location.Location;
import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.designer.beans.models.SelectionModel;
import com.fr.design.designer.beans.models.StateModel; import com.fr.design.designer.beans.models.StateModel;
import com.fr.design.designer.creator.XChartEditor; import com.fr.design.designer.creator.*;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XCreatorUtils;
import com.fr.design.designer.creator.XEditorHolder;
import com.fr.design.designer.creator.XElementCase;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.creator.cardlayout.XCardSwitchButton; import com.fr.design.designer.creator.cardlayout.XCardSwitchButton;
import com.fr.design.designer.creator.cardlayout.XWCardLayout; import com.fr.design.designer.creator.cardlayout.XWCardLayout;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -27,18 +23,13 @@ import com.fr.design.utils.ComponentUtils;
import com.fr.design.utils.gui.GUICoreUtils; import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.design.utils.gui.LayoutUtils; import com.fr.design.utils.gui.LayoutUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.share.ShareConstants;
import com.fr.stable.Constants; import com.fr.stable.Constants;
import javax.swing.BorderFactory; import com.fr.stable.StringUtils;
import javax.swing.JComponent; import javax.swing.*;
import javax.swing.JPopupMenu;
import javax.swing.JWindow;
import javax.swing.SwingUtilities;
import javax.swing.event.MouseInputAdapter; import javax.swing.event.MouseInputAdapter;
import java.awt.Color; import java.awt.*;
import java.awt.Container;
import java.awt.Cursor;
import java.awt.Rectangle;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
/** /**
@ -158,7 +149,7 @@ public class EditingMouseListener extends MouseInputAdapter {
if (e.getButton() == MouseEvent.BUTTON1) { if (e.getButton() == MouseEvent.BUTTON1) {
Direction dir = selectionModel.getDirectionAt(e); Direction dir = selectionModel.getDirectionAt(e);
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
stateModel.setDirection(dir); stateModel.setDirection(dir);
} }
@ -272,7 +263,7 @@ public class EditingMouseListener extends MouseInputAdapter {
public void mouseMoved(MouseEvent e) { public void mouseMoved(MouseEvent e) {
XCreator component = designer.getComponentAt(e); XCreator component = designer.getComponentAt(e);
setCoverPaneNotDisplay(e, false); setCoverPaneNotDisplay(component, e, false);
if (processTopLayoutMouseMove(component, e)) { if (processTopLayoutMouseMove(component, e)) {
return; return;
@ -297,7 +288,7 @@ public class EditingMouseListener extends MouseInputAdapter {
if (designer.isDrawLineMode() && stateModel.getDirection() == Location.outer) { if (designer.isDrawLineMode() && stateModel.getDirection() == Location.outer) {
designer.updateDrawLineMode(e); designer.updateDrawLineMode(e);
} }
if (!BaseUtils.isAuthorityEditing()) { if (!DesignerMode.isAuthorityEditing()) {
stateModel.setDirection(dir); stateModel.setDirection(dir);
} }
@ -325,23 +316,42 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
} }
xElementCase.setHelpBtnOnFocus(false); setHelpBtnFocus(e, xElementCase);
if (xElementCase.getCoverPane().getComponentCount() > 1) { }
JComponent button1 = (JComponent) xElementCase.getCoverPane().getComponent(1);
int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue(); private void setHelpBtnFocus(MouseEvent e, XCreator component) {
int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue(); component.setHelpBtnOnFocus(false);
if (e.getX() + GAP - xElementCase.getInsets().left > minX1 && e.getX() - GAP - xElementCase.getInsets().left < minX1 + button1.getWidth()) { if (component.getCoverPane() != null) {
if (e.getY() + GAP - xElementCase.getInsets().top > minY1 && e.getY() - GAP - xElementCase.getInsets().top < minY1 + button1.getHeight()) { if (component.getCoverPane().getComponentCount() > 1) {
JComponent button1 = (JComponent) component.getCoverPane().getComponent(1);
int minX1 = button1.getX() + getParentPositionX(component, 0) - designer.getArea().getHorizontalValue();
int minY1 = button1.getY() + getParentPositionY(component, 0) - designer.getArea().getVerticalValue();
if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + button1.getWidth()) {
if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + button1.getHeight()) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
component.setHelpBtnOnFocus(true);
}
}
}
component.displayCoverPane(true);
component.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT);
} else {
//没有帮助信息时,不显示帮助图标
if (StringUtils.isEmpty(component.toData().getDescription())) {
return;
}
int minX1 = getParentPositionX(component, component.getX()) + component.getWidth() - ShareConstants.SHARE_EL_CONTROL_BUTTON_HW - designer.getArea().getHorizontalValue();
int minY1 = getParentPositionY(component, component.getY()) - designer.getArea().getVerticalValue();
if (e.getX() + GAP - component.getInsets().left > minX1 && e.getX() - GAP - component.getInsets().left < minX1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) {
if (e.getY() + GAP - component.getInsets().top > minY1 && e.getY() - GAP - component.getInsets().top < minY1 + ShareConstants.SHARE_EL_CONTROL_BUTTON_HW) {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
xElementCase.setHelpBtnOnFocus(true); component.setHelpBtnOnFocus(true);
} }
} }
} }
xElementCase.displayCoverPane(true);
xElementCase.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT);
} }
private void setCoverPaneNotDisplay(MouseEvent e, boolean isLinkedHelpDialog) { private void setCoverPaneNotDisplay(XCreator component, MouseEvent e, boolean isLinkedHelpDialog) {
if (xElementCase != null) { if (xElementCase != null) {
int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue(); int x = getParentPositionX(xElementCase, 0) - designer.getArea().getHorizontalValue();
int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue(); int y = getParentPositionY(xElementCase, 0) - designer.getArea().getVerticalValue();
@ -349,15 +359,16 @@ public class EditingMouseListener extends MouseInputAdapter {
if (rect.contains(e.getPoint())) { if (rect.contains(e.getPoint())) {
return; return;
} }
if (isLinkedHelpDialog) {
xElementCase.destroyHelpDialog();
}
xElementCase.displayCoverPane(false); xElementCase.displayCoverPane(false);
} }
if (xChartEditor != null) { if (xChartEditor != null) {
xChartEditor.displayCoverPane(false); xChartEditor.displayCoverPane(false);
} }
if (isLinkedHelpDialog) {
component.destroyHelpDialog();
}
component.displayCoverPane(false);
if (xTopLayoutContainer != null) { if (xTopLayoutContainer != null) {
xTopLayoutContainer.setMouseEnter(false); xTopLayoutContainer.setMouseEnter(false);
} }
@ -383,6 +394,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
} }
setHelpBtnFocus(e, xTopLayoutContainer);
return true; return true;
} }
} }
@ -403,8 +415,7 @@ public class EditingMouseListener extends MouseInputAdapter {
designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); designer.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
} }
} }
xChartEditor.displayCoverPane(true); setHelpBtnFocus(e, xChartEditor);
xChartEditor.setDirections(Direction.TOP_BOTTOM_LEFT_RIGHT);
designer.repaint(); designer.repaint();
} }
} }
@ -425,9 +436,12 @@ public class EditingMouseListener extends MouseInputAdapter {
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
public void mouseDragged(MouseEvent e) { public void mouseDragged(MouseEvent e) {
if (BaseUtils.isAuthorityEditing()) { if (DesignerMode.isAuthorityEditing()) {
return; return;
} }
if ((e.isShiftDown() || InputEventBaseOnOS.isControlDown(e)) && !stateModel.isSelecting()) {
stateModel.startSelecting(e);
}
// 如果当前是左键拖拽状态,拖拽组件 // 如果当前是左键拖拽状态,拖拽组件
if (stateModel.dragable()) { if (stateModel.dragable()) {
if (SwingUtilities.isRightMouseButton(e)) { if (SwingUtilities.isRightMouseButton(e)) {
@ -571,12 +585,9 @@ public class EditingMouseListener extends MouseInputAdapter {
* @param e 鼠标事件 * @param e 鼠标事件
*/ */
public void mouseExited(MouseEvent e) { public void mouseExited(MouseEvent e) {
if (designer.getCursor().getType() != Cursor.DEFAULT_CURSOR) { if (designer.getCursor().getType() != Cursor.DEFAULT_CURSOR && !(e.isShiftDown() || InputEventBaseOnOS.isControlDown(e))) {
designer.setCursor(Cursor.getDefaultCursor()); designer.setCursor(Cursor.getDefaultCursor());
} }
setCoverPaneNotDisplay(e, true);
cancelPromptWidgetForbidEnter(); cancelPromptWidgetForbidEnter();
} }

124
designer-form/src/com/fr/design/widget/ui/designer/mobile/BodyMobileDefinePane.java

@ -0,0 +1,124 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.container.WSortLayout;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
import java.lang.reflect.Method;
/**
* Created by plough on 2018/2/1.
*/
public class BodyMobileDefinePane extends MobileWidgetDefinePane {
private XCreator bodyCreator;
private FormDesigner designer;
private AttributeChangeListener changeListener;
private UICheckBox appRelayoutCheck;
private MobileWidgetListPane mobileWidgetListPane;
public BodyMobileDefinePane(XCreator xCreator) {
this.bodyCreator = xCreator;
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
this.add(getMobilePropertyPane(), BorderLayout.NORTH);
this.add(getMobileWidgetListPane(), BorderLayout.CENTER);
this.repaint();
}
// 手机属性
private UIExpandablePane getMobilePropertyPane() {
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane();
appRelayoutCheck = new UICheckBox(Inter.getLocText("FR-Designer-App_ReLayout"), true);
appRelayoutCheck.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0));
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
panel.add(appRelayoutCheck);
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(panel, BorderLayout.NORTH);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Properties_Mobile"), 280, 20, panelWrapper);
}
// 控件顺序
private UIExpandablePane getMobileWidgetListPane() {
mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) bodyCreator.toData());
mobileWidgetListPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(mobileWidgetListPane, BorderLayout.CENTER);
return new UIExpandablePane(Inter.getLocText("FR-Designer_WidgetOrder"), 280, 20, panelWrapper);
}
private void bindListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
}
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
// body是否开启手机重布局
private boolean isAppRelayout() {
boolean result = false;
try {
Method m = bodyCreator.toData().getClass().getMethod("isAppRelayout");
result = (boolean)m.invoke(bodyCreator.toData());
} catch (Exception e) {
// do nothing
}
return result;
}
private void setAppRelayout(boolean appRelayoutSeleted) {
if (appRelayoutSeleted == isAppRelayout()) {
return;
}
try {
Method m = bodyCreator.toData().getClass().getMethod("setAppRelayout", boolean.class);
m.invoke(bodyCreator.toData(), appRelayoutSeleted);
} catch (Exception e) {
// do nothing
}
}
@Override
public void populate(FormDesigner designer) {
this.designer = designer;
appRelayoutCheck.setSelected(isAppRelayout());
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
}
@Override
public void update() {
setAppRelayout(appRelayoutCheck.isSelected());
mobileWidgetListPane.updateToDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
}

196
designer-form/src/com/fr/design/widget/ui/designer/mobile/ChartEditorDefinePane.java

@ -0,0 +1,196 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.base.mobile.ChartMobileAttrProvider;
import com.fr.base.mobile.ChartMobileFitAttrState;
import com.fr.base.mobile.ChartMobileFitAttrStateProvider;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWAbsoluteBodyLayout;
import com.fr.design.designer.creator.XWAbsoluteLayout;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.FormFunctionProcessor;
import com.fr.form.ui.BaseChartEditor;
import com.fr.form.ui.container.WFitLayout;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.stable.fun.FunctionProcessor;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
/**
* Created by plough on 2018/1/18.
*/
public class ChartEditorDefinePane extends MobileWidgetDefinePane {
private static final Item[] ITEMS = {
new Item(ChartMobileFitAttrState.AUTO.description(), ChartMobileFitAttrState.AUTO),
new Item(ChartMobileFitAttrState.AREA.description(), ChartMobileFitAttrState.AREA),
new Item(ChartMobileFitAttrState.PROPORTION.description(), ChartMobileFitAttrState.PROPORTION)
};
private XCreator xCreator; // 当前选中控件的xCreator
private FormDesigner designer; // 当前设计器
private UIComboBox zoomOutComboBox;// 缩小逻辑下拉框
private AttributeChangeListener changeListener;
private UILabel tipLabel;
public ChartEditorDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
JPanel mobileSettingsPane;
if (isInAbsoluteLayout()) {
mobileSettingsPane = getUnavailableTipPane(Inter.getLocText("FR-Designer_Tip_Chart_Adaptivity_Unavailable_In_Absolute_Layout"));
} else if (!isAppRelayout()) {
mobileSettingsPane = getUnavailableTipPane(Inter.getLocText("FR-Designer_Tip_Chart_Adaptivity_Unavailable"));
} else {
mobileSettingsPane = getMobileSettingsPane();
}
this.add(mobileSettingsPane, BorderLayout.NORTH);
this.repaint();
}
private boolean isInAbsoluteLayout() {
Container parent = xCreator.getParent();
while (parent != null) {
if (parent instanceof XWAbsoluteLayout && !(parent instanceof XWAbsoluteBodyLayout)) {
return true;
}
parent = parent.getParent();
}
return false;
}
// body是否开启手机重布局
private boolean isAppRelayout() {
return ((WFitLayout)designer.getRootComponent().toData()).isAppRelayout();
}
private JPanel getUnavailableTipPane(String tipText) {
JPanel panel = new JPanel(new BorderLayout());
UILabel unavailableTipLabel = new UILabel();
unavailableTipLabel.setText("<html>" + tipText + "<html>");
unavailableTipLabel.setForeground(Color.gray);
panel.add(unavailableTipLabel, BorderLayout.NORTH);
return panel;
}
private UIExpandablePane getMobileSettingsPane() {
initZoomOutComboBox();
tipLabel = new UILabel();
tipLabel.setForeground(Color.gray);
updateTipLabel();
Component[][] components = new Component[][]{
new Component[] {new UILabel(Inter.getLocText("FR-Designer_Zoom_In_Logic"), SwingConstants.LEFT), new UILabel(ChartMobileFitAttrState.PROPORTION.description())},
new Component[] {new UILabel(Inter.getLocText("FR-Designer_Zoom_Out_Logic"), SwingConstants.LEFT), zoomOutComboBox},
new Component[] {tipLabel, null}
};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p, p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1}, {1, 1}, {1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(panel, BorderLayout.NORTH);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Chart_Adaptivity"), 280, 20, panelWrapper);
}
private void initZoomOutComboBox() {
this.zoomOutComboBox = new UIComboBox(ITEMS);
}
private void updateTipLabel() {
ChartMobileFitAttrState fitAttrState = (ChartMobileFitAttrState) ((Item)zoomOutComboBox.getSelectedItem()).getValue();
// 使用 html,可以自动换行
tipLabel.setText("<html>" + fitAttrState.tip() + "</html>");
}
private void bindListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
}
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
@Override
public void populate(FormDesigner designer) {
this.designer = designer;
if (!isAppRelayout() || isInAbsoluteLayout()) {
return;
}
BaseChartEditor chartEditor = (BaseChartEditor)xCreator.toData();
ChartMobileFitAttrStateProvider zoomOutAttr = chartEditor.getMobileAttr().getZoomOutAttr();
this.zoomOutComboBox.setSelectedItem(new Item(zoomOutAttr.description(), zoomOutAttr));
updateTipLabel();
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
this.zoomOutComboBox.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent e) {
// 只响应选中事件
if (e.getStateChange() != ItemEvent.SELECTED) {
return;
}
updateTipLabel();
ChartMobileFitAttrState selectedAttr = (ChartMobileFitAttrState)((Item)e.getItem()).getValue();
if (selectedAttr.getState() != ChartMobileFitAttrState.AUTO.getState()) {
// 功能埋点
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(FormFunctionProcessor.MOBILE_CHART_ADAPTIVITY);
}
}
}
});
this.addAttributeChangeListener(changeListener);
}
@Override
public void update() {
ChartMobileAttrProvider mobileAttr = ((BaseChartEditor)xCreator.toData()).getMobileAttr();
mobileAttr.setZoomInAttr(ChartMobileFitAttrState.PROPORTION);
mobileAttr.setZoomOutAttr((ChartMobileFitAttrState)((Item)zoomOutComboBox.getSelectedItem()).getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
}
}

110
designer-form/src/com/fr/design/widget/ui/designer/mobile/MultiFileUploaderDefinePane.java

@ -0,0 +1,110 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.base.mobile.FileUploadModeState;
import com.fr.base.mobile.MultiFileUploaderMobileAttr;
import com.fr.design.constants.LayoutConstants;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.properties.items.Item;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.gui.icombobox.UIComboBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.FormDesigner;
import com.fr.form.ui.MultiFileEditor;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import java.awt.BorderLayout;
import java.awt.Component;
/**
* Created by plough on 2018/4/19.
*/
public class MultiFileUploaderDefinePane extends MobileWidgetDefinePane {
private static final Item[] ITEMS = {
new Item(Inter.getLocText("FR-Designer_Take_Photos_And_Choose_From_Album"), FileUploadModeState.TAKE_PHOTOS_AND_CHOOSE_FROM_ALBUM),
new Item(Inter.getLocText("FR-Designer_Only_Take_Photos"), FileUploadModeState.ONLY_TAKE_PHOTOS)
};
private XCreator xCreator; // 当前选中控件的xCreator
private UIComboBox uploadModeComboBox;// 上传方式下拉框
public MultiFileUploaderDefinePane(XCreator xCreator) {
this.xCreator = xCreator;
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel mobileSettingsPane;
mobileSettingsPane = getMobileSettingsPane();
this.add(mobileSettingsPane, BorderLayout.NORTH);
this.repaint();
}
private UIExpandablePane getMobileSettingsPane() {
initUploadModeComboBox();
// 以后可能会扩展,还是用 TableLayout 吧
Component[][] components = new Component[][]{
new Component[] {new UILabel(Inter.getLocText("FR-Designer_Upload_Mode"), SwingConstants.LEFT), uploadModeComboBox}
};
double f = TableLayout.FILL;
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p,f};
int[][] rowCount = {{1, 1}};
final JPanel panel = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 30, LayoutConstants.VGAP_LARGE);
panel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
final JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(panel, BorderLayout.NORTH);
return new UIExpandablePane(Inter.getLocText("FR-Designer_Terminal"), 280, 20, panelWrapper);
}
private void initUploadModeComboBox() {
this.uploadModeComboBox = new UIComboBox(ITEMS);
}
private void bindListeners2Widgets() {
reInitAllListeners();
AttributeChangeListener changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
this.addAttributeChangeListener(changeListener);
}
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
@Override
public void populate(FormDesigner designer) {
MultiFileUploaderMobileAttr mobileAttr = ((MultiFileEditor)xCreator.toData()).getMobileAttr();
FileUploadModeState fileUploadModeState = mobileAttr.getFileUploadModeState();
uploadModeComboBox.setSelectedIndex(fileUploadModeState.getState());
// 数据 populate 完成后,再设置监听
this.bindListeners2Widgets();
}
@Override
public void update() {
MultiFileUploaderMobileAttr mobileAttr = ((MultiFileEditor)xCreator.toData()).getMobileAttr();
mobileAttr.setFileUploadModeState((FileUploadModeState) ((Item)uploadModeComboBox.getSelectedItem()).getValue());
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); // 触发设计器保存按钮亮起来
}
}

81
designer-form/src/com/fr/design/widget/ui/designer/mobile/ParaMobileDefinePane.java

@ -0,0 +1,81 @@
package com.fr.design.widget.ui.designer.mobile;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.foldablepane.UIExpandablePane;
import com.fr.design.gui.frpane.AttributeChangeListener;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.MobileWidgetListPane;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.form.ui.container.WSortLayout;
import com.fr.general.Inter;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import java.awt.BorderLayout;
/**
* Created by plough on 2018/2/5.
*/
public class ParaMobileDefinePane extends MobileWidgetDefinePane {
private XCreator paraCreator;
private FormDesigner designer;
private AttributeChangeListener changeListener;
private MobileWidgetListPane mobileWidgetListPane;
public ParaMobileDefinePane(XCreator xCreator) {
this.paraCreator = xCreator;
}
@Override
public void initPropertyGroups(Object source) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
this.add(getMobileWidgetListPane(), BorderLayout.CENTER);
this.repaint();
}
// 控件顺序
private UIExpandablePane getMobileWidgetListPane() {
mobileWidgetListPane = new MobileWidgetListPane(designer, (WSortLayout) paraCreator.toData());
mobileWidgetListPane.setBorder(BorderFactory.createEmptyBorder(10, 0, 5, 0));
JPanel panelWrapper = FRGUIPaneFactory.createBorderLayout_S_Pane();
panelWrapper.add(mobileWidgetListPane, BorderLayout.CENTER);
return new UIExpandablePane(Inter.getLocText("FR-Designer_WidgetOrder"), 280, 20, panelWrapper);
}
private void bindListeners2Widgets() {
reInitAllListeners();
this.changeListener = new AttributeChangeListener() {
@Override
public void attributeChange() {
update();
}
};
}
/**
* 后台初始化所有事件.
*/
private void reInitAllListeners() {
initListener(this);
}
@Override
public void populate(FormDesigner designer) {
this.designer = designer;
// 设置监听
this.bindListeners2Widgets();
this.addAttributeChangeListener(changeListener);
}
@Override
public void update() {
mobileWidgetListPane.updateToDesigner();
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
}

26
designer-realize/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -1,5 +1,6 @@
package com.fr.design.actions.report; package com.fr.design.actions.report;
import com.fr.base.iofileattr.MobileOnlyTemplateAttrMark;
import com.fr.design.actions.JWorkBookAction; import com.fr.design.actions.JWorkBookAction;
import com.fr.design.dialog.BasicDialog; import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter; import com.fr.design.dialog.DialogActionAdapter;
@ -7,6 +8,7 @@ import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.JWorkBook;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.design.report.mobile.ReportMobileAttrPane; import com.fr.design.report.mobile.ReportMobileAttrPane;
import com.fr.file.FILE;
import com.fr.general.IOUtils; import com.fr.general.IOUtils;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.main.TemplateWorkBook; import com.fr.main.TemplateWorkBook;
@ -53,14 +55,26 @@ public class ReportMobileAttrAction extends JWorkBookAction{
@Override @Override
public void doOk() { public void doOk() {
ElementCaseMobileAttr elementCaseMobileAttr = mobileAttrPane.updateBean(); ElementCaseMobileAttr elementCaseMobileAttr = mobileAttrPane.updateBean();
wbTpl.setReportMobileAttr(elementCaseMobileAttr); if (elementCaseMobileAttr.isMobileCanvasSize() && wbTpl.getAttrMark(MobileOnlyTemplateAttrMark.XML_TAG) == null) {
jwb.fireTargetModified(); // 如果是老模板,选择手机专属之后需要另存为
if (elementCaseMobileAttr.isMobileCanvasSize()) { FILE editingFILE = jwb.getEditingFILE();
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor(); if (editingFILE != null && editingFILE.exists()) {
if (processor != null) { String fileName = editingFILE.getName().substring(0, editingFILE.getName().length() - jwb.suffix().length()) + "_mobile";
processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_CPT); if (!jwb.saveAsTemplate(true, fileName)) {
return; // 不激活保存按钮
}
} }
// 放到后面。如果提前 return 了,则仍然处于未设置状态,不要添加
wbTpl.addAttrMark(new MobileOnlyTemplateAttrMark());
}
// 记录功能点
FunctionProcessor processor = ExtraClassManager.getInstance().getFunctionProcessor();
if (processor != null) {
processor.recordFunction(ReportFunctionProcessor.MOBILE_TEMPLATE_CPT);
} }
// 设置移动端属性并刷新界面
wbTpl.setReportMobileAttr(elementCaseMobileAttr); // 会同时修改页面设置,放到最后
jwb.fireTargetModified();
} }
}); });
dialog.setVisible(true); dialog.setVisible(true);

12
designer-realize/src/com/fr/design/mainframe/CellWidgetPropertyPane.java

@ -107,17 +107,22 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
final CellSelection finalCS = (CellSelection) ePane.getSelection(); final CellSelection finalCS = (CellSelection) ePane.getSelection();
final TemplateElementCase tplEC = ePane.getEditingElementCase(); final TemplateElementCase tplEC = ePane.getEditingElementCase();
final Widget cellWidget = cellEditorDefPane.update();
if(finalCS.isSelectedOneCell(ePane)){ if(finalCS.isSelectedOneCell(ePane)){
if(tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow())== null){//cellElement未加入到report中时要添加进去 if(tplEC.getTemplateCellElement(cellElement.getColumn(), cellElement.getRow())== null){//cellElement未加入到report中时要添加进去
tplEC.addCellElement(cellElement); tplEC.addCellElement(cellElement);
} }
setCellWidget(cellElement); setCellWidget(cellWidget, cellElement);
}else{ }else{
ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() { ReportActionUtils.actionIterateWithCellSelection(finalCS, tplEC, new ReportActionUtils.IterAction() {
public void dealWith(CellElement editCellElement) { public void dealWith(CellElement editCellElement) {
// p:最后把这个cellEditorDef设置到CellGUIAttr. // p:最后把这个cellEditorDef设置到CellGUIAttr.
TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement; TemplateCellElement templateCellElement = (TemplateCellElement) editCellElement;
setCellWidget(templateCellElement); try {
setCellWidget((Widget)cellWidget.clone(), templateCellElement);
} catch (CloneNotSupportedException e) {
FRContext.getLogger().error("InternalError: " + e.getMessage());
}
} }
}); });
} }
@ -126,8 +131,7 @@ public class CellWidgetPropertyPane extends BasicPane {
} }
} }
private void setCellWidget(TemplateCellElement cellElement){ private void setCellWidget(Widget cellWidget, TemplateCellElement cellElement){
Widget cellWidget = cellEditorDefPane.update();
if (cellWidget instanceof NoneWidget) { if (cellWidget instanceof NoneWidget) {
cellElement.setWidget(null); cellElement.setWidget(null);
} else { } else {

87
designer-realize/src/com/fr/design/webattr/EditToolBar.java

@ -31,19 +31,31 @@ import com.fr.form.ui.WidgetInfoConfig;
import com.fr.general.Background; import com.fr.general.Background;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.web.button.Export; import com.fr.report.web.button.Export;
import com.fr.report.web.button.PDFPrint;
import com.fr.report.web.button.Print;
import com.fr.report.web.button.write.AppendColumnRow; import com.fr.report.web.button.write.AppendColumnRow;
import com.fr.report.web.button.write.Submit; import com.fr.report.web.button.write.Submit;
import com.fr.stable.ArrayUtils; import com.fr.stable.ArrayUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import javax.swing.*; import javax.swing.BorderFactory;
import javax.swing.event.ChangeEvent; import javax.swing.Box;
import javax.swing.event.ChangeListener; import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.ImageIcon;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSplitPane;
import javax.swing.ListCellRenderer;
import javax.swing.SpinnerNumberModel;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import java.awt.*; import java.awt.BorderLayout;
import java.awt.CardLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.util.ArrayList; import java.util.ArrayList;
@ -320,7 +332,8 @@ public class EditToolBar extends BasicPane {
private CardLayout card; private CardLayout card;
private JPanel centerPane; private JPanel centerPane;
private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word, private UICheckBox icon, text, pdf, excelP, excelO, excelS, image, word,
flashPrint, pdfPrint, appletPrint, serverPrint, isPopup, isVerify, failSubmit, isCurSheet; isPopup, isVerify, failSubmit, isCurSheet, excelImClean,
excelImCover, excelImAppend, excelImCust;
private UIBasicSpinner count; private UIBasicSpinner count;
private Widget widget; private Widget widget;
private UITextField nameField; private UITextField nameField;
@ -381,9 +394,7 @@ public class EditToolBar extends BasicPane {
centerPane.setLayout(card); centerPane.setLayout(card);
centerPane.add("custom", getCustomPane()); centerPane.add("custom", getCustomPane());
centerPane.add("export", getExport()); centerPane.add("export", getExport());
centerPane.add("print", getPrint());
centerPane.add("none", none); centerPane.add("none", none);
centerPane.add("pdfprint", getPdfPrintSetting());
// centerPane.add("editexcel", editExcel); // centerPane.add("editexcel", editExcel);
centerPane.add(getCpane(), "appendcount"); centerPane.add(getCpane(), "appendcount");
centerPane.add(getSubmitPane(), "submit"); centerPane.add(getSubmitPane(), "submit");
@ -435,22 +446,6 @@ public class EditToolBar extends BasicPane {
return export; return export;
} }
private JPanel getPrint() {
JPanel print = FRGUIPaneFactory.createY_AXISBoxInnerContainer_L_Pane();
// print.setLayout(new BoxLayout(print, BoxLayout.Y_AXIS));
flashPrint = new UICheckBox(Inter.getLocText("FR-Designer_Flash_Print"));
pdfPrint = new UICheckBox(Inter.getLocText("FR-Designer_PDF_Print"));
appletPrint = new UICheckBox(Inter.getLocText("FR-Designer_Applet_Print"));
serverPrint = new UICheckBox(Inter.getLocText("FR-Designer_Server_Print"));
print.add(flashPrint);
print.add(pdfPrint);
print.add(appletPrint);
print.add(serverPrint);
print.setBorder(BorderFactory.createTitledBorder(Inter.getLocText(new String[]{"Form-Button", "Property", "Set"})));
return print;
}
private JPanel getCpane() { private JPanel getCpane() {
JPanel appendCountPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane(); JPanel appendCountPane = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
count = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1)); count = new UIBasicSpinner(new SpinnerNumberModel(1, 0, Integer.MAX_VALUE, 1));
@ -463,16 +458,6 @@ public class EditToolBar extends BasicPane {
} }
private JPanel getPdfPrintSetting() {
// richer:pdf打印按钮设置
JPanel pdfPrintSetting = FRGUIPaneFactory.createY_AXISBoxInnerContainer_S_Pane();
isPopup = new UICheckBox(Inter.getLocText("PDF-Print_isPopup"));
pdfPrintSetting.add(isPopup);
pdfPrintSetting.setBorder(BorderFactory.createTitledBorder(Inter.getLocText("PDF-Print_Setting")));
return pdfPrintSetting;
}
private JPanel getSubmitPane() { private JPanel getSubmitPane() {
isVerify = new UICheckBox(Inter.getLocText("Verify-Data_Verify")); isVerify = new UICheckBox(Inter.getLocText("Verify-Data_Verify"));
failSubmit = new UICheckBox(Inter.getLocText(new String[]{"Verify_Fail", "Still", "Submit"})); failSubmit = new UICheckBox(Inter.getLocText(new String[]{"Verify_Fail", "Still", "Submit"}));
@ -523,10 +508,6 @@ public class EditToolBar extends BasicPane {
} }
if (widget instanceof Export) { if (widget instanceof Export) {
populateExport(); populateExport();
} else if (widget instanceof Print) {
populatePrint();
} else if (widget instanceof PDFPrint) {
populatePDFPrint();
} else if (widget instanceof AppendColumnRow) { } else if (widget instanceof AppendColumnRow) {
populateAppendColumnRow(); populateAppendColumnRow();
} else if (widget instanceof Submit) { } else if (widget instanceof Submit) {
@ -581,21 +562,6 @@ public class EditToolBar extends BasicPane {
this.isCurSheet.setSelected(submit.isOnlySubmitSelect()); this.isCurSheet.setSelected(submit.isOnlySubmitSelect());
} }
private void populatePDFPrint(){
card.show(centerPane, "pdfprint");
PDFPrint pdfPrint = (PDFPrint) widget;
this.isPopup.setSelected(pdfPrint.isPopup());
}
private void populatePrint(){
card.show(centerPane, "print");
Print print = (Print) widget;
this.pdfPrint.setSelected(print.isPDFPrint());
this.appletPrint.setSelected(print.isAppletPrint());
this.flashPrint.setSelected(print.isFlashPrint());
this.serverPrint.setSelected(print.isServerPrint());
}
private void populateDefault(){ private void populateDefault(){
Button button = (Button) widget; Button button = (Button) widget;
this.icon.setSelected(button.isShowIcon()); this.icon.setSelected(button.isShowIcon());
@ -612,11 +578,6 @@ public class EditToolBar extends BasicPane {
public Widget update() { public Widget update() {
if (widget instanceof Export) { if (widget instanceof Export) {
updateExport(); updateExport();
} else if (widget instanceof Print) {
updatePrint();
} else if (widget instanceof PDFPrint) {
PDFPrint pdfPrint = (PDFPrint) widget;
pdfPrint.setPopup(this.isPopup.isSelected());
} else if (widget instanceof AppendColumnRow) { } else if (widget instanceof AppendColumnRow) {
((AppendColumnRow) widget).setCount(((Integer) count.getValue()).intValue()); ((AppendColumnRow) widget).setCount(((Integer) count.getValue()).intValue());
} else if (widget instanceof Submit) { } else if (widget instanceof Submit) {
@ -650,14 +611,6 @@ public class EditToolBar extends BasicPane {
submit.setOnlySubmitSelect(this.isCurSheet.isSelected()); submit.setOnlySubmitSelect(this.isCurSheet.isSelected());
} }
private void updatePrint(){
Print print = (Print) widget;
print.setAppletPrint(this.appletPrint.isSelected());
print.setFlashPrint(this.flashPrint.isSelected());
print.setPDFPrint(this.pdfPrint.isSelected());
print.setServerPrint(this.serverPrint.isSelected());
}
private void updateExport(){ private void updateExport(){
Export export = (Export) widget; Export export = (Export) widget;
export.setPdfAvailable(this.pdf.isSelected()); export.setPdfAvailable(this.pdf.isSelected());

70
designer-realize/src/com/fr/design/webattr/ToolBarPane.java

@ -7,9 +7,14 @@ import com.fr.design.gui.core.WidgetOption;
import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.ui.ToolBar; import com.fr.form.ui.ToolBar;
import com.fr.form.ui.Widget; import com.fr.form.ui.Widget;
import com.fr.general.Inter;
import javax.swing.*; import com.fr.report.web.annotation.OldPrintMethod;
import java.awt.*;
import javax.swing.BorderFactory;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import javax.swing.TransferHandler;
import java.awt.Component;
import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.UnsupportedFlavorException; import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.event.MouseAdapter; import java.awt.event.MouseAdapter;
@ -19,6 +24,7 @@ import java.util.List;
public class ToolBarPane extends BasicBeanPane<ToolBar> { public class ToolBarPane extends BasicBeanPane<ToolBar> {
private FToolBar ftoolbar = new FToolBar(); private FToolBar ftoolbar = new FToolBar();
private boolean populateFinished = false; // 正在 populate 数据
public ToolBarPane() { public ToolBarPane() {
super(); super();
@ -26,11 +32,11 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
/** /**
* 添加鼠标监听 * 添加鼠标监听
* *
* @param mouselistener 鼠标监听 * @param mouselistener 鼠标监听
*/ */
public void addAuthorityListener(MouseListener mouselistener) { public void addAuthorityListener(MouseListener mouselistener) {
List<ToolBarButton> list = ftoolbar.getButtonlist(); List<ToolBarButton> list = ftoolbar.getButtonlist();
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
@ -44,9 +50,9 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
this.add(button); this.add(button);
} }
/** /**
* 初始化组件 * 初始化组件
*/ */
public void initComponent() { public void initComponent() {
this.addMouseListener(listener); this.addMouseListener(listener);
this.setLayout(FRGUIPaneFactory.createBoxFlowLayout()); this.setLayout(FRGUIPaneFactory.createBoxFlowLayout());
@ -54,9 +60,9 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
this.setBorder(BorderFactory.createTitledBorder("")); this.setBorder(BorderFactory.createTitledBorder(""));
} }
/** /**
* 删除鼠标事件 * 删除鼠标事件
*/ */
public void removeDefaultMouseListener() { public void removeDefaultMouseListener() {
this.removeMouseListener(listener); this.removeMouseListener(listener);
} }
@ -70,15 +76,19 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
this.ftoolbar.addButton(button); this.ftoolbar.addButton(button);
} }
/** /**
* 添加组件 * 添加组件
* *
* @param comp 组件 * @param comp 组件
* *
* @return 被添加的组件 * @return 被添加的组件
*/ */
public Component add(Component comp) { public Component add(Component comp) {
if (comp instanceof ToolBarButton) { if (comp instanceof ToolBarButton) {
if (isPopulateFinished() && ((ToolBarButton) comp).getWidget().getClass().isAnnotationPresent(OldPrintMethod.class)) {
JOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(this), Inter.getLocText("FR-Designer_Use_New_Print_Tip"));
return comp;
}
this.ftoolbar.addButton((ToolBarButton) comp); this.ftoolbar.addButton((ToolBarButton) comp);
} }
return super.add(comp); return super.add(comp);
@ -128,15 +138,16 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
@Override @Override
public void populateBean(ToolBar toolbar) { public void populateBean(ToolBar toolbar) {
setPopulateFinished(false);
this.removeAll(); this.removeAll();
this.getFToolBar().clearButton(); this.getFToolBar().clearButton();
for (int j = 0; j < toolbar.getWidgetSize(); j++) { for (int j = 0; j < toolbar.getWidgetSize(); j++) {
Widget widget = toolbar.getWidget(j); Widget widget = toolbar.getWidget(j);
WidgetOption no = WidgetOption.getToolBarButton(widget.getClass()); WidgetOption no = WidgetOption.getToolBarButton(widget.getClass());
if (no == null){ if (no == null){
//如果装了什么插件, 放到了工具栏上, 后来删除了插件, 模板里还存着之前的控件 //如果装了什么插件, 放到了工具栏上, 后来删除了插件, 模板里还存着之前的控件
continue; continue;
} }
ToolBarButton button = new ToolBarButton(no.optionIcon(), widget); ToolBarButton button = new ToolBarButton(no.optionIcon(), widget);
button.setNameOption(no); button.setNameOption(no);
@ -146,6 +157,7 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
this.getFToolBar().setBackground(toolbar.getBackground()); this.getFToolBar().setBackground(toolbar.getBackground());
this.getFToolBar().setDefault(toolbar.isDefault()); this.getFToolBar().setDefault(toolbar.isDefault());
setPopulateFinished(true);
} }
@Override @Override
@ -171,6 +183,14 @@ public class ToolBarPane extends BasicBeanPane<ToolBar> {
} }
}; };
private boolean isPopulateFinished() {
return populateFinished;
}
private void setPopulateFinished(boolean populateFinished) {
this.populateFinished = populateFinished;
}
/* /*
* 拖拽属性设置 * 拖拽属性设置

Loading…
Cancel
Save