Browse Source

Merge pull request #233 in BA/design from ~NEIL/design:release to dev

* commit 'e95acb79babdaa1500535731b29e438782df0593': (24 commits)
  上传design项目的3个build.gradle文件
  1
  冲突
  冲突
  方法名
  空import
  exe启动插件被禁用
  整理
  设计器无法保存文字竖排
  read plugin
  执行
  sonar配置
  bug
  bug
  图标
  update
  登陆username为空时的npe问题
  更新jar后文件上传控件挂了.
  rt
  文字竖排没了
  ...
master
superman 8 years ago
parent
commit
7fa2e1b3cf
  1. 31
      designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java
  2. 20
      designer/src/com/fr/design/module/DesignerModule.java
  3. 10
      designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java
  4. 61
      designer_base/build.gradle
  5. 1
      designer_base/src/com/fr/design/beans/BasicBeanPane.java
  6. 9
      designer_base/src/com/fr/design/gui/style/AlignmentPane.java
  7. 8
      designer_base/src/com/fr/design/style/AlignmentPane.java
  8. 57
      designer_chart/build.gradle
  9. 24
      designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java
  10. 20
      designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java
  11. 1
      designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java
  12. 1
      designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java
  13. 65
      designer_form/build.gradle
  14. 21
      designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java
  15. 20
      designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java
  16. 4
      designer_form/src/com/fr/design/designer/creator/XWFitLayout.java
  17. 63
      designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java
  18. 111
      designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java
  19. 8
      designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java
  20. 2
      sonar-project.properties

31
designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java

@ -279,23 +279,26 @@ public class BBSLoginDialog extends UIDialog {
* @return 同上
*/
public static boolean login(String username, String password) {
try {
username = URLEncoder.encode(username, EncodeConstants.ENCODING_GBK);
} catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error(e.getMessage());
}
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password;
HttpClient client = new HttpClient(url);
client.setTimeout(TIME_OUT);
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) {
if (StringUtils.isNotBlank(username) && StringUtils.isNotBlank(password)) {
try {
String res = client.getResponseText(EncodeConstants.ENCODING_GBK);
if (res.contains(LOGIN_SUCCESS_FLAG)) {
return true;
}
} catch (Exception e) {
username = URLEncoder.encode(username, EncodeConstants.ENCODING_GBK);
password = URLEncoder.encode(password, EncodeConstants.ENCODING_GBK);
} catch (UnsupportedEncodingException e) {
FRLogger.getLogger().error(e.getMessage());
}
String url = SiteCenter.getInstance().acquireUrlByKind("bbs.login") + "&username=" + username + "&password=" + password;
HttpClient client = new HttpClient(url);
client.setTimeout(TIME_OUT);
if (client.getResponseCodeNoException() == HttpURLConnection.HTTP_OK) {
try {
String res = client.getResponseText(EncodeConstants.ENCODING_GBK);
if (res.contains(LOGIN_SUCCESS_FLAG)) {
return true;
}
} catch (Exception e) {
FRLogger.getLogger().error(e.getMessage());
}
}
}
return false;
}

20
designer/src/com/fr/design/module/DesignerModule.java

