kerry 8 years ago
parent
commit
a82e9a93cc
  1. 4
      designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  2. 3
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  3. 16
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  4. 70
      designer/src/com/fr/design/report/mobile/MobileToolBarPane.java
  5. 25
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  6. 13
      designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java
  7. 55
      designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  8. 64
      designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java
  9. 8
      designer_form/src/com/fr/design/mainframe/JForm.java
  10. 73
      designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java

4
designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -57,9 +57,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'P';
}
public char getMnemonic() { return 'P'; }
@Override
public String getMenuName() {

3
designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java

@ -3,7 +3,6 @@ package com.fr.design.mainframe;
import com.fr.base.BaseUtils;
import com.fr.design.fun.MenuHandler;
import com.fr.design.menu.KeySetUtils;
import com.fr.design.parameter.ParameterPropertyPane;
import com.fr.general.Inter;
import com.fr.page.ReportSettingsProvider;
import com.fr.design.file.HistoryTemplateListPane;
@ -103,7 +102,7 @@ public class ElementCasePaneDelegate extends ElementCasePane<WorkSheet> {
// 插入菜单
private MenuDef createInsertMenuDef() {
MenuDef menuDef = new MenuDef(Inter.getLocText("M-Insert"), 'I');
MenuDef menuDef = new MenuDef(Inter.getLocText("FR-Designer_M-Insert"), 'I');
menuDef.setAnchor(MenuHandler.INSERT);
// 单元格菜单
menuDef.addShortCut(DeprecatedActionManager.getCellMenu(this));

16
designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java

@ -19,8 +19,6 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioGroupPane horizionPane;
//竖屏设置面板
private MobileRadioGroupPane verticalPane;
//缩放选项面板
private MobileRadioCheckPane radioCheckPane;
//效果预览面板
private AppFitPreviewPane appFitPreviewPane;
@ -36,16 +34,13 @@ public class AppFitBrowserPane 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"));
ActionListener actionListener = getAppPreviewActionListener();
horizionPane.addActionListener(actionListener);
verticalPane.addActionListener(actionListener);
fitOpsPane.add(horizionPane, BorderLayout.NORTH);
fitOpsPane.add(verticalPane, BorderLayout.CENTER);
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH);
fitOpsPane.add(verticalPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane);
this.add(borderPane);
}
public void setAppFitPreviewPane(AppFitPreviewPane appFitPreviewPane) {
@ -54,7 +49,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
//纵向和横向独立设置
public int[] getCurrentFitOptions() {
return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()};
return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex()};
}
@Override
@ -64,7 +59,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
}
horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.isZoom());
// radioCheckPane.populateBean(ob.isZoom());
appFitPreviewPane.refreshPreview(getCurrentFitOptions());
}
@ -73,8 +68,9 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean();
boolean isZoom = radioCheckPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
// boolean isZoom = radioCheckPane.updateBean();
// return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
return new ElementCaseMobileAttr(horizonState, verticalState);
}
@Override

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

@ -0,0 +1,70 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.mobile.MobileRadioCheckPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
/**
* Created by 方磊 on 2016/11/8.
*/
public class MobileToolBarPane extends BasicBeanPane<ElementCaseMobileAttr> {
//缩放选项面板
private MobileRadioCheckPane zoomCheckPane;
//刷新选项面板
private MobileRadioCheckPane refreshCheckPane;
public MobileToolBarPane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow());
JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel uiLabel = new UILabel("html5");
uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15));
zoomCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Zoom"));
refreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Refresh"));
toobarsPane.add(uiLabel, BorderLayout.WEST);
toobarsPane.add(zoomCheckPane, BorderLayout.CENTER);
toobarsPane.add(refreshCheckPane, BorderLayout.EAST);
borderPane.add(toobarsPane);
this.add(borderPane);
}
@Override
public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) {
ob = new ElementCaseMobileAttr();
}
this.zoomCheckPane.populateBean(ob.isZoom());
this.refreshCheckPane.populateBean(ob.isRefresh());
}
@Override
public ElementCaseMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setZoom(this.zoomCheckPane.updateBean());
mobileAttr.setRefresh(this.refreshCheckPane.updateBean());
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Mobile-Toolbar");
}
}

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

