forked from fanruan/design
Browse Source
* commit 'bc446a5405bc36a4c94eff0ecd18071208aeab4c': static final修饰变量,消除魔术数 增加了formMobileAttr保存表单属性 由于report的elementCaseMobileAttrProvider没有改好,form里面菜单弹窗先屏蔽防止报错 消除魔术数 规范国际化 完成了刷新菜单的数据保存 增加移动端属性菜单里面的刷新选项master
10 changed files with 301 additions and 30 deletions
@ -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"); |
||||||
|
} |
||||||
|
} |
@ -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"); |
||||||
|
} |
||||||
|
} |
@ -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"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -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.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() { |
||||||
|
@Override |
||||||
|
public char getMnemonic() { |
||||||
|
return 'T'; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getMenuName() { |
||||||
|
return Inter.getLocText("FR-Designer_Mobile-Attr"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public KeyStroke getKeyStroke() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
Loading…
Reference in new issue