@ -14,15 +14,8 @@ import com.fr.design.actions.insert.flot.ImageFloatAction;
import com.fr.design.actions.insert.flot.TextBoxFloatAction;
import com.fr.design.actions.server.StyleListAction;
import com.fr.design.fun.ElementUIProvider;
import com.fr.design.gui.controlpane.NameObjectCreator;
import com.fr.design.gui.controlpane.NameableCreator;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.hyperlink.ReportletHyperlinkPane;
import com.fr.design.hyperlink.WebHyperlinkPane;
import com.fr.design.javascript.EmailPane;
import com.fr.design.javascript.JavaScriptImplPane;
import com.fr.design.javascript.ParameterJavaScriptPane;
import com.fr.design.javascript.ProcessTransitionAdapter;
import com.fr.design.mainframe.*;
import com.fr.design.mainframe.bbs.BBSGuestPane;
@ -38,7 +31,6 @@ import com.fr.general.*;
import com.fr.general.xml.GeneralXMLTools;
import com.fr.io.importer.Excel2007ReportImporter;
import com.fr.io.importer.ExcelReportImporter;
import com.fr.js.*;
import com.fr.main.impl.WorkBook;
import com.fr.plugin.ExtraClassManager;
import com.fr.quickeditor.ChartQuickEditor;
@ -55,10 +47,11 @@ import com.fr.stable.ParameterProvider;
import com.fr.stable.StringUtils;
import com.fr.stable.bridge.StableFactory;
import com.fr.stable.fun.LogProvider;
import com.fr.stable.module.Module;
import com.fr.stable.plugin.PluginSimplify;
import com.fr.stable.script.CalculatorProviderContext;
import com.fr.stable.script.ValueConverter;
import com.fr.stable.web.ServletContext;
import com.fr.stable.web.ServletContextAdapter;
import com.fr.stable.xml.ObjectTokenizer;
import com.fr.stable.xml.ObjectXMLWriterFinder;
import com.fr.start.BBSGuestPaneProvider;
@ -75,6 +68,15 @@ import java.util.Set;
public class DesignerModule extends DesignModule {
static {
ServletContext.addServletContextListener(new ServletContextAdapter() {
public void onServletStart() {
ModuleContext.startModule(DesignerModule.class.getName());
}
});
}
/**
* 启动设计器模块
*/

10
designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java

@ -173,10 +173,9 @@ public class SubmitVisitorListPane extends ObjectJControlPane {
comboItemsMap = new HashMap<>();
Set<SubmitProvider> providers = ExtraDesignClassManager.getInstance().getArray(SubmitProvider.MARK_STRING);
providers.add(new DefaultSubmit());
addSubmitPane(new DefaultSubmit());
for (SubmitProvider provider : providers) {
customSubmitPanes.put(provider.keyForSubmit(), provider.appearanceForSubmit());
comboItemsMap.put(provider.keyForSubmit(), provider.dataForSubmit());
addSubmitPane(provider);
}
configTypes = new ArrayList<>();
@ -211,6 +210,11 @@ public class SubmitVisitorListPane extends ObjectJControlPane {
});
}
private void addSubmitPane(SubmitProvider provider) {
customSubmitPanes.put(provider.keyForSubmit(), provider.appearanceForSubmit());
comboItemsMap.put(provider.keyForSubmit(), provider.dataForSubmit());
}
@Override
public void populateBean(WClassSubmiterProvider ob) {
editing = ob;

61
designer_base/build.gradle

@ -0,0 +1,61 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
version='8.0'
jar{
baseName='fr-designer-core'
}
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design"
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib"
sourceSets{
main{
java{
srcDirs=["${srcDir}/designer_base/src"]
}
}
}
dependencies{
compile fileTree(dir:'../../',include:'**/*.jar')
compile fileTree(dir:libDir,include:'*.jar')
compile fileTree(dir:"${libDir}/jetty",include:'*.jar')
testCompile 'junit:junit:4.12'
}
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/designer_base/src"){
exclude '**/*.java'
}
into 'build/classes/main'
}
}
//ѹËõÏîÄ¿ÖеÄjsÎļþ
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../lib',includes:'*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/designer_base/src"){
include (name:'**/*.js')
}
}
}
jar.dependsOn compressJS

1
designer_base/src/com/fr/design/beans/BasicBeanPane.java

