xiaohu 9 years ago
parent
commit
e267b9212b
  1. 2
      designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java
  2. 2
      designer/src/com/fr/design/report/VerifierListPane.java
  3. 94
      designer/src/com/fr/design/report/mobile/AppFitBrowserPane.java
  4. 71
      designer/src/com/fr/design/report/mobile/AppFitPreviewPane.java
  5. 70
      designer/src/com/fr/design/report/mobile/MobileRadioCheckPane.java
  6. 33
      designer/src/com/fr/design/report/mobile/ReportMobileAttrPane.java
  7. 2
      designer/src/com/fr/start/Designer.java
  8. 19
      designer_base/src/com/fr/design/ExtraDesignClassManager.java
  9. 40
      designer_base/src/com/fr/design/fun/VerifyDefineProvider.java
  10. 20
      designer_base/src/com/fr/design/fun/impl/AbstractVerifyDefineProvider.java
  11. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/H0.png
  12. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/H1.png
  13. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/H2.png
  14. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/H3.png
  15. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/V0.png
  16. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/V1.png
  17. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/V2.png
  18. BIN
      designer_base/src/com/fr/design/images/dialog/appfit/V3.png
  19. 48
      designer_base/src/com/fr/env/RemoteEnv.java
  20. 48
      designer_form/src/com/fr/design/designer/creator/XElementCase.java
  21. 64
      designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java
  22. 2
      designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java

2
designer/src/com/fr/design/actions/report/ReportMobileAttrAction.java

@ -45,7 +45,7 @@ public class ReportMobileAttrAction extends JWorkBookAction{
final ReportMobileAttrPane mobileAttrPane = new ReportMobileAttrPane(); final ReportMobileAttrPane mobileAttrPane = new ReportMobileAttrPane();
mobileAttrPane.populateBean(mobileAttr); mobileAttrPane.populateBean(mobileAttr);
BasicDialog dialog = mobileAttrPane.showMediumWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { BasicDialog dialog = mobileAttrPane.showWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() {
@Override @Override
public void doOk() { public void doOk() {
wbTpl.setReportMobileAttr(mobileAttrPane.updateBean()); wbTpl.setReportMobileAttr(mobileAttrPane.updateBean());

2
designer/src/com/fr/design/report/VerifierListPane.java

File diff suppressed because one or more lines are too long

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

@ -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);
}
};
}
}

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

@ -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");
}
}

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

@ -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;
}
}

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

@ -1,40 +1,33 @@
package com.fr.design.report.mobile; package com.fr.design.report.mobile;
import com.fr.design.beans.BasicBeanPane; import com.fr.design.beans.BasicBeanPane;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.general.Inter; import com.fr.general.Inter;
import com.fr.report.mobile.ElementCaseMobileAttr; import com.fr.report.mobile.ElementCaseMobileAttr;
import com.fr.base.mobile.MobileFitAttrState;
import javax.swing.*; import javax.swing.*;
import java.awt.*;
/** /**
* Created by Administrator on 2016/5/12/0012. * Created by Administrator on 2016/5/12/0012.
*/ */
public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
//横屏设置面板
private MobileRadioGroupPane horizionPane; private AppFitBrowserPane appFitBrowserPane;
//竖屏设置面板
private MobileRadioGroupPane verticalPane;
public ReportMobileAttrPane() { public ReportMobileAttrPane() {
initComponents(); initComponents();
} }
private void initComponents() { private void initComponents() {
this.setLayout(FRGUIPaneFactory.createBorderLayout()); this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
JPanel borderPane = FRGUIPaneFactory.createTitledBorderPane(this.title4PopupWindow()); this.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
AppFitPreviewPane appFitPreviewPane = new AppFitPreviewPane();
JPanel fitOpsPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); appFitBrowserPane = new AppFitBrowserPane();
horizionPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Horizontal")); appFitBrowserPane.setAppFitPreviewPane(appFitPreviewPane);
verticalPane = new MobileRadioGroupPane(Inter.getLocText("FR-Designer_Mobile-Vertical")); this.add(appFitBrowserPane);
fitOpsPane.add(horizionPane, BorderLayout.NORTH);
fitOpsPane.add(verticalPane, BorderLayout.SOUTH);
borderPane.add(fitOpsPane); this.add(appFitPreviewPane);
this.add(borderPane);
} }
@Override @Override
@ -42,17 +35,13 @@ public class ReportMobileAttrPane extends BasicBeanPane<ElementCaseMobileAttr>{
if (ob == null) { if (ob == null) {
ob = new ElementCaseMobileAttr(); ob = new ElementCaseMobileAttr();
} }
appFitBrowserPane.populateBean(ob);
horizionPane.populateBean(ob.getHorziontalAttr());
verticalPane.populateBean(ob.getVerticalAttr());
} }
@Override @Override
public ElementCaseMobileAttr updateBean() { public ElementCaseMobileAttr updateBean() {
MobileFitAttrState horizonState = horizionPane.updateBean(); return appFitBrowserPane.updateBean();
MobileFitAttrState verticalState = verticalPane.updateBean();
return new ElementCaseMobileAttr(horizonState, verticalState);
} }
@Override @Override

