@ -0,0 +1,94 @@
|
||||
package com.fr.design.report.mobile; |
||||
|
||||
import com.fr.base.mobile.MobileFitAttrState; |
||||
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.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
/** |
||||
* Created by 夏翔 on 2016/5/28. |
||||
*/ |
||||
public class AppFitBrowserPane extends BasicBeanPane<ElementCaseMobileAttr> { |
||||
//横屏设置面板
|
||||
private MobileRadioGroupPane horizionPane; |
||||
//竖屏设置面板
|
||||
private MobileRadioGroupPane verticalPane; |
||||
//缩放选项面板
|
||||
private MobileRadioCheckPane radioCheckPane; |
||||
//效果预览面板
|
||||
private AppFitPreviewPane appFitPreviewPane; |
||||
|
||||
|
||||
public AppFitBrowserPane(){ |
||||
initComponents(); |
||||
|
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); |
||||
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.CENTER); |
||||
fitOpsPane.add(radioCheckPane, BorderLayout.SOUTH); |
||||
borderPane.add(fitOpsPane); |
||||
this.add(borderPane); |
||||
|
||||
} |
||||
|
||||
public void setAppFitPreviewPane(AppFitPreviewPane appFitPreviewPane) { |
||||
this.appFitPreviewPane = appFitPreviewPane; |
||||
} |
||||
|
||||
//纵向和横向独立设置
|
||||
public int[] getCurrentFitOptions() { |
||||
return new int[]{horizionPane.getSelectRadioIndex(), verticalPane.getSelectRadioIndex(), radioCheckPane.getCurrentState()}; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(ElementCaseMobileAttr ob) { |
||||
if (ob == null) { |
||||
ob = new ElementCaseMobileAttr(); |
||||
} |
||||
horizionPane.populateBean(ob.getHorziontalAttr()); |
||||
verticalPane.populateBean(ob.getVerticalAttr()); |
||||
radioCheckPane.populateBean(ob.isZoom()); |
||||
appFitPreviewPane.refreshPreview(getCurrentFitOptions()); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public ElementCaseMobileAttr updateBean() { |
||||
MobileFitAttrState horizonState = horizionPane.updateBean(); |
||||
MobileFitAttrState verticalState = verticalPane.updateBean(); |
||||
boolean isZoom = radioCheckPane.updateBean(); |
||||
return new ElementCaseMobileAttr(horizonState, verticalState, isZoom); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Designer_Fit-App"); |
||||
} |
||||
|
||||
private ActionListener getAppPreviewActionListener() { |
||||
return new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
int[] fitOptions = getCurrentFitOptions(); |
||||
appFitPreviewPane.refreshPreview(fitOptions); |
||||
} |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,71 @@
|
||||
package com.fr.design.report.mobile; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.general.Inter; |
||||
|
||||
import javax.swing.*; |
||||
import java.util.ArrayList; |
||||
|
||||
/** |
||||
* Created by 夏翔 on 2016/5/28. |
||||
*/ |
||||
public class AppFitPreviewPane extends BasicPane{ |
||||
|
||||
private UILabel horizontalImageLabel; |
||||
|
||||
private UILabel verticalImagelabel; |
||||
|
||||
private ArrayList<ImageIcon> cachedVerticalPreviewImage = new ArrayList<ImageIcon>(); |
||||
|
||||
private ArrayList<ImageIcon> cachedHorizonPreviewImage = new ArrayList<ImageIcon>(); |
||||
|
||||
|
||||
public AppFitPreviewPane() { |
||||
//初始化缓存图片
|
||||
initCacheImage(); |
||||
//初始化组件
|
||||
initComponents(); |
||||
} |
||||
|
||||
private void initCacheImage() { |
||||
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V0.png"))); |
||||
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V1.png"))); |
||||
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V2.png"))); |
||||
cachedVerticalPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/V3.png"))); |
||||
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H0.png"))); |
||||
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H1.png"))); |
||||
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H2.png"))); |
||||
cachedHorizonPreviewImage.add(new ImageIcon(IOUtils.readImage("/com/fr/design/images/dialog/appfit/H3.png"))); |
||||
} |
||||
|
||||
private void initComponents() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
|
||||
JPanel outnorthPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); |
||||
this.add(outnorthPane); |
||||
|
||||
horizontalImageLabel = new UILabel(); |
||||
horizontalImageLabel.setIcon(cachedHorizonPreviewImage.get(1)); |
||||
outnorthPane.add(horizontalImageLabel); |
||||
|
||||
verticalImagelabel = new UILabel(); |
||||
verticalImagelabel.setIcon(cachedVerticalPreviewImage.get(0)); |
||||
outnorthPane.add(verticalImagelabel); |
||||
} |
||||
|
||||
public void refreshPreview(int[] index) { |
||||
ImageIcon newHorizonImageIcon = cachedHorizonPreviewImage.get(index[0]) ; |
||||
ImageIcon newVerticalImageIcon = cachedVerticalPreviewImage.get(index[1]); |
||||
horizontalImageLabel.setIcon(newHorizonImageIcon); |
||||
verticalImagelabel.setIcon(newVerticalImageIcon); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return Inter.getLocText("FR-Plugin_Preview"); |
||||
} |
||||
} |
@ -0,0 +1,70 @@
|
||||
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.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("FR-Designer_Mobile-Open")); |
||||
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; |
||||
} |
||||
} |
@ -0,0 +1,40 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.data.Verifier; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.stable.fun.Level; |
||||
import com.fr.stable.fun.Provider; |
||||
|
||||
/** |
||||
* Created by richie on 16/6/8. |
||||
*/ |
||||
public interface VerifyDefineProvider extends Level, Provider { |
||||
|
||||
String MARK_STRING = "VerifyDefineProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 对应的校验类 |
||||
* @return 校验类 |
||||
*/ |
||||
Class<? extends Verifier> classForVerifier(); |
||||
|
||||
/** |
||||
* 校验设置的界面 |
||||
* @return 界面 |
||||
*/ |
||||
Class<? extends BasicBeanPane> appearanceForVerifier(); |
||||
|
||||
/** |
||||
* 此种类型的校验的名字 |
||||
* @return 名字 |
||||
*/ |
||||
String nameForVerifier(); |
||||
|
||||
/** |
||||
* 菜单图标 |
||||
* @return 图标路径 |
||||
*/ |
||||
String iconPath(); |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.VerifyDefineProvider; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
|
||||
/** |
||||
* Created by richie on 16/6/8. |
||||
*/ |
||||
public abstract class AbstractVerifyDefineProvider extends AbstractProvider implements VerifyDefineProvider { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
} |
After Width: | Height: | Size: 745 B |
After Width: | Height: | Size: 810 B |
After Width: | Height: | Size: 837 B |
After Width: | Height: | Size: 779 B |
After Width: | Height: | Size: 815 B |
After Width: | Height: | Size: 818 B |
After Width: | Height: | Size: 890 B |
After Width: | Height: | Size: 842 B |