neil 9 years ago
parent
commit
4261721176
  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 verticalPane;
//缩放选项面板
private MobileRadioCheckPane radioCheckPane;
//效果预览面板
private AppFitPreviewPane appFitPreviewPane;
@ -34,11 +36,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.SOUTH);
fitOpsPane.add(verticalPane, BorderLayout.CENTER);
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane);
this.add(borderPane);
@ -50,7 +54,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
//纵向和横向独立设置
public int[] getCurrentFitOptions() {
return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex()};
return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()};
}
@Override
@ -60,6 +64,7 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
}
horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr());
radioCheckPane.populateBean(ob.getZoom());
appFitPreviewPane.refreshPreview(getCurrentFitOptions());
}
@ -68,8 +73,8 @@ public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> {
public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState);
boolean isZoom = radioCheckPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState, isZoom);
}
@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