Browse Source

增加移动端属性菜单里面的刷新选项

master
fanglei 8 years ago
parent
commit
dc825bd01e
  1. 4
      designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  2. 1
      designer/src/com/fr/design/mainframe/ElementCasePaneDelegate.java
  3. 16
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  4. 32
      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. 56
      designer_base/src/com/fr/design/dialog/mobile/MobileToolBarBeanPane.java
  8. 32
      designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java
  9. 8
      designer_form/src/com/fr/design/mainframe/JForm.java
  10. 56
      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() {

1
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;

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

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

@ -0,0 +1,32 @@
package com.fr.design.report.mobile;
import com.fr.design.dialog.mobile.MobileToolBarBeanPane;
import com.fr.report.mobile.ElementCaseMobileAttr;
/**
* Created by 方磊 on 2016/11/8.
*/
public class MobileToolBarPane extends MobileToolBarBeanPane<ElementCaseMobileAttr> {
@Override
public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) {
ob = new ElementCaseMobileAttr();
}
super.getZoomCheckPane().populateBean(ob.isZoom());
super.getRefreshCheckPane().populateBean(ob.isRefresh());
}
@Override
public ElementCaseMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setZoom(super.getZoomCheckPane().updateBean());
mobileAttr.setRefresh(super.getRefreshCheckPane().updateBean());
}
}
}

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);
}

56
designer_base/src/com/fr/design/dialog/mobile/MobileToolBarBeanPane.java

@ -0,0 +1,56 @@
package com.fr.design.dialog.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter;
import javax.swing.*;
import java.awt.*;
/**
* Created by fanglei on 2016/11/14.
* 这个toolbar类需要被design和design_form两个模块复用所以为了结构精简抽出共同方法作为抽象类供它们使用
*/
public abstract class MobileToolBarBeanPane<T> extends BasicBeanPane<T> {
//缩放选项面板
private MobileRadioCheckPane zoomCheckPane;
//刷新选项面板
private MobileRadioCheckPane refreshCheckPane;
public MobileRadioCheckPane getZoomCheckPane() {
return zoomCheckPane;
}
public MobileRadioCheckPane getRefreshCheckPane() {
return refreshCheckPane;
}
public MobileToolBarBeanPane() {
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("刷新");
toobarsPane.add(uiLabel, BorderLayout.WEST);
toobarsPane.add(zoomCheckPane, BorderLayout.CENTER);
toobarsPane.add(refreshCheckPane, BorderLayout.EAST);
borderPane.add(toobarsPane);
this.add(borderPane);
}
@Override
protected String title4PopupWindow() {
return "工具栏";
}
}

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

@ -0,0 +1,32 @@
package com.fr.design.form.mobile;
import com.fr.design.dialog.mobile.MobileToolBarBeanPane;
import com.fr.report.mobile.ElementCaseMobileAttr;
/**
* Created by 方磊 on 2016/11/8.
*/
public class MobileToolBarPane extends MobileToolBarBeanPane<ElementCaseMobileAttr> {
@Override
public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) {
ob = new ElementCaseMobileAttr();
}
super.getZoomCheckPane().populateBean(ob.isZoom());
super.getRefreshCheckPane().populateBean(ob.isRefresh());
}
@Override
public ElementCaseMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setZoom(super.getZoomCheckPane().updateBean());
mobileAttr.setRefresh(super.getRefreshCheckPane().updateBean());
}
}
}

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());
}
}

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

@ -0,0 +1,56 @@
package com.fr.design.mainframe.actions;
import com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction;
import com.fr.design.mainframe.JForm;
import com.fr.design.menu.MenuKeySet;
import com.fr.form.main.Form;
import com.fr.report.mobile.ElementCaseMobileAttr;
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();
}
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@Override
public char getMnemonic() {
return 'T';
}
@Override
public String getMenuName() {
return "移动端属性";
}
@Override
public KeyStroke getKeyStroke() {
return null;
}
};
}
Loading…
Cancel
Save