@ -8,6 +8,7 @@ import com.fr.design.dialog.BasicPane;
public abstract class BasicBeanPane<T> extends BasicPane {
/**
* Populate.
*/

9
designer_base/src/com/fr/design/gui/style/AlignmentPane.java

@ -22,6 +22,7 @@ import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.report.fun.VerticalTextProcessor;
import com.fr.report.fun.impl.DefaultVerticalTextProcessor;
import com.fr.stable.Constants;
import javax.swing.*;
@ -134,10 +135,8 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
private void initTextRotationCombox(){
ArrayList<String> selectOption = new ArrayList<String>();
selectOption.add(Inter.getLocText("FR-Designer_Custom-Angle"));
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG);
if (processor != null){
selectOption.addAll(Arrays.asList(processor.getComboxOption()));
}
VerticalTextProcessor processor = ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG, DefaultVerticalTextProcessor.class);
selectOption.addAll(Arrays.asList(processor.getComboxOption()));
textRotationComboBox = new UIComboBox(selectOption.toArray(new String[selectOption.size()]));
}
@ -241,7 +240,7 @@ public class AlignmentPane extends AbstractBasicStylePane implements GlobalNameO
} else {
this.textComboBox.setSelectedIndex(0);
}
if (style.getVerticalText() == Style.VERTICALTEXT && ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG) != null) {
if (style.getVerticalText() == Style.VERTICALTEXT) {
textRotationComboBox.setSelectedIndex(style.getTextDirection() == Style.LEFT_TO_RIGHT ? 1 : 2);
} else {
textRotationComboBox.setSelectedIndex(0);

8
designer_base/src/com/fr/design/style/AlignmentPane.java

@ -16,8 +16,6 @@ import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.ComparatorUtils;
import com.fr.general.Inter;
import com.fr.plugin.ExtraClassManager;
import com.fr.report.fun.VerticalTextProcessor;
import com.fr.stable.CoreConstants;
import javax.swing.*;
@ -126,9 +124,6 @@ public class AlignmentPane extends BasicPane {
directionBG.add(rightToLeftRB);
rightToLeftRB.setSelected(true);
if (ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG) == null){
return;
}
isVerticalTextPanel.add(isVerticalTextCheckBox);
isVerticalTextPanel.add(leftToRightRB);
isVerticalTextPanel.add(rightToLeftRB);
@ -302,9 +297,6 @@ public class AlignmentPane extends BasicPane {
}
private void populateVertical(Style style){
if (ExtraClassManager.getInstance().getSingle(VerticalTextProcessor.XML_TAG) == null){
return;
}
this.isVerticalTextCheckBox.setSelected(true);
this.rotationSpinner.setEnabled(false);
if (style.getTextDirection() == Style.LEFT_TO_RIGHT) {

57
designer_chart/build.gradle

@ -0,0 +1,57 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
version='8.0'
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design"
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib"
jar{
baseName='fr-designer-chart'
}
sourceSets{
main{
java{
srcDirs=["${srcDir}/designer_chart/src"]
}
}
}
dependencies{
compile fileTree(dir:'../../',include:'**/*.jar')
compile fileTree(dir:libDir,include:'*.jar')
compile fileTree(dir:"${libDir}/jetty",include:'*.jar')
testCompile 'junit:junit:4.12'
}
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/designer_chart/src"){
exclude '**/*.java'
}
into 'build/classes/main'
}
}
//ѹËõÏîÄ¿ÖеÄjsÎļþ
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../lib',includes:'*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/designer_chart/src"){
include (name:'**/*.js')
}
}
}
jar.dependsOn compressJS

24
designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java

