Browse Source

Merge pull request #1085 in BA/design from ~FANGLEI/design:release/9.0 to release/9.0

* commit '6ec84ffb626f0d23de544761f354eea21a0b8415':
  删除设计器-移动端属性-解析方式 删除自适应规则中的默认选项
master
superman 7 years ago
parent
commit
e9333fb05a
  1. 8
      designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java
  2. 32
      designer/src/com/fr/design/report/mobile/MobileUseHtmlGroupPane.java
  3. 6
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  4. 112
      designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java
  5. 14
      designer_form/src/com/fr/design/form/mobile/FormMobileAttrPane.java
  6. 33
      designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java

8
designer/src/com/fr/design/report/mobile/MobileRadioGroupPane.java

@ -29,21 +29,19 @@ public class MobileRadioGroupPane extends BasicBeanPane<MobileFitAttrState>{
private void initComponents(String title) { private void initComponents(String title) {
double p = TableLayout.PREFERRED; double p = TableLayout.PREFERRED;
double[] rowSize = {p}; double[] rowSize = {p};
double[] columnSize = {p, p, p, p, p, p}; double[] columnSize = {p, p, p, p, p};
IndexRadioButton defaultRadio = new IndexRadioButton(MobileFitAttrState.DEFAULT.description(), MobileFitAttrState.DEFAULT);
defaultRadio.setSelected(true);
IndexRadioButton horizonRadio = new IndexRadioButton(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL); IndexRadioButton horizonRadio = new IndexRadioButton(MobileFitAttrState.HORIZONTAL.description(), MobileFitAttrState.HORIZONTAL);
horizonRadio.setSelected(true);
IndexRadioButton verticalRadio = new IndexRadioButton(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL); IndexRadioButton verticalRadio = new IndexRadioButton(MobileFitAttrState.VERTICAL.description(), MobileFitAttrState.VERTICAL);
IndexRadioButton bidirectionalRadio = new IndexRadioButton(MobileFitAttrState.BIDIRECTIONAL.description(), MobileFitAttrState.BIDIRECTIONAL); IndexRadioButton bidirectionalRadio = new IndexRadioButton(MobileFitAttrState.BIDIRECTIONAL.description(), MobileFitAttrState.BIDIRECTIONAL);
IndexRadioButton notFitRadio = new IndexRadioButton(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE); IndexRadioButton notFitRadio = new IndexRadioButton(MobileFitAttrState.NONE.description(), MobileFitAttrState.NONE);
addToButtonGroup(defaultRadio, horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio); addToButtonGroup(horizonRadio, verticalRadio, notFitRadio, bidirectionalRadio);
Component[][] components = new Component[][]{ Component[][] components = new Component[][]{
new Component[] { new Component[] {
new UILabel(title), new UILabel(title),
defaultRadio,
horizonRadio, horizonRadio,
verticalRadio, verticalRadio,
bidirectionalRadio, bidirectionalRadio,

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

@ -1,32 +0,0 @@
package com.fr.design.report.mobile;
import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
import com.fr.report.mobile.ElementCaseMobileAttr;
/**
* Created by kunsnat on 2016/8/3.
*/
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<ElementCaseMobileAttr> {
public MobileUseHtmlGroupPane(String annotation) {
super(annotation);
}
@Override
public void populateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0);
}
}
@Override
public ElementCaseMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(ElementCaseMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
}
}
}

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

@ -15,8 +15,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
private AppFitBrowserPane appFitBrowserPane; private AppFitBrowserPane appFitBrowserPane;
private MobileUseHtmlGroupPane htmlGroupPane;
//工具栏容器 //工具栏容器
private MobileToolBarPane mobileToolBarPane; private MobileToolBarPane mobileToolBarPane;
@ -34,8 +32,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
jPanel.add(appFitBrowserPane); jPanel.add(appFitBrowserPane);
jPanel.add(htmlGroupPane = new MobileUseHtmlGroupPane(Inter.getLocText("FR-Designer_Mobile_Report_Analysis_Annotation")));
jPanel.add(mobileToolBarPane = new MobileToolBarPane()); jPanel.add(mobileToolBarPane = new MobileToolBarPane());
jPanel.add(appFitPreviewPane); jPanel.add(appFitPreviewPane);
@ -50,7 +46,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
} }
appFitBrowserPane.populateBean(ob); appFitBrowserPane.populateBean(ob);
mobileToolBarPane.populateBean(ob); mobileToolBarPane.populateBean(ob);
htmlGroupPane.populateBean(ob);
} }
@ -58,7 +53,6 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean(); ElementCaseMobileAttr caseMobileAttr = appFitBrowserPane.updateBean();
mobileToolBarPane.updateBean(caseMobileAttr); mobileToolBarPane.updateBean(caseMobileAttr);
htmlGroupPane.updateBean(caseMobileAttr);
return caseMobileAttr; return caseMobileAttr;
} }

112
designer_base/src/com/fr/design/dialog/mobile/MobileUseHtmlGroupBeanPane.java

