Browse Source

Merge pull request #132 in BA/design from ~GARYTU/design:dev to dev

* commit 'cf48cc3a1e4024057729ced6f6b403fd80612aec':
  缩放属性面板
master
superman 9 years ago
parent
commit
e96f00a075
  1. 13
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  2. 71
      designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java

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

@ -19,6 +19,8 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
private MobileRadioGroupPane horizionPane; private MobileRadioGroupPane horizionPane;
//竖屏设置面板 //竖屏设置面板
private MobileRadioGroupPane verticalPane; private MobileRadioGroupPane verticalPane;
//缩放选项面板
private MobileRadioCheckPane radioCheckPane;
//效果预览面板 //效果预览面板
private AppFitPreviewPane appFitPreviewPane; private AppFitPreviewPane appFitPreviewPane;
@ -34,11 +36,13 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane();
horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal"));
verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical"));
radioCheckPane = new MobileRadioCheckPane(Inter.getLocText("FR-Designer_Mobile-ZOOM"));
ActionListener actionListener = getAppPreviewActionListener(); ActionListener actionListener = getAppPreviewActionListener();
horizionPane.addActionListener(actionListener); horizionPane.addActionListener(actionListener);
verticalPane.addActionListener(actionListener); verticalPane.addActionListener(actionListener);
fitOpsPane.add(horizionPane, BorderLayout.NORTH); fitOpsPane.add(horizionPane, BorderLayout.NORTH);
fitOpsPane.add(verticalPane, BorderLayout.SOUTH); fitOpsPane.add(verticalPane, BorderLayout.CENTER);
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane); borderPane.add(fitOpsPane);
this.add(borderPane); this.add(borderPane);
@ -50,7 +54,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
//纵向和横向独立设置 //纵向和横向独立设置
public int[] getCurrentFitOptions() { public int[] getCurrentFitOptions() {
return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex()}; return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()};
} }
@Override @Override
@ -60,6 +64,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
} }
horizionPane.populateBean(ob.getHorziontalAttr()); horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr()); verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.getZoom());
appFitPreviewPane.refreshPreview(getCurrentFitOptions()); appFitPreviewPane.refreshPreview(getCurrentFitOptions());
} }
@ -68,8 +73,8 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean(); MobileFitAttrState horizonState = horizionPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean(); MobileFitAttrState verticalState = verticalPane.updateBean();
boolean isZoom = radioCheckPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState); return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
} }
@Override @Override

71
designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java

@ -0,0 +1,71 @@
package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.layout.TableLayout;
import com.fr.design.layout.TableLayoutHelper;
import com.fr.general.Inter;
import com.fr.stable.StringUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.List;
public class MobileRadioCheckPane extends BasicBeanPane<Boolean> {
private List<UICheckBox> checkBoxes = new ArrayList<UICheckBox>();
public MobileRadioCheckPane(String title) {
initComponents(title);
}
private void initComponents(String title) {
double p = TableLayout.PREFERRED;
double[] rowSize = {p};
double[] columnSize = {p,p};
UICheckBox checkBox = new UICheckBox(Inter.getLocText("FS-CPT_ZOOM"));
checkBox.setSelected(true);
checkBoxes.add(checkBox);
Component[][] components = new Component[][]{
new Component[]{new UILabel(title), checkBox}
};
JPanel fitOpsPane = TableLayoutHelper.createTableLayoutPane(components, rowSize, columnSize);
fitOpsPane.setBorder(BorderFactory.createEmptyBorder(10, 13, 10, 10));
this.add(fitOpsPane);
}
public int getCurrentState() {
return checkBoxes.get(0).isSelected() ? 0 : 1;
}
/**
* 设置按钮状态
*/
public void setEnabled(boolean enabled) {
for (UICheckBox checkBox : checkBoxes) {
checkBox.setEnabled(enabled);
}
}
@Override
protected String title4PopupWindow() {
return StringUtils.EMPTY;
}
@Override
public void populateBean(Boolean ob) {
checkBoxes.get(0).setSelected(ob);
}
@Override
public Boolean updateBean() {
int state = getCurrentState();
return state == 0 ? true : false;
}
}
Loading…
Cancel
Save