Browse Source

完成了刷新菜单的数据保存

master
fanglei 8 years ago
parent
commit
151c0edb75
  1. 50
      designer/src/com/fr/design/report/mobile/MobileToolBarPane.java
  2. 56
      designer_base/src/com/fr/design/dialog/mobile/MobileToolBarBeanPane.java
  3. 53
      designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  4. 44
      designer_form/src/com/fr/design/form/mobile/MobileToolBarPane.java
  5. 19
      designer_form/src/com/fr/design/mainframe/actions/FormMobileAttrAction.java

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

@ -1,20 +1,53 @@
package com.fr.design.report.mobile; package com.fr.design.report.mobile;
import com.fr.design.dialog.mobile.MobileToolBarBeanPane; 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 com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
/** /**
* Created by 方磊 on 2016/11/8. * Created by 方磊 on 2016/11/8.
*/ */
public class MobileToolBarPane extends MobileToolBarBeanPane<ElementCaseMobileAttr> { 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 @Override
public void populateBean(ElementCaseMobileAttr ob) { public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) { if (ob == null) {
ob = new ElementCaseMobileAttr(); ob = new ElementCaseMobileAttr();
} }
super.getZoomCheckPane().populateBean(ob.isZoom()); this.zoomCheckPane.populateBean(ob.isZoom());
super.getRefreshCheckPane().populateBean(ob.isRefresh()); this.refreshCheckPane.populateBean(ob.isRefresh());
} }
@Override @Override
@ -25,8 +58,13 @@ public class MobileToolBarPane extends MobileToolBarBeanPane<ElementCaseMobileAt
@Override @Override
public void updateBean(ElementCaseMobileAttr mobileAttr) { public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) { if(mobileAttr != null) {
mobileAttr.setZoom(super.getZoomCheckPane().updateBean()); mobileAttr.setZoom(this.zoomCheckPane.updateBean());
mobileAttr.setRefresh(super.getRefreshCheckPane().updateBean()); mobileAttr.setRefresh(this.refreshCheckPane.updateBean());
}
} }
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Mobile-Toolbar");
} }
} }

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

@ -1,56 +0,0 @@
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 "工具栏";
}
}

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

@ -0,0 +1,53 @@
package com.fr.design.form.mobile;
import com.fr.design.beans.BasicBeanPane;
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 fanglei on 2016/11/17.
*/
public class FormMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
//工具栏容器
private MobileToolBarPane mobileToolBarPane;
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() + 10));
jPanel.add("North", mobileToolBarPane);
this.add(jPanel);
}
@Override
public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) {
ob = new ElementCaseMobileAttr();
}
this.mobileToolBarPane.populateBean(ob);
}
@Override
public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = new ElementCaseMobileAttr();
this.mobileToolBarPane.updateBean(caseMobileAttr);
return caseMobileAttr;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Mobile-Attr");
}
}

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

@ -1,20 +1,47 @@
package com.fr.design.form.mobile; package com.fr.design.form.mobile;
import com.fr.design.dialog.mobile.MobileToolBarBeanPane; 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 com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*;
import java.awt.*;
/** /**
* Created by 方磊 on 2016/11/8. * Created by 方磊 on 2016/11/8.
*/ */
public class MobileToolBarPane extends MobileToolBarBeanPane<ElementCaseMobileAttr> { public class MobileToolBarPane extends BasicBeanPane<ElementCaseMobileAttr> {
//刷新选项面板
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 @Override
public void populateBean(ElementCaseMobileAttr ob) { public void populateBean(ElementCaseMobileAttr ob) {
if (ob == null) { if (ob == null) {
ob = new ElementCaseMobileAttr(); ob = new ElementCaseMobileAttr();
} }
super.getZoomCheckPane().populateBean(ob.isZoom()); this.refreshCheckPane.populateBean(ob.isRefresh());
super.getRefreshCheckPane().populateBean(ob.isRefresh());
} }
@Override @Override
@ -25,8 +52,13 @@ public class MobileToolBarPane extends MobileToolBarBeanPane<ElementCaseMobileAt
@Override @Override
public void updateBean(ElementCaseMobileAttr mobileAttr) { public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) { if(mobileAttr != null) {
mobileAttr.setZoom(super.getZoomCheckPane().updateBean()); mobileAttr.setRefresh(this.refreshCheckPane.updateBean());
mobileAttr.setRefresh(super.getRefreshCheckPane().updateBean());
} }
} }
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Designer_Mobile-Toolbar");
}
} }

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

@ -2,9 +2,14 @@ package com.fr.design.mainframe.actions;
import com.fr.base.BaseUtils; import com.fr.base.BaseUtils;
import com.fr.design.actions.JTemplateAction; 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.mainframe.JForm;
import com.fr.design.menu.MenuKeySet; import com.fr.design.menu.MenuKeySet;
import com.fr.form.main.Form; import com.fr.form.main.Form;
import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr; import com.fr.report.mobile.ElementCaseMobileAttr;
import javax.swing.*; import javax.swing.*;
@ -35,6 +40,18 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
return; return;
} }
final Form formTpl = jf.getTarget(); final Form formTpl = jf.getTarget();
ElementCaseMobileAttr mobileAttr = formTpl.getReportMobileAttr();
final FormMobileAttrPane mobileAttrPane = new FormMobileAttrPane();
mobileAttrPane.populateBean(mobileAttr);
BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override
public void doOk() {
formTpl.setReportMobileAttr(mobileAttrPane.updateBean());
jf.fireTargetModified();
}
});
dialog.setVisible(true);
} }
private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() { private static final MenuKeySet REPORT_APP_ATTR = new MenuKeySet() {
@ -45,7 +62,7 @@ public class FormMobileAttrAction extends JTemplateAction<JForm> {
@Override @Override
public String getMenuName() { public String getMenuName() {
return "移动端属性"; return Inter.getLocText("FR-Designer_Mobile-Attr");
} }
@Override @Override

Loading…
Cancel
Save