2
designer/src/com/fr/start/Designer.java

@ -35,6 +35,7 @@ import com.fr.general.Inter;
import com.fr.stable.ProductConstants; import com.fr.stable.ProductConstants;
import com.fr.stable.StableUtils; import com.fr.stable.StableUtils;
import com.fr.stable.StringUtils; import com.fr.stable.StringUtils;
import com.fr.stable.web.ServletContext;
import com.fr.stable.xml.XMLTools; import com.fr.stable.xml.XMLTools;
import javax.swing.*; import javax.swing.*;
@ -431,6 +432,7 @@ public class Designer extends BaseDesigner {
InformationCollector collector = InformationCollector.getInstance(); InformationCollector collector = InformationCollector.getInstance();
collector.collectStopTime(); collector.collectStopTime();
collector.saveXMLFile(); collector.saveXMLFile();
ServletContext.fireServletStopListener();
} }
} }

19
designer_base/src/com/fr/design/ExtraDesignClassManager.java

@ -138,6 +138,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
private Set<BackgroundUIProvider> backgroundUIProviders; private Set<BackgroundUIProvider> backgroundUIProviders;
private Set<VerifyDefineProvider> verifyDefineProviders;
public TableDataPaneProcessor getTableDataPaneProcessor() { public TableDataPaneProcessor getTableDataPaneProcessor() {
return tableDataPaneProcessor; return tableDataPaneProcessor;
} }
@ -804,6 +806,21 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
backgroundUIProviders.add((BackgroundUIProvider) level); backgroundUIProviders.add((BackgroundUIProvider) level);
} }
public VerifyDefineProvider[] getVerifyDefineProviders() {
if (verifyDefineProviders == null) {
return new VerifyDefineProvider[0];
}
return verifyDefineProviders.toArray(new VerifyDefineProvider[verifyDefineProviders.size()]);
}
private void addVerifyDefineProvider(Level level, PluginSimplify simplify) throws Exception {
if (verifyDefineProviders == null) {
verifyDefineProviders = new HashSet<>();
}
validAPILevel(level, VerifyDefineProvider.CURRENT_LEVEL, simplify.getPluginName());
verifyDefineProviders.add((VerifyDefineProvider) level);
}
/** /**
* 文件名 * 文件名
* *
@ -902,6 +919,8 @@ public class ExtraDesignClassManager extends XMLFileManager implements ExtraDesi
addWidgetAttrProvider(impl, simplify); addWidgetAttrProvider(impl, simplify);
} else if (tagName.equals(ExportAttrTabProvider.XML_TAG)) { } else if (tagName.equals(ExportAttrTabProvider.XML_TAG)) {
addExportAttrTabProvider(impl, simplify); addExportAttrTabProvider(impl, simplify);
} else if (tagName.equals(VerifyDefineProvider.MARK_STRING)) {
addVerifyDefineProvider(impl, simplify);
} }
} catch (PluginInvalidLevelException e) { } catch (PluginInvalidLevelException e) {
PluginMessage.remindUpdate(e.getMessage()); PluginMessage.remindUpdate(e.getMessage());

40
designer_base/src/com/fr/design/fun/VerifyDefineProvider.java

@ -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();
}

20
designer_base/src/com/fr/design/fun/impl/AbstractVerifyDefineProvider.java

@ -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();
}
}

BIN
designer_base/src/com/fr/design/images/dialog/appfit/H0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/H1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 810 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/H2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 837 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/H3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 779 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/V0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 815 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/V1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/V2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 890 B

BIN
designer_base/src/com/fr/design/images/dialog/appfit/V3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

48
designer_base/src/com/fr/env/RemoteEnv.java vendored

@ -28,6 +28,8 @@ import com.fr.json.JSONArray;
import com.fr.json.JSONException; import com.fr.json.JSONException;
import com.fr.json.JSONObject; import com.fr.json.JSONObject;
import com.fr.plugin.Plugin; import com.fr.plugin.Plugin;
import com.fr.plugin.PluginLicense;
import com.fr.plugin.PluginLicenseManager;
import com.fr.plugin.PluginLoader; import com.fr.plugin.PluginLoader;
import com.fr.stable.*; import com.fr.stable.*;
import com.fr.stable.file.XMLFileManagerProvider; import com.fr.stable.file.XMLFileManagerProvider;
@ -2044,25 +2046,45 @@ public class RemoteEnv implements Env {
} }
public InputStream readPluginConfig() throws Exception { private void readPlugins() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>(); HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design"); para.put("op", "fr_remote_design");
para.put("cmd", "design_get_plugin_info"); para.put("cmd", "design_plugins");
InputStream inputStream = postBytes2ServerB(out.toByteArray(), para);
String pluginsStr = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
if (StringUtils.isNotBlank(pluginsStr) && pluginsStr.startsWith("[")) {
JSONArray jsonArray = new JSONArray(pluginsStr);
for (int i = 0; i < jsonArray.length(); i++) {
Plugin plugin = new Plugin();
plugin.parseJSON(jsonArray.getJSONObject(i));
PluginLoader.getLoader().addRemotePlugin(plugin);
}
}
}
return postBytes2ServerB(out.toByteArray(), para); private void readPluginLicenses() throws Exception {
ByteArrayOutputStream out = new ByteArrayOutputStream();
HashMap<String, String> para = new HashMap<String, String>();
para.put("op", "fr_remote_design");
para.put("cmd", "design_plugin_licenses");
InputStream inputStream = postBytes2ServerB(out.toByteArray(), para);
String pluginsLicensesStr = IOUtils.inputStream2String(inputStream, EncodeConstants.ENCODING_UTF_8);
if (StringUtils.isNotBlank(pluginsLicensesStr) && pluginsLicensesStr.startsWith("[")) {
JSONArray jsonArray = new JSONArray(pluginsLicensesStr);
for (int i = 0; i < jsonArray.length(); i++) {
PluginLicense pluginLicense = new PluginLicense();
pluginLicense.parseJSON(jsonArray.getJSONObject(i));
PluginLicenseManager.getInstance().addRemotePluginLicense(pluginLicense);
}
}
} }
/**
* 远程设计先不需要检测MD5
*
* @return 是否正确
* @throws Exception MD5算法异常
*/
@Override @Override
public boolean isTruePluginMD5(Plugin plugin, File file) throws Exception { public void readPluginConfig() throws Exception {
return true; readPlugins();
readPluginLicenses();
} }
} }