@ -1,6 +1,7 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icontainer.UIScrollPane;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr;
@ -16,22 +17,30 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private MobileUseHtmlGroupPane htmlGroupPane;
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
public ReportMobileAttrPane() {
initComponents();
}
private void initComponents() {
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
AppFitPreviewPane appFitPreviewPane = new AppFitPreviewPane();
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JPanel jPanel = new JPanel();
jPanel.setLayout(new BoxLayout(jPanel, BoxLayout.Y_AXIS));
jPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
appFitBrowserPane = new AppFitBrowserPane();
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
this.add(appFitBrowserPane);
jPanel.add(appFitBrowserPane);
this.add(htmlGroupPane = new MobileUseHtmlGroupPane());
jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane());
this.add(appFitPreviewPane);
jPanel.add(mobileToolBarPane = new MobileToolBarPane());
jPanel.add(appFitPreviewPane);
UIScrollPane scrollPane = new UIScrollPane(jPanel);
this.add(scrollPane);
}
@Override
@ -40,7 +49,7 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
ob = new ElementCaseMobileAttr();
}
appFitBrowserPane.populateBean(ob);
mobileToolBarPane.populateBean(ob);
htmlGroupPane.populateBean(ob);
}
@ -48,7 +57,7 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
@Override
public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
mobileToolBarPane.updateBean(caseMobileAttr);
htmlGroupPane.updateBean(caseMobileAttr);
return caseMobileAttr;

13
designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java → designer_base/src/com/fr/design/dialog/mobile/MobileRadioCheckPane.java

@ -1,4 +1,4 @@
package com.fr.design.report.mobile;
package com.fr.design.dialog.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox;
@ -13,6 +13,9 @@ import java.awt.*;
import java.util.ArrayList;
import java.util.List;
/**
* 这个类要被复用移动到design_base中去
*/
public class MobileRadioCheckPane extends BasicBeanPane<Boolean> {
private List<UICheckBox> checkBoxes = new ArrayList<UICheckBox>();
@ -26,16 +29,16 @@ public class MobileRadioCheckPane extends BasicBeanPane<Boolean> {
double[] rowSize = {p};
double[] columnSize = {p,p};
UICheckBox checkBox = new UICheckBox(Inter.getLocText("FR-Designer_Mobile-Open"));
checkBox.setSelected(true);
UICheckBox checkBox = new UICheckBox(title);
checkBox.setSelected(false);
checkBoxes.add(checkBox);
Component[][] components = new Component[][]{
new Component[]{new UILabel(title), checkBox}
new Component[]{checkBox}
};
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 0));
this.add(fitOpsPane);
}

55
designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java