@ -1,112 +0,0 @@
package com.fr.design.dialog.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.border.UITitledBorder;
import com.fr.design.gui.ibutton.UIRadioButton;
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.general.Inter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
/**
* 由于MobileUserHtmlGroupPane 现在在report和form中均会用到会出现重复代码故放入base中
* Created by fanglei on 2016/12/28.
*/
public abstract class MobileUseHtmlGroupBeanPane<T> extends BasicBeanPane<T> {
private List<UIRadioButton> radioButtons = new ArrayList<UIRadioButton>();
public MobileUseHtmlGroupBeanPane(String annotation) {
initComponents(annotation);
}
private void initComponents(String annotation) {
this.setLayout(FRGUIPaneFactory.createBorderLayout());
this.setBorder(UITitledBorder.createBorderWithTitle(this.title4PopupWindow()));
double p = TableLayout.PREFERRED;
double[] rowSize = {p, p};
double[] columnSize = {p, p, p};
UIRadioButton useApp = new UIRadioButton(Inter.getLocText("FR-mobile_native_analysis"));
useApp.setSelected(true);
UIRadioButton useHTML5 = new UIRadioButton(Inter.getLocText("FR-mobile_html_analysis"));
addToButtonGroup(useApp, useHTML5);
Component[][] components = new Component[][]{
new Component[]{new UILabel(Inter.getLocText("FR-mobile_analysis_style")), useApp, useHTML5},
new Component[]{new UILabel(annotation), null, null}
};
JPanel usePane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
usePane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(usePane);
}
private void addToButtonGroup(UIRadioButton... radios) {
ButtonGroup buttonGroup = new ButtonGroup();
for (UIRadioButton radio : radios) {
radioButtons.add(radio);
buttonGroup.add(radio);
}
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.setEnabled(enabled);
}
}
/**
* 获取当前选中的按钮index
*
* @return 按钮index
*/
public int getSelectRadioIndex() {
for (int i = 0, len = radioButtons.size(); i < len; i++) {
if (radioButtons.get(i).isSelected()) {
return i;
}
}
return 0;
}
/**
* 选中指定index的按钮
*/
public void selectIndexButton(int index) {
if (index < 0 || index > radioButtons.size() - 1) {
return;
}
UIRadioButton button = radioButtons.get(index);
button.setSelected(true);
}
/**
* 给所有的按钮加上监听
*/
public void addActionListener(ActionListener actionListener) {
for (UIRadioButton radioButton : radioButtons) {
radioButton.addActionListener(actionListener);
}
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-mobile_report_analysis");
}
}

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

@ -16,9 +16,6 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//工具栏容器 //工具栏容器
private MobileToolBarPane mobileToolBarPane; private MobileToolBarPane mobileToolBarPane;
//h5解析容器
private MobileUseHtmlGroupPane mobileUseHtmlGroupPane;
static final int PADDINGHEIGHT = 10; static final int PADDINGHEIGHT = 10;
public FormMobileAttrPane() { public FormMobileAttrPane() {
@ -29,21 +26,14 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
//拉长两个Panel的高度去填满整个对话框。 //拉长两个Panel的高度去填满整个对话框。
private void initComponents() { private void initComponents() {
JPanel jPanel1 = new JPanel(); JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout()); jPanel1.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); jPanel1.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
jPanel2.setLayout(FRGUIPaneFactory.createBorderLayout());
jPanel2.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
this.mobileToolBarPane = new MobileToolBarPane(); this.mobileToolBarPane = new MobileToolBarPane();
this.mobileUseHtmlGroupPane = new MobileUseHtmlGroupPane(Inter.getLocText("FR-Designer_Mobile_Form_Analysis_Annotation"));
//设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中 //设置一个JPanel包裹mobileToolBarPane这个Panel,让jPanel的高度等于mobileToolBarPane高度加10,再放入this中
jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); jPanel1.setPreferredSize(new Dimension(0, (int)this.mobileToolBarPane.getPreferredSize().getHeight() + PADDINGHEIGHT));
jPanel2.setPreferredSize(new Dimension(0, (int)this.mobileUseHtmlGroupPane.getPreferredSize().getHeight() + PADDINGHEIGHT)); jPanel1.add("North", this.mobileToolBarPane);
jPanel1.add("North", this.mobileUseHtmlGroupPane);
jPanel2.add("North", this.mobileToolBarPane);
this.add("North", jPanel1); this.add("North", jPanel1);
this.add("Center", jPanel2);
} }
@Override @Override
@ -52,14 +42,12 @@ public class FormMobileAttrPane extends BasicBeanPane<FormMobileAttr>{
ob = new FormMobileAttr(); ob = new FormMobileAttr();
} }
this.mobileToolBarPane.populateBean(ob); this.mobileToolBarPane.populateBean(ob);
this.mobileUseHtmlGroupPane.populateBean(ob);
} }
@Override @Override
public FormMobileAttr updateBean() { public FormMobileAttr updateBean() {
FormMobileAttr formMobileAttr = new FormMobileAttr(); FormMobileAttr formMobileAttr = new FormMobileAttr();
this.mobileToolBarPane.updateBean(formMobileAttr); this.mobileToolBarPane.updateBean(formMobileAttr);
this.mobileUseHtmlGroupPane.updateBean(formMobileAttr);
return formMobileAttr; return formMobileAttr;
} }

33
designer_form/src/com/fr/design/form/mobile/MobileUseHtmlGroupPane.java

@ -1,33 +0,0 @@
package com.fr.design.form.mobile;
import com.fr.design.dialog.mobile.MobileUseHtmlGroupBeanPane;
import com.fr.form.main.mobile.FormMobileAttr;
/**
* 直接copyreport中的MobileUseHtmlGroupPane
* Created by fanglei on 2016/12/28.
*/
public class MobileUseHtmlGroupPane extends MobileUseHtmlGroupBeanPane<FormMobileAttr> {
public MobileUseHtmlGroupPane(String annotation) {
super(annotation);
}
@Override
public void populateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
selectIndexButton(mobileAttr.isUseHTML() ? 1 : 0);
}
}
@Override
public FormMobileAttr updateBean() {
return null;
}
@Override
public void updateBean(FormMobileAttr mobileAttr) {
if(mobileAttr != null) {
mobileAttr.setUseHTML(getSelectRadioIndex() == 1);
}
}
}
Loading…
Cancel
Save