48
designer_form/src/com/fr/design/designer/creator/XElementCase.java

@ -25,8 +25,6 @@ import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.List;
public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{ public class XElementCase extends XBorderStyleWidgetCreator implements FormElementCaseContainerProvider{
private UILabel imageLable; private UILabel imageLable;
@ -56,23 +54,14 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
* @throws IntrospectionException 异常 * @throws IntrospectionException 异常
*/ */
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] crp = ((ElementCaseEditor) data).isHeightRestrict() ? revealHeightLimit() : getDefault();
FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor();
if (processor == null) {
return crp;
}
PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass());
return (CRPropertyDescriptor[]) ArrayUtils.addAll(crp, extraEditor);
}
protected List<CRPropertyDescriptor> createNonListenerProperties() throws IntrospectionException { CRPropertyDescriptor[] propertyTableEditor = new CRPropertyDescriptor[]{
CRPropertyDescriptor[] propertyTableEditor = {
new CRPropertyDescriptor("widgetName", this.data.getClass()) new CRPropertyDescriptor("widgetName", this.data.getClass())
.setI18NName(Inter.getLocText("Form-Widget_Name")), .setI18NName(Inter.getLocText("Form-Widget_Name")),
new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass( new CRPropertyDescriptor("borderStyle", this.data.getClass()).setEditorClass(
WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName( WLayoutBorderStyleEditor.class).setRendererClass(LayoutBorderStyleRenderer.class).setI18NName(
Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"). Inter.getLocText("FR-Designer-Widget_Style")).putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
setPropertyChangeListener(new PropertyChangeAdapter() { .setPropertyChangeListener(new PropertyChangeAdapter() {
@Override @Override
public void propertyChange() { public void propertyChange() {
@ -85,34 +74,15 @@ public class XElementCase extends XBorderStyleWidgetCreator implements FormEleme
new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class) new CRPropertyDescriptor("showToolBar", this.data.getClass()).setEditorClass(BooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_toolbar")) .setI18NName(Inter.getLocText("Form-EC_toolbar"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"), .putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced"),
new CRPropertyDescriptor("heightRestrict", this.data.getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced")
};
List<CRPropertyDescriptor> defaultList = new ArrayList<>(); };
for (CRPropertyDescriptor propertyDescriptor : propertyTableEditor) { FormElementCaseEditorProcessor processor = ExtraDesignClassManager.getInstance().getPropertyTableEditor();
defaultList.add(propertyDescriptor); if (processor == null){
return propertyTableEditor;
} }
return defaultList; PropertyDescriptor[] extraEditor = processor.createPropertyDescriptor(this.data.getClass());
} return (CRPropertyDescriptor[]) ArrayUtils.addAll(propertyTableEditor, extraEditor);
protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException {
CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.data.getClass())
.setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightpercent"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
defaultList.add(heightLimitProperty);
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
} }

64
designer_form/src/com/fr/design/designer/properties/mobile/ElementCasePropertyTable.java

@ -1,6 +1,7 @@
package com.fr.design.designer.properties.mobile; package com.fr.design.designer.properties.mobile;
import com.fr.base.FRContext; import com.fr.base.FRContext;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.CRPropertyDescriptor; import com.fr.design.designer.creator.CRPropertyDescriptor;
import com.fr.design.designer.creator.XCreator; import com.fr.design.designer.creator.XCreator;
import com.fr.design.form.util.XCreatorConstants; import com.fr.design.form.util.XCreatorConstants;
@ -9,11 +10,15 @@ import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.gui.xtable.PropertyGroupModel; import com.fr.design.gui.xtable.PropertyGroupModel;
import com.fr.design.mainframe.FormDesigner; import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane; import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.DoubleEditor;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
import com.fr.form.ui.ElementCaseEditor;
import com.fr.general.Inter; import com.fr.general.Inter;
import javax.swing.table.TableModel; import javax.swing.table.TableModel;
import java.beans.IntrospectionException; import java.beans.IntrospectionException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
/** /**
* Created by Administrator on 2016/5/16/0016. * Created by Administrator on 2016/5/16/0016.
@ -27,6 +32,52 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
this.xCreator = xCreator; this.xCreator = xCreator;
} }
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
if (((ElementCaseEditor ) xCreator.toData()).getVerticalAttr().getState() == 2 && !((ElementCaseEditor ) xCreator.toData()).isHeightRestrict()) {
((ElementCaseEditor ) xCreator.toData()).setHeightRestrict(true);
return revealHeightLimit();
}
CRPropertyDescriptor[] crp = ((ElementCaseEditor) xCreator.toData()).isHeightRestrict() ? revealHeightLimit() : getDefault();
return crp;
}
protected List<CRPropertyDescriptor> createNonListenerProperties() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = {
new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
new CRPropertyDescriptor("heightRestrict", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightrestrict"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App"))
};
List<CRPropertyDescriptor> defaultList = new ArrayList<>();
for (CRPropertyDescriptor propertyDescriptor: propertyTableEditor) {
defaultList.add(propertyDescriptor);
}
return defaultList;
}
protected CRPropertyDescriptor[] revealHeightLimit() throws IntrospectionException {
CRPropertyDescriptor heightLimitProperty = new CRPropertyDescriptor("heightPercent", this.xCreator.toData().getClass())
.setEditorClass(DoubleEditor.class)
.setI18NName(Inter.getLocText("Form-EC_heightpercent"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, "Advanced");
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
defaultList.add(heightLimitProperty);
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
protected CRPropertyDescriptor[] getDefault() throws IntrospectionException {
ArrayList<CRPropertyDescriptor> defaultList = (ArrayList<CRPropertyDescriptor>) createNonListenerProperties();
return defaultList.toArray(new CRPropertyDescriptor[defaultList.size()]);
}
@Override @Override
public void initPropertyGroups(Object source) { public void initPropertyGroups(Object source) {
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner(); this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
@ -34,17 +85,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
groups = new ArrayList<PropertyGroup>(); groups = new ArrayList<PropertyGroup>();
CRPropertyDescriptor[] propertyTableEditor = null; CRPropertyDescriptor[] propertyTableEditor = null;
try { try {
propertyTableEditor = new CRPropertyDescriptor[]{ propertyTableEditor = supportedDescriptor();
new CRPropertyDescriptor("horziontalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Horizontal"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App")),
new CRPropertyDescriptor("verticalAttr", this.xCreator.toData().getClass()).setEditorClass(MobileFitEditor.class)
.setRendererClass(MobileFitRender.class)
.setI18NName(Inter.getLocText("FR-Designer_Mobile-Vertical"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer_Fit-App"))
};
} catch (IntrospectionException e) { } catch (IntrospectionException e) {
FRContext.getLogger().error(e.getMessage()); FRContext.getLogger().error(e.getMessage());
} }
@ -59,6 +100,7 @@ public class ElementCasePropertyTable extends AbstractPropertyTable{
@Override @Override
public void firePropertyEdit() { public void firePropertyEdit() {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
} }
public void populate(FormDesigner designer) { public void populate(FormDesigner designer) {

2
designer_form/src/com/fr/design/designer/properties/mobile/MobileFitEditor.java

@ -45,6 +45,6 @@ public class MobileFitEditor extends ComboEditor{
*/ */
@Override @Override
public boolean refreshInTime() { public boolean refreshInTime() {
return false; return true;
} }
} }

Loading…
Cancel
Save