@ -0,0 +1,55 @@
package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by fanglei on 2016/11/17.
*/
public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
static final int paddingHeight = 10;
public FormMobileAttrPane() {
this.initComponents();
}
private void initComponents() {
JPanel jPanel = new JPanel();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
jPanel.setLayout(FRGUIPaneFactory.createBorderLayout());
this.mobileToolBarPane = new MobileToolBarPane();
//设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中
jPanel.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + paddingHeight));
jPanel.add("North", mobileToolBarPane);
this.add(jPanel);
}
@Override
public void populateBean(FormMobileAttr ob) {
if (ob == null) {
ob = new FormMobileAttr();
}
this.mobileToolBarPane.populateBean(ob);
}
@Override
public FormMobileAttr updateBean() {
FormMobileAttr caseMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(caseMobileAttr);
return caseMobileAttr;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

64
designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java

@ -0,0 +1,64 @@
package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.dialog.mobile.MobileRadioCheckPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by 方磊 on 2016/11/8.
*/
public class MobileToolBarPane extends BasicBeanPane<FormMobileAttr> {
//刷新选项面板
private MobileRadioCheckPane refreshCheckPane;
public MobileToolBarPane() {
this.initComponents();
}
private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow());
JPanel toobarsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
UILabel uiLabel = new UILabel("html5");
uiLabel.setBorder(BorderFactory.createEmptyBorder(5, 15, 10, 15));
this.refreshCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-Refresh"));
toobarsPane.add(uiLabel, BorderLayout.WEST);
toobarsPane.add(refreshCheckPane, BorderLayout.EAST);
borderPane.add(toobarsPane);
this.add(borderPane);
}
@Override
public void populateBean(FormMobileAttr ob) {
if (ob == null) {
ob = new FormMobileAttr();
}
this.refreshCheckPane.populateBean(ob.isRefresh());
}
@Override
public FormMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setRefresh(this.refreshCheckPane.updateBean());
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Mobile-Toolbar");
}
}

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

@ -4,6 +4,7 @@ import com.fr.base.BaseUtils;
import com.fr.design.DesignState;
import com.fr.design.actions.core.WorkBookSupportable;
import com.fr.design.actions.file.WebPreviewUtils;
import com.fr.design.mainframe.actions.FormMobileAttrAction;
import com.fr.design.cell.FloatElementsProvider;
import com.fr.design.constants.UIConstants;
import com.fr.design.designer.beans.actions.FormDeleteAction;
@ -71,6 +72,7 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
private JComponent editingComponent;
private FormECCompositeProvider reportComposite;
//FORM_TAB代表是否点击编辑,用于点击编辑前后菜单的显示
protected int index = FORM_TAB;
public JForm() {
@ -383,11 +385,13 @@ public class JForm extends JTemplate<Form, FormUndoState> implements BaseJForm {
public ShortCut[] shortcut4TemplateMenu() {
if (this.index == FORM_TAB) {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
new TemplateParameterAction(this)
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, new ShortCut[0]);
} else {
return (ShortCut[]) ArrayUtils.addAll(new ShortCut[]{
new TemplateParameterAction(this)
new TemplateParameterAction(this),
new FormMobileAttrAction(this)
}, this.elementCaseDesign.shortcut4TemplateMenu());
}
}

73
designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java

@ -0,0 +1,73 @@
package com.fr.design.mainframe.actions;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.dialog.BasicDialog;
import com.fr.design.dialog.DialogActionAdapter;
import com.fr.design.form.mobile.FormMobileAttrPane;
import com.fr.design.mainframe.DesignerContext;
import com.fr.design.mainframe.JForm;
import com.fr.design.menu.MenuKeySet;
import com.fr.form.main.Form;
import com.fr.form.main.mobile.FormMobileAttr;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.event.ActionEvent;
/**
* Created by fanglei on 2016/11/14.
*/
public class FormMobileAttrAction extends JTemplateAction<JForm> {
public FormMobileAttrAction(JForm jf) {
super(jf);
this.setMenuKeySet(REPORT_APP_ATTR);
this.setName(getMenuKeySet().getMenuKeySetName() + "...");
this.setMnemonic(getMenuKeySet().getMnemonic());
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/mobile.png"));
}
/**
* 执行动作
*
* @return 是否执行成功
*/
@Override
public void actionPerformed(ActionEvent e) {
final JForm jf = getEditingComponent();
if (jf == null) {
return;
}
final Form formTpl = jf.getTarget();
FormMobileAttr mobileAttr = formTpl.getFormMobileAttr();
final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane();
mobileAttrPane.populateBean(mobileAttr);
BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
formTpl.setFormMobileAttr(mobileAttrPane.updateBean());
jf.fireTargetModified();
}
});
dialog.setVisible(true);
}
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}
Loading…
Cancel
Save