diff --git a/designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java b/designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java index c56e6547f..2845ccece 100644 --- a/designer/src/com/fr/design/mainframe/bbs/BBSLoginDialog.java +++ b/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; } diff --git a/designer/src/com/fr/design/module/DesignerModule.java b/designer/src/com/fr/design/module/DesignerModule.java index 8ed444c19..13dc722dc 100644 --- a/designer/src/com/fr/design/module/DesignerModule.java +++ b/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()); + } + }); + } + /** * 启动设计器模块 */ diff --git a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java index 156af0f96..3dfea6c15 100644 --- a/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java +++ b/designer/src/com/fr/design/write/submit/SubmitVisitorListPane.java @@ -173,10 +173,9 @@ public class SubmitVisitorListPane extends ObjectJControlPane { comboItemsMap = new HashMap<>(); Set 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; diff --git a/designer_base/build.gradle b/designer_base/build.gradle new file mode 100644 index 000000000..319cc17f2 --- /dev/null +++ b/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 + + + diff --git a/designer_base/src/com/fr/design/beans/BasicBeanPane.java b/designer_base/src/com/fr/design/beans/BasicBeanPane.java index 6648bf786..2a8adfe19 100644 --- a/designer_base/src/com/fr/design/beans/BasicBeanPane.java +++ b/designer_base/src/com/fr/design/beans/BasicBeanPane.java @@ -8,6 +8,7 @@ import com.fr.design.dialog.BasicPane; public abstract class BasicBeanPane extends BasicPane { + /** * Populate. */ diff --git a/designer_base/src/com/fr/design/beans/location/Absorptionline.java b/designer_base/src/com/fr/design/beans/location/Absorptionline.java index a0ff0d0e4..189c7e046 100644 --- a/designer_base/src/com/fr/design/beans/location/Absorptionline.java +++ b/designer_base/src/com/fr/design/beans/location/Absorptionline.java @@ -14,6 +14,7 @@ public class Absorptionline { // 2.(x,y)(x±2根号3,y-2)(x±2根号3,y+2) private static int RECTANGLE_OFFSET_X = 2; private static int RECTANGLE_OFFSET_Y = 3; + private static int WIDGET_DISTANCE_MIN = 8; //控件周围八个拖拽框的大小 private static int RESIZE_BOX_SIZE = 5; @@ -238,114 +239,155 @@ public class Absorptionline { //朝向上方的等距线 private void paintTopEquidistantLine(Graphics g){ - int x1[] = { + int x[] = { equidistantStart.x + equidistantStart.width / 2, equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X }; - int y1[] = { - top, - top + RECTANGLE_OFFSET_Y, - top + RECTANGLE_OFFSET_Y - }; - int x2[] = { - equidistantStart.x + equidistantStart.width / 2, - equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, - equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X - }; - int y2[] = { - equidistantStart.y - RESIZE_BOX_SIZE, - equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, - equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] y1, y2; + if (equidistantStart.y - top > WIDGET_DISTANCE_MIN) { + y1 = new int[] { + top, + top + RECTANGLE_OFFSET_Y, + top + RECTANGLE_OFFSET_Y + }; + y2 = new int[]{ + equidistantStart.y - RESIZE_BOX_SIZE, + equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, + equidistantStart.y - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y + }; + } + else{ + y1 = new int[] { + top, + top - RECTANGLE_OFFSET_Y, + top - RECTANGLE_OFFSET_Y + }; + y2 = new int[] { + equidistantStart.y, + equidistantStart.y + RECTANGLE_OFFSET_Y, + equidistantStart.y + RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x, y1, 3); + g.fillPolygon(x, y2, 3); GraphHelper.drawLine(g, equidistantStart.x + equidistantStart.width / 2, top, equidistantStart.x + equidistantStart.width / 2, equidistantStart.y - RESIZE_BOX_SIZE); } //朝向左侧的等距线 private void paintLeftEquidistantLine(Graphics g){ - int x1[] = { - left, - left + RECTANGLE_OFFSET_Y, - left + RECTANGLE_OFFSET_Y, - }; - int y1[] = { + int y[] = { equidistantStart.y + equidistantStart.height / 2, equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, }; - int x2[] = { - equidistantStart.x - RESIZE_BOX_SIZE, - equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, - equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y - }; - int y2[] = { - equidistantStart.y + equidistantStart.height / 2, - equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, - equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] x1, x2; + if (equidistantStart.x - left > WIDGET_DISTANCE_MIN) { + x1 = new int[] { + left, + left + RECTANGLE_OFFSET_Y, + left + RECTANGLE_OFFSET_Y, + }; + + x2 = new int[] { + equidistantStart.x - RESIZE_BOX_SIZE, + equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y, + equidistantStart.x - RESIZE_BOX_SIZE - RECTANGLE_OFFSET_Y + }; + } + else{ + x1 = new int[] { + left, + left - RECTANGLE_OFFSET_Y, + left - RECTANGLE_OFFSET_Y, + }; + x2 = new int[] { + equidistantStart.x, + equidistantStart.x + RECTANGLE_OFFSET_Y, + equidistantStart.x + RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x1, y, 3); + g.fillPolygon(x2, y, 3); GraphHelper.drawLine(g, left, equidistantStart.y + equidistantStart.height / 2, - equidistantStart.x - RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2); + equidistantStart.x, equidistantStart.y + equidistantStart.height / 2); } //朝向下方的等距线 private void paintBottomEquidistantLine(Graphics g) { - int x1[] = { + int x[] = { equidistantStart.x + equidistantStart.width / 2, equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X, }; - int y1[] = { - equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, - equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, - equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, - }; - int x2[] = { - equidistantStart.x + equidistantStart.width / 2, - equidistantStart.x + equidistantStart.width / 2 + RECTANGLE_OFFSET_X, - equidistantStart.x + equidistantStart.width / 2 - RECTANGLE_OFFSET_X - }; - int y2[] = { - bottom, - bottom - RECTANGLE_OFFSET_Y, - bottom - RECTANGLE_OFFSET_Y - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] y1, y2; + if (bottom - equidistantStart.y + equidistantStart.height > WIDGET_DISTANCE_MIN) { + y1 = new int[] { + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + }; + y2 = new int[] { + bottom, + bottom - RECTANGLE_OFFSET_Y, + bottom - RECTANGLE_OFFSET_Y + }; + } + else{ + y1 = new int[] { + equidistantStart.y + equidistantStart.height, + equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y, + equidistantStart.y + equidistantStart.height - RECTANGLE_OFFSET_Y, + }; + y2 = new int[] { + bottom, + bottom + RECTANGLE_OFFSET_Y, + bottom + RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x, y1, 3); + g.fillPolygon(x, y2, 3); GraphHelper.drawLine(g, - equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height + RESIZE_BOX_SIZE, + equidistantStart.x + equidistantStart.width / 2, equidistantStart.y + equidistantStart.height, equidistantStart.x + equidistantStart.width / 2, bottom); } //朝向右侧的等距线 private void paintRightEquidistantLine(Graphics g){ - int x1[] = { - right, - right - 3, - right - 3 - }; - int y1[] = { + int y[] = { equidistantStart.y + equidistantStart.height / 2, equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X }; - int x2[] = { - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y - }; - int y2[] = { - equidistantStart.y + equidistantStart.height / 2, - equidistantStart.y + equidistantStart.height / 2 - RECTANGLE_OFFSET_X, - equidistantStart.y + equidistantStart.height / 2 + RECTANGLE_OFFSET_X, - }; - g.fillPolygon(x1, y1, 3); - g.fillPolygon(x2, y2, 3); + int[] x1, x2; + if(right - equidistantStart.x > WIDGET_DISTANCE_MIN) { + x1 = new int[]{ + right, + right - RECTANGLE_OFFSET_Y, + right - RECTANGLE_OFFSET_Y + }; + x2 = new int[]{ + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y, + equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE + RECTANGLE_OFFSET_Y + }; + } + else{ + x1 = new int[]{ + right, + right + RECTANGLE_OFFSET_Y, + right + RECTANGLE_OFFSET_Y + }; + x2 = new int[]{ + equidistantStart.x + equidistantStart.width, + equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y, + equidistantStart.x + equidistantStart.width - RECTANGLE_OFFSET_Y + }; + } + g.fillPolygon(x1, y, 3); + g.fillPolygon(x2, y, 3); GraphHelper.drawLine(g, - equidistantStart.x + equidistantStart.width + RESIZE_BOX_SIZE, equidistantStart.y + equidistantStart.height / 2, + equidistantStart.x + equidistantStart.width, equidistantStart.y + equidistantStart.height / 2, right, equidistantStart.y + equidistantStart.height / 2); } } \ No newline at end of file diff --git a/designer_base/src/com/fr/design/beans/location/MoveUtils.java b/designer_base/src/com/fr/design/beans/location/MoveUtils.java index e0bed7ca1..18c282cdc 100644 --- a/designer_base/src/com/fr/design/beans/location/MoveUtils.java +++ b/designer_base/src/com/fr/design/beans/location/MoveUtils.java @@ -468,6 +468,7 @@ public class MoveUtils { equidistantLines.add(equidistantLines1[0]); equidistantLines.add(equidistantLines1[2]); pEquidistantY.palce = operatingRectangle.y - offset / 2; + operatingRectangle.y = pEquidistantY.palce; } } if (equidistantLines1[1] != null && equidistantLines1[3] != null){//left, right @@ -477,6 +478,7 @@ public class MoveUtils { equidistantLines.add(equidistantLines1[1]); equidistantLines.add(equidistantLines1[3]); pEquidistantX.palce = operatingRectangle.x - offset / 2; + operatingRectangle.x = pEquidistantX.palce; } } } diff --git a/designer_base/src/com/fr/design/extra/PluginManagerPane.java b/designer_base/src/com/fr/design/extra/PluginManagerPane.java index 36948fe36..64ceea369 100644 --- a/designer_base/src/com/fr/design/extra/PluginManagerPane.java +++ b/designer_base/src/com/fr/design/extra/PluginManagerPane.java @@ -67,6 +67,16 @@ public class PluginManagerPane extends BasicPane { } } + /** + * 以关键词打开设计器商店 + * + * @param keyword 关键词 + */ + public PluginManagerPane(String keyword) { + this(); + PluginWebBridge.getHelper().openWithSearch(keyword); + } + private void addPane(String installHome) { PluginWebPane webPane = new PluginWebPane(new File(installHome).getAbsolutePath()); add(webPane, BorderLayout.CENTER); diff --git a/designer_base/src/com/fr/design/extra/PluginWebBridge.java b/designer_base/src/com/fr/design/extra/PluginWebBridge.java index 156627b6b..144f913da 100644 --- a/designer_base/src/com/fr/design/extra/PluginWebBridge.java +++ b/designer_base/src/com/fr/design/extra/PluginWebBridge.java @@ -6,7 +6,6 @@ import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.*; import com.fr.general.FRLogger; import com.fr.general.Inter; -import com.fr.general.SiteCenter; import com.fr.plugin.Plugin; import com.fr.plugin.PluginLicense; import com.fr.plugin.PluginLicenseManager; @@ -18,13 +17,14 @@ import javafx.scene.web.WebEngine; import javafx.stage.FileChooser; import javafx.stage.Stage; import netscape.javascript.JSObject; +import org.json.JSONObject; import javax.swing.*; import java.awt.*; import java.io.File; import java.io.IOException; import java.net.URI; -import java.util.ArrayList; +import java.util.*; import java.util.List; /** @@ -35,6 +35,26 @@ public class PluginWebBridge { private static PluginWebBridge helper; private UIDialog uiDialog; + private ACTIONS action; + private String ACTION = "action"; + private String KEYWORD = "keyword"; + private Map config; + + /** + * 动作枚举 + */ + public enum ACTIONS { + SEARCH("search"); + private String context; + + ACTIONS(String context) { + this.context = context; + } + + public String getContext() { + return context; + } + } public static PluginWebBridge getHelper() { if (helper != null) { @@ -59,6 +79,54 @@ public class PluginWebBridge { private PluginWebBridge() { } + /** + * 获取打开动作配置 + * + * @return 配置信息 + */ + public String getRunConfig() { + if (action != null) { + JSONObject jsonObject = new JSONObject(); + jsonObject.put(ACTION, action.getContext()); + Set keySet = config.keySet(); + for (String key : keySet) { + jsonObject.put(key, config.get(key).toString()); + } + return jsonObject.toString(); + } + return StringUtils.EMPTY; + } + + /** + * 配置打开动作 + * + * @param action 动作 + * @param config 参数 + */ + public void setRunConfig(ACTIONS action, Map config) { + this.action = action; + this.config = config; + } + + /** + * 清楚打开动作 + */ + public void clearRunConfig() { + this.action = null; + this.config = null; + } + + /** + * 打开时搜索 + * + * @param keyword 关键词 + */ + public void openWithSearch(String keyword) { + HashMap map = new HashMap(2); + map.put(KEYWORD, keyword); + setRunConfig(ACTIONS.SEARCH, map); + } + public void setEngine(WebEngine webEngine) { this.webEngine = webEngine; } @@ -203,7 +271,7 @@ public class PluginWebBridge { * * @return 已安装的插件授权对象 */ - public PluginLicense getPluginLicenseByID(String pluginID ) { + public PluginLicense getPluginLicenseByID(String pluginID) { return PluginLicenseManager.getInstance().getPluginLicenseByID(pluginID); } @@ -296,7 +364,7 @@ public class PluginWebBridge { /** * 在本地浏览器里打开url * tips:重载的时候,需要给js调用的方法需要放在前面,否则可能不会被调用(此乃坑) - * 所以最好的是不要重载在js可以访问的接口文件中 + * 所以最好的是不要重载在js可以访问的接口文件中 * * @param url 要打开的地址 */ diff --git a/designer_base/src/com/fr/design/gui/style/AlignmentPane.java b/designer_base/src/com/fr/design/gui/style/AlignmentPane.java index 413ad70a4..aff23e952 100644 --- a/designer_base/src/com/fr/design/gui/style/AlignmentPane.java +++ b/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 selectOption = new ArrayList(); 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); diff --git a/designer_base/src/com/fr/design/style/AlignmentPane.java b/designer_base/src/com/fr/design/style/AlignmentPane.java index d95d4bcea..0cae29707 100644 --- a/designer_base/src/com/fr/design/style/AlignmentPane.java +++ b/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) { diff --git a/designer_chart/build.gradle b/designer_chart/build.gradle new file mode 100644 index 000000000..2a667bf82 --- /dev/null +++ b/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 + diff --git a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java b/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java index 500ece8b4..3144ca1d9 100644 --- a/designer_chart/src/com/fr/design/ChartTypeInterfaceManager.java +++ b/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()); diff --git a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java b/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java index 252e0b751..fdcda38b2 100644 --- a/designer_chart/src/com/fr/design/chart/series/SeriesCondition/impl/ChartHyperPoplinkPane.java +++ b/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 { 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 { 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 { return cc; } - protected int getChartParaType() { + protected int getChartParaType() { return ParameterTableModel.CHART_NORMAL_USE; } @@ -90,7 +88,7 @@ public class ChartHyperPoplinkPane extends BasicBeanPane { protected boolean needRenamePane(){ return true; } - + @Override protected String title4PopupWindow() { return Inter.getLocText("FR-Chart-Pop_Chart"); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java index 7c60161f4..bf64e4957 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/data/NormalChartDataPane.java +++ b/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); diff --git a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java index 2416e3a61..e0919c235 100644 --- a/designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java +++ b/designer_chart/src/com/fr/design/mainframe/chart/gui/style/datalabel/ChartLabelFontPane.java @@ -58,6 +58,7 @@ public class ChartLabelFontPane extends BasicScrollPane { } cateTextAttrPane.populate(cateTextAttr); categoryName.setSelected(meterPlot.isShowCateName()); + cateTextAttrPane.setEnabled(meterPlot.isShowCateName()); } diff --git a/designer_form/build.gradle b/designer_form/build.gradle new file mode 100644 index 000000000..1a87cbf95 --- /dev/null +++ b/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 + diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java index 8ce0d0529..2847cd8c0 100644 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java +++ b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRAbsoluteLayoutAdapter.java @@ -2,14 +2,14 @@ package com.fr.design.designer.beans.adapters.layout; import java.awt.*; +import com.fr.design.beans.GroupModel; import com.fr.design.designer.beans.ConstraintsGroupModel; import com.fr.design.designer.beans.HoverPainter; import com.fr.design.designer.beans.painters.FRAbsoluteLayoutPainter; -import com.fr.design.designer.creator.XCreator; -import com.fr.design.designer.creator.XCreatorUtils; -import com.fr.design.designer.creator.XLayoutContainer; -import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.designer.creator.*; import com.fr.design.designer.properties.BoundsGroupModel; +import com.fr.design.designer.properties.FRAbsoluteLayoutPropertiesGroupModel; +import com.fr.design.designer.properties.FRFitLayoutPropertiesGroupModel; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.design.utils.ComponentUtils; import com.fr.design.utils.gui.LayoutUtils; @@ -112,4 +112,10 @@ public class FRAbsoluteLayoutAdapter extends AbstractLayoutAdapter { public ConstraintsGroupModel getLayoutConstraints(XCreator creator) { return new BoundsGroupModel((XWAbsoluteLayout)container, creator); } + + @Override + public GroupModel getLayoutProperties() { + XWAbsoluteLayout xwAbsoluteLayout = (XWAbsoluteLayout) container; + return new FRAbsoluteLayoutPropertiesGroupModel(xwAbsoluteLayout); + } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java b/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java deleted file mode 100644 index 0dc00045b..000000000 --- a/designer_form/src/com/fr/design/designer/beans/adapters/layout/FRBodyFitLayoutAdapter.java +++ /dev/null @@ -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); - } -} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java index 46e1c42c2..b729ce049 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java +++ b/designer_form/src/com/fr/design/designer/creator/XWAbsoluteLayout.java @@ -7,6 +7,7 @@ import java.awt.*; import java.awt.event.ContainerEvent; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; +import java.beans.IntrospectionException; import java.util.HashMap; import com.fr.design.designer.beans.AdapterBus; @@ -17,15 +18,21 @@ import com.fr.design.designer.beans.adapters.layout.FRAbsoluteLayoutAdapter; import com.fr.design.designer.beans.location.Direction; import com.fr.design.designer.beans.models.SelectionModel; import com.fr.design.form.layout.FRAbsoluteLayout; +import com.fr.design.form.util.XCreatorConstants; import com.fr.design.icon.IconPathConstants; import com.fr.design.mainframe.EditingMouseListener; import com.fr.design.mainframe.FormDesigner; +import com.fr.design.mainframe.widget.editors.PaddingMarginEditor; +import com.fr.design.mainframe.widget.editors.WLayoutBorderStyleEditor; +import com.fr.design.mainframe.widget.renderer.LayoutBorderStyleRenderer; +import com.fr.design.mainframe.widget.renderer.PaddingMarginCellRenderer; import com.fr.form.ui.Connector; import com.fr.form.ui.Widget; import com.fr.form.ui.container.WAbsoluteLayout; import com.fr.form.ui.container.WAbsoluteLayout.BoundsWidget; import com.fr.general.IOUtils; import com.fr.general.Inter; +import com.fr.stable.core.PropertyChangeAdapter; /** * @author richer @@ -105,7 +112,17 @@ public class XWAbsoluteLayout extends XLayoutContainer { protected void initLayoutManager() { this.setLayout(new FRAbsoluteLayout()); } - + + /** + * 是否支持标题样式 + * + * @return 默认false + */ + @Override + public boolean hasTitleStyle() { + return false; + } + @Override public void paintComponent(Graphics g) { super.paintComponent(g); @@ -211,6 +228,18 @@ public class XWAbsoluteLayout extends XLayoutContainer { } } + /** + * 得到属性名 + * @return 属性名 + * @throws java.beans.IntrospectionException + */ + public CRPropertyDescriptor[] supportedDescriptor() throws IntrospectionException { + return new CRPropertyDescriptor[] { + new CRPropertyDescriptor("widgetName", this.data.getClass()).setI18NName( + Inter.getLocText("FR-Designer_Form-Widget_Name")) + }; + } + public void paint(Graphics g) { super.paint(g); //如果鼠标移动到布局内且布局不可编辑,画出编辑蒙层 diff --git a/designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java deleted file mode 100644 index d9a404cb5..000000000 --- a/designer_form/src/com/fr/design/designer/creator/XWBodyFitLayout.java +++ /dev/null @@ -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); - } -} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java b/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java index 489aab52b..a67e7c878 100644 --- a/designer_form/src/com/fr/design/designer/creator/XWFitLayout.java +++ b/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)}; } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java new file mode 100644 index 000000000..4cc770eec --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateRenderer.java @@ -0,0 +1,12 @@ +package com.fr.design.designer.properties; + +import com.fr.design.mainframe.widget.renderer.EncoderCellRenderer; + +/** + * Created by zhouping on 2016/8/1. + */ +public class AbsoluteStateRenderer extends EncoderCellRenderer { + public AbsoluteStateRenderer() { + super(new AbsoluteStateWrapper()); + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java new file mode 100644 index 000000000..3a07be8a7 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/AbsoluteStateWrapper.java @@ -0,0 +1,12 @@ +package com.fr.design.designer.properties; + +import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; + +/** + * Created by zhouping on 2016/8/1. + */ +public class AbsoluteStateWrapper extends ItemWrapper{ + public AbsoluteStateWrapper() { + super(new FRAbsoluteConstraintsItems()); + } +} diff --git a/designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java b/designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java index e675a81f0..6c10884a4 100644 --- a/designer_form/src/com/fr/design/designer/properties/BodyAppRelayoutTable.java +++ b/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 getCreatorPropertyGroup(XCreator source) { - ArrayList groups = new ArrayList(); - 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(); + 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); } } \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java deleted file mode 100644 index 7ec437662..000000000 --- a/designer_form/src/com/fr/design/designer/properties/BodyMobileLayoutPropertiesGroupModel.java +++ /dev/null @@ -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; - } - } -} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java new file mode 100644 index 000000000..fc9c0985c --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/FRAbsoluteLayoutPropertiesGroupModel.java @@ -0,0 +1,94 @@ +package com.fr.design.designer.properties; + +import com.fr.design.beans.GroupModel; +import com.fr.design.designer.creator.XWAbsoluteLayout; +import com.fr.design.mainframe.widget.editors.AbsoluteLayoutDirectionEditor; +import com.fr.design.mainframe.widget.editors.IntegerPropertyEditor; +import com.fr.design.mainframe.widget.editors.PropertyCellEditor; +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.general.Inter; + +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; + +/** + * Created by zhouping on 2016/8/1. + */ +public class FRAbsoluteLayoutPropertiesGroupModel implements GroupModel { + + private PropertyCellEditor editor; + private DefaultTableCellRenderer renderer; + private AbsoluteLayoutDirectionEditor stateEditor; + private AbsoluteStateRenderer stateRenderer; + private WAbsoluteLayout layout; + private XWAbsoluteLayout xwAbsoluteLayout; + + public FRAbsoluteLayoutPropertiesGroupModel(XWAbsoluteLayout xwAbsoluteLayout){ + this.xwAbsoluteLayout = xwAbsoluteLayout; + this.layout = xwAbsoluteLayout.toData(); + renderer = new DefaultTableCellRenderer(); + editor = new PropertyCellEditor(new IntegerPropertyEditor()); + stateEditor = new AbsoluteLayoutDirectionEditor(); + stateRenderer = new AbsoluteStateRenderer(); + } + + /** + * 布局管理器自己的属性 + */ + @Override + public String getGroupName() { + return Inter.getLocText("FR-Designer-Widget_Area_Scaling"); + } + + @Override + public int getRowCount() { + return 1; + } + + @Override + public TableCellRenderer getRenderer(int row) { + return stateRenderer; + } + + @Override + public TableCellEditor getEditor(int row) { + return stateEditor; + } + + @Override + public Object getValue(int row, int column) { + if (column == 0) { + return Inter.getLocText("FR-Designer-Widget_Scaling_Mode"); + } else { + return layout.getCompState(); + } + } + + @Override + public boolean setValue(Object value, int row, int column) { + int state = 0; + if(value instanceof Integer) { + state = (Integer)value; + } + if (column == 0 || state < 0) { + return false; + } else { + if (row == 0) { + layout.setCompState(state); + return true; + } + return false; + } + } + + /** + * 是否可编辑 + * @param row 行 + * @return 否 + */ + @Override + public boolean isEditable(int row) { + return true; + } +} diff --git a/designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java b/designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java new file mode 100644 index 000000000..5b46b8956 --- /dev/null +++ b/designer_form/src/com/fr/design/designer/properties/items/FRAbsoluteConstraintsItems.java @@ -0,0 +1,19 @@ +package com.fr.design.designer.properties.items; + +import com.fr.form.ui.container.WAbsoluteLayout; +import com.fr.general.Inter; + +/** + * Created by zhouping on 2016/8/1. + */ +public class FRAbsoluteConstraintsItems implements ItemProvider{ + + public static final Item[] ITEMS = new Item[] { + new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fit"), WAbsoluteLayout.STATE_FIT), + new Item(Inter.getLocText("FR-Designer_Widget_Scaling_Mode_Fixed"), WAbsoluteLayout.STATE_FIXED) + }; + + public Item[] getItems() { + return ITEMS; + } +} \ No newline at end of file diff --git a/designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java b/designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java index 3816b9841..a64de4158 100644 --- a/designer_form/src/com/fr/design/designer/properties/mobile/BodyMobilePropertyUI.java +++ b/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 diff --git a/designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java b/designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java new file mode 100644 index 000000000..2998cfdbf --- /dev/null +++ b/designer_form/src/com/fr/design/mainframe/widget/editors/AbsoluteLayoutDirectionEditor.java @@ -0,0 +1,13 @@ +package com.fr.design.mainframe.widget.editors; + +import com.fr.design.designer.properties.EnumerationEditor; +import com.fr.design.designer.properties.items.FRAbsoluteConstraintsItems; + +/** + * Created by zhouping on 2016/8/1. + */ +public class AbsoluteLayoutDirectionEditor extends EnumerationEditor { + public AbsoluteLayoutDirectionEditor() { + super(new FRAbsoluteConstraintsItems()); + } +} diff --git a/sonar-project.properties b/sonar-project.properties index 05253b02f..f3ad57a2d 100644 --- a/sonar-project.properties +++ b/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.