@ -58,7 +58,6 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
if (classManager == null) {
classManager = new ChartTypeInterfaceManager();
chartTypeInterfaces.clear();
classManager.readXMLFile();
}
return classManager;
}
@ -75,16 +74,15 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
GeneralContext.addPluginReadListener(new PluginReadListener() {
@Override
public void success() {
if (chartTypeInterfaces != null) {
readDefault();
//重新注册designModuleFactory
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption());
}
ChartTypeInterfaceManager.getInstance().readDefault();
//重新注册designModuleFactory
DesignModuleFactory.registerExtraWidgetOptions(initWidgetOption());
}
});
}
public static WidgetOption[] initWidgetOption(){
ChartInternationalNameContentBean[] typeName = ChartTypeManager.getInstance().getAllChartBaseNames();
ChartWidgetOption[] child = new ChartWidgetOption[typeName.length];
for (int i = 0; i < typeName.length; i++) {
@ -101,7 +99,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
private synchronized static void envChanged() {
chartTypeInterfaces.clear();
classManager = null;
}
private static void readDefault() {
@ -132,6 +130,12 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
}
}
public static void addChartTypeInterface(IndependentChartUIProvider provider, String plotID) {
if (chartTypeInterfaces != null && !chartTypeInterfaces.containsKey(plotID)) {
chartTypeInterfaces.put(plotID, provider);
}
}
/**
* 增加界面接口定义
*
@ -141,7 +145,7 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
public void addChartInterface(String className, String plotID, PluginSimplify simplify) {
if (StringUtils.isNotBlank(className)) {
try {
Class<?> clazz = loader.loadClass(className);
Class<?> clazz = Class.forName(className);
Authorize authorize = clazz.getAnnotation(Authorize.class);
if (authorize != null) {
PluginLicenseManager.getInstance().registerPaid(authorize, simplify);
@ -149,8 +153,8 @@ public class ChartTypeInterfaceManager extends XMLFileManager implements ExtraCh
IndependentChartUIProvider provider = (IndependentChartUIProvider) clazz.newInstance();
if (PluginCollector.getCollector().isError(provider, IndependentChartUIProvider.CURRENT_API_LEVEL, simplify.getPluginName()) || !containsChart(plotID)) {
PluginMessage.remindUpdate(className);
} else if (!chartTypeInterfaces.containsKey(plotID)) {
chartTypeInterfaces.put(plotID, provider);
} else {
ChartTypeInterfaceManager.getInstance().addChartTypeInterface(provider, plotID);
}
} catch (ClassNotFoundException e) {
FRLogger.getLogger().error("class not found:" + e.getMessage());

20
designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java

@ -4,7 +4,6 @@ import com.fr.base.chart.BaseChartCollection;
import com.fr.chart.chartattr.Bar2DPlot;
import com.fr.chart.chartattr.Chart;
import com.fr.chart.chartattr.ChartCollection;
import com.fr.chart.chartattr.ChartFactory;
import com.fr.chart.charttypes.ChartTypeManager;
import com.fr.chart.web.ChartHyperPoplink;
import com.fr.design.beans.BasicBeanPane;
@ -23,7 +22,7 @@ import com.fr.general.Inter;
import java.awt.*;
/**
* 类说明: 图表超链 -- 弹出 悬浮窗.
* 类说明: 图表超链 -- 弹出 悬浮窗.
* @author kunsnat E-mail:kunsnat@gmail.com
* @version 创建时间2011-12-28 上午10:41:39
*/
@ -32,7 +31,7 @@ public class ChartHyperPoplinkPane extends BasicBeanPane<ChartHyperPoplink> {
private UITextField itemNameTextField;
private ChartHyperEditPane hyperEditPane;
private ChartComponent chartComponent;
public ChartHyperPoplinkPane() {
this.setLayout(FRGUIPaneFactory.createM_BorderLayout());
@ -43,18 +42,17 @@ public class ChartHyperPoplinkPane extends BasicBeanPane<ChartHyperPoplink> {
hyperEditPane = new ChartHyperEditPane(getChartParaType(), getValueEditorPane(), getValueEditorPane());
this.add(hyperEditPane, BorderLayout.CENTER);
ChartCollection cc = createChartCollection();
ChartCollection cc = createChartCollection();
chartComponent = new ChartComponent();
chartComponent.setPreferredSize(new Dimension(220, 170));// 在单元格弹出时 需要调整保证属性表的大小.
chartComponent.setSupportEdit(false);
chartComponent.populate(cc);
this.add(chartComponent, BorderLayout.EAST);
hyperEditPane.populate(cc);
hyperEditPane.useChartComponent(chartComponent);
}
@ -75,7 +73,7 @@ public class ChartHyperPoplinkPane extends BasicBeanPane<ChartHyperPoplink> {
return cc;
}
protected int getChartParaType() {
protected int getChartParaType() {
return ParameterTableModel.CHART_NORMAL_USE;
}
@ -90,7 +88,7 @@ public class ChartHyperPoplinkPane extends BasicBeanPane<ChartHyperPoplink> {
protected boolean needRenamePane(){
return true;
}
@Override
protected String title4PopupWindow() {
return Inter.getLocText("FR-Chart-Pop_Chart");

1
designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java

@ -109,7 +109,6 @@ public class NormalChartDataPane extends DataContentsPane {
} else {
dataPane.populateBean(collection);
}
this.initAllListeners();
this.addAttributeChangeListener(listener);

1
designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java

@ -58,6 +58,7 @@ public class ChartLabelFontPane extends BasicScrollPane<Chart> {
}
cateTextAttrPane.populate(cateTextAttr);
categoryName.setSelected(meterPlot.isShowCateName());
cateTextAttrPane.setEnabled(meterPlot.isShowCateName());
}

65
designer_form/build.gradle

@ -0,0 +1,65 @@
apply plugin: 'java'
tasks.withType(JavaCompile){
options.encoding = 'UTF-8'
}
version='8.0'
def srcDir="${System.getenv()['JENKINS_HOME']}/workspace/design"
def libDir="${System.getenv()['JENKINS_HOME']}/workspace/lib"
jar{
baseName='fr-designer-report'
}
sourceSets{
main{
java{
srcDirs=["${srcDir}/designer/src",
"${srcDir}/designer_form/src"]
}
}
}
dependencies{
compile fileTree(dir:'../../',include:'**/*.jar')
compile fileTree(dir:libDir,include:'*.jar')
compile fileTree(dir:"${libDir}/jetty",include:'*.jar')
testCompile 'junit:junit:4.12'
}
task copyFile(type:Copy,dependsOn:compileJava){
copy{
from ("${srcDir}/designer/src"){
exclude '**/*.java'
}
from ("${srcDir}/designer_form/src")
into ('build/classes/main')
}
}
//ѹËõÏîÄ¿ÖеÄjsÎļþ
task compressJS{
ant.taskdef(name:'yuicompress',classname:'com.yahoo.platform.yui.compressor.YUICompressTask'){
classpath {
fileset(dir:'../../lib',includes:'*.jar')
}
}
ant.yuicompress(linebreak:"500",warn:"false", munge:"yes",preserveallsemicolons:"false", , charset:"utf-8",encoding:"utf-8",outputfolder:'build/classes/main'){
fileset (dir:"${srcDir}/designer/src"){
include (name:'**/*.js')
}
fileset (dir:"${srcDir}/designer_form/src"){
include (name:'**/*.js')
}
}
}
jar.dependsOn compressJS

21
designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java

@ -1,21 +0,0 @@
package com.fr.design.designer.beans.adapters.layout;
import com.fr.design.beans.GroupModel;
import com.fr.design.designer.creator.XLayoutContainer;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.BodyMobileLayoutPropertiesGroupModel;
public class FRBodyFitLayoutAdapter extends FRFitLayoutAdapter {
public FRBodyFitLayoutAdapter(XLayoutContainer container) {
super(container);
}
/**
* 返回布局自身属性方便一些特有设置在layout刷新时处理
*/
@Override
public GroupModel getLayoutProperties() {
XWFitLayout xfl = (XWFitLayout) container;
return new BodyMobileLayoutPropertiesGroupModel(xfl);
}
}

20
designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java

@ -1,20 +0,0 @@
package com.fr.design.designer.creator;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.designer.beans.adapters.layout.FRBodyFitLayoutAdapter;
import com.fr.form.ui.container.WFitLayout;
import java.awt.Dimension;
public class XWBodyFitLayout extends XWFitLayout {
public XWBodyFitLayout() {
this(new WFitLayout(), new Dimension());
}
public XWBodyFitLayout(WFitLayout widget, Dimension initSize) {
super(widget, initSize);
}
@Override
public LayoutAdapter getLayoutAdapter() {
return new FRBodyFitLayoutAdapter(this);
}
}

4
designer_form/src/com/fr/design/designer/creator/XWFitLayout.java

@ -51,7 +51,7 @@ public class XWFitLayout extends XLayoutContainer {
public XWFitLayout(WFitLayout widget, Dimension initSize) {
super(widget, initSize);
initPercent();
}
@ -1160,7 +1160,7 @@ public class XWFitLayout extends XLayoutContainer {
@Override
public WidgetPropertyUIProvider[] getWidgetPropertyUIProviders() {
return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(new XWBodyFitLayout())};
return new WidgetPropertyUIProvider[]{ new BodyMobilePropertyUI(this)};
}
}

63
designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java

@ -1,40 +1,39 @@
package com.fr.design.designer.properties;
import java.awt.event.MouseEvent;
import java.beans.IntrospectionException;
import java.util.ArrayList;
import javax.swing.JTable;
import javax.swing.table.TableColumn;
import javax.swing.table.TableModel;
import com.fr.design.beans.GroupModel;
import com.fr.base.FRContext;
import com.fr.design.designer.beans.events.DesignerEvent;
import com.fr.design.designer.creator.*;
import com.fr.design.form.util.XCreatorConstants;
import com.fr.design.gui.itable.AbstractPropertyTable;
import com.fr.design.gui.itable.PropertyGroup;
import com.fr.design.designer.beans.LayoutAdapter;
import com.fr.design.gui.xtable.ReportAppPropertyGroupModel;
import com.fr.design.mainframe.FormDesigner;
import com.fr.design.mainframe.WidgetPropertyPane;
import com.fr.design.mainframe.widget.editors.InChangeBooleanEditor;
import com.fr.general.Inter;
public class BodyAppRelayoutTable extends AbstractPropertyTable {
private XWBodyFitLayout xwBodyFitLayout;
private XCreator xCreator;
private FormDesigner designer;
public BodyAppRelayoutTable(XWBodyFitLayout xwBodyFitLayout) {
super();
setDesigner(xwBodyFitLayout);
public BodyAppRelayoutTable(XCreator xCreator) {
this.xCreator = xCreator;
}
public static ArrayList<PropertyGroup> getCreatorPropertyGroup(XCreator source) {
ArrayList<PropertyGroup> groups = new ArrayList<PropertyGroup>();
if (source instanceof XLayoutContainer) {
LayoutAdapter layoutAdapter = ((XLayoutContainer)source).getLayoutAdapter();
if(layoutAdapter != null){
GroupModel m = layoutAdapter.getLayoutProperties();
if (m != null) {
groups.add(new PropertyGroup(m));
}
}
}
return groups;
public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException {
CRPropertyDescriptor[] propertyTableEditor = {
new CRPropertyDescriptor("appRelayout", this.xCreator.toData().getClass()).setEditorClass(InChangeBooleanEditor.class)
.setI18NName(Inter.getLocText("FR-Designer-App_ReLayout"))
.putKeyValue(XCreatorConstants.PROPERTY_CATEGORY, Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"))
};
return propertyTableEditor;
}
/**
@ -43,20 +42,24 @@ public class BodyAppRelayoutTable extends AbstractPropertyTable {
*/
public void initPropertyGroups(Object source) {
groups = getCreatorPropertyGroup(xwBodyFitLayout);
this.designer = WidgetPropertyPane.getInstance().getEditingFormDesigner();
groups = new ArrayList<PropertyGroup>();
CRPropertyDescriptor[] propertyTableEditor = null;
try {
propertyTableEditor = supportedDescriptor();
}catch (IntrospectionException e) {
FRContext.getLogger().error(e.getMessage());
}
groups.add(new PropertyGroup(new ReportAppPropertyGroupModel(Inter.getLocText("FR-Designer-Layout_Adaptive_Layout"), xCreator, propertyTableEditor, designer)));
TableModel model = new BeanTableModel();
setModel(model);
this.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
TableColumn tc = this.getColumn(this.getColumnName(0));
tc.setPreferredWidth(30);
this.repaint();
}
private void setDesigner(XWBodyFitLayout xwBodyFitLayout) {
this.xwBodyFitLayout = xwBodyFitLayout;
}
/**
* 单元格tooltip
@ -78,6 +81,6 @@ public class BodyAppRelayoutTable extends AbstractPropertyTable {
* 待说明
*/
public void firePropertyEdit() {
designer.getEditListenerTable().fireCreatorModified(DesignerEvent.CREATOR_EDITED);
}
}

111
designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java

@ -1,111 +0,0 @@
package com.fr.design.designer.properties;
import com.fr.design.beans.GroupModel;
import com.fr.form.ui.container.WFitLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.mainframe.widget.editors.BooleanEditor;
import com.fr.design.mainframe.widget.editors.PropertyCellEditor;
import com.fr.general.Inter;
import javax.swing.*;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
import java.awt.*;
public class BodyMobileLayoutPropertiesGroupModel implements GroupModel {
private PropertyCellEditor reLayoutEditor;
private CheckBoxCellRenderer reLayoutrenderer;
private WFitLayout layout;
private XWFitLayout xfl;
public BodyMobileLayoutPropertiesGroupModel(XWFitLayout xfl) {
this.xfl = xfl;
this.layout = xfl.toData();
reLayoutrenderer = new CheckBoxCellRenderer();
reLayoutEditor = new PropertyCellEditor(new BooleanEditor());
}
@Override
public String getGroupName() {
return Inter.getLocText("FR-Designer-Layout_Adaptive_Layout");
}
@Override
public int getRowCount() {
return 1;
}
@Override
public TableCellRenderer getRenderer(int row) {
return reLayoutrenderer;
}
@Override
public TableCellEditor getEditor(int row) {
return reLayoutEditor;
}
@Override
public Object getValue(int row, int column) {
if (column == 0) {
return Inter.getLocText("FR-Designer-App_ReLayout");
}else {
return layout.getAppRelayout();
}
}
@Override
public boolean setValue(Object value, int row, int column) {
int state = 0;
boolean appRelayoutState = true;
if(value instanceof Integer) {
state = (Integer)value;
}else if (value instanceof Boolean) {
appRelayoutState = (boolean)value;
}
if (column == 0 || state < 0) {
return false;
} else {
layout.setAppRelayout(appRelayoutState);
return true;
}
}
/**
* 是否可编辑
* @param row
* @return
*/
@Override
public boolean isEditable(int row) {
return true;
}
private class CheckBoxCellRenderer extends UICheckBox implements TableCellRenderer {
public CheckBoxCellRenderer() {
super();
setOpaque(true);
}
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
if (value instanceof Boolean) {
setSelected(((Boolean) value).booleanValue());
setEnabled(table.isCellEditable(row, column));
if (isSelected) {
setBackground(table.getSelectionBackground());
setForeground(table.getSelectionForeground());
} else {
setForeground(table.getForeground());
setBackground(table.getBackground());
}
} else {
return null;
}
return this;
}
}
}

8
designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java

@ -1,7 +1,7 @@
package com.fr.design.designer.properties.mobile;
import com.fr.design.designer.creator.XCreator;
import com.fr.design.designer.creator.XWBodyFitLayout;
import com.fr.design.designer.creator.XWFitLayout;
import com.fr.design.designer.properties.BodyAppRelayoutTable;
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider;
import com.fr.design.gui.itable.AbstractPropertyTable;
@ -14,13 +14,13 @@ public class BodyMobilePropertyUI extends AbstractWidgetPropertyUIProvider {
private XCreator xCreator;
public BodyMobilePropertyUI(XWBodyFitLayout xWBodyFitLayout) {
this.xCreator = xWBodyFitLayout;
public BodyMobilePropertyUI(XWFitLayout xwFitLayout) {
this.xCreator = xwFitLayout;
}
@Override
public AbstractPropertyTable createWidgetAttrTable() {
return new BodyAppRelayoutTable((XWBodyFitLayout) xCreator);
return new BodyAppRelayoutTable(xCreator);
}
@Override

2
sonar-project.properties

@ -3,7 +3,7 @@ sonar.projectKey=finereport.design
# this is the name displayed in the SonarQube UI
sonar.projectName=finereport.design
sonar.projectVersion=1.0
sonar.branch=dev
sonar.branch=master
# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.

Loading…
Cancel
Save