diff --git a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java index bd464d77e0..dcc588fa35 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -182,6 +182,8 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { public static DesignerEnvManager getEnvManager(boolean needCheckEnv) { if (designerEnvManager == null) { designerEnvManager = new DesignerEnvManager(); + //REPORT-15332有一个国际化调用比较早,需要在这边就设置好locale,由于后台GeneralContext默认是China + GeneralContext.setLocale(designerEnvManager.getLanguage()); try { XMLTools.readFileXML(designerEnvManager, designerEnvManager.getDesignerEnvFile()); } catch (Exception e) { diff --git a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java index 9293500812..9775de2f5f 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/PreferencePane.java @@ -2,6 +2,7 @@ package com.fr.design.actions.file; import com.fr.base.BaseUtils; import com.fr.config.Configuration; +import com.fr.config.ServerPreferenceConfig; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; import com.fr.design.dialog.BasicDialog; @@ -136,6 +137,7 @@ public class PreferencePane extends BasicPane { private UICheckBox oracleSpace; private UISpinner cachingTemplateSpinner; private UICheckBox openDebugComboBox; + private UICheckBox useOptimizedUPMCheckbox; private UICheckBox joinProductImproveCheckBox; private UICheckBox autoPushUpdateCheckBox; @@ -190,6 +192,11 @@ public class PreferencePane extends BasicPane { debuggerPane.add(openDebugComboBox, BorderLayout.CENTER); advancePane.add(debuggerPane); + JPanel upmSelectorPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager")); + useOptimizedUPMCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Use_New_Update_Plugin_Manager")); + upmSelectorPane.add(useOptimizedUPMCheckbox); + advancePane.add(upmSelectorPane); + JPanel improvePane = FRGUIPaneFactory.createVerticalTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Product_Improve")); joinProductImproveCheckBox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Join_Product_Improve")); improvePane.add(joinProductImproveCheckBox); @@ -630,6 +637,7 @@ public class PreferencePane extends BasicPane { this.portEditor.setValue(new Integer(designerEnvManager.getEmbedServerPort())); openDebugComboBox.setSelected(designerEnvManager.isOpenDebug()); + useOptimizedUPMCheckbox.setSelected(ServerPreferenceConfig.getInstance().isUseOptimizedUPM()); this.oracleSpace.setSelected(designerEnvManager.isOracleSystemSpace()); this.cachingTemplateSpinner.setValue(designerEnvManager.getCachingTemplateLimit()); @@ -725,6 +733,18 @@ public class PreferencePane extends BasicPane { } }); + Configurations.update(new Worker() { + @Override + public void run() { + ServerPreferenceConfig.getInstance().setUseOptimizedUPM(useOptimizedUPMCheckbox.isSelected()); + } + + @Override + public Class[] targets() { + return new Class[] {ServerPreferenceConfig.class}; + } + }); + } diff --git a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java index 536fc87ee5..17d19aab71 100644 --- a/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java @@ -1,7 +1,7 @@ package com.fr.design.actions.file.export; -import com.fr.base.vcs.DesignerMode; import com.fr.design.actions.JTemplateAction; +import com.fr.design.base.mode.DesignModeContext; import com.fr.design.gui.iprogressbar.FRProgressBar; import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.DesignerContext; @@ -9,6 +9,7 @@ import com.fr.design.mainframe.JTemplate; import com.fr.exception.RemoteDesignPermissionDeniedException; import com.fr.file.FILE; import com.fr.file.FILEChooserPane; +import com.fr.file.RenameExportFILE; import com.fr.file.filter.ChooseFileFilter; import com.fr.io.exporter.DesignExportType; import com.fr.io.exporter.ExporterKey; @@ -92,12 +93,17 @@ public abstract class AbstractExportAction> extends JT int saveValue = fileChooserPane.showSaveDialog(DesignerContext.getDesignerFrame(), "." + this.getDefaultExtension()); if (saveValue == FILEChooserPane.JOPTIONPANE_OK_OPTION || saveValue == FILEChooserPane.OK_OPTION) { FILE target = fileChooserPane.getSelectedFILE(); + //rename 方式导出 + target = RenameExportFILE.create(target); try { target.mkfile(); } catch (Exception exp) { FineLoggerFactory.getLogger().error("Error In Make New File", exp); } - FineLoggerFactory.getLogger().info("\"" + target.getName() + "\"" + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!"); + FineLoggerFactory.getLogger().info( + "\"" + RenameExportFILE.recoverFileName(target.getName()) + "\"" + + Toolkit.i18nText("Fine-Design_Report_Prepare_Export") + "!" + ); progressbar = new FRProgressBar( createExportWork(getSource(), target, para), @@ -124,7 +130,7 @@ public abstract class AbstractExportAction> extends JT private boolean processNotSaved() { //当前编辑的模板 E e = getEditingComponent(); - if (!e.isALLSaved() && !DesignerMode.isVcsMode()) { + if (!e.isALLSaved() && !DesignModeContext.isVcsMode()) { e.stopEditing(); int returnVal = JOptionPane.showConfirmDialog( DesignerContext.getDesignerFrame(), @@ -149,7 +155,7 @@ public abstract class AbstractExportAction> extends JT private SwingWorker createExportWork(final FILE source, final FILE target, final Map parameterMap) { final String path = source.getPath(); - final String name = target.getName(); + final String name = RenameExportFILE.recoverFileName(target.getName()); return new SwingWorker() { @@ -162,7 +168,6 @@ public abstract class AbstractExportAction> extends JT dealExporter(outputStream, path, parameterMap); this.setProgress(80); outputStream.flush(); - outputStream.close(); this.setProgress(100); FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!"); diff --git a/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java b/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java new file mode 100644 index 0000000000..4b09de8562 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/actions/help/FineUIAction.java @@ -0,0 +1,67 @@ +package com.fr.design.actions.help; + +import com.fr.design.actions.UpdateAction; +import com.fr.design.dialog.BasicDialog; +import com.fr.design.dialog.DialogActionAdapter; +import com.fr.design.mainframe.DesignerContext; +import com.fr.design.ui.ModernUIPane; +import com.fr.locale.InterProviderFactory; +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.Atom; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.impl.FineUI; + +import java.awt.event.ActionEvent; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-03-08 + */ +public class FineUIAction extends UpdateAction { + + public FineUIAction() { + setName("FineUI"); + } + + @Override + public void actionPerformed(final ActionEvent e) { + ModernUIPane pane = new ModernUIPane.Builder<>() +// .prepare(new ScriptContextAdapter() { +// @Override +// public void onScriptContextCreated(ScriptContextEvent event) { +// JSValue pool = event.getBrowser().executeJavaScriptAndReturnValue("window.Pool"); +// pool.asObject().setProperty("i18n", new I18n()); +// } +// }) + .withComponent(new AssembleComponent() { + + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("/com/fr/design/ui/help/demo.js"); + } + + @Override + public Atom[] refer() { + return new Atom[] {FineUI.KEY}; + } + }) + .build(); + BasicDialog dialog = pane.showLargeWindow(DesignerContext.getDesignerFrame(), new DialogActionAdapter() { + @Override + public void doOk() { + + } + }); + dialog.setVisible(true); + + } + + public static class I18n { + + public String i18nText(String key) { + return InterProviderFactory.getProvider().getLocText(key); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java index ecd0d961a1..1b7d7bbc47 100644 --- a/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java +++ b/designer-base/src/main/java/com/fr/design/actions/server/PluginManagerAction.java @@ -1,10 +1,11 @@ package com.fr.design.actions.server; -import com.fr.base.BaseUtils; +import com.fr.config.ServerPreferenceConfig; import com.fr.design.actions.UpdateAction; import com.fr.design.extra.WebViewDlgHelper; import com.fr.design.menu.MenuKeySet; - +import com.fr.design.upm.UpmFinder; +import com.fr.general.IOUtils; import javax.swing.*; import java.awt.event.ActionEvent; @@ -20,12 +21,17 @@ public class PluginManagerAction extends UpdateAction { this.setMenuKeySet(PLUGIN_MANAGER); this.setName(getMenuKeySet().getMenuKeySetName()); this.setMnemonic(getMenuKeySet().getMnemonic()); - this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/server/plugin.png")); + this.setSmallIcon(IOUtils.readIcon("/com/fr/design/images/server/plugin.png")); } @Override public void actionPerformed(ActionEvent e) { - WebViewDlgHelper.createPluginDialog(); + // 可以启用新版本的插件商店(使用JxBrowser作为容器) + if (ServerPreferenceConfig.getInstance().isUseOptimizedUPM()) { + UpmFinder.showUPMDialog(); + } else { + WebViewDlgHelper.createPluginDialog(); + } } public static final MenuKeySet PLUGIN_MANAGER = new MenuKeySet() { diff --git a/designer-base/src/main/java/com/fr/design/bridge/exec/JSBridge.java b/designer-base/src/main/java/com/fr/design/bridge/exec/JSBridge.java new file mode 100644 index 0000000000..4c79952436 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/bridge/exec/JSBridge.java @@ -0,0 +1,17 @@ +package com.fr.design.bridge.exec; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + * 用于标记一个方法是用于和JS做桥接的,避免被误删除 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.SOURCE) +public @interface JSBridge { +} diff --git a/designer-base/src/main/java/com/fr/design/bridge/exec/JSCallback.java b/designer-base/src/main/java/com/fr/design/bridge/exec/JSCallback.java new file mode 100644 index 0000000000..0a0451b54d --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/bridge/exec/JSCallback.java @@ -0,0 +1,18 @@ +package com.fr.design.bridge.exec; + +/** + * Created by ibm on 2017/5/27. + */ +public class JSCallback { + + private JSExecutor executeScript; + + public JSCallback(JSExecutor jsExecutor) { + this.executeScript = jsExecutor; + } + + public void execute(String newValue) { + executeScript.executor(newValue); + } +} + diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/JSExecutor.java b/designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java similarity index 72% rename from designer-base/src/main/java/com/fr/design/extra/exe/callback/JSExecutor.java rename to designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java index 2adbadc87e..9ded472eb3 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/JSExecutor.java +++ b/designer-base/src/main/java/com/fr/design/bridge/exec/JSExecutor.java @@ -1,4 +1,4 @@ -package com.fr.design.extra.exe.callback; +package com.fr.design.bridge.exec; /** * Created by ibm on 2017/6/21. diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/JSCallback.java b/designer-base/src/main/java/com/fr/design/bridge/exec/JSUtils.java similarity index 59% rename from designer-base/src/main/java/com/fr/design/extra/exe/callback/JSCallback.java rename to designer-base/src/main/java/com/fr/design/bridge/exec/JSUtils.java index d01446ee01..730a283e15 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/JSCallback.java +++ b/designer-base/src/main/java/com/fr/design/bridge/exec/JSUtils.java @@ -1,46 +1,20 @@ -package com.fr.design.extra.exe.callback; +package com.fr.design.bridge.exec; +import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; -import javafx.application.Platform; -import javafx.scene.web.WebEngine; import netscape.javascript.JSObject; +import java.util.ArrayList; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * Created by ibm on 2017/5/27. + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 */ -public class JSCallback { - - private JSExecutor executeScript; - - public JSCallback(final WebEngine webEngine, final JSObject callback) { - init(webEngine, callback); - } - - public void init(final WebEngine webEngine, final JSObject callback){ - executeScript = new JSExecutor() { - @Override - public void executor(final String newValue) { - Platform.runLater(new Runnable() { - @Override - public void run() { - String fun = "(" + callback + ")(\"" + trimText(newValue) + "\")"; - try { - webEngine.executeScript(fun); - } catch (Exception e) { - webEngine.executeScript("alert(\"" + e.getMessage() + "\")"); - } - } - }); - } - }; - } - - public void execute(String newValue) { - executeScript.executor(newValue); - } +public class JSUtils { /** @@ -60,7 +34,7 @@ public class JSCallback { * @param old 原始字符串 * @return 处理之后的字符串 */ - private String trimText(String old) { + public static String trimText(String old) { if (StringUtils.isNotBlank(old)) { String b = filterHtmlTag(old); return b.replaceAll("\\\\n", StringUtils.EMPTY).replaceAll("\\\\t", StringUtils.EMPTY).replaceAll("\"", "\\\\\"").replaceAll("\'", "\\\\\'").replaceAll("\\\\\\\\", "\\\\\\\\\\\\"); @@ -73,7 +47,7 @@ public class JSCallback { * @param origin 原始字符串 * @return 处理之后的字符串 */ - private String filterHtmlTag(String origin) { + public static String filterHtmlTag(String origin) { String regHtml = "<[^>]+>"; Pattern patternHtml = Pattern.compile(regHtml, Pattern.CASE_INSENSITIVE); Matcher matchHtml = patternHtml.matcher(origin); @@ -81,5 +55,15 @@ public class JSCallback { return origin; } + public String[] jsObjectToStringArray(JSObject obj) { + if (obj == null) { + return ArrayUtils.EMPTY_STRING_ARRAY; + } + int len = (int) obj.getMember("length"); + List list = new ArrayList<>(); + for (int i = 0; i < len; i++) { + list.add(obj.getSlot(i).toString()); + } + return list.toArray(new String[len]); + } } - diff --git a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java index bed0dc96b0..a18ae856eb 100644 --- a/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/BasicTableDataTreePane.java @@ -147,6 +147,7 @@ public abstract class BasicTableDataTreePane extends DockingView implements Resp private boolean isIncludeUnderline(String name) { return ComparatorUtils.equals(name.indexOf(StoreProcedureAssist.GROUP_MARKER), -1) ? false : true; } + public abstract void addDataPane(final AbstractTableDataPane uPanel, String paneName); public abstract TableDataTree getDataTree(); diff --git a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java index 37aa4ef123..56f81e9a5b 100644 --- a/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java +++ b/designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java @@ -324,4 +324,31 @@ public class TableDataTreePane extends BasicTableDataTreePane { dataTree.refresh(); return Collections.unmodifiableMap(tdNameMap); } + public void addDataPane(final AbstractTableDataPane uPanel, String paneName) { + final NamePane nPanel = uPanel.asNamePane(); + nPanel.setObjectName(paneName); + final String oldName = paneName; + + allDSNames = DesignTableDataManager.getAllDSNames(tc.getBook()); + + DesignTableDataManager.setThreadLocal(DesignTableDataManager.NO_PARAMETER); + tc.renameTableData(oldName, nPanel.getObjectName(), false); + TableDataSource tds = tc.getBook(); + TableData td = uPanel.updateBean(); + if (td instanceof TableDataSourceDependent) { + ((TableDataSourceDependent) td).setTableDataSource(tds); + } + String tdName = nPanel.getObjectName(); + tds.putTableData(tdName, td); + Map map = new HashMap(); + if (!ComparatorUtils.equals(oldName, tdName)) { + map.put(oldName, tdName); + } + fireDSChanged(map); + tc.fireTargetModified(); + tc.parameterChanged(); + int[] rows = dataTree.getSelectionRows(); + dataTree.refreshChildByName(tdName); + dataTree.setSelectionRows(rows); + } } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java index d441d51160..85b8fbd7d3 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/tabledatapane/DBTableDataPane.java @@ -29,6 +29,7 @@ import com.fr.design.gui.itableeditorpane.UITableEditorPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.syntax.ui.rsyntaxtextarea.SyntaxConstants; import com.fr.design.gui.syntax.ui.rtextarea.RTextScrollPane; +import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.DesignerContext; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ToolBarDef; @@ -211,10 +212,13 @@ public class DBTableDataPane extends AbstractTableDataPane { isShareCheckBox.setBackground(Color.WHITE); maxPanel = new MaxMemRowCountPanel(); maxPanel.setBorder(null); + JPanel wrapMaxPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); + wrapMaxPanel.add(maxPanel); + wrapMaxPanel.setPreferredSize(new Dimension(250, 20)); UIToolbar editToolBar = ToolBarDef.createJToolBar(); toolBarDef.updateToolBar(editToolBar); editToolBar.add(isShareCheckBox); - editToolBar.add(maxPanel); + editToolBar.add(wrapMaxPanel); return editToolBar; } diff --git a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java index 8c70536505..c01daff70e 100644 --- a/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java +++ b/designer-base/src/main/java/com/fr/design/dialog/BasicPane.java @@ -2,13 +2,18 @@ package com.fr.design.dialog; import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.itextfield.UITextField; - -import com.fr.stable.core.PropertyChangeAdapter; +import com.fr.design.i18n.Toolkit; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.core.PropertyChangeAdapter; -import javax.swing.*; +import javax.swing.JPanel; import javax.swing.event.DocumentEvent; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Window; /* * _denny: 这里的BasicPane通常会有populate & update方法 @@ -298,18 +303,20 @@ public abstract class BasicPane extends JPanel { public void checkValid() throws Exception { } - public static final class NamePane extends BasicPane { + public static class NamePane extends BasicPane { private UITextField nameTextField; + private UILabel Name; private BasicPane centerPane; private UILabel showfield; private PropertyChangeAdapter changeListener; - private NamePane(BasicPane bPane) { + public NamePane(BasicPane bPane) { this.setLayout(new BorderLayout(4, 4)); nameTextField = new UITextField(30); + Name = new UILabel(Toolkit.i18nText("Fine-Design_Basic_Name") + ":"); JPanel northPane = new JPanel(new BorderLayout(4, 4)); - northPane.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Name") + ":"), BorderLayout.WEST); + northPane.add(Name, BorderLayout.WEST); northPane.add(nameTextField, BorderLayout.CENTER); northPane.add(showfield = new UILabel(" "), BorderLayout.EAST); showfield.setForeground(new Color(204, 0, 1)); @@ -343,6 +350,11 @@ public abstract class BasicPane extends JPanel { } } + public void setVisible(boolean isVisible) { + this.nameTextField.setVisible(isVisible); + this.Name.setVisible(isVisible); + } + public String getObjectName() { return this.nameTextField.getText().trim(); } diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginJavaFxExecutor.java b/designer-base/src/main/java/com/fr/design/extra/PluginJavaFxExecutor.java new file mode 100644 index 0000000000..c3863a46df --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/extra/PluginJavaFxExecutor.java @@ -0,0 +1,42 @@ +package com.fr.design.extra; + +import com.fr.design.bridge.exec.JSExecutor; +import com.fr.design.bridge.exec.JSUtils; +import javafx.application.Platform; +import javafx.scene.web.WebEngine; +import netscape.javascript.JSObject; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + */ +public class PluginJavaFxExecutor implements JSExecutor { + + public static PluginJavaFxExecutor create(WebEngine webEngine, JSObject callback) { + return new PluginJavaFxExecutor(webEngine, callback); + } + + private WebEngine webEngine; + private JSObject callback; + + private PluginJavaFxExecutor(WebEngine webEngine, JSObject callback) { + this.webEngine = webEngine; + this.callback = callback; + } + + @Override + public void executor(final String newValue) { + Platform.runLater(new Runnable() { + @Override + public void run() { + String fun = "(" + callback + ")(\"" + JSUtils.trimText(newValue) + "\")"; + try { + webEngine.executeScript(fun); + } catch (Exception e) { + webEngine.executeScript("alert(\"" + e.getMessage() + "\")"); + } + } + }); + } +} diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java index 99e02bdc14..7745786303 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginOperateUtils.java @@ -3,7 +3,7 @@ package com.fr.design.extra; import com.fr.config.MarketConfig; import com.fr.design.extra.exe.callback.InstallFromDiskCallback; import com.fr.design.extra.exe.callback.InstallOnlineCallback; -import com.fr.design.extra.exe.callback.JSCallback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.exe.callback.ModifyStatusCallback; import com.fr.design.extra.exe.callback.UninstallPluginCallback; import com.fr.design.extra.exe.callback.UpdateFromDiskCallback; diff --git a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java index 02a51ad3f2..492bbfd97d 100644 --- a/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java +++ b/designer-base/src/main/java/com/fr/design/extra/PluginWebBridge.java @@ -3,6 +3,7 @@ package com.fr.design.extra; import com.fr.base.passport.FinePassportManager; import com.fr.config.MarketConfig; import com.fr.design.RestartHelper; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.dialog.UIDialog; import com.fr.design.extra.exe.GetInstalledPluginsExecutor; import com.fr.design.extra.exe.GetPluginCategoriesExecutor; @@ -11,12 +12,9 @@ import com.fr.design.extra.exe.GetPluginPrefixExecutor; import com.fr.design.extra.exe.PluginLoginExecutor; import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; import com.fr.design.extra.exe.SearchOnlineExecutor; -import com.fr.design.extra.exe.callback.JSCallback; import com.fr.design.gui.ilable.UILabel; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; - import com.fr.general.CloudCenter; -import com.fr.json.JSONException; import com.fr.json.JSONObject; import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginMarker; @@ -172,7 +170,7 @@ public class PluginWebBridge { * @param callback 回调函数 */ public void installPluginOnline(final String pluginInfo, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); } @@ -183,7 +181,7 @@ public class PluginWebBridge { * @param filePath 插件包的路径 */ public void installPluginFromDisk(final String filePath, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); File file = new File(filePath); PluginOperateUtils.installPluginFromDisk(file, jsCallback); } @@ -194,7 +192,7 @@ public class PluginWebBridge { * @param pluginInfo 插件信息 */ public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); } @@ -204,7 +202,7 @@ public class PluginWebBridge { * @param pluginIDs 插件集合 */ public void updatePluginOnline(JSObject pluginIDs, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); String[] pluginInfos = jsObjectToStringArray(pluginIDs); List pluginMarkerList = new ArrayList(); for (int i = 0; i < pluginInfos.length; i++) { @@ -219,7 +217,7 @@ public class PluginWebBridge { * @param filePath 插件包的路径 */ public void updatePluginFromDisk(String filePath, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); File file = new File(filePath); PluginOperateUtils.updatePluginFromDisk(file, jsCallback); } @@ -230,7 +228,7 @@ public class PluginWebBridge { * @param pluginID 插件ID */ public void setPluginActive(String pluginID, final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); PluginOperateUtils.setPluginActive(pluginID, jsCallback); } @@ -427,7 +425,7 @@ public class PluginWebBridge { * @param callback */ public void registerLoginInfo(final JSObject callback) { - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); PluginOperateUtils.getLoginInfo(jsCallback, uiLabel); } @@ -559,7 +557,7 @@ public class PluginWebBridge { } public void getPackInfo(final JSObject callback){ - JSCallback jsCallback = new JSCallback(webEngine, callback); + JSCallback jsCallback = new JSCallback(PluginJavaFxExecutor.create(webEngine, callback)); jsCallback.execute(StringUtils.EMPTY); } diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java index 1e170c8443..e8096efbf7 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallFromDiskCallback.java @@ -1,5 +1,6 @@ package com.fr.design.extra.exe.callback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginUtils; diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java index 9b86641e66..23b6679b69 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/InstallOnlineCallback.java @@ -1,5 +1,6 @@ package com.fr.design.extra.exe.callback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginOperateUtils; import com.fr.log.FineLoggerFactory; diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java index 681180053e..b7b817ef4c 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/ModifyStatusCallback.java @@ -1,5 +1,6 @@ package com.fr.design.extra.exe.callback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginUtils; import com.fr.plugin.manage.control.PluginTaskCallback; diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java index a6f781b94b..db8a69188a 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UninstallPluginCallback.java @@ -1,5 +1,6 @@ package com.fr.design.extra.exe.callback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginUtils; import com.fr.log.FineLoggerFactory; diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java index cd0ccab848..26315fd030 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateFromDiskCallback.java @@ -1,5 +1,6 @@ package com.fr.design.extra.exe.callback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginOperateUtils; import com.fr.design.extra.PluginUtils; diff --git a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java index c857960c78..28f4f6a31f 100644 --- a/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java +++ b/designer-base/src/main/java/com/fr/design/extra/exe/callback/UpdateOnlineCallback.java @@ -1,5 +1,6 @@ package com.fr.design.extra.exe.callback; +import com.fr.design.bridge.exec.JSCallback; import com.fr.design.extra.PluginOperateUtils; import com.fr.log.FineLoggerFactory; diff --git a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java index 65989dfccf..968f72a599 100644 --- a/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java +++ b/designer-base/src/main/java/com/fr/design/file/MutilTempalteTabPane.java @@ -751,8 +751,11 @@ public class MutilTempalteTabPane extends JComponent { JTemplate template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); selectedIndex = HistoryTemplateListCache.getInstance().contains(template); } - //如果是已后台关闭的模板,则重新打开文件 - openedTemplate.get(selectedIndex).activeOldJTemplate(); + if (selectedIndex < openedTemplate.size()) { + //如果是已后台关闭的模板,则重新打开文件 + openedTemplate.get(selectedIndex).activeOldJTemplate(); + } + } } diff --git a/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java b/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java new file mode 100644 index 0000000000..44acc11902 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/OemProcessor.java @@ -0,0 +1,38 @@ +package com.fr.design.fun; + +import com.fr.design.menu.MenuDef; +import com.fr.start.SplashStrategy; + +import java.awt.image.BufferedImage; +import java.util.List; + +/** + * 设计器Oem接口 + */ +public interface OemProcessor { + public static final String MARK_STRING = "OemProcessor"; + + /** + * 启动动画,如果不替换则返回null + * + * @return + */ + SplashStrategy createSplashStrategy(); + + /** + * 替换标题图标--DesignerFrame.initTitleIcon + * 如果不替换则返回null + * + * @return + */ + List createTitleIcon(); + + /** + * 处理设计器菜单(增删改) + * + * @param menuDefs 已加载的菜单 + * @return 新的菜单数组 + */ + MenuDef[] dealWithMenuDef(MenuDef[] menuDefs); + +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java new file mode 100644 index 0000000000..d49bfdf246 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/fun/impl/AbstractOemProcessor.java @@ -0,0 +1,25 @@ +package com.fr.design.fun.impl; + +import com.fr.design.fun.OemProcessor; +import com.fr.design.menu.MenuDef; +import com.fr.start.SplashStrategy; + +import java.awt.image.BufferedImage; +import java.util.List; + +public abstract class AbstractOemProcessor implements OemProcessor{ + @Override + public MenuDef[] dealWithMenuDef(MenuDef[] menuDefs) { + return menuDefs; + } + + @Override + public List createTitleIcon() { + return null; + } + + @Override + public SplashStrategy createSplashStrategy() { + return null; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java index c51aeaaecc..4bb286dbc0 100644 --- a/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java +++ b/designer-base/src/main/java/com/fr/design/gui/controlpane/JControlUpdatePane.java @@ -60,7 +60,8 @@ class JControlUpdatePane extends JPanel { elEditing = el; NameableCreator[] creators = listControlPane.creators(); - for (int i = 0, len = updatePanes.length; i < len; i++) { + //倒序的原因是为了让一些继承内置连接类的插件实现能够生效REPORT-15409 + for (int i = updatePanes.length - 1; i > -1; i--) { Object ob2Populate = creators[i].acceptObject2Populate(el.wrapper); if (ob2Populate != null) { if (updatePanes[i] == null) { diff --git a/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java b/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java index 7f1468a450..8e794f1924 100644 --- a/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java +++ b/designer-base/src/main/java/com/fr/design/javascript/beautify/JavaScriptFormatHelper.java @@ -1,16 +1,16 @@ package com.fr.design.javascript.beautify; -import com.fr.log.FineLoggerFactory; +import com.eclipsesource.v8.V8; +import com.eclipsesource.v8.V8Array; +import com.eclipsesource.v8.V8Object; +import com.eclipsesource.v8.utils.V8ObjectUtils; import com.fr.general.IOUtils; -import com.fr.script.ScriptFactory; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.EncodeConstants; -import javax.script.Invocable; -import javax.script.ScriptEngine; -import javax.script.ScriptException; import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; +import java.io.UnsupportedEncodingException; public class JavaScriptFormatHelper { @@ -34,15 +34,21 @@ public class JavaScriptFormatHelper { */ public static String beautify(String jsCode, BeautifyOption option) { InputStream resourceAsStream = IOUtils.readResource("com/fr/design/javascript/beautify/beautify.js"); - ScriptEngine scriptEngine = ScriptFactory.newScriptEngine(); String result = jsCode; + V8 v8 = V8.createV8Runtime(); try { - Reader reader = new InputStreamReader(resourceAsStream); - scriptEngine.eval(reader); - Invocable invocable = (Invocable) scriptEngine; - result = (String) invocable.invokeFunction("js_beautify_global", jsCode, option.toFormatArgument()); - } catch (ScriptException | NoSuchMethodException e) { + v8.executeVoidScript(IOUtils.inputStream2String(resourceAsStream, EncodeConstants.ENCODING_UTF_8)); + V8Array parameters = new V8Array(v8); + parameters.push(jsCode); + V8Object arg = V8ObjectUtils.toV8Object(v8, option.toFormatArgument()); + parameters.push(arg); + result = v8.executeStringFunction("js_beautify_global", parameters); + parameters.release(); + arg.release(); + } catch (UnsupportedEncodingException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); + } finally { + v8.release(true); } return result; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignAuthorityEventType.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignAuthorityEventType.java new file mode 100644 index 0000000000..fc1d0ab5a0 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignAuthorityEventType.java @@ -0,0 +1,11 @@ +package com.fr.design.mainframe; + +import com.fr.event.Event; + +public enum DesignAuthorityEventType implements Event { + + // 退出权限编辑 + StartEdit, + // 进入权限编辑 + StopEdit; +} diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java index 2cc83543c3..04dab52b50 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrame.java @@ -24,6 +24,7 @@ import com.fr.design.file.MutilTempalteTabPane; import com.fr.design.file.NewTemplatePane; import com.fr.design.file.SaveSomeTemplatePane; import com.fr.design.file.TemplateTreePane; +import com.fr.design.fun.OemProcessor; import com.fr.design.fun.TitlePlaceProcessor; import com.fr.design.fun.impl.AbstractTemplateTreeShortCutProvider; import com.fr.design.gui.ibutton.UIButton; @@ -39,6 +40,7 @@ import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; import com.fr.design.menu.MenuManager; import com.fr.design.menu.ShortCut; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.event.EventDispatcher; import com.fr.exception.DecryptTemplateException; import com.fr.file.FILE; import com.fr.file.FILEFactory; @@ -56,6 +58,7 @@ import com.fr.stable.ProductConstants; import com.fr.stable.StringUtils; import com.fr.stable.image4j.codec.ico.ICODecoder; import com.fr.stable.project.ProjectConstants; +import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import com.fr.workspace.Workspace; import com.fr.workspace.connect.WorkspaceConnectionInfo; @@ -333,6 +336,7 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta needToAddAuhtorityPaint(); refreshDottedLine(); fireAuthorityStateToNomal(); + EventDispatcher.fire(DesignAuthorityEventType.StopEdit, DesignerFrame.this); } /** @@ -456,8 +460,19 @@ public class DesignerFrame extends JFrame implements JTemplateActionListener, Ta try { @SuppressWarnings("unchecked") - List image = ICODecoder.read(DesignerFrame.class - .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + OemProcessor oemProcessor = OemHandler.findOem(); + List image = null; + if (oemProcessor != null) { + try { + image = oemProcessor.createTitleIcon(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + } + if (image == null) { + image = ICODecoder.read(DesignerFrame.class + .getResourceAsStream("/com/fr/base/images/oem/logo.ico")); + } this.setIconImages(image); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); diff --git a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java index f2f53fead6..264d14fc2c 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/DesignerFrameFileDealerPane.java @@ -321,13 +321,6 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } - private void saveCurrentEditingTemplate() { - JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); - jt.stopEditing(); - jt.saveTemplate(); - jt.requestFocus(); - } - private boolean isCurrentEditing(String path) { JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); String editing = jt.getEditingFILE().getPath(); @@ -431,6 +424,7 @@ public class DesignerFrameFileDealerPane extends JPanel implements FileToolbarSt } selectedOperation.deleteFile(); stateChange(); + DesignerContext.getDesignerFrame().setTitle(); } } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java index 6fd7ee0079..a8ec61abc8 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/JTemplate.java @@ -603,7 +603,11 @@ public abstract class JTemplate> editingFILE = fileChooser.getSelectedFILE(); } - boolean lockedTarget = WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); + boolean lockedTarget = + // 目标本地文件 + !editingFILE.isEnvFile() || + // 目标远程文件 + WorkContext.getCurrent().get(TplOperator.class).saveAs(editingFILE.getPath()); if (lockedTarget) { boolean saved = saveNewFile(editingFILE, oldName); // 目标文件保存成功并且源文件不一致的情况下,把源文件锁释放掉 @@ -683,7 +687,10 @@ public abstract class JTemplate> this.saved = true; this.authoritySaved = true; DesignerContext.getDesignerFrame().setTitle(); + if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) { + VcsHelper.dealWithVcs(this); + } this.fireJTemplateSaved(); return true; } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java index cc51482565..c26dce9a02 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/toolbar/ToolBarMenuDock.java @@ -6,6 +6,7 @@ package com.fr.design.mainframe.toolbar; import com.fr.base.FRContext; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignState; +import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.actions.community.BBSAction; @@ -24,6 +25,7 @@ import com.fr.design.actions.file.OpenTemplateAction; import com.fr.design.actions.file.PreferenceAction; import com.fr.design.actions.file.SwitchExistEnv; import com.fr.design.actions.help.AboutAction; +import com.fr.design.actions.help.FineUIAction; import com.fr.design.actions.help.TutorialAction; import com.fr.design.actions.help.WebDemoAction; import com.fr.design.actions.help.alphafine.AlphaFineAction; @@ -36,6 +38,7 @@ import com.fr.design.actions.server.PlatformManagerAction; import com.fr.design.actions.server.PluginManagerAction; import com.fr.design.file.NewTemplatePane; import com.fr.design.fun.MenuHandler; +import com.fr.design.fun.OemProcessor; import com.fr.design.fun.TableDataPaneProcessor; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -54,6 +57,7 @@ import com.fr.design.remote.action.RemoteDesignAuthManagerAction; import com.fr.design.utils.ThemeUtils; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.log.FineLoggerFactory; import com.fr.plugin.context.PluginContext; import com.fr.plugin.context.PluginRuntime; import com.fr.plugin.manage.PluginFilter; @@ -62,6 +66,7 @@ import com.fr.plugin.observer.PluginEventListener; import com.fr.plugin.observer.PluginEventType; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.start.OemHandler; import com.fr.workspace.WorkContext; import javax.swing.JComponent; @@ -198,6 +203,18 @@ public abstract class ToolBarMenuDock { }; this.menus = menus(plus); + try { + OemProcessor oemProcessor = OemHandler.findOem(); + if (oemProcessor != null) { + this.menus = oemProcessor.dealWithMenuDef(this.menus); + if (this.menus == null) { + this.menus = menus(plus); + } + } + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + this.menus = menus(plus); + } for (int i = 0; i < menus.length; i++) { menus[i].setHasRecMenu(true); UIMenu subMenu = menus[i].createJMenu(); @@ -499,9 +516,14 @@ public abstract class ToolBarMenuDock { if (AlphaFineConfigManager.isALPHALicAvailable()) { shortCuts.add(new AlphaFineAction()); } + shortCuts.add(SeparatorDef.DEFAULT); + if (DesignerEnvManager.getEnvManager().isOpenDebug()) { + shortCuts.add(new FineUIAction()); + } shortCuts.add(new AboutAction()); - return shortCuts.toArray(new ShortCut[shortCuts.size()]); + + return shortCuts.toArray(new ShortCut[0]); } /** diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java index 9933fc0e74..40edc01f05 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/common/VcsCacheFileNodeFile.java @@ -6,9 +6,10 @@ import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.stable.StableUtils; import com.fr.workspace.WorkContext; -import com.fr.workspace.resource.WorkResource; import com.fr.workspace.resource.WorkResourceOutputStream; +import com.fr.workspace.server.lock.TplOperator; +import java.io.ByteArrayInputStream; import java.io.InputStream; import java.io.OutputStream; @@ -29,7 +30,7 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { * @throws Exception */ @Override - public InputStream asInputStream() { + public InputStream asInputStream() throws Exception { if (node == null) { return null; } @@ -40,8 +41,11 @@ public class VcsCacheFileNodeFile extends FileNodeFILE { return null; } - InputStream in = WorkContext.getCurrent().get(WorkResource.class) - .openStream(StableUtils.pathJoin(VcsHelper.VCS_CACHE_DIR, envPath.substring(VcsHelper.VCS_CACHE_DIR.length() + 1))); + InputStream in = new ByteArrayInputStream( + WorkContext.getCurrent().get(TplOperator.class).readAndLockFile( + StableUtils.pathJoin(VcsHelper.VCS_CACHE_DIR, envPath.substring(VcsHelper.VCS_CACHE_DIR.length() + 1)) + ) + ); return envPath.endsWith(".cpt") || envPath.endsWith(".frm") ? XMLEncryptUtils.decodeInputStream(in) : in; diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java index e814a9b94b..a37a5cea66 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionRowPanel.java @@ -63,6 +63,7 @@ public class FileVersionRowPanel extends JPanel { public void actionPerformed(ActionEvent evt) { if (JOptionPane.showConfirmDialog(null, Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Confirm"), Toolkit.i18nText("Fine-Design_Vcs_Version_Revert_Title"), JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { + vcsEntity.setUsername(VcsHelper.getCurrentUsername()); WorkContext.getCurrent().get(VcsOperator.class).rollbackTo(vcsEntity); FileVersionsPanel.getInstance().exitVcs(vcsEntity.getFilename()); } diff --git a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java index 7f9fc56fe3..4d9b6e35e6 100644 --- a/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java +++ b/designer-base/src/main/java/com/fr/design/mainframe/vcs/ui/FileVersionsPanel.java @@ -19,7 +19,6 @@ import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.ToolBarDef; import com.fr.file.FileNodeFILE; import com.fr.file.filetree.FileNode; -import com.fr.log.FineLoggerFactory; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; @@ -101,7 +100,8 @@ public class FileVersionsPanel extends BasicPane { } private void showFilterPane() { - versionDialog = new FileVersionDialog(DesignerContext.getDesignerFrame(), templatePath); + String savePath = templatePath.startsWith("/") ? templatePath.substring(1) : templatePath; + versionDialog = new FileVersionDialog(DesignerContext.getDesignerFrame(), savePath); versionDialog.setVisible(true); } diff --git a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java index a412e0a8a8..d839461dda 100644 --- a/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java +++ b/designer-base/src/main/java/com/fr/design/roleAuthority/ReportAndFSManagePane.java @@ -11,18 +11,29 @@ import com.fr.design.gui.icontainer.UIScrollPane; import com.fr.design.gui.itoolbar.UIToolbar; import com.fr.design.gui.itree.refreshabletree.ExpandMutableTreeNode; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.design.mainframe.DesignAuthorityEventType; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.mainframe.DesignerFrame; import com.fr.design.mainframe.DockingView; import com.fr.design.menu.ToolBarDef; - - -import javax.swing.*; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; + +import javax.swing.BorderFactory; +import javax.swing.Icon; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.ScrollPaneConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import javax.swing.event.TreeSelectionEvent; +import javax.swing.tree.DefaultTreeSelectionModel; import javax.swing.tree.TreeNode; import javax.swing.tree.TreePath; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -40,6 +51,15 @@ public class ReportAndFSManagePane extends DockingView implements Prepare4DataSo private static ReportAndFSManagePane singleton = new ReportAndFSManagePane(); private static RoleTree roleTree; + static { + EventDispatcher.listen(DesignAuthorityEventType.StopEdit, new Listener() { + + public void on(Event event, DesignerFrame param) { + DefaultTreeSelectionModel model = roleTree.getCheckBoxTreeSelectionModel(); + model.removeSelectionPaths(model.getSelectionPaths()); + } + }); + } private RefreshAction refreshAction = new RefreshAction(); private UIHeadGroup buttonGroup; private RoleSourceOP op; diff --git a/designer-base/src/main/java/com/fr/design/ui/Assistant.java b/designer-base/src/main/java/com/fr/design/ui/Assistant.java index 601f0ac36f..7a51c188c4 100644 --- a/designer-base/src/main/java/com/fr/design/ui/Assistant.java +++ b/designer-base/src/main/java/com/fr/design/ui/Assistant.java @@ -49,5 +49,6 @@ public class Assistant { ProtocolService protocolService = browserContext.getProtocolService(); // 支持读取jar包中文件的自定义协议————emb:/com/fr/design/images/bbs.png protocolService.setProtocolHandler("emb", handler); + //protocolService.setProtocolHandler("file", handler); } } diff --git a/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java b/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java index 6636e28744..94456df97f 100644 --- a/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java +++ b/designer-base/src/main/java/com/fr/design/ui/EmbProtocolHandler.java @@ -1,7 +1,11 @@ package com.fr.design.ui; +import com.fr.base.TemplateUtils; import com.fr.general.IOUtils; import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.codec.net.URLCodec; +import com.fr.third.org.apache.commons.io.FileUtils; +import com.fr.third.org.apache.commons.io.FilenameUtils; import com.fr.web.struct.AssembleComponent; import com.fr.web.struct.AtomBuilder; import com.fr.web.struct.PathGroup; @@ -11,7 +15,12 @@ import com.teamdev.jxbrowser.chromium.ProtocolHandler; import com.teamdev.jxbrowser.chromium.URLRequest; import com.teamdev.jxbrowser.chromium.URLResponse; +import java.io.File; +import java.io.FileInputStream; import java.io.InputStream; +import java.io.StringReader; +import java.net.URI; +import java.util.Map; /** * @author richie @@ -21,6 +30,7 @@ import java.io.InputStream; public class EmbProtocolHandler implements ProtocolHandler { private AssembleComponent component; + private Map map; public EmbProtocolHandler() { @@ -30,17 +40,35 @@ public class EmbProtocolHandler implements ProtocolHandler { this.component = component; } + public EmbProtocolHandler(AssembleComponent component, Map map) { + this.component = component; + this.map = map; + } + + public EmbProtocolHandler(Map map) { + this.map = map; + } @Override public URLResponse onRequest(URLRequest req) { try { String path = req.getURL(); - if (path.startsWith("emb:dynamic")) { + if (path.startsWith("file:")) { + String url = new URLCodec().decode(path); + String filePath = TemplateUtils.renderParameter4Tpl(url, map); + File file = new File(URI.create(filePath).getPath()); + InputStream inputStream = new FileInputStream(file); + if (path.endsWith(".svg")) { + System.out.println(path); + } + return Assistant.inputStream2Response(inputStream, "file:///" + file.getAbsolutePath()); + } + else if (path.startsWith("emb:dynamic")) { URLResponse response = new URLResponse(); response.setData(htmlText().getBytes()); response.getHeaders().setHeader("Content-Type", "text/html"); return response; - } else { + } else { int index = path.indexOf("="); if (index > 0) { path = path.substring(index + 1); @@ -51,7 +79,7 @@ public class EmbProtocolHandler implements ProtocolHandler { return Assistant.inputStream2Response(inputStream, path); } } catch (Exception ignore) { - + ignore.printStackTrace(); } return null; } diff --git a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java index 81f9e051b5..99a4fe97cf 100644 --- a/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java +++ b/designer-base/src/main/java/com/fr/design/ui/ModernUIPane.java @@ -2,6 +2,10 @@ package com.fr.design.ui; import com.fr.design.DesignerEnvManager; import com.fr.design.dialog.BasicPane; +import com.fr.design.gui.ibutton.UIButton; +import com.fr.design.gui.itoolbar.UIToolbar; +import com.fr.design.i18n.Toolkit; +import com.fr.design.utils.gui.GUICoreUtils; import com.fr.web.struct.AssembleComponent; import com.teamdev.jxbrowser.chromium.Browser; import com.teamdev.jxbrowser.chromium.BrowserPreferences; @@ -14,8 +18,11 @@ import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; import com.teamdev.jxbrowser.chromium.events.ScriptContextListener; import com.teamdev.jxbrowser.chromium.swing.BrowserView; -import javax.swing.JSplitPane; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.util.Map; /** * @author richie @@ -39,17 +46,29 @@ public class ModernUIPane extends BasicPane { setLayout(new BorderLayout()); BrowserPreferences.setChromiumSwitches("--disable-google-traffic"); if (DesignerEnvManager.getEnvManager().isOpenDebug()) { - JSplitPane splitPane = new JSplitPane(); - add(splitPane, BorderLayout.CENTER); - splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); - splitPane.setDividerLocation(500); + UIToolbar toolbar = new UIToolbar(); + add(toolbar, BorderLayout.NORTH); + UIButton openDebugButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Open_Debug_Window")); + toolbar.add(openDebugButton); + UIButton reloadButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Reload")); + toolbar.add(reloadButton); + + openDebugButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + showDebuggerDialog(); + } + }); + + reloadButton.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + browser.reloadIgnoringCache(); + } + }); BrowserPreferences.setChromiumSwitches("--remote-debugging-port=9222"); initializeBrowser(); - splitPane.setLeftComponent(new BrowserView(browser)); - Browser debugger = new Browser(); - debugger.loadURL(browser.getRemoteDebuggingURL()); - BrowserView debuggerView = new BrowserView(debugger); - splitPane.setRightComponent(debuggerView); + add(new BrowserView(browser), BorderLayout.CENTER); } else { initializeBrowser(); add(new BrowserView(browser), BorderLayout.CENTER); @@ -57,6 +76,18 @@ public class ModernUIPane extends BasicPane { } } + private void showDebuggerDialog() { + JDialog dialog = new JDialog(SwingUtilities.getWindowAncestor(this)); + Browser debugger = new Browser(); + BrowserView debuggerView = new BrowserView(debugger); + dialog.add(debuggerView, BorderLayout.CENTER); + dialog.setSize(new Dimension(800, 400)); + GUICoreUtils.centerWindow(dialog); + dialog.setVisible(true); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + debugger.loadURL(browser.getRemoteDebuggingURL()); + } + private void initializeBrowser() { browser = new Browser(); // 初始化的时候,就把命名空间对象初始化好,确保window.a.b.c("a.b.c"为命名空间)对象都是初始化过的 @@ -68,6 +99,14 @@ public class ModernUIPane extends BasicPane { }); } + /** + * 转向一个新的地址,相当于重新加载 + * @param url 新的地址 + */ + public void redirect(String url) { + browser.loadURL(url); + } + @Override protected String title4PopupWindow() { return "Modern"; @@ -126,6 +165,16 @@ public class ModernUIPane extends BasicPane { return this; } + /** + * 加载url指向的资源 + * @param url 文件的地址 + */ + public Builder withURL(final String url, Map map) { + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(map)); + pane.browser.loadURL(url); + return this; + } + /** * 加载Atom组件 * @param component Atom组件 @@ -136,6 +185,17 @@ public class ModernUIPane extends BasicPane { return this; } + /** + * 加载Atom组件 + * @param component Atom组件 + */ + public Builder withComponent(AssembleComponent component, Map map) { + Assistant.setEmbProtocolHandler(pane.browser, new EmbProtocolHandler(component, map)); + pane.browser.loadURL("emb:dynamic"); + return this; + } + + /** * 加载html文本内容 * @param html 要加载html文本内容 diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java index cc22902169..df16261931 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/RestoreResultDialog.java @@ -1,6 +1,5 @@ package com.fr.design.update.ui.dialog; -import com.fr.base.FRContext; import com.fr.design.RestartHelper; import com.fr.design.gui.ibutton.UIButton; import com.fr.design.gui.ilable.UILabel; @@ -8,6 +7,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.update.domain.UpdateConstants; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; +import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.project.ProjectConstants; @@ -175,8 +175,8 @@ public class RestoreResultDialog extends JDialog { String backupDir = UpdateConstants.DESIGNER_BACKUP_DIR; for (String file : files) { map.put(StableUtils.pathJoin(installHome, backupDir, jarRestoreDir, file), - StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); - list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); + StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); + list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); } } } \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java index 5e5943051e..ad6c4b33f1 100644 --- a/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java +++ b/designer-base/src/main/java/com/fr/design/update/ui/dialog/UpdateMainDialog.java @@ -1,6 +1,5 @@ package com.fr.design.update.ui.dialog; -import com.fr.base.FRContext; import com.fr.design.RestartHelper; import com.fr.design.constants.LayoutConstants; import com.fr.design.dialog.UIDialog; @@ -707,7 +706,7 @@ public class UpdateMainDialog extends UIDialog { for (String file : files) { try { IOUtils.copy( - new File(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)), + new File(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)), new File(StableUtils.pathJoin(todayBackupDir))); } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage()); @@ -748,8 +747,8 @@ public class UpdateMainDialog extends UIDialog { private void putNewFilesToInstallEnv(String installHome, String[] files, Map map, java.util.List list) { for (String file : files) { map.put(StableUtils.pathJoin(installHome, UpdateConstants.DOWNLOAD_DIR, file), - StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); - list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, FRContext.getCommonOperator().getAppName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); + StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); + list.add(StableUtils.pathJoin(installHome, UpdateConstants.APPS_FOLDER_NAME, ProductConstants.getAppFolderName(), ProjectConstants.WEBINF_NAME, ProjectConstants.LIB_NAME, file)); } } diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java new file mode 100644 index 0000000000..3d0f28613a --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/UpmBridge.java @@ -0,0 +1,406 @@ +package com.fr.design.upm; + +import com.fr.base.passport.FinePassportManager; +import com.fr.config.MarketConfig; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.UpmResourceLoader; +import com.fr.design.bridge.exec.JSBridge; +import com.fr.design.bridge.exec.JSCallback; +import com.fr.design.extra.PluginOperateUtils; +import com.fr.design.extra.PluginUtils; +import com.fr.design.extra.exe.GetInstalledPluginsExecutor; +import com.fr.design.extra.exe.GetPluginCategoriesExecutor; +import com.fr.design.extra.exe.GetPluginFromStoreExecutor; +import com.fr.design.extra.exe.PluginLoginExecutor; +import com.fr.design.extra.exe.ReadUpdateOnlineExecutor; +import com.fr.design.extra.exe.SearchOnlineExecutor; +import com.fr.design.i18n.Toolkit; +import com.fr.design.upm.event.CertificateEvent; +import com.fr.design.upm.event.DownloadEvent; +import com.fr.design.upm.exec.UpmBrowserExecutor; +import com.fr.design.upm.task.UpmTaskWorker; +import com.fr.event.EventDispatcher; +import com.fr.general.CloudCenter; +import com.fr.general.GeneralUtils; +import com.fr.json.JSONObject; +import com.fr.log.FineLoggerFactory; +import com.fr.plugin.context.PluginMarker; +import com.fr.stable.ArrayUtils; +import com.fr.stable.StringUtils; +import com.teamdev.jxbrowser.chromium.Browser; +import com.teamdev.jxbrowser.chromium.JSArray; +import com.teamdev.jxbrowser.chromium.JSFunction; +import com.teamdev.jxbrowser.chromium.JSObject; + +import javax.swing.*; +import javax.swing.filechooser.FileNameExtensionFilter; +import java.awt.*; +import java.io.File; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.FutureTask; +import java.util.concurrent.RunnableFuture; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + * 桥接Java和JavaScript的类 + */ +public class UpmBridge { + + public static UpmBridge getBridge(Browser browser) { + return new UpmBridge(browser); + } + + private JSObject window; + + private UpmBridge(Browser browser) { + this.window = browser.executeJavaScriptAndReturnValue("window").asObject(); + } + + public void startDownload(final JSFunction callback) { + + new SwingWorker(){ + @Override + protected Void doInBackground() throws Exception { + callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Start")); + UpmResourceLoader.INSTANCE.download(); + UpmResourceLoader.INSTANCE.install(); + return null; + } + + @Override + protected void done() { + try { + get(); + callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Success")); + EventDispatcher.fire(DownloadEvent.SUCCESS, "success"); + } catch (Exception e) { + callback.invoke(window, Toolkit.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download_Error")); + FineLoggerFactory.getLogger().error(e.getMessage(), e); + EventDispatcher.fire(DownloadEvent.ERROR, "error"); + } + } + }.execute(); + } + + @JSBridge + public String i18nText(String key) { + return Toolkit.i18nText(key); + } + + @JSBridge + public void closeWindow() { + UpmFinder.closeWindow(); + } + + + @JSBridge + public boolean isDesigner() { + return true; + } + + @JSBridge + public void getPackInfo(final JSFunction callback) { + callback.invoke(window, StringUtils.EMPTY); + } + + /** + * 在线获取插件分类 + * + * @param callback 回调函数 + */ + @JSBridge + public void getPluginCategories(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginCategoriesExecutor()); + task.execute(); + } + + /** + * 根据条件获取在线插件 + * + * @param info 插件信息 + * @param callback 回调函数 + */ + @JSBridge + public void getPluginFromStoreNew(String info, final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetPluginFromStoreExecutor(new JSONObject(info))); + task.execute(); + } + + /** + * 已安装插件检查更新 + */ + @JSBridge + public void readUpdateOnline(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new ReadUpdateOnlineExecutor()); + task.execute(); + } + + /** + * 获取已经安装的插件的数组 + */ + @JSBridge + public void getInstalledPlugins(final JSFunction callback) { + UpmTaskWorker task = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new GetInstalledPluginsExecutor()); + task.execute(); + } + + /** + * 从插件服务器上更新选中的插件 + * + * @param pluginIDs 插件集合 + */ + @JSBridge + public void updatePluginOnline(Object pluginIDs, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + List pluginMarkerList = new ArrayList<>(); + if (pluginIDs instanceof String) { + pluginMarkerList.add(PluginUtils.createPluginMarker(pluginIDs.toString())); + } else if (pluginIDs instanceof JSArray) { + JSArray pluginInfos = (JSArray) pluginIDs; + for (int i = 0, len = pluginInfos.length(); i < len; i++) { + String value = pluginInfos.get(i).asString().getValue(); + pluginMarkerList.add(PluginUtils.createPluginMarker(value)); + } + } + PluginOperateUtils.updatePluginOnline(pluginMarkerList, jsCallback); + } + + /** + * 搜索在线插件 + * + * @param keyword 关键字 + */ + @JSBridge + public void searchPlugin(String keyword, final JSFunction callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new SearchOnlineExecutor(keyword)); + worker.execute(); + } + + /** + * 从磁盘上选择插件安装包进行安装 + * + * @param filePath 插件包的路径 + */ + @JSBridge + public void installPluginFromDisk(final String filePath, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + File file = new File(filePath); + PluginOperateUtils.installPluginFromDisk(file, jsCallback); + } + + /** + * 卸载当前选中的插件 + * + * @param pluginInfo 插件信息 + */ + @JSBridge + public void uninstallPlugin(final String pluginInfo, final boolean isForce, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + PluginOperateUtils.uninstallPlugin(pluginInfo, isForce, jsCallback); + } + + /** + * 从插件服务器上安装插件 + * + * @param pluginInfo 插件的ID + * @param callback 回调函数 + */ + @JSBridge + public void installPluginOnline(final String pluginInfo, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + PluginMarker pluginMarker = PluginUtils.createPluginMarker(pluginInfo); + PluginOperateUtils.installPluginOnline(pluginMarker, jsCallback); + } + + /** + * 从磁盘上选择插件安装包进行插件升级 + * + * @param filePath 插件包的路径 + */ + public void updatePluginFromDisk(String filePath, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + File file = new File(filePath); + PluginOperateUtils.updatePluginFromDisk(file, jsCallback); + } + + /** + * 修改选中的插件的活跃状态 + * + * @param pluginID 插件ID + */ + @JSBridge + public void setPluginActive(String pluginID, final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + PluginOperateUtils.setPluginActive(pluginID, jsCallback); + } + + /** + * 选择文件对话框 + * + * @return 选择的文件的路径 + */ + @JSBridge + public String showFileChooser() { + return showFileChooserWithFilter(StringUtils.EMPTY, StringUtils.EMPTY); + } + + /** + * 选择文件对话框 + * + * @param des 过滤文件描述 + * @param filter 文件的后缀 + * @return 选择的文件的路径 + * 这里换用JFileChooser会卡死,不知道为什么 + */ + @JSBridge + public String showFileChooserWithFilter(final String des, final String filter) { + RunnableFuture future = new FutureTask<>(new Callable() { + @Override + public String call() { + JFileChooser fileChooser = new JFileChooser(); + fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + + if (StringUtils.isNotEmpty(filter)) { + fileChooser.setFileFilter(new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filter))); + } + + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; + } + }); + SwingUtilities.invokeLater(future); + try { + return future.get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + /** + * 选择文件对话框 + * + * @param des 过滤文件描述 + * @param args 文件的后缀 + * @return 选择的文件的路径 + */ + @JSBridge + public String showFileChooserWithFilters(final String des, final Object args) { + RunnableFuture future = new FutureTask<>(new Callable() { + @Override + public String call() { + JFileChooser fileChooser = new JFileChooser(); + List filterList = new ArrayList<>(); + if (args instanceof String) { + filterList.add(GeneralUtils.objectToString(args)); + } else if (args instanceof JSArray) { + JSArray array = (JSArray)args; + for (int i = 0, len = array.length(); i < len; i ++) { + filterList.add(array.get(i).getStringValue()); + } + } + String[] filters = filterList.toArray(new String[0]); + if (ArrayUtils.isNotEmpty(filters)) { + FileNameExtensionFilter filter = new FileNameExtensionFilter(des, UpmUtils.findMatchedExtension(filters)); + fileChooser.setFileFilter(filter); + } + int result = fileChooser.showOpenDialog(UpmFinder.getDialog()); + if (result == JFileChooser.APPROVE_OPTION) { + return fileChooser.getSelectedFile().getAbsolutePath(); + } + return null; + } + }); + SwingUtilities.invokeLater(future); + try { + return future.get(); + } catch (Exception e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + return null; + } + + ////////登录相关/////// + + /** + * 获取系统登录的用户名 + */ + @JSBridge + public String getLoginInfo(final JSFunction callback) { + registerLoginInfo(callback); + return MarketConfig.getInstance().getBbsUsername(); + } + + /** + * 系统登录注册 + * + * @param callback 回调函数 + */ + @JSBridge + public void registerLoginInfo(final JSFunction callback) { + JSCallback jsCallback = new JSCallback(UpmBrowserExecutor.create(window, callback)); + String username = MarketConfig.getInstance().getBbsUsername(); + if (StringUtils.isEmpty(username)) { + jsCallback.execute(StringUtils.EMPTY); + EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY); + } else { + jsCallback.execute(username); + EventDispatcher.fire(CertificateEvent.LOGIN, username); + } + } + + + /** + * 设计器端的用户登录 + * + * @param username 用户名 + * @param password 密码 + * @param callback 回调函数 + */ + @JSBridge + public void defaultLogin(String username, String password, final JSFunction callback) { + UpmTaskWorker worker = new UpmTaskWorker<>(new JSCallback(UpmBrowserExecutor.create(window, callback)), new PluginLoginExecutor(username, password)); + worker.execute(); + } + + /** + * 清除用户信息 + */ + public void clearUserInfo() { + MarketConfig.getInstance().setInShowBBsName(StringUtils.EMPTY); + FinePassportManager.getInstance().logout(); + EventDispatcher.fire(CertificateEvent.LOGOUT, StringUtils.EMPTY); + } + + /** + * 打开论坛消息界面 + */ + @JSBridge + public void getPriviteMessage() { + try { + String loginUrl = CloudCenter.getInstance().acquireUrlByKind("bbs.default"); + Desktop.getDesktop().browse(new URI(loginUrl)); + } catch (Exception exp) { + FineLoggerFactory.getLogger().info(exp.getMessage()); + } + } + + /** + * 忘记密码 + */ + @JSBridge + public void forgetHref() { + try { + Desktop.getDesktop().browse(new URI(CloudCenter.getInstance().acquireUrlByKind("bbs.reset"))); + } catch (Exception e) { + FineLoggerFactory.getLogger().info(e.getMessage()); + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java new file mode 100644 index 0000000000..5b90d43307 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/UpmFinder.java @@ -0,0 +1,68 @@ +package com.fr.design.upm; + +import com.fr.base.FRContext; +import com.fr.design.dialog.UIDialog; +import com.fr.design.mainframe.DesignerContext; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.fr.stable.StableUtils; +import com.fr.workspace.Workspace; +import com.fr.workspace.WorkspaceEvent; + +import javax.swing.*; +import java.io.File; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + */ +public class UpmFinder { + + private static final String UPM_DIR = "/upm"; + private static final String MAIN_RESOURCE_PATH = UPM_DIR + "/plugin_design.html"; + + public static String installHome = FRContext.getCommonOperator().getWebRootPath(); + + private static UIDialog dialog = null; + + static { + EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { + @Override + public void on(Event event, Workspace param) { + installHome = FRContext.getCommonOperator().getWebRootPath(); + } + }); + } + + public static boolean checkUPMResourcesExist() { + String mainJsPath = StableUtils.pathJoin(installHome, MAIN_RESOURCE_PATH); + File file = new File(mainJsPath); + return file.exists(); + } + + public static String getMainResourcePath() { + return "file:///" + StableUtils.pathJoin(installHome, MAIN_RESOURCE_PATH); + } + + public static UIDialog getDialog() { + return dialog; + } + + public static void showUPMDialog() { + UpmShowPane upmPane = new UpmShowPane(); + if (dialog == null) { + dialog = new UpmShowDialog(DesignerContext.getDesignerFrame(), upmPane); + } + dialog.setVisible(true); + } + + public static void closeWindow() { + if (dialog != null) { + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); + dialog.setVisible(false); + dialog = null; + } + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java new file mode 100644 index 0000000000..704e011218 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowDialog.java @@ -0,0 +1,34 @@ +package com.fr.design.upm; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.dialog.UIDialog; +import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.stable.StableUtils; + +import javax.swing.*; +import java.awt.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + */ +public class UpmShowDialog extends UIDialog { + + private static final Dimension DEFAULT_SHOP = new Dimension(900, 700); + + public UpmShowDialog(Frame frame, BasicPane pane) { + super(frame); + setUndecorated(true); + JPanel panel = (JPanel) getContentPane(); + panel.setLayout(new BorderLayout()); + add(pane, BorderLayout.CENTER); + setSize(DEFAULT_SHOP); + GUICoreUtils.centerWindow(this); + setResizable(false); + } + + @Override + public void checkValid() throws Exception { + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java new file mode 100644 index 0000000000..e64e5f02ea --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/UpmShowPane.java @@ -0,0 +1,63 @@ +package com.fr.design.upm; + +import com.fr.design.dialog.BasicPane; +import com.fr.design.ui.ModernUIPane; +import com.fr.design.upm.event.DownloadEvent; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; +import com.teamdev.jxbrowser.chromium.JSValue; +import com.teamdev.jxbrowser.chromium.events.ScriptContextAdapter; +import com.teamdev.jxbrowser.chromium.events.ScriptContextEvent; + +import java.awt.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + * Update Plugin Manager容器 + */ +public class UpmShowPane extends BasicPane { + + private ModernUIPane modernUIPane; + + @Override + protected String title4PopupWindow() { + return "UPM"; + } + + public UpmShowPane() { + setLayout(new BorderLayout()); + if (UpmFinder.checkUPMResourcesExist()) { + modernUIPane = new ModernUIPane.Builder<>() + .prepare(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); + window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); + } + }) + .withURL(UpmFinder.getMainResourcePath()) + .build(); + } else { + modernUIPane = new ModernUIPane.Builder<>() + .withComponent(WarnComponent.KEY) + .prepare(new ScriptContextAdapter() { + @Override + public void onScriptContextCreated(ScriptContextEvent event) { + JSValue window = event.getBrowser().executeJavaScriptAndReturnValue("window"); + window.asObject().setProperty("PluginHelper", UpmBridge.getBridge(event.getBrowser())); + } + }).build(); + EventDispatcher.listen(DownloadEvent.SUCCESS, new Listener() { + @Override + public void on(Event event, String param) { + modernUIPane.redirect(UpmFinder.getMainResourcePath()); + } + }); + } + add(modernUIPane, BorderLayout.CENTER); + } + +} diff --git a/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java b/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java new file mode 100644 index 0000000000..a74f0f616e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/UpmUtils.java @@ -0,0 +1,21 @@ +package com.fr.design.upm; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + */ +public class UpmUtils { + + public static String[] findMatchedExtension(String... extensions) { + List list = new ArrayList<>(); + for (String ext : extensions) { + String[] arr = ext.split("\\."); + list.add(arr[arr.length - 1]); + } + return list.toArray(new String[0]); + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/WarnComponent.java b/designer-base/src/main/java/com/fr/design/upm/WarnComponent.java new file mode 100644 index 0000000000..3ab134acf1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/WarnComponent.java @@ -0,0 +1,33 @@ +package com.fr.design.upm; + +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.Atom; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.impl.FineUI; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + */ +public class WarnComponent extends AssembleComponent { + + public static final WarnComponent KEY = new WarnComponent(); + + private WarnComponent() { + + } + + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("com/fr/design/upm/warn.js"); + } + + @Override + public Atom[] refer() { + return new Atom[]{ + FineUI.KEY + }; + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/event/CertificateEvent.java b/designer-base/src/main/java/com/fr/design/upm/event/CertificateEvent.java new file mode 100644 index 0000000000..5710768449 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/event/CertificateEvent.java @@ -0,0 +1,12 @@ +package com.fr.design.upm.event; + +import com.fr.event.Event; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + */ +public enum CertificateEvent implements Event { + LOGIN,LOGOUT +} diff --git a/designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java b/designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java new file mode 100644 index 0000000000..e07156b83e --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/event/DownloadEvent.java @@ -0,0 +1,13 @@ +package com.fr.design.upm.event; + +import com.fr.event.Event; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-12 + */ +public enum DownloadEvent implements Event { + + SUCCESS, ERROR +} diff --git a/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java b/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java new file mode 100644 index 0000000000..572f7b5f23 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/exec/UpmBrowserExecutor.java @@ -0,0 +1,30 @@ +package com.fr.design.upm.exec; + +import com.fr.design.bridge.exec.JSExecutor; +import com.teamdev.jxbrowser.chromium.JSFunction; +import com.teamdev.jxbrowser.chromium.JSObject; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + */ +public class UpmBrowserExecutor implements JSExecutor { + + public static UpmBrowserExecutor create(JSObject window, JSFunction callback) { + return new UpmBrowserExecutor(window, callback); + } + + private JSObject window; + private JSFunction callback; + + private UpmBrowserExecutor(JSObject window, JSFunction callback) { + this.window = window; + this.callback = callback; + } + + @Override + public void executor(String newValue) { + callback.invoke(window, newValue); + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java b/designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java new file mode 100644 index 0000000000..93857dc8bc --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/loader/UpmDesignResourceLoader.java @@ -0,0 +1,27 @@ +package com.fr.design.upm.loader; + +import com.fr.decision.webservice.bean.plugin.store.ProjectInfoBean; +import com.fr.decision.webservice.v10.plugin.helper.category.impl.BaseResourceLoader; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-18 + */ +public class UpmDesignResourceLoader extends BaseResourceLoader { + + @Override + public String getPluginPath() { + return "upm/plugin_design.html"; + } + + @Override + public void checkResourceExist(ProjectInfoBean projectInfoBean) throws Exception { + + } + + @Override + public String getDownloadPath() throws Exception { + return "http://fanruan-market.oss-cn-shanghai.aliyuncs.com/upm/1.0/upm-10.0.zip"; + } +} diff --git a/designer-base/src/main/java/com/fr/design/upm/task/UpmTaskWorker.java b/designer-base/src/main/java/com/fr/design/upm/task/UpmTaskWorker.java new file mode 100644 index 0000000000..4de5198376 --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/upm/task/UpmTaskWorker.java @@ -0,0 +1,52 @@ +package com.fr.design.upm.task; + +import com.fr.design.bridge.exec.JSCallback; +import com.fr.design.bridge.exec.JSUtils; +import com.fr.design.extra.Process; +import com.fr.design.extra.exe.Command; +import com.fr.design.extra.exe.Executor; +import com.fr.stable.StringUtils; + +import javax.swing.*; + +/** + * @author richie + * @version 10.0 + * Created by richie on 2019-04-17 + */ +public class UpmTaskWorker extends SwingWorker { + + private Executor executor; + private JSCallback callback; + + public UpmTaskWorker(final JSCallback callback, final Executor executor) { + this.executor = executor; + this.callback = callback; + } + + @Override + protected V doInBackground() throws Exception { + Command[] commands = executor.getCommands(); + for (Command command : commands) { + String message = command.getExecuteMessage(); + if (StringUtils.isNotBlank(message)) { + publish(message); + } + command.run(new Process() { + @Override + public void process(String s) { + if (StringUtils.isNotBlank(s)) { + publish(JSUtils.trimText(s)); + } + } + }); + } + return null; + } + + @Override + protected void done() { + String result = executor.getTaskFinishMessage(); + callback.execute(result); + } +} diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java index 8687461a1c..dab6e4f85b 100644 --- a/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/DesignUtils.java @@ -1,6 +1,5 @@ package com.fr.design.utils; -import com.fr.base.BaseUtils; import com.fr.base.FeedBackInfo; import com.fr.base.ServerConfig; import com.fr.design.DesignerEnvManager; @@ -14,8 +13,7 @@ import com.fr.general.FRFont; import com.fr.general.GeneralContext; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; -import com.fr.stable.CodeUtils; -import com.fr.stable.EncodeConstants; +import com.fr.stable.CommonCodeUtils; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.start.ServerStarter; @@ -33,32 +31,33 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; import java.net.ServerSocket; import java.net.Socket; import java.net.URI; -import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.Enumeration; import java.util.Locale; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * Some util method of Designer */ public class DesignUtils { - private static final int MESSAGEPORT = 51462; - private static final int TIME_OUT = 20 * 1000; + private static int port = DesignerPort.MESSAGE_PORT; - public synchronized static void setPort(int port) { - DesignUtils.port = port; + private DesignUtils() { } - private static int port = MESSAGEPORT; - - private DesignUtils() { + public synchronized static void setPort(int port) { + DesignUtils.port = port; } + public static int getPort() { + return port; + } /** * 通过端口是否被占用判断设计器有没有启动 @@ -70,8 +69,7 @@ public class DesignUtils { try { new Socket("localhost", port); return true; - } catch (Exception exp) { - + } catch (Exception ignored) { } return false; } @@ -82,7 +80,7 @@ public class DesignUtils { * @param lines 命令行 */ public static void clientSend(String[] lines) { - if (lines != null && lines.length <= 0) { + if (lines == null || lines.length == 0) { return; } Socket socket = null; @@ -90,18 +88,21 @@ public class DesignUtils { try { socket = new Socket("localhost", port); - writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), EncodeConstants.ENCODING_UTF_8))); + writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), StandardCharsets.UTF_8))); for (int i = 0; i < lines.length; i++) { writer.println(lines[i]); } - writer.flush(); } catch (Exception e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } finally { try { - writer.close(); - socket.close(); + if (writer != null) { + writer.close(); + } + if (socket != null) { + socket.close(); + } } catch (IOException e) { FineLoggerFactory.getLogger().error(e.getMessage(), e); } @@ -114,47 +115,52 @@ public class DesignUtils { * @param startPort 端口 * @param suffixs 文件后缀 */ - public static void creatListeningServer(final int startPort, final String[] suffixs) { - Thread serverSocketThread = new Thread() { + public static void createListeningServer(final int startPort, final String[] suffixs) { + ExecutorService service = Executors.newSingleThreadExecutor(); + service.execute(new Runnable() { + @Override public void run() { ServerSocket serverSocket = null; try { serverSocket = new ServerSocket(startPort); } catch (IOException e1) { - FineLoggerFactory.getLogger().error("Cannot create server socket on" + port); + FineLoggerFactory.getLogger().error("Cannot create server socket on " + port); } while (true) { try { - Socket socket = serverSocket.accept(); // 接收客户连接 - BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), EncodeConstants.ENCODING_UTF_8)); - String line = null; - while ((line = reader.readLine()) != null) { - if (line.startsWith("demo")) { - DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); - ServerStarter.browserDemoURL(); - } else if (StringUtils.isNotEmpty(line)) { - File f = new File(line); - String path = f.getAbsolutePath(); - - boolean isMatch = false; - for (int i = 0; i < suffixs.length; i++) { - isMatch = isMatch || path.endsWith(suffixs[i]); - } - if (isMatch) { - DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); + if (serverSocket != null) { + Socket socket = serverSocket.accept(); // 接收客户连接 + BufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = reader.readLine()) != null) { + if (line.startsWith("demo")) { + DesignerEnvManager.getEnvManager().setCurrentEnv2Default(); + ServerStarter.browserDemoURL(); + } else if (StringUtils.isNotEmpty(line)) { + File f = new File(line); + String path = f.getAbsolutePath(); + + boolean isMatch = false; + for (int i = 0; i < suffixs.length; i++) { + isMatch = isMatch || path.endsWith(suffixs[i]); + } + if (isMatch) { + DesignerContext.getDesignerFrame().openTemplate(new FileFILE(f)); + } } } + reader.close(); + socket.close(); + } else { + FineLoggerFactory.getLogger().error("Cannot create server socket on " + port); + break; } - - reader.close(); - socket.close(); - } catch (IOException e) { - + } catch (IOException ignored) { } } } - }; - serverSocketThread.start(); + }); + } /** @@ -278,19 +284,18 @@ public class DesignUtils { */ public static void visitEnvServerByParameters(String baseRoute, String[] names, String[] values) { int len = Math.min(ArrayUtils.getLength(names), ArrayUtils.getLength(values)); - String[] segs = new String[len]; + String[] nameValuePairs = new String[len]; for (int i = 0; i < len; i++) { - try { - //设计器里面据说为了改什么界面统一, 把分隔符统一用File.separator, 意味着在windows里面报表路径变成了\ - //以前的超链, 以及预览url什么的都是/, 产品组的意思就是用到的地方替换下, 真恶心. - String value = values[i].replaceAll("\\\\", "/"); - segs[i] = URLEncoder.encode(CodeUtils.cjkEncode(names[i]), EncodeConstants.ENCODING_UTF_8) + "=" + URLEncoder.encode(CodeUtils.cjkEncode(value), "UTF-8"); - } catch (UnsupportedEncodingException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } + //设计器里面据说为了改什么界面统一, 把分隔符统一用File.separator, 意味着在windows里面报表路径变成了\ + //以前的超链, 以及预览url什么的都是/, 产品组的意思就是用到的地方替换下, 真恶心. + String value = values[i].replaceAll("\\\\", "/"); + // 两次 encode 支持中文和特殊符号,避免跳转登录后预览400报错 + nameValuePairs[i] = + CommonCodeUtils.encodeURIComponent(CommonCodeUtils.encodeURIComponent(names[i])) + + "=" + CommonCodeUtils.encodeURIComponent(CommonCodeUtils.encodeURIComponent(value)); } - String postfixOfUri = (segs.length > 0 ? "?" + StableUtils.join(segs, "&") : StringUtils.EMPTY); - + String postfixOfUri = (nameValuePairs.length > 0 ? "?" + StableUtils.join(nameValuePairs, "&") : StringUtils.EMPTY); + if (!WorkContext.getCurrent().isLocal()) { try { String urlPath = getWebBrowserPath(); @@ -305,8 +310,7 @@ public class DesignUtils { + "/" + web + "/" + ServerConfig.getInstance().getServletName() + baseRoute + postfixOfUri; ServerStarter.browserURLWithLocalEnv(url); - } catch (Throwable e) { - // + } catch (Throwable ignored) { } } } @@ -321,87 +325,6 @@ public class DesignUtils { return urlPath; } - //TODO:august:下个版本,要把下面的图片都放在一个preload文件夹下,表示可以预先加载。然后遍历一下就可以了,不用这么一个一个的写了 - - /** - * 预加载 - */ - public static void preLoadingImages() { - BaseUtils.readIcon("com/fr/design/images/custombtn/baobiaozhuti.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/baobiaozhuti_hover.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/baobiaozhuti_click.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/canshujiemian.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/canshujiemian_hover.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/canshujiemian_click.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/setting.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/setting_hover.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/setting_click.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/page.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/page_hover.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/page_click.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/form.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/form_hover.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/form_click.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/edit.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/edit_hover.png"); - BaseUtils.readIcon("com/fr/design/images/custombtn/edit_click.png"); - BaseUtils.readIcon("com/fr/base/images/oem/addworksheet.png"); - BaseUtils.readIcon("com/fr/design/images/sheet/addpolysheet.png"); - BaseUtils.readIcon("com/fr/base/images/oem/worksheet.png"); - BaseUtils.readIcon("com/fr/design/images/sheet/polysheet.png"); - BaseUtils.readIcon("com/fr/design/images/sheet/left_right_btn.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/cellPop.png"); - BaseUtils.readIcon("/com/fr/design/images/docking/right.gif"); - BaseUtils.readIcon("/com/fr/design/images/docking/left.gif"); - BaseUtils.readIcon("/com/fr/design/images/m_file/save.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/excel.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/pdf.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/word.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/svg.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/csv.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/text.png"); - BaseUtils.readIcon("/com/fr/design/images/m_web/datasource.png"); - BaseUtils.readIcon("/com/fr/design/images/m_report/webreportattribute.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/pageSetup.png"); - BaseUtils.readIcon("/com/fr/design/images/m_report/header.png"); - BaseUtils.readIcon("/com/fr/design/images/m_report/footer.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/saveAs.png"); - BaseUtils.readIcon("/com/fr/design/images/m_report/background.png"); - loadOtherImages(); - } - - - private static void loadOtherImages() { - BaseUtils.readIcon("/com/fr/design/images/m_report/reportWriteAttr.png"); - BaseUtils.readIcon("/com/fr/design/images/m_report/linearAttr.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/bindColumn.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/text.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/chart.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/image.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/bias.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/subReport.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/insertRow.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/insertColumn.png"); - BaseUtils.readIcon("/com/fr/design/images/m_format/highlight.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/hyperLink.png"); - BaseUtils.readIcon("/com/fr/design/images/m_edit/merge.png"); - BaseUtils.readIcon("/com/fr/design/images/m_edit/unmerge.png"); - BaseUtils.readIcon("/com/fr/design/images/m_file/export.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/cell.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/float.png"); - BaseUtils.readIcon("/com/fr/design/images/m_edit/undo.png"); - BaseUtils.readIcon("/com/fr/design/images/m_edit/redo.png"); - BaseUtils.readIcon("/com/fr/design/images/m_edit/cut.png"); - BaseUtils.readIcon("/com/fr/design/images/m_edit/paste.png"); - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/leftAlignment.png"); - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/centerAlignment.png"); - BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/rightAlignment.png"); - BaseUtils.readIcon("/com/fr/design/images/m_format/noboder.png"); - BaseUtils.readIcon("/com/fr/design/images/gui/color/background.png"); - BaseUtils.readIcon("/com/fr/design/images/m_insert/floatPop.png"); - } - - /** * 将用户反馈发送至服务器 * diff --git a/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java new file mode 100644 index 0000000000..7c082800ed --- /dev/null +++ b/designer-base/src/main/java/com/fr/design/utils/DesignerPort.java @@ -0,0 +1,26 @@ +package com.fr.design.utils; + +/** + * 为的就是能替换 DesignPort.class 实现多开,因此避免编译器常量编译展开优化 + */ +public class DesignerPort { + private DesignerPort() { + } + + /** + * 设计器端口,避免编译期常量优化展开 + */ + public static final int MESSAGE_PORT = getMessagePort(); + /** + * 设计器端口,避免编译期常量优化展开 + */ + public static final int DEBUG_MESSAGE_PORT = getDebugMessagePort(); + + private static int getMessagePort() { + return 51462; + } + + private static int getDebugMessagePort() { + return 51463; + } +} diff --git a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java index 3e1f98555f..d2e9704658 100644 --- a/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java +++ b/designer-base/src/main/java/com/fr/design/utils/gui/UIComponentUtils.java @@ -2,6 +2,8 @@ package com.fr.design.utils.gui; import com.fr.design.gui.core.UITextComponent; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.general.ComparatorUtils; +import com.fr.general.GeneralContext; import com.fr.stable.StringUtils; import javax.swing.JComponent; @@ -9,6 +11,7 @@ import javax.swing.JPanel; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Dimension; +import java.util.Locale; /** * 包含 UI 组件相关的工具方法 @@ -45,15 +48,18 @@ public class UIComponentUtils { } private static void insertPrefixToText(UITextComponent comp, String prefix) { - if (comp == null) { + if (comp == null || ComparatorUtils.equals(Locale.CHINA, GeneralContext.getLocale())) { + // 最初是为了解决日文国际化显示不全,而增加的换行功能。中文不需要换行。 + // windows 下,字体为宋体时,对于 JLabel、JCheckBox、JButton 等控件,使用换行后,文字会下移,可能导致文字下半部分被截断。 + // 因此中文直接返回,不加换行逻辑。 return; } - String text = comp.getText(); - if (StringUtils.isEmpty(comp.getText()) || text.startsWith(HTML_TAG)) { + String text = comp.getText(); + if (StringUtils.isEmpty(text) || text.startsWith(HTML_TAG)) { return; } - comp.setText(prefix + comp.getText()); + comp.setText(prefix + text); } /** diff --git a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java index b85ac113d5..74a4990300 100644 --- a/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java +++ b/designer-base/src/main/java/com/fr/design/web/CustomIconPane.java @@ -291,7 +291,7 @@ public class CustomIconPane extends BasicPane { Configurations.update(new WorkerFacade(WidgetInfoConfig.class) { @Override public void run() { - WidgetInfoConfig.getInstance().setIconManager(IconManager.getIconManager()); + WidgetInfoConfig.getInstance().setIconManager(iconManager); } }); diff --git a/designer-base/src/main/java/com/fr/file/AbstractFILE.java b/designer-base/src/main/java/com/fr/file/AbstractFILE.java new file mode 100644 index 0000000000..866ea2c2b1 --- /dev/null +++ b/designer-base/src/main/java/com/fr/file/AbstractFILE.java @@ -0,0 +1,93 @@ +package com.fr.file; + +import javax.swing.Icon; +import java.io.InputStream; +import java.io.OutputStream; + +public abstract class AbstractFILE implements FILE { + + @Override + public String prefix() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isDirectory() { + throw new UnsupportedOperationException(); + } + + @Override + public String getName() { + throw new UnsupportedOperationException(); + } + + @Override + public Icon getIcon() { + throw new UnsupportedOperationException(); + } + + @Override + public String getPath() { + throw new UnsupportedOperationException(); + } + + @Override + public void setPath(String path) { + throw new UnsupportedOperationException(); + } + + @Override + public FILE getParent() { + throw new UnsupportedOperationException(); + } + + @Override + public FILE[] listFiles() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean createFolder(String name) { + throw new UnsupportedOperationException(); + } + + @Override + public boolean mkfile() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public boolean exists() { + throw new UnsupportedOperationException(); + } + + @Override + public void closeTemplate() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public InputStream asInputStream() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public OutputStream asOutputStream() throws Exception { + throw new UnsupportedOperationException(); + } + + @Override + public String getEnvFullName() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isMemFile() { + throw new UnsupportedOperationException(); + } + + @Override + public boolean isEnvFile() { + throw new UnsupportedOperationException(); + } +} diff --git a/designer-base/src/main/java/com/fr/file/FileFILE.java b/designer-base/src/main/java/com/fr/file/FileFILE.java index 5331cd7785..c4f58fa1a3 100644 --- a/designer-base/src/main/java/com/fr/file/FileFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileFILE.java @@ -201,7 +201,7 @@ public class FileFILE implements FILE { OutputStream out; try { StableUtils.makesureFileExist(file); - out = new FileOutputStream(file, true); + out = new FileOutputStream(file, false); } catch (Exception e) { throw SessionLocalManager.createLogPackedException(e); } diff --git a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java index 7f73fc7081..dce2c38e0b 100644 --- a/designer-base/src/main/java/com/fr/file/FileNodeFILE.java +++ b/designer-base/src/main/java/com/fr/file/FileNodeFILE.java @@ -7,6 +7,9 @@ import com.fr.design.file.NodeAuthProcessor; import com.fr.design.gui.itree.filetree.FileNodeComparator; import com.fr.design.gui.itree.filetree.FileTreeIcon; import com.fr.design.i18n.Toolkit; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; import com.fr.file.filetree.FileNode; import com.fr.general.ComparatorUtils; import com.fr.io.EncryptUtils; @@ -15,6 +18,8 @@ import com.fr.stable.CoreConstants; import com.fr.stable.StableUtils; import com.fr.stable.project.ProjectConstants; import com.fr.workspace.WorkContext; +import com.fr.workspace.Workspace; +import com.fr.workspace.WorkspaceEvent; import com.fr.workspace.resource.WorkResourceTempRenameStream; import com.fr.workspace.server.lock.TplOperator; @@ -26,6 +31,21 @@ import java.util.Arrays; public class FileNodeFILE implements FILE { + + private static String webRootPath = FRContext.getCommonOperator().getWebRootPath(); + private static String[] supportTypes = FRContext.getFileNodes().getSupportedTypes(); + + static { + EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener() { + @Override + public void on(Event event, Workspace workspace) { + webRootPath = FRContext.getCommonOperator().getWebRootPath(); + supportTypes = FRContext.getFileNodes().getSupportedTypes(); + } + }); + } + + private FileNode node; //记录下FILE对应的运行环境,每次创建都设置下当前的运行环境 @@ -95,7 +115,7 @@ public class FileNodeFILE implements FILE { @Override public String prefix() { - if (ComparatorUtils.equals(getEnvPath(), FRContext.getCommonOperator().getWebRootPath())) { + if (ComparatorUtils.equals(getEnvPath(), webRootPath)) { return FILEFactory.WEBREPORT_PREFIX; } return FILEFactory.ENV_PREFIX; @@ -212,7 +232,7 @@ public class FileNodeFILE implements FILE { try { FileNode[] nodeArray; nodeArray = listFile(node.getEnvPath()); - Arrays.sort(nodeArray, new FileNodeComparator(FRContext.getFileNodes().getSupportedTypes())); + Arrays.sort(nodeArray, new FileNodeComparator(supportTypes)); return fileNodeArray2FILEArray(nodeArray, envPath); } catch (Exception e) { @@ -235,7 +255,7 @@ public class FileNodeFILE implements FILE { private FileNode[] listFile(String rootFilePath) { try { - if (ComparatorUtils.equals(envPath, FRContext.getCommonOperator().getWebRootPath())) { + if (ComparatorUtils.equals(envPath, webRootPath)) { return FRContext.getFileNodes().listWebRootFile(rootFilePath); } else { return FRContext.getFileNodes().list(rootFilePath); diff --git a/designer-base/src/main/java/com/fr/file/RenameExportFILE.java b/designer-base/src/main/java/com/fr/file/RenameExportFILE.java new file mode 100644 index 0000000000..8b03e943f6 --- /dev/null +++ b/designer-base/src/main/java/com/fr/file/RenameExportFILE.java @@ -0,0 +1,102 @@ +package com.fr.file; + +import com.fr.stable.StableUtils; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.commons.io.FileUtils; +import com.fr.web.session.SessionLocalManager; + +import javax.swing.Icon; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +public class RenameExportFILE extends AbstractFILE { + + private static final String EXPORT_SUFFIX = ".FRExportTmp"; + + private FILE file; + + private RenameExportFILE(FILE file) { + this.file = new FileFILE(new File(file.getPath() + EXPORT_SUFFIX)); + } + + public static RenameExportFILE create(FILE file) { + return new RenameExportFILE(file); + } + + public static String recoverFileName(String fileName) { + if (StringUtils.isEmpty(fileName) || !fileName.endsWith(EXPORT_SUFFIX)) { + return fileName; + } + return fileName.substring(0, fileName.lastIndexOf(EXPORT_SUFFIX)); + } + + @Override + public String prefix() { + return file.prefix(); + } + + @Override + public boolean isDirectory() { + return false; + } + + @Override + public String getName() { + return file.getName(); + } + + @Override + public Icon getIcon() { + return null; + } + + @Override + public String getPath() { + return file.getPath(); + } + + + @Override + public FILE getParent() { + return file.getParent(); + } + + + @Override + public boolean mkfile() throws Exception { + return file.mkfile(); + } + + @Override + public boolean exists() { + return file.exists(); + } + + @Override + public OutputStream asOutputStream() throws Exception { + + final File localeFile = new File(file.getPath()); + OutputStream out; + try { + StableUtils.makesureFileExist(localeFile); + out = new FileOutputStream(localeFile, false) { + @Override + public void close() throws IOException { + super.close(); + String path = file.getPath(); + if (localeFile.exists()) { + FileUtils.copyFile(localeFile, new File(recoverFileName(path))); + if (localeFile.getPath().endsWith(EXPORT_SUFFIX)) { + FileUtils.forceDelete(localeFile); + } + } + } + }; + } catch (Exception e) { + throw SessionLocalManager.createLogPackedException(e); + } + return out; + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/file/StashedFILE.java b/designer-base/src/main/java/com/fr/file/StashedFILE.java index 4bc9b431ea..181af28601 100644 --- a/designer-base/src/main/java/com/fr/file/StashedFILE.java +++ b/designer-base/src/main/java/com/fr/file/StashedFILE.java @@ -1,15 +1,13 @@ package com.fr.file; import javax.swing.Icon; -import javax.transaction.NotSupportedException; import java.io.ByteArrayInputStream; import java.io.InputStream; -import java.io.OutputStream; /** * 切换环境用于暂存的文件类型 */ -public class StashedFILE implements FILE { +public class StashedFILE extends AbstractFILE { private FILE file; private byte[] content; @@ -44,31 +42,6 @@ public class StashedFILE implements FILE { return file.getPath(); } - @Override - public void setPath(String path) { - throw new UnsupportedOperationException(); - } - - @Override - public FILE getParent() { - throw new UnsupportedOperationException(); - } - - @Override - public FILE[] listFiles() { - throw new UnsupportedOperationException(); - } - - @Override - public boolean createFolder(String name) { - throw new UnsupportedOperationException(); - } - - @Override - public boolean mkfile() throws Exception { - throw new UnsupportedOperationException(); - } - @Override public boolean exists() { return false; @@ -84,11 +57,6 @@ public class StashedFILE implements FILE { return new ByteArrayInputStream(content); } - @Override - public OutputStream asOutputStream() throws Exception { - throw new NotSupportedException(); - } - @Override public String getEnvFullName() { return file.getEnvFullName(); diff --git a/designer-base/src/main/java/com/fr/start/OemHandler.java b/designer-base/src/main/java/com/fr/start/OemHandler.java new file mode 100644 index 0000000000..b127e07f43 --- /dev/null +++ b/designer-base/src/main/java/com/fr/start/OemHandler.java @@ -0,0 +1,14 @@ +package com.fr.start; + +import com.fr.design.fun.OemProcessor; +import com.fr.stable.bridge.StableFactory; + +/** + * OEM处理中心 + */ +public class OemHandler { + + public static OemProcessor findOem() { + return StableFactory.getMarkedInstanceObjectFromClass(OemProcessor.MARK_STRING, OemProcessor.class); + } +} \ No newline at end of file diff --git a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java index 2d08b286d5..0955c16e57 100644 --- a/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java +++ b/designer-base/src/main/java/com/fr/start/server/FineEmbedServerActivator.java @@ -6,6 +6,7 @@ import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; import com.fr.module.ModuleRole; import com.fr.stable.EncodeConstants; +import com.fr.stable.ProductConstants; import com.fr.startup.FineWebApplicationInitializer; import com.fr.third.springframework.web.SpringServletContainerInitializer; import com.fr.third.springframework.web.context.support.AnnotationConfigWebApplicationContext; @@ -62,6 +63,8 @@ public class FineEmbedServerActivator extends Activator { // 设置解码uri使用的字符编码 tomcat.getConnector().setURIEncoding(EncodeConstants.ENCODING_UTF_8); String docBase = new File(WorkContext.getCurrent().getPath()).getParent(); + //内置的上下文是自己定的,这里把WEB_APP_NAME一并设置了,否则下面appName是/null + ProductConstants.setWebAppName(ProductConstants.getAppFolderName()); String appName = "/" + FRContext.getCommonOperator().getAppName(); Context context = tomcat.addContext(appName, docBase); Tomcat.initWebappDefaults(context); diff --git a/designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js b/designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js index 0274d5fa50..03b2bb32ae 100644 --- a/designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js +++ b/designer-base/src/main/resources/com/fr/design/ui/InitNameSpace.js @@ -1,6 +1,6 @@ -var arr ="%s".split(".").reverse(); -var create = function (obj, names) { - var name = names.pop(); +let arr ="%s".split(".").reverse(); +let create = function (obj, names) { + let name = names.pop(); if (!name) { return; } diff --git a/designer-base/src/main/resources/com/fr/design/upm/warn.js b/designer-base/src/main/resources/com/fr/design/upm/warn.js new file mode 100644 index 0000000000..1eb5fb6407 --- /dev/null +++ b/designer-base/src/main/resources/com/fr/design/upm/warn.js @@ -0,0 +1,61 @@ +window.onload = function () { + let label = BI.createWidget({ + type: "bi.label", + text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Resource_Warn"), + height: 30 + }); + let callback = function(text) { + download.setValue(text); + }; + let buttonOK = BI.createWidget({ + type: "bi.button", + text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Download"), + level: 'common', + height: 30, + handler: function () { + PluginHelper.startDownload(callback); + } + }); + let buttonClose = BI.createWidget({ + type: "bi.button", + text: PluginHelper.i18nText("Fine-Design_Basic_Update_Plugin_Manager_Close"), + level: 'warning', + height: 30, + handler: function () { + PluginHelper.closeWindow(); + } + }); + + let download = BI.createWidget({ + type: "bi.label", + height: 30 + }); + let left = 300; + let top = 200; + BI.createWidget({ + type: "bi.absolute", + element: "body", + items: [ + { + el: label, + left: left, + top: top + }, + { + el : buttonOK, + left : left, + top : top + 40 + }, + { + el : buttonClose, + left : left + 100, + top : top + 40 + }, + { + el : download, + left : left, + top : top + 80 + } + ] + }); +}; \ No newline at end of file diff --git a/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java b/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java index c875716a5b..c7dd4b6821 100644 --- a/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java +++ b/designer-base/src/test/java/com/fr/design/ui/FineUIDemo.java @@ -2,10 +2,8 @@ package com.fr.design.ui; import com.fr.design.DesignerEnvManager; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.WindowConstants; -import java.awt.BorderLayout; +import javax.swing.*; +import java.awt.*; /** * @author richie diff --git a/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java b/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java index f5c8aaaa92..9676ee998a 100644 --- a/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java +++ b/designer-base/src/test/java/com/fr/design/ui/ModernUIPaneTest.java @@ -2,13 +2,8 @@ package com.fr.design.ui; import com.fr.design.DesignerEnvManager; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.WindowConstants; -import java.awt.BorderLayout; -import java.awt.FlowLayout; +import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; diff --git a/designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamComponent.java b/designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamComponent.java new file mode 100644 index 0000000000..6299fb860a --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamComponent.java @@ -0,0 +1,40 @@ +package com.fr.design.ui.report; + +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.Atom; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ParserType; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; +import com.fr.web.struct.impl.FineUI; + +/** + * Created by windy on 2019/3/25. + * 报表服务器参数demo使用 + */ +public class ReportServerParamComponent extends AssembleComponent { + + public static final ReportServerParamComponent KEY = new ReportServerParamComponent(); + + private ReportServerParamComponent() { + + } + + @Override + public Atom[] refer() { + return new Atom[] { + FineUI.KEY + }; + } + + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("/com/fr/design/ui/script/report.js"); + } + + @Override + public StylePath style() { + + return StylePath.build("/com/fr/design/ui/script/report.css", ParserType.DYNAMIC); + } +} diff --git a/designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamDemo.java b/designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamDemo.java new file mode 100644 index 0000000000..42199134dc --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/ui/report/ReportServerParamDemo.java @@ -0,0 +1,29 @@ +package com.fr.design.ui.report; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.ui.ModernUIPane; +import com.fr.design.ui.ModernUIPaneTest; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by windy on 2019/3/25. + * 报表服务器参数demo + */ +public class ReportServerParamDemo { + + public static void main(String... args) { + final JFrame frame = new JFrame(); + frame.setSize(660, 600); + JPanel contentPane = (JPanel) frame.getContentPane(); + // 是否需要开启调试窗口 + DesignerEnvManager.getEnvManager().setOpenDebug(true); + + final ModernUIPane pane = new ModernUIPane.Builder() + .withComponent(ReportServerParamComponent.KEY).build(); + contentPane.add(pane, BorderLayout.CENTER); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingComponent.java b/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingComponent.java new file mode 100644 index 0000000000..333c6ab108 --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingComponent.java @@ -0,0 +1,40 @@ +package com.fr.design.ui.report; + +import com.fr.web.struct.AssembleComponent; +import com.fr.web.struct.Atom; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ParserType; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; +import com.fr.web.struct.impl.FineUI; + +/** + * Created by windy on 2019/3/26. + * 模板Web属性demo使用 + */ +public class TemplateWebSettingComponent extends AssembleComponent { + + public static final TemplateWebSettingComponent KEY = new TemplateWebSettingComponent(); + + private TemplateWebSettingComponent() { + + } + + @Override + public Atom[] refer() { + return new Atom[] { + FineUI.KEY + }; + } + + @Override + public ScriptPath script(RequestClient req) { + return ScriptPath.build("/com/fr/design/ui/script/template.js"); + } + + @Override + public StylePath style() { + + return StylePath.build("/com/fr/design/ui/script/template.css", ParserType.DYNAMIC); + } +} diff --git a/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java b/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java new file mode 100644 index 0000000000..b267b1346a --- /dev/null +++ b/designer-base/src/test/java/com/fr/design/ui/report/TemplateWebSettingDemo.java @@ -0,0 +1,28 @@ +package com.fr.design.ui.report; + +import com.fr.design.DesignerEnvManager; +import com.fr.design.ui.ModernUIPane; +import com.fr.design.ui.ModernUIPaneTest; + +import javax.swing.*; +import java.awt.*; + +/** + * Created by windy on 2019/3/26. + * 模板Web属性demo + */ +public class TemplateWebSettingDemo { + public static void main(String... args) { + final JFrame frame = new JFrame(); + frame.setSize(660, 600); + JPanel contentPane = (JPanel) frame.getContentPane(); + // 是否需要开启调试窗口 + DesignerEnvManager.getEnvManager().setOpenDebug(true); + + final ModernUIPane pane = new ModernUIPane.Builder() + .withComponent(TemplateWebSettingComponent.KEY).build(); + contentPane.add(pane, BorderLayout.CENTER); + frame.setVisible(true); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + } +} diff --git a/designer-base/src/test/resources/com/fr/design/ui/demo.html b/designer-base/src/test/resources/com/fr/design/ui/demo.html index 2beae25a78..9e5211c89e 100644 --- a/designer-base/src/test/resources/com/fr/design/ui/demo.html +++ b/designer-base/src/test/resources/com/fr/design/ui/demo.html @@ -10,6 +10,12 @@ return Pool.data; }; +
测试页面,请点击最下面的按钮
diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/css/js/common/settingtab/settingtab.css b/designer-base/src/test/resources/com/fr/design/ui/script/css/js/common/settingtab/settingtab.css new file mode 100644 index 0000000000..05d98d1557 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/css/js/common/settingtab/settingtab.css @@ -0,0 +1,12 @@ +.bi-setting-tab .tab-group { + background-color: #F2F4F7; + font-size: 12px; +} +.bi-setting-tab .tab-group .tab-item:hover { + color: #3685f2; +} +.bi-setting-tab .tab-group .tab-item.active { + background-color: #ffffff; + color: #3685f2; + border-top: 3px solid #3685f2; +} diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/css/js/index.css b/designer-base/src/test/resources/com/fr/design/ui/script/css/js/index.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/bar.container.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/bar.container.js new file mode 100644 index 0000000000..dd682b2e6c --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/bar.container.js @@ -0,0 +1,41 @@ +!(function(){ + /** + * 带确定取消的通用控件 + */ + var Bar = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-settings-bar-container", + el: { + + } + }, + + render: function() { + return { + type: "bi.vtape", + items: [this.options.el, { + type: "bi.right_vertical_adapt", + height: 24, + rgap: 10, + vgap: 10, + items: [{ + type: "bi.button", + level: "ignore", + text: BI.i18nText("Fine-Design_Report_OK"), + handler: function() { + + } + }, { + type: "bi.button", + level: "ignore", + text: BI.i18nText("Fine-Design_Basic_Engine_Cancel"), + handler: function() { + + } + }] + }] + } + } + }) + BI.shortcut("bi.settings.bar_container", Bar) +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/edit.list.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/edit.list.js new file mode 100644 index 0000000000..a7c77c0d79 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/edit.list.js @@ -0,0 +1,89 @@ +!(function () { + /** + * 事件设置 + */ + var List = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-edit-list" + }, + + render: function () { + var self = this; + return { + type: "bi.vtape", + vgap: 5, + items: [{ + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.icon_button", + cls: "text-add-tip-font", + width: 24, + height: 24, + handler: function() { + self.group.addItems([self._createItem()]) + } + }, { + type: "bi.icon_button", + cls: "close-font", + width: 24, + height: 24, + handler: function() { + self.group.removeItemAt(); + } + }, { + type: "bi.icon_button", + cls: "close-font", + width: 24, + height: 24, + handler: function() { + self.removeItemAt(self._getIndexOfItemValue(self.group.getValue())) + } + }] + }, { + type: "bi.button_group", + cls: "bi-border bi-card", + ref: function(_ref) { + self.group = _ref; + }, + items: [] + }] + }; + }, + + _getIndexOfItemValue: function(values) { + values = BI.isArray(values) ? values : [values]; + var indexes = []; + BI.each(this.group.getAllButtons(), function(idx, button){ + if(BI.contains(values, button.getValue())) { + indexes.push(idx); + } + }); + return indexes; + }, + + _createItem: function() { + return { + type: "bi.text_button", + textAlign: "left", + hgap: 10, + text: "选项" + this.group.getAllButtons().length, + cls: "bi-list-item-select", + value: BI.UUID() + }; + }, + + populate: function(items) { + this.group.populate(items); + }, + + addItems: function(items) { + + }, + + removeItemAt: function(indexes) { + this.group.removeItemAt(indexes); + } + }); + BI.shortcut("bi.report.server.param_setting.edit_list", List); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/form.rowbackground.setting.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/form.rowbackground.setting.js new file mode 100644 index 0000000000..d50cfa57ed --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/form.rowbackground.setting.js @@ -0,0 +1,33 @@ +!(function () { + /** + * 填报当前编辑行背景设置相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-form-background-setting" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + items: [{ + type: "bi.multi_select_item", + logic: { + dynamic: true + }, + iconWrapperWidth: 16, + text: BI.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + }, { + el: { + type: "bi.color_chooser", + width: 24, + height: 24 + }, + lgap: 10 + }] + }; + } + }); + BI.shortcut("bi.report.form_background_setting", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/globalsingle.combo.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/globalsingle.combo.js new file mode 100644 index 0000000000..7a6df9c95d --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/globalsingle.combo.js @@ -0,0 +1,54 @@ +!(function () { + /** + * + * 为模板单独设置的相关项 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-global-or-single-combo", + value: 1 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + rgap: 10, + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Blow_Set") + }, { + type: "bi.text_value_combo", + width: 200, + ref: function(_ref) { + self.combo = _ref; + }, + value: o.value, + items: [{ + text: BI.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings"), + value: 2 + }], + listerners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }] + }; + }, + + getValue: function() { + return self.combo.getValue(); + }, + + setValue: function(v) { + this.combo.setValue(v); + } + }); + BI.shortcut("bi.report.global_or_single_combo", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/leavesetting.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/leavesetting.js new file mode 100644 index 0000000000..680a8c8bf0 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/leavesetting.js @@ -0,0 +1,53 @@ +!(function () { + /** + * 离开提示/直接显示控件/自动暂存相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-leave-setting", + value: [1] + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.button_group", + value: o.value, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Unload_Check"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Basic_Engine_Event_Show_Widgets"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Write_Auto_Stash"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt", + rgap: 5 + }], + ref: function(_ref) { + self.group = _ref; + } + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.leave_setting", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/reportshow.location.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/reportshow.location.js new file mode 100644 index 0000000000..41a2a40e88 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/reportshow.location.js @@ -0,0 +1,53 @@ +!(function () { + /** + * 报表显示位置相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-report-show-location" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Show_Location") + }, { + type: "bi.button_group", + ref: function(_ref) { + self.group = _ref; + }, + value: 2, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Center_Display"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Left_Display"), + value: 2 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.left", + lgap: 10 + }] + }] + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.server.param_setting.report_show_location", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.js new file mode 100644 index 0000000000..c047e9a9b6 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.js @@ -0,0 +1,59 @@ +!(function () { + + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-setting-tab", + value: "", + tabItems: [], + cardCreator: BI.emptyFn + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vtape", + items: [{ + type: "bi.vertical_adapt", + cls: "tab-group", + items: [{ + type: "bi.button_group", + layouts: [{ + type: "bi.left" + }], + value: o.value, + items: BI.map(o.tabItems, function(idx, item){ + return { + el: BI.extend({ + type: "bi.text_button", + hgap: 10, + height: 24 + }, item) + }; + }), + listeners: [{ + eventName: BI.ButtonGroup.EVENT_CHANGE, + action: function (v) { + self.tableTab.setSelect(v); + } + }], + ref: function (_ref) { + // self.buttons = _ref; + } + }], + height: 24 + }, { + type: "bi.tab", + cls: "bi-card", + showIndex: o.value, + cardCreator: this.options.cardCreator, + ref: function (ref) { + self.tableTab = ref; + } + }] + }; + } + }); + + BI.shortcut("bi.setting.tab", Tab); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.less b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.less new file mode 100644 index 0000000000..186eb32810 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/settingtab/settingtab.less @@ -0,0 +1,17 @@ +@import "../../index.less"; +.bi-setting-tab { + & .tab-group { + background-color: @color-bi-background-light-gray; + font-size: @font-size-12; + & .tab-item { + &:hover { + color: @color-bi-text-highlight; + } + &.active { + background-color: @color-bi-background-default; + color: @color-bi-text-highlight; + border-top: 3px solid @color-bi-text-highlight; + } + } + } +} \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/sheetlabel.position.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/sheetlabel.position.js new file mode 100644 index 0000000000..e4e7acc77b --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/sheetlabel.position.js @@ -0,0 +1,53 @@ +!(function () { + /** + * sheet标签页显示位置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-report-show-location" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position") + }, { + type: "bi.button_group", + ref: function(_ref) { + self.group = _ref; + }, + value: 2, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Form_Base_Top"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Bottom"), + value: 2 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.left", + lgap: 10 + }] + }] + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.sheet_label_location", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toobar.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toobar.js new file mode 100644 index 0000000000..74f83ef97b --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toobar.js @@ -0,0 +1,126 @@ +!(function(){ + var ToolBar = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-settings-tool-bar", + value: [1] + }, + + render: function() { + var self = this, o = this.options; + return { + type: "bi.vertical", + items: [{ + type: "bi.left_right_vertical_adapt", + height: 24, + bgap: 15, + rhgap: 10, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar"), + width: 70, + textAlign: "left" + }, { + type: "bi.button_group", + value: o.value, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_ToolBar_Top"), + value: 1, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + if(this.isSelected()) { + self._populateDefault(); + } else { + self.topRegion.populate(); + } + } + }] + }, { + text: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"), + value: 2 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + ref: function(_ref) { + self.group = _ref; + }, + layouts: [{ + type: "bi.left" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }], + right: [{ + el: { + type: "bi.text_button", + cls: "bi-border", + text: BI.i18nText("Fine-Design_Basic_Scale_Custom_Button"), + handler: function() { + + }, + hgap: 5 + } + }, { + el: { + type: "bi.text_button", + cls: "bi-border", + text: BI.i18nText("Fine-Design_Report_Restore_Default"), + handler: function() { + + }, + hgap: 5 + } + }] + } + }, { + el: { + type: "bi.settings.tool_bar.region", + height: 56, + title: BI.i18nText("Fine-Design_Report_ToolBar_Top"), + ref: function(_ref) { + self.topRegion = _ref; + }, + items: BI.contains(o.value, 1) ? this._createDefaultItems() : [] + }, + bgap: 20 + }, { + type: "bi.settings.tool_bar.region", + height: 56, + title: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"), + ref: function(_ref) { + self.bottomRegion = _ref; + } + }] + } + }, + + _createDefaultItems: function() { + return BI.createItems(BI.Constants.getConstant("bi.constant.report.template.web_setting.tools"), { + type: "bi.icon_text_item", + height: 24, + extraCls: "bi-background bi-list-item-select bi-border-radius", + logic: { + dynamic: true + }, + textHgap: 10, + value: BI.UUID() + }) + }, + + _populateDefault: function() { + this.topRegion.populate(this._createDefaultItems()); + } + }) + BI.shortcut("bi.settings.tool_bar", ToolBar) +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toolbar.region.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toolbar.region.js new file mode 100644 index 0000000000..6fbd6f5ff3 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toobar/toolbar.region.js @@ -0,0 +1,42 @@ +!(function(){ + var Region = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-settings-tool-bar-region", + title: "" + }, + + render: function() { + var self = this, o = this.options; + return [{ + type: "bi.button_group", + cls: "bi-border", + items: o.items, + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt", + hgap: 10 + }], + ref: function(_ref) { + self.group = _ref; + } + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.label", + cls: "bi-background", + text: o.title + }, + top: -10, + left: 10 + }] + }] + }, + + populate: function(items) { + this.group.populate(items); + } + }) + BI.shortcut("bi.settings.tool_bar.region", Region); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toolbarHeight.select.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toolbarHeight.select.js new file mode 100644 index 0000000000..e2524e8753 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/toolbarHeight.select.js @@ -0,0 +1,67 @@ +!(function () { + /** + * 工具栏高度相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-tool-bar-height-select", + height: 24, + value: 2 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + el: { + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar_Height") + }, + rgap: 10 + }, { + type: "bi.button_group", + value: o.value, + ref: function(_ref) { + self.group = _ref; + }, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Tool_Bar_High"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Tool_Bar_Middle"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Tool_Bar_Low"), + value: 3 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.vertical_adapt" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }] + + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.server.param_setting.tool_bar_height_select", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/common/usetoolbar.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/usetoolbar.js new file mode 100644 index 0000000000..d0107db328 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/common/usetoolbar.js @@ -0,0 +1,47 @@ +!(function () { + /** + * 使用工具栏相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-use-tool-bar" + }, + + render: function () { + var self = this; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + el: { + type: "bi.multi_select_item", + ref: function(_ref) { + self.multiSelect = _ref; + }, + hgap: 5, + selected: true, + text: BI.i18nText("Fine-Design_Report_Use_ToolBar"), + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + } + }, { + type: "bi.text_button", + cls: "bi-card bi-border", + text: BI.i18nText("Fine-Design_Report_Edit"), + hgap: 10 + }] + }; + }, + + getValue: function() { + return self.multiSelect.getSelected(); + }, + + setValue: function(v) { + this.multiSelect.setSelected(v); + } + }); + BI.shortcut("bi.report.server.param_setting.use_tool_bar", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/enum.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/enum.js new file mode 100644 index 0000000000..943d4d1030 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/enum.js @@ -0,0 +1,30 @@ +window.BICst = window.BICst || {}; +BICst.REPORT_SERVER_PARAM = { + SPLIT_PAGE_PREVIEW_SETTING: 1, + FORM_PAGE_SETTING: 2, + DATA_ANALYSIS_SETTING: 3, + IMPORT_CSS: 4, + IMPORT_JS: 5, + ERROR_TEMPLATE_DEFINE: 6, + PRINT_SETTING: 7 +}; +BICst.REPORT_TEMPLATE_WEB_SETTING = { + BASE: 1, + PRINT: 2, + SPLIT_PAGE_PREVIEW_SETTING: 3, + FORM_PAGE_SETTING: 4, + DATA_ANALYSIS_SETTING: 5, + BROWSER: 6, + IMPORT_CSS: 7, + IMPORT_JS: 8 +}; + +BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS = { + FIRST_PAGE: 1, + PRE_PAGE: 2, + NEXT_PAGE: 3, + LAST_PAGE: 4, + PRINT: 5, + EXPORT: 6, + EMAIL: 7 +}; \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/i18n.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/i18n.js new file mode 100644 index 0000000000..01974dc998 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/i18n.js @@ -0,0 +1,53 @@ +BI.addI18n({ + "Fine-Design_Report_WEB_Pagination_Setting": "分页预览设置", + "Fine-Design_Report_WEB_Write_Setting": "填报页面设置", + "Fine-Design_Report_Data_Analysis_Settings": "数据分析设置", + "Fine-Design_Report_ReportServerP_Import_Css": "引用Css", + "Fine-Design_Report_ReportServerP_Import_JavaScript": "引用JavaScript", + "Fine-Design_Report_Error_Handler_Template": "出错模板定义", + "Fine-Design_Report_Print_Setting": "打印设置", + "Fine-Design_Report_Mobile_ToolBar": "工具栏", + "Fine-Design_Report_Tool_Bar_High": "高", + "Fine-Design_Report_Tool_Bar_Middle": "中", + "Fine-Design_Report_Tool_Bar_Low": "低", + "Fine-Design_Report_Mobile_ToolBar_Height": "工具栏高度", + "Fine-Design_Report_Is_Paint_Page": "以图片方式显示", + "Fine-Design_Report_IS_Auto_Scale": "iframe嵌入时自动缩放", + "Fine-Design_Report_IS_TD_HEAVY_EXPORT": "重方式输出格子", + "Fine-Design_Report_Use_ToolBar": "使用工具栏", + "Fine-Design_Report_Show_Location": "报表显示位置", + "Fine-Design_Report_Center_Display": "居中展示", + "Fine-Design_Report_Left_Display": "左展示", + "Fine-Design_Report_Editing_Listeners": "事件编辑", + "Fine-Design_Report_Edit": "编辑", + "Fine-Design_Report_Sheet_Label_Page_Display_Position": "sheet标签页显示位置:", + "Fine-Design_Form_Base_Top": "上", + "Fine-Design_Report_Bottom": "下", + "Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background": "当前编辑行背景设置", + "Fine-Design_Report_Unload_Check": "未提交离开提示", + "Fine-Design_Basic_Engine_Event_Show_Widgets": "直接显示控件", + "Fine-Design_Report_Write_Auto_Stash": "自动暂存", + "Fine-Design_Report_Engine_Sort_Sort": "排序", + "Fine-Design_Report_Engine_Selection_Filter": "条件筛选", + "Fine-Design_Report_Engine_List_Filter": "列表筛选", + "Fine-Design_Basic_Engine_Cancel": "取消", + "Fine-Design_Report_OK": "确定", + "Fine-Design_Report_Basic": "基本", + "Fine-Design_Report_Printer(Server)": "打印机(服务器)", + "Fine-Design_Report_Browser_Background": "浏览器背景", + "Fine-Design_Report_I_Want_To_Set_Single": "为该模板单独设置", + "Fine-Design_Form_Using_Server_Report_View_Settings": "采用服务器设置", + "Fine-Design_Report_Blow_Set": "以下设置:", + "Fine-Design_Report_PageSetup_Page": "页面", + "Fine-Design_Report_ToolBar_Top": "顶部工具栏", + "Fine-Design_Report_ToolBar_Bottom": "底部工具栏", + "Fine-Design_Basic_Scale_Custom_Button": "自定义", + "Fine-Design_Report_Restore_Default": "恢复默认", + "Fine-Design_Report_Engine_ReportServerP_First": "首页", + "Fine-Design_Report_Engine_ReportServerP_Previous": "上一页", + "Fine-Design_Report_Engine_ReportServerP_Next": "下一页", + "Fine-Design_Report_Engine_ReportServerP_Last": "末页", + "Fine-Design_Report_Engine_Print": "打印", + "Fine-Design_Report_Engine_Export": "导出", + "Fine-Design_Report_Engine_Email": "邮件" +}); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/index.less b/designer-base/src/test/resources/com/fr/design/ui/script/js/index.less new file mode 100644 index 0000000000..8844ce72d8 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/index.less @@ -0,0 +1 @@ +@import "../../fineui/src/less/index.less"; \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/data.analysis.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/data.analysis.js new file mode 100644 index 0000000000..29459d1f8f --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/data.analysis.js @@ -0,0 +1,59 @@ +!(function () { + /** + * 服务器 数据分析设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-data-analysis" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.button_group", + height: 24, + value: [1,2,3], + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Engine_Sort_Sort"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Selection_Filter"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Engine_List_Filter"), + value: 2 + }], { + type: "bi.multi_select_item", + logic: { + dynamic: true + }, + iconWrapperWidth: 16, + hgap: 5 + }), + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt" + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24, + value: true + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.data_analysis", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/form.page.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/form.page.js new file mode 100644 index 0000000000..c0f78f54e5 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/form.page.js @@ -0,0 +1,69 @@ +!(function () { + + /** + * 服务器 填报预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-form-page" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.grid", + height: 78, + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.report.sheet_label_location", + height: 24 + } + }, { + column: 1, + row: 0, + el: { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + } + }, { + column: 0, + row: 1, + el: { + type: "bi.report.form_background_setting", + height: 24 + } + }, { + column: 1, + row: 1, + el: { + type: "bi.report.leave_setting", + height: 24 + } + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24, + value: true + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.form_page", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/page.preview.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/page.preview.js new file mode 100644 index 0000000000..09f59b0945 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/card/page.preview.js @@ -0,0 +1,66 @@ +!(function () { + /** + * 服务器 分页预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-page-preview" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.server.param_setting.report_show_location", + height: 24 + }, { + type: "bi.button_group", + height: 92, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + el: { + text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"), + value: 1 + }, + bgap: 10 + }, { + el: { + text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"), + value: 2 + }, + bgap: 10 + }, { + text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + layouts: [{ + type: "bi.vertical" + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24 + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.page_preview", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.constants.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.constants.js new file mode 100644 index 0000000000..eb2a257dab --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.constants.js @@ -0,0 +1,33 @@ +!(function () { + BI.constant("bi.constant.report.server.param_setting", [ + { + text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.IMPORT_CSS + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.IMPORT_JS + }, { + text: BI.i18nText("Fine-Design_Report_Error_Handler_Template"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE + }, { + text: BI.i18nText("Fine-Design_Report_Print_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.PRINT_SETTING + }] + ); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.js new file mode 100644 index 0000000000..41e206b662 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/reportserverparam/reportserver.js @@ -0,0 +1,50 @@ +!(function () { + + /** + * 报表服务器参数面板 + */ + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-report-server-param-setting" + }, + + render: function () { + return { + type: "bi.setting.tab", + value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING, + tabItems: BI.Constants.getConstant("bi.constant.report.server.param_setting"), + cardCreator: BI.bind(this._createCard, this) + }; + }, + + _createCard: function (v) { + switch (v) { + case BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING: + return { + type: "bi.report.server.param_setting.page_preview" + }; + case BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING: + return { + type: "bi.report.server.param_setting.form_page" + }; + case BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING: + return { + type: "bi.report.server.param_setting.data_analysis" + } + case BICst.REPORT_SERVER_PARAM.IMPORT_CSS: + case BICst.REPORT_SERVER_PARAM.IMPORT_JS: + case BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE: + case BICst.REPORT_SERVER_PARAM.PRINT_SETTING: + default: + return { + type: "bi.label", + text: "1" + }; + } + } + + }); + + BI.shortcut("bi.report.server.param_setting", Tab); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/form.page.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/form.page.js new file mode 100644 index 0000000000..1dddc66072 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/form.page.js @@ -0,0 +1,64 @@ +!(function () { + /** + * 填报页面设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-form-page" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.global_or_single_combo", + height: 24 + }, { + type: "bi.grid", + height: 78, + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.report.sheet_label_location" + } + }, { + column: 1, + row: 0, + el: { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + } + }, { + column: 0, + row: 1, + el: { + type: "bi.report.form_background_setting" + } + }, { + column: 1, + row: 1, + el: { + type: "bi.report.leave_setting" + } + }] + }, { + type: "bi.settings.tool_bar", + height: 180 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.template.web_setting.form_page", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/page.preview.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/page.preview.js new file mode 100644 index 0000000000..39ac4be76f --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/card/page.preview.js @@ -0,0 +1,73 @@ +!(function () { + /** + * 分页预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-page-preview" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.global_or_single_combo", + height: 24 + }, { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + }, { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_PageSetup_Page"), + textAlign: "right", + width: 70 + }, { + el: { + type: "bi.button_group", + height: 24, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + layouts: [{ + type: "bi.left", + lgap: 5 + }] + }, + lgap: 10 + }] + }, { + type: "bi.settings.tool_bar", + height: 180 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.template.web_setting.page_preview", Analysis); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.constants.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.constants.js new file mode 100644 index 0000000000..8ac65da150 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.constants.js @@ -0,0 +1,69 @@ +!(function () { + BI.constant("bi.constant.report.template.web_setting", [ + { + text: BI.i18nText("Fine-Design_Report_Basic"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.BASE + }, { + text: BI.i18nText("Fine-Design_Report_Printer(Server)"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Browser_Background"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS + }] + ); + + BI.constant("bi.constant.report.template.web_setting.tools", [ + { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_First"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.FIRST_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Previous"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRE_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Next"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.NEXT_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Last"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.LAST_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Print"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRINT + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Export"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EXPORT + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Email"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EMAIL + }] + ); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.js b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.js new file mode 100644 index 0000000000..7cca5cc908 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/js/templatewebproperties/templateweb.js @@ -0,0 +1,48 @@ +!(function () { + + /** + * 模板Web属性面板 + */ + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-report-template-web-setting" + }, + + render: function () { + return { + type: "bi.setting.tab", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING, + tabItems: BI.Constants.getConstant("bi.constant.report.template.web_setting"), + cardCreator: BI.bind(this._createCard, this) + }; + }, + + _createCard: function (v) { + switch (v) { + case BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING: + return { + type: "bi.report.template.web_setting.page_preview" + } + case BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING: + return { + type: "bi.report.template.web_setting.form_page" + } + case BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING: + case BICst.REPORT_TEMPLATE_WEB_SETTING.BASE: + case BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT: + case BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER: + case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS: + case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS: + default: + return { + type: "bi.label", + text: "1" + }; + } + } + + }); + + BI.shortcut("bi.report.template.web_setting", Tab); +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/report.css b/designer-base/src/test/resources/com/fr/design/ui/script/report.css new file mode 100644 index 0000000000..05d98d1557 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/report.css @@ -0,0 +1,12 @@ +.bi-setting-tab .tab-group { + background-color: #F2F4F7; + font-size: 12px; +} +.bi-setting-tab .tab-group .tab-item:hover { + color: #3685f2; +} +.bi-setting-tab .tab-group .tab-item.active { + background-color: #ffffff; + color: #3685f2; + border-top: 3px solid #3685f2; +} diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/report.js b/designer-base/src/test/resources/com/fr/design/ui/script/report.js new file mode 100644 index 0000000000..baa357cb3a --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/report.js @@ -0,0 +1,1328 @@ +!(function(){ + /** + * 带确定取消的通用控件 + */ + var Bar = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-settings-bar-container", + el: { + + } + }, + + render: function() { + return { + type: "bi.vtape", + items: [this.options.el, { + type: "bi.right_vertical_adapt", + height: 24, + rgap: 10, + vgap: 10, + items: [{ + type: "bi.button", + level: "ignore", + text: BI.i18nText("Fine-Design_Report_OK"), + handler: function() { + + } + }, { + type: "bi.button", + level: "ignore", + text: BI.i18nText("Fine-Design_Basic_Engine_Cancel"), + handler: function() { + + } + }] + }] + } + } + }) + BI.shortcut("bi.settings.bar_container", Bar) +})();!(function () { + /** + * 事件设置 + */ + var List = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-edit-list" + }, + + render: function () { + var self = this; + return { + type: "bi.vtape", + vgap: 5, + items: [{ + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.icon_button", + cls: "text-add-tip-font", + width: 24, + height: 24, + handler: function() { + self.group.addItems([self._createItem()]) + } + }, { + type: "bi.icon_button", + cls: "close-font", + width: 24, + height: 24, + handler: function() { + self.group.removeItemAt(); + } + }, { + type: "bi.icon_button", + cls: "close-font", + width: 24, + height: 24, + handler: function() { + self.removeItemAt(self._getIndexOfItemValue(self.group.getValue())) + } + }] + }, { + type: "bi.button_group", + cls: "bi-border bi-card", + ref: function(_ref) { + self.group = _ref; + }, + items: [] + }] + }; + }, + + _getIndexOfItemValue: function(values) { + values = BI.isArray(values) ? values : [values]; + var indexes = []; + BI.each(this.group.getAllButtons(), function(idx, button){ + if(BI.contains(values, button.getValue())) { + indexes.push(idx); + } + }); + return indexes; + }, + + _createItem: function() { + return { + type: "bi.text_button", + textAlign: "left", + hgap: 10, + text: "选项" + this.group.getAllButtons().length, + cls: "bi-list-item-select", + value: BI.UUID() + }; + }, + + populate: function(items) { + this.group.populate(items); + }, + + addItems: function(items) { + + }, + + removeItemAt: function(indexes) { + this.group.removeItemAt(indexes); + } + }); + BI.shortcut("bi.report.server.param_setting.edit_list", List); +})();!(function () { + /** + * 填报当前编辑行背景设置相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-form-background-setting" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + items: [{ + type: "bi.multi_select_item", + logic: { + dynamic: true + }, + iconWrapperWidth: 16, + text: BI.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + }, { + el: { + type: "bi.color_chooser", + width: 24, + height: 24 + }, + lgap: 10 + }] + }; + } + }); + BI.shortcut("bi.report.form_background_setting", Analysis); +})();!(function () { + /** + * + * 为模板单独设置的相关项 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-global-or-single-combo", + value: 1 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + rgap: 10, + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Blow_Set") + }, { + type: "bi.text_value_combo", + width: 200, + ref: function(_ref) { + self.combo = _ref; + }, + value: o.value, + items: [{ + text: BI.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings"), + value: 2 + }], + listerners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }] + }; + }, + + getValue: function() { + return self.combo.getValue(); + }, + + setValue: function(v) { + this.combo.setValue(v); + } + }); + BI.shortcut("bi.report.global_or_single_combo", Analysis); +})();!(function () { + /** + * 离开提示/直接显示控件/自动暂存相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-leave-setting", + value: [1] + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.button_group", + value: o.value, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Unload_Check"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Basic_Engine_Event_Show_Widgets"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Write_Auto_Stash"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt", + rgap: 5 + }], + ref: function(_ref) { + self.group = _ref; + } + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.leave_setting", Analysis); +})();!(function () { + /** + * 报表显示位置相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-report-show-location" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Show_Location") + }, { + type: "bi.button_group", + ref: function(_ref) { + self.group = _ref; + }, + value: 2, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Center_Display"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Left_Display"), + value: 2 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.left", + lgap: 10 + }] + }] + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.server.param_setting.report_show_location", Analysis); +})();!(function () { + + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-setting-tab", + value: "", + tabItems: [], + cardCreator: BI.emptyFn + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vtape", + items: [{ + type: "bi.vertical_adapt", + cls: "tab-group", + items: [{ + type: "bi.button_group", + layouts: [{ + type: "bi.left" + }], + value: o.value, + items: BI.map(o.tabItems, function(idx, item){ + return { + el: BI.extend({ + type: "bi.text_button", + hgap: 10, + height: 24 + }, item) + }; + }), + listeners: [{ + eventName: BI.ButtonGroup.EVENT_CHANGE, + action: function (v) { + self.tableTab.setSelect(v); + } + }], + ref: function (_ref) { + // self.buttons = _ref; + } + }], + height: 24 + }, { + type: "bi.tab", + cls: "bi-card", + showIndex: o.value, + cardCreator: this.options.cardCreator, + ref: function (ref) { + self.tableTab = ref; + } + }] + }; + } + }); + + BI.shortcut("bi.setting.tab", Tab); +})();!(function () { + /** + * sheet标签页显示位置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-report-show-location" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position") + }, { + type: "bi.button_group", + ref: function(_ref) { + self.group = _ref; + }, + value: 2, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Form_Base_Top"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Bottom"), + value: 2 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.left", + lgap: 10 + }] + }] + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.sheet_label_location", Analysis); +})();!(function(){ + var ToolBar = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-settings-tool-bar", + value: [1] + }, + + render: function() { + var self = this, o = this.options; + return { + type: "bi.vertical", + items: [{ + type: "bi.left_right_vertical_adapt", + height: 24, + bgap: 15, + rhgap: 10, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar"), + width: 70, + textAlign: "left" + }, { + type: "bi.button_group", + value: o.value, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_ToolBar_Top"), + value: 1, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + if(this.isSelected()) { + self._populateDefault(); + } else { + self.topRegion.populate(); + } + } + }] + }, { + text: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"), + value: 2 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + ref: function(_ref) { + self.group = _ref; + }, + layouts: [{ + type: "bi.left" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }], + right: [{ + el: { + type: "bi.text_button", + cls: "bi-border", + text: BI.i18nText("Fine-Design_Basic_Scale_Custom_Button"), + handler: function() { + + }, + hgap: 5 + } + }, { + el: { + type: "bi.text_button", + cls: "bi-border", + text: BI.i18nText("Fine-Design_Report_Restore_Default"), + handler: function() { + + }, + hgap: 5 + } + }] + } + }, { + el: { + type: "bi.settings.tool_bar.region", + height: 56, + title: BI.i18nText("Fine-Design_Report_ToolBar_Top"), + ref: function(_ref) { + self.topRegion = _ref; + }, + items: BI.contains(o.value, 1) ? this._createDefaultItems() : [] + }, + bgap: 20 + }, { + type: "bi.settings.tool_bar.region", + height: 56, + title: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"), + ref: function(_ref) { + self.bottomRegion = _ref; + } + }] + } + }, + + _createDefaultItems: function() { + return BI.createItems(BI.Constants.getConstant("bi.constant.report.template.web_setting.tools"), { + type: "bi.icon_text_item", + height: 24, + extraCls: "bi-background bi-list-item-select bi-border-radius", + logic: { + dynamic: true + }, + textHgap: 10, + value: BI.UUID() + }) + }, + + _populateDefault: function() { + this.topRegion.populate(this._createDefaultItems()); + } + }) + BI.shortcut("bi.settings.tool_bar", ToolBar) +})();!(function(){ + var Region = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-settings-tool-bar-region", + title: "" + }, + + render: function() { + var self = this, o = this.options; + return [{ + type: "bi.button_group", + cls: "bi-border", + items: o.items, + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt", + hgap: 10 + }], + ref: function(_ref) { + self.group = _ref; + } + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.label", + cls: "bi-background", + text: o.title + }, + top: -10, + left: 10 + }] + }] + }, + + populate: function(items) { + this.group.populate(items); + } + }) + BI.shortcut("bi.settings.tool_bar.region", Region); +})();!(function () { + /** + * 工具栏高度相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-tool-bar-height-select", + height: 24, + value: 2 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + el: { + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar_Height") + }, + rgap: 10 + }, { + type: "bi.button_group", + value: o.value, + ref: function(_ref) { + self.group = _ref; + }, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Tool_Bar_High"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Tool_Bar_Middle"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Tool_Bar_Low"), + value: 3 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.vertical_adapt" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }] + + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.server.param_setting.tool_bar_height_select", Analysis); +})();!(function () { + /** + * 使用工具栏相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-use-tool-bar" + }, + + render: function () { + var self = this; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + el: { + type: "bi.multi_select_item", + ref: function(_ref) { + self.multiSelect = _ref; + }, + hgap: 5, + selected: true, + text: BI.i18nText("Fine-Design_Report_Use_ToolBar"), + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + } + }, { + type: "bi.text_button", + cls: "bi-card bi-border", + text: BI.i18nText("Fine-Design_Report_Edit"), + hgap: 10 + }] + }; + }, + + getValue: function() { + return self.multiSelect.getSelected(); + }, + + setValue: function(v) { + this.multiSelect.setSelected(v); + } + }); + BI.shortcut("bi.report.server.param_setting.use_tool_bar", Analysis); +})();window.BICst = window.BICst || {}; +BICst.REPORT_SERVER_PARAM = { + SPLIT_PAGE_PREVIEW_SETTING: 1, + FORM_PAGE_SETTING: 2, + DATA_ANALYSIS_SETTING: 3, + IMPORT_CSS: 4, + IMPORT_JS: 5, + ERROR_TEMPLATE_DEFINE: 6, + PRINT_SETTING: 7 +}; +BICst.REPORT_TEMPLATE_WEB_SETTING = { + BASE: 1, + PRINT: 2, + SPLIT_PAGE_PREVIEW_SETTING: 3, + FORM_PAGE_SETTING: 4, + DATA_ANALYSIS_SETTING: 5, + BROWSER: 6, + IMPORT_CSS: 7, + IMPORT_JS: 8 +}; + +BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS = { + FIRST_PAGE: 1, + PRE_PAGE: 2, + NEXT_PAGE: 3, + LAST_PAGE: 4, + PRINT: 5, + EXPORT: 6, + EMAIL: 7 +};BI.addI18n({ + "Fine-Design_Report_WEB_Pagination_Setting": "分页预览设置", + "Fine-Design_Report_WEB_Write_Setting": "填报页面设置", + "Fine-Design_Report_Data_Analysis_Settings": "数据分析设置", + "Fine-Design_Report_ReportServerP_Import_Css": "引用Css", + "Fine-Design_Report_ReportServerP_Import_JavaScript": "引用JavaScript", + "Fine-Design_Report_Error_Handler_Template": "出错模板定义", + "Fine-Design_Report_Print_Setting": "打印设置", + "Fine-Design_Report_Mobile_ToolBar": "工具栏", + "Fine-Design_Report_Tool_Bar_High": "高", + "Fine-Design_Report_Tool_Bar_Middle": "中", + "Fine-Design_Report_Tool_Bar_Low": "低", + "Fine-Design_Report_Mobile_ToolBar_Height": "工具栏高度", + "Fine-Design_Report_Is_Paint_Page": "以图片方式显示", + "Fine-Design_Report_IS_Auto_Scale": "iframe嵌入时自动缩放", + "Fine-Design_Report_IS_TD_HEAVY_EXPORT": "重方式输出格子", + "Fine-Design_Report_Use_ToolBar": "使用工具栏", + "Fine-Design_Report_Show_Location": "报表显示位置", + "Fine-Design_Report_Center_Display": "居中展示", + "Fine-Design_Report_Left_Display": "左展示", + "Fine-Design_Report_Editing_Listeners": "事件编辑", + "Fine-Design_Report_Edit": "编辑", + "Fine-Design_Report_Sheet_Label_Page_Display_Position": "sheet标签页显示位置:", + "Fine-Design_Form_Base_Top": "上", + "Fine-Design_Report_Bottom": "下", + "Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background": "当前编辑行背景设置", + "Fine-Design_Report_Unload_Check": "未提交离开提示", + "Fine-Design_Basic_Engine_Event_Show_Widgets": "直接显示控件", + "Fine-Design_Report_Write_Auto_Stash": "自动暂存", + "Fine-Design_Report_Engine_Sort_Sort": "排序", + "Fine-Design_Report_Engine_Selection_Filter": "条件筛选", + "Fine-Design_Report_Engine_List_Filter": "列表筛选", + "Fine-Design_Basic_Engine_Cancel": "取消", + "Fine-Design_Report_OK": "确定", + "Fine-Design_Report_Basic": "基本", + "Fine-Design_Report_Printer(Server)": "打印机(服务器)", + "Fine-Design_Report_Browser_Background": "浏览器背景", + "Fine-Design_Report_I_Want_To_Set_Single": "为该模板单独设置", + "Fine-Design_Form_Using_Server_Report_View_Settings": "采用服务器设置", + "Fine-Design_Report_Blow_Set": "以下设置:", + "Fine-Design_Report_PageSetup_Page": "页面", + "Fine-Design_Report_ToolBar_Top": "顶部工具栏", + "Fine-Design_Report_ToolBar_Bottom": "底部工具栏", + "Fine-Design_Basic_Scale_Custom_Button": "自定义", + "Fine-Design_Report_Restore_Default": "恢复默认", + "Fine-Design_Report_Engine_ReportServerP_First": "首页", + "Fine-Design_Report_Engine_ReportServerP_Previous": "上一页", + "Fine-Design_Report_Engine_ReportServerP_Next": "下一页", + "Fine-Design_Report_Engine_ReportServerP_Last": "末页", + "Fine-Design_Report_Engine_Print": "打印", + "Fine-Design_Report_Engine_Export": "导出", + "Fine-Design_Report_Engine_Email": "邮件" +});!(function () { + /** + * 服务器 数据分析设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-data-analysis" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.button_group", + height: 24, + value: [1,2,3], + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Engine_Sort_Sort"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Selection_Filter"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Engine_List_Filter"), + value: 2 + }], { + type: "bi.multi_select_item", + logic: { + dynamic: true + }, + iconWrapperWidth: 16, + hgap: 5 + }), + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt" + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24, + value: true + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.data_analysis", Analysis); +})();!(function () { + + /** + * 服务器 填报预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-form-page" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.grid", + height: 78, + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.report.sheet_label_location", + height: 24 + } + }, { + column: 1, + row: 0, + el: { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + } + }, { + column: 0, + row: 1, + el: { + type: "bi.report.form_background_setting", + height: 24 + } + }, { + column: 1, + row: 1, + el: { + type: "bi.report.leave_setting", + height: 24 + } + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24, + value: true + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.form_page", Analysis); +})();!(function () { + /** + * 服务器 分页预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-page-preview" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.server.param_setting.report_show_location", + height: 24 + }, { + type: "bi.button_group", + height: 92, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + el: { + text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"), + value: 1 + }, + bgap: 10 + }, { + el: { + text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"), + value: 2 + }, + bgap: 10 + }, { + text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + layouts: [{ + type: "bi.vertical" + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24 + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.page_preview", Analysis); +})();!(function () { + BI.constant("bi.constant.report.server.param_setting", [ + { + text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.IMPORT_CSS + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.IMPORT_JS + }, { + text: BI.i18nText("Fine-Design_Report_Error_Handler_Template"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE + }, { + text: BI.i18nText("Fine-Design_Report_Print_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.PRINT_SETTING + }] + ); +})();!(function () { + + /** + * 报表服务器参数面板 + */ + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-report-server-param-setting" + }, + + render: function () { + return { + type: "bi.setting.tab", + value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING, + tabItems: BI.Constants.getConstant("bi.constant.report.server.param_setting"), + cardCreator: BI.bind(this._createCard, this) + }; + }, + + _createCard: function (v) { + switch (v) { + case BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING: + return { + type: "bi.report.server.param_setting.page_preview" + }; + case BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING: + return { + type: "bi.report.server.param_setting.form_page" + }; + case BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING: + return { + type: "bi.report.server.param_setting.data_analysis" + } + case BICst.REPORT_SERVER_PARAM.IMPORT_CSS: + case BICst.REPORT_SERVER_PARAM.IMPORT_JS: + case BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE: + case BICst.REPORT_SERVER_PARAM.PRINT_SETTING: + default: + return { + type: "bi.label", + text: "1" + }; + } + } + + }); + + BI.shortcut("bi.report.server.param_setting", Tab); +})();!(function () { + /** + * 填报页面设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-form-page" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.global_or_single_combo", + height: 24 + }, { + type: "bi.grid", + height: 78, + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.report.sheet_label_location" + } + }, { + column: 1, + row: 0, + el: { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + } + }, { + column: 0, + row: 1, + el: { + type: "bi.report.form_background_setting" + } + }, { + column: 1, + row: 1, + el: { + type: "bi.report.leave_setting" + } + }] + }, { + type: "bi.settings.tool_bar", + height: 180 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.template.web_setting.form_page", Analysis); +})();!(function () { + /** + * 分页预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-page-preview" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.global_or_single_combo", + height: 24 + }, { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + }, { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_PageSetup_Page"), + textAlign: "right", + width: 70 + }, { + el: { + type: "bi.button_group", + height: 24, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + layouts: [{ + type: "bi.left", + lgap: 5 + }] + }, + lgap: 10 + }] + }, { + type: "bi.settings.tool_bar", + height: 180 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.template.web_setting.page_preview", Analysis); +})();!(function () { + BI.constant("bi.constant.report.template.web_setting", [ + { + text: BI.i18nText("Fine-Design_Report_Basic"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.BASE + }, { + text: BI.i18nText("Fine-Design_Report_Printer(Server)"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Browser_Background"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS + }] + ); + + BI.constant("bi.constant.report.template.web_setting.tools", [ + { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_First"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.FIRST_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Previous"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRE_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Next"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.NEXT_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Last"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.LAST_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Print"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRINT + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Export"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EXPORT + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Email"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EMAIL + }] + ); +})();!(function () { + + /** + * 模板Web属性面板 + */ + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-report-template-web-setting" + }, + + render: function () { + return { + type: "bi.setting.tab", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING, + tabItems: BI.Constants.getConstant("bi.constant.report.template.web_setting"), + cardCreator: BI.bind(this._createCard, this) + }; + }, + + _createCard: function (v) { + switch (v) { + case BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING: + return { + type: "bi.report.template.web_setting.page_preview" + } + case BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING: + return { + type: "bi.report.template.web_setting.form_page" + } + case BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING: + case BICst.REPORT_TEMPLATE_WEB_SETTING.BASE: + case BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT: + case BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER: + case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS: + case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS: + default: + return { + type: "bi.label", + text: "1" + }; + } + } + + }); + + BI.shortcut("bi.report.template.web_setting", Tab); +})();!(function(){ + window.addEventListener("load", function (ev) { + BI.createWidget({ + type:"bi.absolute", + element: "body", + items: [{ + el: { + type: "bi.settings.bar_container", + el: { + type: "bi.report.server.param_setting" + } + }, + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + }); + }) +})(); \ No newline at end of file diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/template.css b/designer-base/src/test/resources/com/fr/design/ui/script/template.css new file mode 100644 index 0000000000..05d98d1557 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/template.css @@ -0,0 +1,12 @@ +.bi-setting-tab .tab-group { + background-color: #F2F4F7; + font-size: 12px; +} +.bi-setting-tab .tab-group .tab-item:hover { + color: #3685f2; +} +.bi-setting-tab .tab-group .tab-item.active { + background-color: #ffffff; + color: #3685f2; + border-top: 3px solid #3685f2; +} diff --git a/designer-base/src/test/resources/com/fr/design/ui/script/template.js b/designer-base/src/test/resources/com/fr/design/ui/script/template.js new file mode 100644 index 0000000000..7693577848 --- /dev/null +++ b/designer-base/src/test/resources/com/fr/design/ui/script/template.js @@ -0,0 +1,1328 @@ +!(function(){ + /** + * 带确定取消的通用控件 + */ + var Bar = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-settings-bar-container", + el: { + + } + }, + + render: function() { + return { + type: "bi.vtape", + items: [this.options.el, { + type: "bi.right_vertical_adapt", + height: 24, + rgap: 10, + vgap: 10, + items: [{ + type: "bi.button", + level: "ignore", + text: BI.i18nText("Fine-Design_Report_OK"), + handler: function() { + + } + }, { + type: "bi.button", + level: "ignore", + text: BI.i18nText("Fine-Design_Basic_Engine_Cancel"), + handler: function() { + + } + }] + }] + } + } + }) + BI.shortcut("bi.settings.bar_container", Bar) +})();!(function () { + /** + * 事件设置 + */ + var List = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-edit-list" + }, + + render: function () { + var self = this; + return { + type: "bi.vtape", + vgap: 5, + items: [{ + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.icon_button", + cls: "text-add-tip-font", + width: 24, + height: 24, + handler: function() { + self.group.addItems([self._createItem()]) + } + }, { + type: "bi.icon_button", + cls: "close-font", + width: 24, + height: 24, + handler: function() { + self.group.removeItemAt(); + } + }, { + type: "bi.icon_button", + cls: "close-font", + width: 24, + height: 24, + handler: function() { + self.removeItemAt(self._getIndexOfItemValue(self.group.getValue())) + } + }] + }, { + type: "bi.button_group", + cls: "bi-border bi-card", + ref: function(_ref) { + self.group = _ref; + }, + items: [] + }] + }; + }, + + _getIndexOfItemValue: function(values) { + values = BI.isArray(values) ? values : [values]; + var indexes = []; + BI.each(this.group.getAllButtons(), function(idx, button){ + if(BI.contains(values, button.getValue())) { + indexes.push(idx); + } + }); + return indexes; + }, + + _createItem: function() { + return { + type: "bi.text_button", + textAlign: "left", + hgap: 10, + text: "选项" + this.group.getAllButtons().length, + cls: "bi-list-item-select", + value: BI.UUID() + }; + }, + + populate: function(items) { + this.group.populate(items); + }, + + addItems: function(items) { + + }, + + removeItemAt: function(indexes) { + this.group.removeItemAt(indexes); + } + }); + BI.shortcut("bi.report.server.param_setting.edit_list", List); +})();!(function () { + /** + * 填报当前编辑行背景设置相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-form-background-setting" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + items: [{ + type: "bi.multi_select_item", + logic: { + dynamic: true + }, + iconWrapperWidth: 16, + text: BI.i18nText("Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background") + }, { + el: { + type: "bi.color_chooser", + width: 24, + height: 24 + }, + lgap: 10 + }] + }; + } + }); + BI.shortcut("bi.report.form_background_setting", Analysis); +})();!(function () { + /** + * + * 为模板单独设置的相关项 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-global-or-single-combo", + value: 1 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + rgap: 10, + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Blow_Set") + }, { + type: "bi.text_value_combo", + width: 200, + ref: function(_ref) { + self.combo = _ref; + }, + value: o.value, + items: [{ + text: BI.i18nText("Fine-Design_Report_I_Want_To_Set_Single"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Form_Using_Server_Report_View_Settings"), + value: 2 + }], + listerners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }] + }; + }, + + getValue: function() { + return self.combo.getValue(); + }, + + setValue: function(v) { + this.combo.setValue(v); + } + }); + BI.shortcut("bi.report.global_or_single_combo", Analysis); +})();!(function () { + /** + * 离开提示/直接显示控件/自动暂存相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-leave-setting", + value: [1] + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.button_group", + value: o.value, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Unload_Check"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Basic_Engine_Event_Show_Widgets"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Write_Auto_Stash"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt", + rgap: 5 + }], + ref: function(_ref) { + self.group = _ref; + } + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.leave_setting", Analysis); +})();!(function () { + /** + * 报表显示位置相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-report-show-location" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Show_Location") + }, { + type: "bi.button_group", + ref: function(_ref) { + self.group = _ref; + }, + value: 2, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Center_Display"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Left_Display"), + value: 2 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.left", + lgap: 10 + }] + }] + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.server.param_setting.report_show_location", Analysis); +})();!(function () { + + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-setting-tab", + value: "", + tabItems: [], + cardCreator: BI.emptyFn + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vtape", + items: [{ + type: "bi.vertical_adapt", + cls: "tab-group", + items: [{ + type: "bi.button_group", + layouts: [{ + type: "bi.left" + }], + value: o.value, + items: BI.map(o.tabItems, function(idx, item){ + return { + el: BI.extend({ + type: "bi.text_button", + hgap: 10, + height: 24 + }, item) + }; + }), + listeners: [{ + eventName: BI.ButtonGroup.EVENT_CHANGE, + action: function (v) { + self.tableTab.setSelect(v); + } + }], + ref: function (_ref) { + // self.buttons = _ref; + } + }], + height: 24 + }, { + type: "bi.tab", + cls: "bi-card", + showIndex: o.value, + cardCreator: this.options.cardCreator, + ref: function (ref) { + self.tableTab = ref; + } + }] + }; + } + }); + + BI.shortcut("bi.setting.tab", Tab); +})();!(function () { + /** + * sheet标签页显示位置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-report-show-location" + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Sheet_Label_Page_Display_Position") + }, { + type: "bi.button_group", + ref: function(_ref) { + self.group = _ref; + }, + value: 2, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Form_Base_Top"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Bottom"), + value: 2 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.left", + lgap: 10 + }] + }] + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.sheet_label_location", Analysis); +})();!(function(){ + var ToolBar = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-settings-tool-bar", + value: [1] + }, + + render: function() { + var self = this, o = this.options; + return { + type: "bi.vertical", + items: [{ + type: "bi.left_right_vertical_adapt", + height: 24, + bgap: 15, + rhgap: 10, + items: { + left: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar"), + width: 70, + textAlign: "left" + }, { + type: "bi.button_group", + value: o.value, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_ToolBar_Top"), + value: 1, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + if(this.isSelected()) { + self._populateDefault(); + } else { + self.topRegion.populate(); + } + } + }] + }, { + text: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"), + value: 2 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + ref: function(_ref) { + self.group = _ref; + }, + layouts: [{ + type: "bi.left" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }], + right: [{ + el: { + type: "bi.text_button", + cls: "bi-border", + text: BI.i18nText("Fine-Design_Basic_Scale_Custom_Button"), + handler: function() { + + }, + hgap: 5 + } + }, { + el: { + type: "bi.text_button", + cls: "bi-border", + text: BI.i18nText("Fine-Design_Report_Restore_Default"), + handler: function() { + + }, + hgap: 5 + } + }] + } + }, { + el: { + type: "bi.settings.tool_bar.region", + height: 56, + title: BI.i18nText("Fine-Design_Report_ToolBar_Top"), + ref: function(_ref) { + self.topRegion = _ref; + }, + items: BI.contains(o.value, 1) ? this._createDefaultItems() : [] + }, + bgap: 20 + }, { + type: "bi.settings.tool_bar.region", + height: 56, + title: BI.i18nText("Fine-Design_Report_ToolBar_Bottom"), + ref: function(_ref) { + self.bottomRegion = _ref; + } + }] + } + }, + + _createDefaultItems: function() { + return BI.createItems(BI.Constants.getConstant("bi.constant.report.template.web_setting.tools"), { + type: "bi.icon_text_item", + height: 24, + extraCls: "bi-background bi-list-item-select bi-border-radius", + logic: { + dynamic: true + }, + textHgap: 10, + value: BI.UUID() + }) + }, + + _populateDefault: function() { + this.topRegion.populate(this._createDefaultItems()); + } + }) + BI.shortcut("bi.settings.tool_bar", ToolBar) +})();!(function(){ + var Region = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-settings-tool-bar-region", + title: "" + }, + + render: function() { + var self = this, o = this.options; + return [{ + type: "bi.button_group", + cls: "bi-border", + items: o.items, + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt", + hgap: 10 + }], + ref: function(_ref) { + self.group = _ref; + } + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.label", + cls: "bi-background", + text: o.title + }, + top: -10, + left: 10 + }] + }] + }, + + populate: function(items) { + this.group.populate(items); + } + }) + BI.shortcut("bi.settings.tool_bar.region", Region); +})();!(function () { + /** + * 工具栏高度相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-tool-bar-height-select", + height: 24, + value: 2 + }, + + render: function () { + var self = this, o = this.options; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + el: { + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_Mobile_ToolBar_Height") + }, + rgap: 10 + }, { + type: "bi.button_group", + value: o.value, + ref: function(_ref) { + self.group = _ref; + }, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Tool_Bar_High"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Tool_Bar_Middle"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Tool_Bar_Low"), + value: 3 + }], { + type: "bi.single_select_radio_item", + logic: { + dynamic: true + } + }), + layouts: [{ + type: "bi.vertical_adapt" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function() { + + } + }] + }] + + }; + }, + + getValue: function() { + return self.group.getValue(); + }, + + setValue: function(v) { + this.group.setValue(v); + } + }); + BI.shortcut("bi.report.server.param_setting.tool_bar_height_select", Analysis); +})();!(function () { + /** + * 使用工具栏相关 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-use-tool-bar" + }, + + render: function () { + var self = this; + return { + type: "bi.vertical_adapt", + height: 24, + items: [{ + el: { + type: "bi.multi_select_item", + ref: function(_ref) { + self.multiSelect = _ref; + }, + hgap: 5, + selected: true, + text: BI.i18nText("Fine-Design_Report_Use_ToolBar"), + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + } + }, { + type: "bi.text_button", + cls: "bi-card bi-border", + text: BI.i18nText("Fine-Design_Report_Edit"), + hgap: 10 + }] + }; + }, + + getValue: function() { + return self.multiSelect.getSelected(); + }, + + setValue: function(v) { + this.multiSelect.setSelected(v); + } + }); + BI.shortcut("bi.report.server.param_setting.use_tool_bar", Analysis); +})();window.BICst = window.BICst || {}; +BICst.REPORT_SERVER_PARAM = { + SPLIT_PAGE_PREVIEW_SETTING: 1, + FORM_PAGE_SETTING: 2, + DATA_ANALYSIS_SETTING: 3, + IMPORT_CSS: 4, + IMPORT_JS: 5, + ERROR_TEMPLATE_DEFINE: 6, + PRINT_SETTING: 7 +}; +BICst.REPORT_TEMPLATE_WEB_SETTING = { + BASE: 1, + PRINT: 2, + SPLIT_PAGE_PREVIEW_SETTING: 3, + FORM_PAGE_SETTING: 4, + DATA_ANALYSIS_SETTING: 5, + BROWSER: 6, + IMPORT_CSS: 7, + IMPORT_JS: 8 +}; + +BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS = { + FIRST_PAGE: 1, + PRE_PAGE: 2, + NEXT_PAGE: 3, + LAST_PAGE: 4, + PRINT: 5, + EXPORT: 6, + EMAIL: 7 +};BI.addI18n({ + "Fine-Design_Report_WEB_Pagination_Setting": "分页预览设置", + "Fine-Design_Report_WEB_Write_Setting": "填报页面设置", + "Fine-Design_Report_Data_Analysis_Settings": "数据分析设置", + "Fine-Design_Report_ReportServerP_Import_Css": "引用Css", + "Fine-Design_Report_ReportServerP_Import_JavaScript": "引用JavaScript", + "Fine-Design_Report_Error_Handler_Template": "出错模板定义", + "Fine-Design_Report_Print_Setting": "打印设置", + "Fine-Design_Report_Mobile_ToolBar": "工具栏", + "Fine-Design_Report_Tool_Bar_High": "高", + "Fine-Design_Report_Tool_Bar_Middle": "中", + "Fine-Design_Report_Tool_Bar_Low": "低", + "Fine-Design_Report_Mobile_ToolBar_Height": "工具栏高度", + "Fine-Design_Report_Is_Paint_Page": "以图片方式显示", + "Fine-Design_Report_IS_Auto_Scale": "iframe嵌入时自动缩放", + "Fine-Design_Report_IS_TD_HEAVY_EXPORT": "重方式输出格子", + "Fine-Design_Report_Use_ToolBar": "使用工具栏", + "Fine-Design_Report_Show_Location": "报表显示位置", + "Fine-Design_Report_Center_Display": "居中展示", + "Fine-Design_Report_Left_Display": "左展示", + "Fine-Design_Report_Editing_Listeners": "事件编辑", + "Fine-Design_Report_Edit": "编辑", + "Fine-Design_Report_Sheet_Label_Page_Display_Position": "sheet标签页显示位置:", + "Fine-Design_Form_Base_Top": "上", + "Fine-Design_Report_Bottom": "下", + "Fine-Design_Report_Set_Face_Write_Current_Edit_Row_Background": "当前编辑行背景设置", + "Fine-Design_Report_Unload_Check": "未提交离开提示", + "Fine-Design_Basic_Engine_Event_Show_Widgets": "直接显示控件", + "Fine-Design_Report_Write_Auto_Stash": "自动暂存", + "Fine-Design_Report_Engine_Sort_Sort": "排序", + "Fine-Design_Report_Engine_Selection_Filter": "条件筛选", + "Fine-Design_Report_Engine_List_Filter": "列表筛选", + "Fine-Design_Basic_Engine_Cancel": "取消", + "Fine-Design_Report_OK": "确定", + "Fine-Design_Report_Basic": "基本", + "Fine-Design_Report_Printer(Server)": "打印机(服务器)", + "Fine-Design_Report_Browser_Background": "浏览器背景", + "Fine-Design_Report_I_Want_To_Set_Single": "为该模板单独设置", + "Fine-Design_Form_Using_Server_Report_View_Settings": "采用服务器设置", + "Fine-Design_Report_Blow_Set": "以下设置:", + "Fine-Design_Report_PageSetup_Page": "页面", + "Fine-Design_Report_ToolBar_Top": "顶部工具栏", + "Fine-Design_Report_ToolBar_Bottom": "底部工具栏", + "Fine-Design_Basic_Scale_Custom_Button": "自定义", + "Fine-Design_Report_Restore_Default": "恢复默认", + "Fine-Design_Report_Engine_ReportServerP_First": "首页", + "Fine-Design_Report_Engine_ReportServerP_Previous": "上一页", + "Fine-Design_Report_Engine_ReportServerP_Next": "下一页", + "Fine-Design_Report_Engine_ReportServerP_Last": "末页", + "Fine-Design_Report_Engine_Print": "打印", + "Fine-Design_Report_Engine_Export": "导出", + "Fine-Design_Report_Engine_Email": "邮件" +});!(function () { + /** + * 服务器 数据分析设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-data-analysis" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.button_group", + height: 24, + value: [1,2,3], + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Engine_Sort_Sort"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Selection_Filter"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_Engine_List_Filter"), + value: 2 + }], { + type: "bi.multi_select_item", + logic: { + dynamic: true + }, + iconWrapperWidth: 16, + hgap: 5 + }), + chooseType: BI.Selection.Multi, + layouts: [{ + type: "bi.vertical_adapt" + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24, + value: true + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.data_analysis", Analysis); +})();!(function () { + + /** + * 服务器 填报预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-form-page" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.grid", + height: 78, + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.report.sheet_label_location", + height: 24 + } + }, { + column: 1, + row: 0, + el: { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + } + }, { + column: 0, + row: 1, + el: { + type: "bi.report.form_background_setting", + height: 24 + } + }, { + column: 1, + row: 1, + el: { + type: "bi.report.leave_setting", + height: 24 + } + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24, + value: true + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.form_page", Analysis); +})();!(function () { + /** + * 服务器 分页预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-page-preview" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.server.param_setting.report_show_location", + height: 24 + }, { + type: "bi.button_group", + height: 92, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + el: { + text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"), + value: 1 + }, + bgap: 10 + }, { + el: { + text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"), + value: 2 + }, + bgap: 10 + }, { + text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + layouts: [{ + type: "bi.vertical" + }] + }, { + type: "bi.report.server.param_setting.use_tool_bar", + height: 24 + }, { + type: "bi.report.server.param_setting.tool_bar_height_select", + height: 24 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.server.param_setting.page_preview", Analysis); +})();!(function () { + BI.constant("bi.constant.report.server.param_setting", [ + { + text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.IMPORT_CSS + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.IMPORT_JS + }, { + text: BI.i18nText("Fine-Design_Report_Error_Handler_Template"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE + }, { + text: BI.i18nText("Fine-Design_Report_Print_Setting"), + cls: "tab-item", + value: BICst.REPORT_SERVER_PARAM.PRINT_SETTING + }] + ); +})();!(function () { + + /** + * 报表服务器参数面板 + */ + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-report-server-param-setting" + }, + + render: function () { + return { + type: "bi.setting.tab", + value: BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING, + tabItems: BI.Constants.getConstant("bi.constant.report.server.param_setting"), + cardCreator: BI.bind(this._createCard, this) + }; + }, + + _createCard: function (v) { + switch (v) { + case BICst.REPORT_SERVER_PARAM.SPLIT_PAGE_PREVIEW_SETTING: + return { + type: "bi.report.server.param_setting.page_preview" + }; + case BICst.REPORT_SERVER_PARAM.FORM_PAGE_SETTING: + return { + type: "bi.report.server.param_setting.form_page" + }; + case BICst.REPORT_SERVER_PARAM.DATA_ANALYSIS_SETTING: + return { + type: "bi.report.server.param_setting.data_analysis" + } + case BICst.REPORT_SERVER_PARAM.IMPORT_CSS: + case BICst.REPORT_SERVER_PARAM.IMPORT_JS: + case BICst.REPORT_SERVER_PARAM.ERROR_TEMPLATE_DEFINE: + case BICst.REPORT_SERVER_PARAM.PRINT_SETTING: + default: + return { + type: "bi.label", + text: "1" + }; + } + } + + }); + + BI.shortcut("bi.report.server.param_setting", Tab); +})();!(function () { + /** + * 填报页面设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-form-page" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.global_or_single_combo", + height: 24 + }, { + type: "bi.grid", + height: 78, + columns: 2, + rows: 2, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.report.sheet_label_location" + } + }, { + column: 1, + row: 0, + el: { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + } + }, { + column: 0, + row: 1, + el: { + type: "bi.report.form_background_setting" + } + }, { + column: 1, + row: 1, + el: { + type: "bi.report.leave_setting" + } + }] + }, { + type: "bi.settings.tool_bar", + height: 180 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.template.web_setting.form_page", Analysis); +})();!(function () { + /** + * 分页预览设置 + */ + var Analysis = BI.inherit(BI.Widget, { + props: { + baseCls: "bi-report-server-param-setting-page-preview" + }, + + render: function () { + return { + type: "bi.vtape", + vgap: 10, + hgap: 10, + items: [{ + type: "bi.report.global_or_single_combo", + height: 24 + }, { + type: "bi.report.server.param_setting.report_show_location", + height: 24 + }, { + type: "bi.vertical_adapt", + height: 24, + items: [{ + type: "bi.label", + text: BI.i18nText("Fine-Design_Report_PageSetup_Page"), + textAlign: "right", + width: 70 + }, { + el: { + type: "bi.button_group", + height: 24, + chooseType: BI.Selection.Multi, + items: BI.createItems([{ + text: BI.i18nText("Fine-Design_Report_Is_Paint_Page"), + value: 1 + }, { + text: BI.i18nText("Fine-Design_Report_IS_Auto_Scale"), + value: 2 + }, { + text: BI.i18nText("Fine-Design_Report_IS_TD_HEAVY_EXPORT"), + value: 3 + }], { + type: "bi.multi_select_item", + hgap: 5, + logic: { + dynamic: true + }, + iconWrapperWidth: 16 + }), + layouts: [{ + type: "bi.left", + lgap: 5 + }] + }, + lgap: 10 + }] + }, { + type: "bi.settings.tool_bar", + height: 180 + }, { + type: "bi.label", + height: 24, + textAlign: "left", + text: BI.i18nText("Fine-Design_Report_Editing_Listeners") + ":", + }, { + type: "bi.report.server.param_setting.edit_list" + }] + }; + } + }); + BI.shortcut("bi.report.template.web_setting.page_preview", Analysis); +})();!(function () { + BI.constant("bi.constant.report.template.web_setting", [ + { + text: BI.i18nText("Fine-Design_Report_Basic"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.BASE + }, { + text: BI.i18nText("Fine-Design_Report_Printer(Server)"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Pagination_Setting"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_WEB_Write_Setting"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Data_Analysis_Settings"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING + }, { + text: BI.i18nText("Fine-Design_Report_Browser_Background"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_Css"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS + }, { + text: BI.i18nText("Fine-Design_Report_ReportServerP_Import_JavaScript"), + cls: "tab-item", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS + }] + ); + + BI.constant("bi.constant.report.template.web_setting.tools", [ + { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_First"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.FIRST_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Previous"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRE_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Next"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.NEXT_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_ReportServerP_Last"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.LAST_PAGE + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Print"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.PRINT + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Export"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EXPORT + }, { + text: BI.i18nText("Fine-Design_Report_Engine_Email"), + cls: "close-font", + value: BICst.REPORT_TEMPLATE_WEB_SETTING_TOOLS.EMAIL + }] + ); +})();!(function () { + + /** + * 模板Web属性面板 + */ + var Tab = BI.inherit(BI.Widget, { + + props: { + baseCls: "bi-report-template-web-setting" + }, + + render: function () { + return { + type: "bi.setting.tab", + value: BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING, + tabItems: BI.Constants.getConstant("bi.constant.report.template.web_setting"), + cardCreator: BI.bind(this._createCard, this) + }; + }, + + _createCard: function (v) { + switch (v) { + case BICst.REPORT_TEMPLATE_WEB_SETTING.SPLIT_PAGE_PREVIEW_SETTING: + return { + type: "bi.report.template.web_setting.page_preview" + } + case BICst.REPORT_TEMPLATE_WEB_SETTING.FORM_PAGE_SETTING: + return { + type: "bi.report.template.web_setting.form_page" + } + case BICst.REPORT_TEMPLATE_WEB_SETTING.DATA_ANALYSIS_SETTING: + case BICst.REPORT_TEMPLATE_WEB_SETTING.BASE: + case BICst.REPORT_TEMPLATE_WEB_SETTING.PRINT: + case BICst.REPORT_TEMPLATE_WEB_SETTING.BROWSER: + case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_CSS: + case BICst.REPORT_TEMPLATE_WEB_SETTING.IMPORT_JS: + default: + return { + type: "bi.label", + text: "1" + }; + } + } + + }); + + BI.shortcut("bi.report.template.web_setting", Tab); +})();!(function(){ + window.addEventListener("load", function (ev) { + BI.createWidget({ + type:"bi.absolute", + element: "body", + items: [{ + el: { + type: "bi.settings.bar_container", + el: { + type: "bi.report.template.web_setting" + } + }, + left: 0, + top: 0, + right: 0, + bottom: 0 + }] + }); + }) +})(); \ No newline at end of file diff --git a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java index 3a8abb56e5..1255d87d5a 100644 --- a/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java +++ b/designer-chart/src/main/java/com/fr/design/ChartTypeInterfaceManager.java @@ -41,6 +41,7 @@ import com.fr.design.module.DesignModuleFactory; import com.fr.form.ui.ChartEditor; import com.fr.general.GeneralContext; import com.fr.general.IOUtils; +import com.fr.locale.InterProviderFactory; import com.fr.plugin.chart.PiePlot4VanChart; import com.fr.plugin.chart.area.VanChartAreaPlot; import com.fr.plugin.chart.bubble.VanChartBubblePlot; @@ -99,7 +100,8 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import static com.fr.chart.charttypes.ChartTypeManager.CHART_PRIORITY; +import static com.fr.chart.charttypes.ChartTypeManager.DEFAULT_PRIORITY; +import static com.fr.chart.charttypes.ChartTypeManager.DEPRECATED_CHART_PRIORITY; import static com.fr.chart.charttypes.ChartTypeManager.VAN_CHART_PRIORITY; /** @@ -165,7 +167,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr } String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(plotID); Icon icon = IOUtils.readIcon(iconPath); - child[index] = new ChartWidgetOption(com.fr.design.i18n.Toolkit.i18nText(bean.getName()), icon, ChartEditor.class, plotID); + child[index] = new ChartWidgetOption(InterProviderFactory.getProvider().getLocText(bean.getName()), icon, ChartEditor.class, plotID); index++; } @@ -198,23 +200,23 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr private static void readDefault() { - addChartTypeInterface(CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.LINE_CHART, new LineIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.BAR_CHART, new BarIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.PIE_CHART, new PieIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.METER_CHART, new MeterIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.MAP_CHART, new MapIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); - addChartTypeInterface(CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.COLUMN_CHART, new ColumnIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.LINE_CHART, new LineIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.BAR_CHART, new BarIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.PIE_CHART, new PieIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.AREA_CHART, new AreaIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.SCATTER_CHART, new XYScatterIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.BUBBLE_CHART, new BubbleIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.RADAR_CHART, new RadarIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.STOCK_CHART, new StockIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.METER_CHART, new MeterIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.RANGE_CHART, new RangeIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.CUSTOM_CHART, new CustomIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.GANTT_CHART, new GanttIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.DONUT_CHART, new DonutIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.MAP_CHART, new MapIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.GIS_CHAER, new GisMapIndependentChartInterface()); + addChartTypeInterface(DEPRECATED_CHART_PRIORITY, ChartConstants.FUNNEL_CHART, new FunnelIndependentChartInterface()); } private static void addChartTypeInterface(String priority, String plotID, IndependentChartUIProvider provider) { @@ -462,7 +464,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public void mount(PluginSingleInjection injection) { if (isIndependentChartUIProvider(injection)) { - String priority = injection.getAttribute("priority", CHART_PRIORITY); + String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); String plotID = injection.getAttribute("plotID"); IndependentChartUIProvider instance = (IndependentChartUIProvider) injection.getObject(); addChartTypeInterface(priority, plotID, instance); @@ -474,7 +476,7 @@ public class ChartTypeInterfaceManager implements ExtraChartDesignClassManagerPr public void demount(PluginSingleInjection injection) { if (isIndependentChartUIProvider(injection)) { - String priority = injection.getAttribute("priority", CHART_PRIORITY); + String priority = injection.getAttribute("priority", DEFAULT_PRIORITY); String plotID = injection.getAttribute("plotID"); removeChartTypeInterface(priority, plotID); } diff --git a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java index de7d08a2b0..d914a81e8b 100644 --- a/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java +++ b/designer-chart/src/main/java/com/fr/design/chart/ChartTypePane.java @@ -16,6 +16,7 @@ import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.license.exception.RegistEditionException; import com.fr.license.function.VT4FR; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import javax.swing.BorderFactory; @@ -67,7 +68,7 @@ public class ChartTypePane extends ChartCommonWizardPane { mainTypeList = new JList(defaultListModel); for (int i = 0; i < typeName.length; i++) { - defaultListModel.insertElementAt(com.fr.design.i18n.Toolkit.i18nText(typeName[i].getName()), i); + defaultListModel.insertElementAt(InterProviderFactory.getProvider().getLocText(typeName[i].getName()), i); } mainTypeList.addListSelectionListener(listSelectionListener); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java index 780a70e57b..7f22a03a6b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/data/TableDataPane.java @@ -11,6 +11,7 @@ import com.fr.design.beans.FurtherBasicBeanPane; import com.fr.design.data.tabledata.wrapper.TableDataWrapper; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.gui.ilable.UILabel; +import com.fr.design.i18n.Toolkit; import com.fr.design.mainframe.chart.gui.ChartDataPane; import com.fr.design.mainframe.chart.gui.data.table.AbstractTableDataContentPane; import com.fr.design.utils.gui.UIComponentUtils; @@ -39,8 +40,9 @@ public class TableDataPane extends FurtherBasicBeanPane{ } private void initDataPane() { - UILabel label = new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TableData")); + UILabel label = new BoldFontTextLabel(Toolkit.i18nText("Fine-Design_Chart_Table_Data")); UIComponentUtils.setLineWrap(label, TABLE_DATA_LABEL_LINE_WRAP_WIDTH); + UIComponentUtils.setPreferedWidth(label, ChartDataPane.LABEL_WIDTH); tableDataPane = new DatabaseTableDataPane(label) { @Override @@ -85,7 +87,7 @@ public class TableDataPane extends FurtherBasicBeanPane{ * @return 返回标题. */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_TableData"); + return Toolkit.i18nText("Fine-Design_Chart_TableData"); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java index 7a1567bf9e..c9a6caf80a 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/style/series/UIColorPickerPane.java @@ -531,12 +531,16 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { double forValue = Double.MAX_VALUE; double backValue = -Double.MAX_VALUE; for(int i = 0, size = textFieldList.size(); i < size; i++) {// check 是否合格, 然后检查 是否改变颜色, + //backNumber是否是公式形式 + boolean formulaBackNumber = false; if(i == size - 1) { backValue = -Double.MAX_VALUE; } else { Number backNumber = ChartBaseUtils.formula2Number(BaseFormula.createFormulaBuilder().build(getValue4Index(i+1))); if(backNumber != null){ backValue = backNumber.doubleValue(); + } else { + formulaBackNumber = true; } } @@ -544,7 +548,7 @@ public class UIColorPickerPane extends BasicPane implements UIObserver { if(number != null) { double value = number.doubleValue(); - if(value < forValue && value > backValue) { + if ((value < forValue && value > backValue) || formulaBackNumber) { setBackgroundUIColor(i,Color.WHITE); } else { setBackgroundUIColor(i, Color.red); diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java index 42667ee9d9..425f508070 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/AreaPlotPane.java @@ -8,6 +8,8 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.charttypes.AreaIndependentChart; +import com.fr.design.i18n.Toolkit; +import com.fr.locale.InterProviderFactory; /** @@ -33,10 +35,10 @@ public class AreaPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { - String area = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Area"); - String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); - String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - String td = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_3D"); + String area = InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Area"); + String stack = Toolkit.i18nText("Fine-Design_Chart_Stacked"); + String percent = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + String td = Toolkit.i18nText("Fine-Design_Chart_3D"); return new String[]{ stack + area, percent + stack + area, @@ -139,7 +141,7 @@ public class AreaPlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Area"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Area"); } public Chart getDefaultChart() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java index 280fca724c..cd5e1b4d66 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BarPlotPane.java @@ -6,6 +6,8 @@ import com.fr.chart.chartattr.BarPlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.BarIndependentChart; +import com.fr.design.i18n.Toolkit; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; @@ -31,16 +33,16 @@ public class BarPlotPane extends AbstractBarPane{ @Override protected String[] getTypeTipName() { - String bar = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bar"); - String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); - String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - String td = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_3D"); + String bar = InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Bar"); + String stack = Toolkit.i18nText("Fine-Design_Chart_Stacked"); + String percent = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + String td = Toolkit.i18nText("Fine-Design_Chart_3D"); return new String[]{ bar, stack + bar, percent + stack + bar, td + bar, - td + bar + "(" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal") + ")", + td + bar + "(" + Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal") + ")", td + stack + bar, td + percent + stack + bar }; @@ -65,8 +67,8 @@ public class BarPlotPane extends AbstractBarPane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Bar"); - } + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Bar"); + } protected Plot getSelectedClonedPlot(){ Chart[] barChart = BarIndependentChart.barChartTypes; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java index 103dbd1940..b3e7cd34ae 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/BubblePlotPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.BubblePlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.BubbleIndependentChart; +import com.fr.locale.InterProviderFactory; /** @@ -25,9 +26,9 @@ public class BubblePlotPane extends AbstractChartTypePane { @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bubble_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Bubble_Chart") }; - } + } @Override protected String[] getTypeLayoutPath() { @@ -44,7 +45,7 @@ public class BubblePlotPane extends AbstractChartTypePane { * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Bubble_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Bubble_Chart"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java index 5f290d5926..55de24714b 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/ColumnPlotPane.java @@ -5,6 +5,8 @@ import com.fr.chart.chartattr.BarPlot; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.ColumnIndependentChart; +import com.fr.design.i18n.Toolkit; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; @@ -30,16 +32,16 @@ public class ColumnPlotPane extends AbstractBarPane{ @Override protected String[] getTypeTipName() { - String column = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column"); - String stack = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stacked"); - String percent = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); - String td = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_3D"); + String column = InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Column"); + String stack = Toolkit.i18nText("Fine-Design_Chart_Stacked"); + String percent = Toolkit.i18nText("Fine-Design_Chart_Use_Percent"); + String td = Toolkit.i18nText("Fine-Design_Chart_3D"); return new String[]{ column, stack + column, percent + stack + column, td + column, - td + column + "(" + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal") + ")", + td + column + "(" + Toolkit.i18nText("Fine-Design_Chart_Direction_Horizontal") + ")", td + stack + column, td + percent + stack + column }; @@ -63,8 +65,8 @@ public class ColumnPlotPane extends AbstractBarPane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Column"); - } + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Column"); + } protected Plot getSelectedClonedPlot(){ Chart[] barChart = ColumnIndependentChart.columnChartTypes; diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java index d6a46df458..8e367444f3 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/CustomPlotPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.CustomIndependentChart; +import com.fr.locale.InterProviderFactory; /** @@ -26,9 +27,9 @@ public class CustomPlotPane extends AbstractChartTypePane { @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Combine_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Combine") }; - } + } @Override protected String[] getTypeLayoutPath() { @@ -45,7 +46,7 @@ public class CustomPlotPane extends AbstractChartTypePane { * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Combine_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Combine"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java index e8643c34ff..c1cd47d78f 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/DonutPlotPane.java @@ -10,10 +10,11 @@ import com.fr.chart.chartattr.Donut3DPlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.charttypes.DonutIndependentChart; - +import com.fr.design.i18n.Toolkit; +import com.fr.locale.InterProviderFactory; import com.fr.stable.Constants; -import java.awt.*; +import java.awt.Color; import java.text.DecimalFormat; /** @@ -35,10 +36,10 @@ public class DonutPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { - String donut = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Donut_Chart"); + String donut = InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Donut"); return new String[]{ donut, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_3D") + donut + Toolkit.i18nText("Fine-Design_Chart_3D") + donut }; } @@ -103,8 +104,8 @@ public class DonutPlotPane extends AbstractChartTypePane{ * @return 标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Donut_Chart"); - } + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Donut"); + } /** * 是否有坐标轴 diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java index 8f31c8c555..2de685cb82 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/FunnelPlotPane.java @@ -7,7 +7,7 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.FunnelPlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.FunnelIndependentChart; - +import com.fr.locale.InterProviderFactory; import java.text.DecimalFormat; @@ -31,7 +31,7 @@ public class FunnelPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Funnel") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Funnel") }; } @@ -50,7 +50,7 @@ public class FunnelPlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Funnel"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Funnel"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java index 537fa46289..b1845bfe4c 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GanttPlotPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.GanttIndependentChart; +import com.fr.locale.InterProviderFactory; /** @@ -24,9 +25,9 @@ public class GanttPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gantt_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Gantt") }; - } + } @Override protected String getPlotTypeID() { @@ -47,7 +48,7 @@ public class GanttPlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Gantt_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Gantt"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java index 25d2fa48f2..9911ce4fbf 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/GisMapPlotPane.java @@ -11,11 +11,12 @@ import com.fr.design.gui.itextfield.UITextField; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.layout.TableLayout; import com.fr.design.layout.TableLayoutHelper; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; - -import javax.swing.*; -import java.awt.*; +import javax.swing.JPanel; +import java.awt.BorderLayout; +import java.awt.Component; public class GisMapPlotPane extends AbstractChartTypePane{ @@ -72,9 +73,9 @@ public class GisMapPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - "gis"+com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Map") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_GIS_Map") }; - } + } @Override protected String getPlotTypeID() { @@ -172,7 +173,7 @@ public class GisMapPlotPane extends AbstractChartTypePane{ * @return 标题 */ public String title4PopupWindow() { - return "gis"+com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Map"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_GIS_Map"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java index 5afd3e2177..0f93938bb0 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/LinePlotPane.java @@ -5,6 +5,7 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.LinePlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.charttypes.LineIndependentChart; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; @@ -21,9 +22,9 @@ public class LinePlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Line") }; - } + } @Override protected String[] getTypeLayoutPath() { @@ -83,7 +84,7 @@ public class LinePlotPane extends AbstractChartTypePane{ } public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Line_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Line"); } public Chart getDefaultChart() { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java index 6f9a55ab56..d761be3712 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MapPlotPane.java @@ -10,6 +10,7 @@ import com.fr.chart.charttypes.MapIndependentChart; import com.fr.design.chart.series.PlotSeries.MapGroupExtensionPane; import com.fr.design.chart.series.PlotStyle.ChartSelectDemoPane; import com.fr.design.layout.FRGUIPaneFactory; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import javax.swing.JPanel; @@ -71,7 +72,7 @@ public class MapPlotPane extends AbstractChartTypePane { * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Map_Map"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_SVG_MAP"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java index 811053641a..10293b68c7 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/MeterPlotPane.java @@ -6,6 +6,8 @@ import com.fr.chart.chartattr.MeterPlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.MeterStyle; import com.fr.chart.charttypes.MeterIndependentChart; +import com.fr.design.i18n.Toolkit; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; @@ -31,9 +33,9 @@ public class MeterPlotPane extends AbstractChartTypePane { @Override protected String[] getTypeTipName() { - String meter = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Gauge"); + String meter = InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Meter"); return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") + meter, + Toolkit.i18nText("Fine-Design_Chart_Mode_Custom") + meter, meter + "1", meter + "2" }; @@ -77,13 +79,13 @@ public class MeterPlotPane extends AbstractChartTypePane { * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Gauge"); - } - - /** - * 保存界面属性 - */ - public void updateBean(Chart chart) { + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Meter"); + } + + /** + * 保存界面属性 + */ + public void updateBean(Chart chart) { if(needsResetChart(chart)){ resetChart(chart); } diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java index 98ccb0e533..eeccd2246e 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/PiePlotPane.java @@ -10,10 +10,10 @@ import com.fr.chart.chartattr.PiePlot; import com.fr.chart.chartattr.Plot; import com.fr.chart.chartglyph.ConditionCollection; import com.fr.chart.charttypes.PieIndependentChart; - +import com.fr.locale.InterProviderFactory; import com.fr.stable.Constants; -import java.awt.*; +import java.awt.Color; import java.text.DecimalFormat; /** @@ -36,11 +36,11 @@ public class PiePlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { - String pie = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Pie"); + String pie = InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Pie"); return new String[]{ - pie, - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_3D") + pie - }; + pie, + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_3D") + pie + }; } @Override @@ -63,7 +63,7 @@ public class PiePlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_New_Pie"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Pie"); } private void createPieCondition(Plot plot) { diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java index 631a4d9d46..50e4a756eb 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RadarPlotPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.RadarIndependentChart; +import com.fr.locale.InterProviderFactory; /** @@ -24,9 +25,9 @@ public class RadarPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radar_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Radar") }; - } + } @Override protected String getPlotTypeID() { @@ -48,7 +49,7 @@ public class RadarPlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Radar_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Radar"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java index 405f9aa4fc..f87c6074d4 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/RangePlotPane.java @@ -4,6 +4,7 @@ import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.RangePlot; import com.fr.chart.charttypes.RangeIndependentChart; +import com.fr.locale.InterProviderFactory; /** @@ -25,9 +26,9 @@ public class RangePlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Range") }; - } + } @Override protected String getPlotTypeID() { @@ -49,7 +50,7 @@ public class RangePlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Range_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Range"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java index 567595703c..63f4ead335 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/StockPlotPane.java @@ -3,6 +3,7 @@ package com.fr.design.mainframe.chart.gui.type; import com.fr.chart.base.ChartConstants; import com.fr.chart.chartattr.Chart; import com.fr.chart.charttypes.StockIndependentChart; +import com.fr.locale.InterProviderFactory; /** @@ -24,9 +25,9 @@ public class StockPlotPane extends AbstractChartTypePane { @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stock_Chart") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Stock") }; - } + } @Override protected String getPlotTypeID() { @@ -48,7 +49,7 @@ public class StockPlotPane extends AbstractChartTypePane { * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Stock_Chart"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_Stock"); } /** diff --git a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java index 0effae28e1..46a5b13c07 100644 --- a/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java +++ b/designer-chart/src/main/java/com/fr/design/mainframe/chart/gui/type/XYScatterPlotPane.java @@ -6,7 +6,7 @@ import com.fr.chart.chartattr.Chart; import com.fr.chart.chartattr.XYScatterPlot; import com.fr.chart.chartglyph.ConditionAttr; import com.fr.chart.charttypes.XYScatterIndependentChart; - +import com.fr.locale.InterProviderFactory; import com.fr.stable.Constants; /** @@ -28,9 +28,9 @@ public class XYScatterPlotPane extends AbstractChartTypePane{ @Override protected String[] getTypeTipName() { return new String[]{ - com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_I_XYScatterStyle_Marker") + InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_XYScatter") }; - } + } @Override protected String[] getTypeLayoutPath() { @@ -47,7 +47,7 @@ public class XYScatterPlotPane extends AbstractChartTypePane{ * @return 界面标题 */ public String title4PopupWindow() { - return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_I_XYScatterStyle_Marker"); + return InterProviderFactory.getProvider().getLocText("Fine-Engine_Chart_Type_XYScatter"); } /** diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java index e42707a62a..b8758b9f5e 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartReportDataPane.java @@ -12,8 +12,8 @@ import com.fr.design.mainframe.chart.gui.data.report.AbstractReportDataContentPa import javax.swing.BorderFactory; import javax.swing.JPanel; import javax.swing.SwingConstants; -import java.awt.Component; import java.awt.BorderLayout; +import java.awt.Component; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @@ -92,38 +92,53 @@ public abstract class AbstractExtendedChartReportDataPane fieldList = new ArrayList(); + if (hasCustomFieldPane()) { + fieldList.add(new ExtendedField(seriesPane.updateBean())); + fieldList.add(new ExtendedField(valuePane.updateBean())); + } + dataConfig.setCustomFields(fieldList); + + return dataSet; + } + @Override public void updateBean(ChartCollection ob) { if (ob != null) { Chart chart = ob.getSelectedChart(); if (chart != null) { - ExtendedReportDataSet dataSet = new ExtendedReportDataSet(); - - AbstractDataConfig dataConfig = update(); - dataSet.setDataConfig(dataConfig); - - List fieldList = new ArrayList(); - if (hasCustomFieldPane()) { - fieldList.add(new ExtendedField(seriesPane.updateBean())); - fieldList.add(new ExtendedField(valuePane.updateBean())); - } - dataConfig.setCustomFields(fieldList); - chart.setFilterDefinition(dataSet); + chart.setFilterDefinition(updateDataSet()); } } } diff --git a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java index 0771b749a5..ac1799e745 100644 --- a/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java +++ b/designer-chart/src/main/java/com/fr/extended/chart/AbstractExtendedChartTableDataPane.java @@ -93,17 +93,40 @@ public abstract class AbstractExtendedChartTableDataPane extends AbstractChartAtt return PaneTitleConstants.CHART_OTHER_TITLE; } + @Override + protected void initContentPane() { + leftContentPane = createContentPane(); + leftContentPane.setBorder(BorderFactory.createMatteBorder(10, 3, 0, 10, original)); + this.add(leftContentPane, BorderLayout.CENTER); + } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java index 61aa49829f..db0d5c8641 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/HeatMapRangeLegendPane.java @@ -1,12 +1,16 @@ package com.fr.van.chart.designer.style; import com.fr.design.gui.frpane.AbstractAttrNoScrollPane; +import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ibutton.UIButtonGroup; +import com.fr.design.gui.ilable.BoldFontTextLabel; +import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; import com.fr.design.mainframe.chart.gui.style.series.MapColorPickerPaneWithFormula; - import com.fr.plugin.chart.type.LegendType; +import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; import com.fr.van.chart.range.component.GradualIntervalConfigPane; import com.fr.van.chart.range.component.GradualLegendPane; +import com.fr.van.chart.range.component.LegendGradientBar; import com.fr.van.chart.range.component.SectionIntervalConfigPaneWithOutNum; import com.fr.van.chart.range.component.SectionLegendPane; @@ -46,8 +50,12 @@ public class HeatMapRangeLegendPane extends VanChartRangeLegendPane { protected GradualIntervalConfigPane createGradualIntervalConfigPane() { return new GradualIntervalConfigPane(){ @Override - protected Component[][] getPaneComponents() { - return super.getPaneComponentsWithOutTheme(); + protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, ColorSelectBoxWithOutTransparent colorSelectBox, UINumberDragPane numberDragPane, LegendGradientBar legendGradientBar) { + return new Component[][]{ + new Component[]{minMaxValuePane, null}, + new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, + new Component[]{null, legendGradientBar} + }; } }; } diff --git a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java index 9a26a87116..012c410a89 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/designer/style/label/VanChartPlotLabelDetailPane.java @@ -143,7 +143,7 @@ public class VanChartPlotLabelDetailPane extends BasicPane { protected JPanel getLabelPositionPane (Component[][] comps, double[] row, double[] col){ JPanel panel = TableLayoutHelper.createTableLayoutPane(comps,row,col); - return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Layout"), panel); + return createTableLayoutPaneWithTitle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Attr_Layout"), panel); } diff --git a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java index 2775a37dcb..dc64adef11 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java +++ b/designer-chart/src/main/java/com/fr/van/chart/map/server/ChartMapEditorAction.java @@ -25,7 +25,7 @@ public class ChartMapEditorAction extends UpdateAction { int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); String web = GeneralContext.getCurrentAppNameOfEnv(); String serverlet = ServerConfig.getInstance().getServletName(); - ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/view/report?op=map", port, web, serverlet) : WorkContext.getCurrent().getPath() + "/view/report?op=map"); + ServerStarter.browserURLWithLocalEnv(WorkContext.getCurrent().isLocal() ? String.format("http://localhost:%d/%s/%s/map/edit", port, web, serverlet) : WorkContext.getCurrent().getPath() + "/map/edit"); } } diff --git a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java index b930c689d0..1a0413ffaa 100644 --- a/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java +++ b/designer-chart/src/main/java/com/fr/van/chart/range/component/GradualIntervalConfigPane.java @@ -4,7 +4,6 @@ import com.fr.design.gui.frpane.UINumberDragPane; import com.fr.design.gui.ilable.BoldFontTextLabel; import com.fr.design.layout.TableLayout; import com.fr.design.mainframe.chart.gui.ColorSelectBoxWithOutTransparent; - import com.fr.plugin.chart.range.GradualIntervalConfig; import com.fr.van.chart.designer.TableLayout4VanChartHelper; import com.fr.van.chart.designer.style.axis.component.MinMaxValuePaneWithOutTick; @@ -23,7 +22,7 @@ public class GradualIntervalConfigPane extends JPanel{ //主题颜色 private ColorSelectBoxWithOutTransparent colorSelectBox; //划分阶段 - UINumberDragPane numberDragPane; + private UINumberDragPane numberDragPane; //渐变色编辑器 private LegendGradientBar legendGradientBar; @@ -58,7 +57,7 @@ public class GradualIntervalConfigPane extends JPanel{ double[] col = new double[]{f, e}; double[] row = new double[]{p, p, p, p}; - Component[][] components = getPaneComponents(); + Component[][] components = getPaneComponents(minMaxValuePane, colorSelectBox, numberDragPane, legendGradientBar); //控件承载面板 JPanel contentPane = TableLayout4VanChartHelper.createGapTableLayoutPane(components,row,col); @@ -70,7 +69,10 @@ public class GradualIntervalConfigPane extends JPanel{ return new LegendGradientBar(); } - protected Component[][] getPaneComponents(){ + protected Component[][] getPaneComponents(MinMaxValuePaneWithOutTick minMaxValuePane, + ColorSelectBoxWithOutTransparent colorSelectBox, + UINumberDragPane numberDragPane, + LegendGradientBar legendGradientBar) { return new Component[][]{ new Component[]{minMaxValuePane, null}, new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Subject_Color")), colorSelectBox}, @@ -79,14 +81,6 @@ public class GradualIntervalConfigPane extends JPanel{ }; } - protected Component[][] getPaneComponentsWithOutTheme(){ - return new Component[][]{ - new Component[]{minMaxValuePane, null}, - new Component[]{new BoldFontTextLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Chart_Value_Divided_Stage")), numberDragPane}, - new Component[]{null, legendGradientBar}, - }; - } - public void populate(GradualIntervalConfig intervalConfig){ minMaxValuePane.populate(intervalConfig.getMinAndMaxValue()); diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java index 3346f7d14e..6822422b29 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormHierarchyTreePane.java @@ -23,6 +23,7 @@ import javax.swing.BorderFactory; import javax.swing.Icon; import javax.swing.JComponent; import javax.swing.JPanel; +import javax.swing.SwingUtilities; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; @@ -122,7 +123,12 @@ public class FormHierarchyTreePane extends FormDockView implements HierarchyTree private void refreshComponentTree() { componentTree.setAndScrollSelectionPath(componentTree.getSelectedTreePath()); - componentTree.refreshUI(); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + componentTree.refreshUI(); + } + }); } private JPanel getWidgetPane() { diff --git a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java index 670c2fa489..090969d348 100644 --- a/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java +++ b/designer-form/src/main/java/com/fr/design/mainframe/FormModelAdapter.java @@ -78,6 +78,10 @@ public class FormModelAdapter extends DesignModelAdapter> list.add(new WidgetName(widget.getWidgetName())); } } + @Override + public boolean dealWithAllCards() { + return true; + } }); return list; } @@ -135,4 +139,4 @@ public class FormModelAdapter extends DesignModelAdapter> protected Parameter[] getLatestParameters() { return this.getBook().getParameters(); } -} \ No newline at end of file +} diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java index 61f39b81db..775f402d8e 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/InformationCollector.java @@ -47,6 +47,10 @@ import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + /** * @author neil * @@ -192,23 +196,16 @@ public class InformationCollector implements XMLReadable, XMLWriter { return; } - Thread sendThread = new Thread(new Runnable() { - + ScheduledExecutorService service = Executors.newSingleThreadScheduledExecutor(); + service.schedule(new Runnable() { @Override public void run() { - try { - //读取XML的5分钟后开始发请求连接服务器. - Thread.sleep(SEND_DELAY); - } catch (InterruptedException e) { - FineLoggerFactory.getLogger().error(e.getMessage(), e); - } sendUserInfo(); FocusPointMessageUploader.getInstance().sendToCloudCenter(); TemplateInfoCollector.getInstance().sendTemplateInfo(); ErrorInfoUploader.getInstance().sendErrorInfo(); } - }); - sendThread.start(); + }, SEND_DELAY, TimeUnit.SECONDS); } /** diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java index 6f329c39d2..7fe8b8ff87 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/bbs/UserInfoLabel.java @@ -16,8 +16,12 @@ import com.fr.design.gui.ilable.UILabel; import com.fr.design.gui.imenu.UIMenuItem; import com.fr.design.gui.imenu.UIPopupMenu; import com.fr.design.mainframe.DesignerContext; +import com.fr.design.upm.event.CertificateEvent; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; +import com.fr.event.Event; +import com.fr.event.EventDispatcher; +import com.fr.event.Listener; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.DateUtils; @@ -208,6 +212,18 @@ public class UserInfoLabel extends UILabel { updateInfoPane(); } }); + EventDispatcher.listen(CertificateEvent.LOGIN, new Listener() { + @Override + public void on(Event event, String text) { + setText(text); + } + }); + EventDispatcher.listen(CertificateEvent.LOGOUT, new Listener() { + @Override + public void on(Event event, String text) { + setText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Base_UnSignIn")); + } + }); } private void clearLoginInformation() { diff --git a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java index cecd400423..cbe37764de 100644 --- a/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java +++ b/designer-realize/src/main/java/com/fr/design/mainframe/cell/settingpane/CellOtherSetPane.java @@ -17,6 +17,7 @@ import com.fr.design.layout.TableLayoutHelper; import com.fr.design.layout.VerticalFlowLayout; import com.fr.design.mainframe.EastRegionContainerPane; import com.fr.design.mainframe.JTemplate; +import com.fr.design.utils.gui.UIComponentUtils; import com.fr.design.widget.FRWidgetFactory; import com.fr.general.ComparatorUtils; import com.fr.report.cell.DefaultTemplateCellElement; @@ -51,6 +52,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private static final int HEAD_WDITH = 290; private static final int HEAD_HEIGTH = 24; private static final int COMBO_WIDTH = 154; + private static final int BUTTON_GROUP_WIDTH = 140; // normal private UIButtonGroup autoshrik; @@ -81,7 +83,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private UIRadioButton[] adjustRadioButtons; // 插入行策略 - private UIButtonGroup insertRowPolicy; + private UIButtonGroup insertRowPolicyButtonGroup; private ValueEditorPane valueEditor; private CardLayout insertRowLayout; private JPanel insertRowPane; @@ -147,7 +149,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { private void initInsertRowPolicyPane() { // 插入行策略 - insertRowPolicy = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"), + insertRowPolicyButtonGroup = new UIButtonGroup(new String[]{com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_NULL"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Estate_Default_Text"), com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_COPY")}); defaultValuePane = new JPanel(new BorderLayout(4, 0)); valueEditor = ValueEditorPaneFactory.createBasicValueEditorPane(); @@ -157,10 +159,10 @@ public class CellOtherSetPane extends AbstractCellAttrPane { insertRowPane.add(new JPanel(), "none"); insertRowPane.add(defaultValuePane, "content"); insertRowPane.setPreferredSize(new Dimension(0, 0)); - insertRowPolicy.addChangeListener(new ChangeListener() { + insertRowPolicyButtonGroup.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { - if (insertRowPolicy.getSelectedIndex() == 1) { + if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) { insertRowPane.setPreferredSize(new Dimension(100, 20)); insertRowLayout.show(insertRowPane, "content"); } else { @@ -169,16 +171,33 @@ public class CellOtherSetPane extends AbstractCellAttrPane { } } }); + + double f = TableLayout.FILL; double p = TableLayout.PREFERRED; - double[] rowSize1 = {p, p}; - double[] columnSize1 = {p, f}; - int[][] rowCount1 = {{1, 1}, {1, 1}}; - Component[][] components1 = new Component[][]{ - new Component[]{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy"), SwingConstants.LEFT), insertRowPolicy}, - new Component[]{null, insertRowPane}, - }; - insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components1, rowSize1, columnSize1, rowCount1, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); + UILabel insertRowPolicyLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy", SwingConstants.LEFT)); + UIComponentUtils.setLineWrap(insertRowPolicyLabel); + + // 如果右侧需要很宽的空间,就用3行1列的布局 + if (insertRowPolicyButtonGroup.getPreferredSize().getWidth() > BUTTON_GROUP_WIDTH) { + double[] rowSize = {p, p, p}; + double[] columnSize = {f}; + + Component[][] components = new Component[][] { + new Component[]{insertRowPolicyLabel}, + new Component[]{insertRowPolicyButtonGroup}, + new Component[]{insertRowPane}, + }; + insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); + } else { + double[] rowSize = {p, p}; + double[] columnSize = {f, BUTTON_GROUP_WIDTH}; + Component[][] components = new Component[][] { + new Component[]{insertRowPolicyLabel, insertRowPolicyButtonGroup}, + new Component[]{null, insertRowPane}, + }; + insertRowPolicyPane = TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, LayoutConstants.VGAP_LARGE, LayoutConstants.VGAP_MEDIUM); + } } private JPanel seniorUpPane() { @@ -200,13 +219,14 @@ public class CellOtherSetPane extends AbstractCellAttrPane { fileNamePane.setBorder(BorderFactory.createEmptyBorder(0,12,0,0)); UILabel showContentLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Show_Content"), SwingConstants.LEFT); + UIComponentUtils.setLineWrap(showContentLabel); UILabel toolTipLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_ToolTip")); JPanel toolTipTextFieldWrapper = new JPanel(new BorderLayout()); toolTipTextFieldWrapper.add(tooltipTextField, BorderLayout.NORTH); Component[][] components = new Component[][]{ - new Component[]{showContentLabel, showContent}, + new Component[]{showContentLabel, UIComponentUtils.wrapWithBorderLayoutPane(showContent)}, new Component[]{fileNamePane, null}, // 选择"用下载连接显示二进制内容"时,会显示这一行的面板 new Component[]{toolTipLabel, toolTipTextFieldWrapper} }; @@ -323,7 +343,7 @@ public class CellOtherSetPane extends AbstractCellAttrPane { pageAfterColumnCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_Page_After_Column")); canBreakOnPaginateCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Can_Break_On_Paginate")); repeatCheckBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellPage_Repeat_Content_When_Paging")); - insertRowPolicy.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); + insertRowPolicyButtonGroup.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); valueEditor.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_CellWrite_InsertRow_Policy")); } @@ -395,16 +415,16 @@ public class CellOtherSetPane extends AbstractCellAttrPane { cellInsertPolicyAttr = new CellInsertPolicyAttr(); } if (ComparatorUtils.equals(CellInsertPolicyAttr.INSERT_POLICY_COPY, cellInsertPolicyAttr.getInsertPolicy())) { - insertRowPolicy.setSelectedIndex(2); + insertRowPolicyButtonGroup.setSelectedIndex(2); } else if (ComparatorUtils.equals(CellInsertPolicyAttr.INSERT_POLICY_DEFAULT, cellInsertPolicyAttr.getInsertPolicy())) { - insertRowPolicy.setSelectedIndex(1); + insertRowPolicyButtonGroup.setSelectedIndex(1); Object defaultValue = cellInsertPolicyAttr.getDefaultInsertValue(); this.valueEditor.populate(defaultValue); } else { - insertRowPolicy.setSelectedIndex(0); + insertRowPolicyButtonGroup.setSelectedIndex(0); this.valueEditor.populate(StringUtils.EMPTY); } - if (insertRowPolicy.getSelectedIndex() == 1) { + if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) { insertRowPane.setPreferredSize(new Dimension(100, 20)); insertRowLayout.show(insertRowPane, "content"); } else { @@ -521,9 +541,9 @@ public class CellOtherSetPane extends AbstractCellAttrPane { // 插入 CellInsertPolicyAttr cellInsertPolicyAttr = new CellInsertPolicyAttr(); - if (insertRowPolicy.getSelectedIndex() == 2) { + if (insertRowPolicyButtonGroup.getSelectedIndex() == 2) { cellInsertPolicyAttr.setInsertPolicy(CellInsertPolicyAttr.INSERT_POLICY_COPY); - } else if (insertRowPolicy.getSelectedIndex() == 1) { + } else if (insertRowPolicyButtonGroup.getSelectedIndex() == 1) { cellInsertPolicyAttr.setInsertPolicy(CellInsertPolicyAttr.INSERT_POLICY_DEFAULT); Object value = valueEditor.update(); cellInsertPolicyAttr.setDefaultInsertValue(value); diff --git a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java index b6683337fd..0a2c627668 100644 --- a/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java +++ b/designer-realize/src/main/java/com/fr/design/webattr/EditToolBar.java @@ -679,12 +679,10 @@ public class EditToolBar extends BasicPane { private void updateCustomToolBarButton() { CustomToolBarButton customToolBarButton = (CustomToolBarButton) widget; - if (customToolBarButton.getJSImpl() != null) { - customToolBarButton.setJSImpl(this.javaScriptPane.updateBean()); - } else { - customToolBarButton.setJSImpl(JavaScriptActionPane.createDefault().updateBean()); + if (customToolBarButton.getJSImpl() == null) { + this.javaScriptPane = JavaScriptActionPane.createDefault(); } - + customToolBarButton.setJSImpl(this.javaScriptPane.updateBean()); } } diff --git a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java index 3130a4b864..564a3ae6a2 100644 --- a/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java +++ b/designer-realize/src/main/java/com/fr/poly/PolyComponentsBar.java @@ -12,6 +12,7 @@ import com.fr.design.gui.itooltip.MultiLineToolTip; import com.fr.design.i18n.Toolkit; import com.fr.design.layout.FRGUIPaneFactory; import com.fr.design.mainframe.dnd.SerializableTransferable; +import com.fr.locale.InterProviderFactory; import com.fr.log.FineLoggerFactory; import com.fr.report.poly.PolyECBlock; import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; @@ -65,7 +66,7 @@ public class PolyComponentsBar extends JToolBar { for (int i = 0; i < typeLen; i++) { BaseChart[] rowChart = BaseChartGetter.getStaticChartTypes(typeName[i].getPlotID()); String iconPath = ChartTypeInterfaceManager.getInstance().getIconPath(typeName[i].getPlotID()); - serIcons[i + 1] = new SerIcon(rowChart[0], Toolkit.i18nText(typeName[i].getName()), iconPath); + serIcons[i + 1] = new SerIcon(rowChart[0], InterProviderFactory.getProvider().getLocText(typeName[i].getName()), iconPath); this.add(serIcons[i + 1]); } diff --git a/designer-realize/src/main/java/com/fr/start/Designer.java b/designer-realize/src/main/java/com/fr/start/Designer.java index 6026ebad82..2c8e030e31 100644 --- a/designer-realize/src/main/java/com/fr/start/Designer.java +++ b/designer-realize/src/main/java/com/fr/start/Designer.java @@ -3,7 +3,6 @@ package com.fr.start; import com.fr.base.BaseUtils; import com.fr.base.vcs.DesignerMode; import com.fr.design.DesignerEnvManager; -import com.fr.design.RestartHelper; import com.fr.design.actions.core.ActionFactory; import com.fr.design.actions.file.WebPreviewUtils; import com.fr.design.actions.file.newReport.NewPolyReportAction; @@ -30,15 +29,12 @@ import com.fr.design.mainframe.JWorkBook; import com.fr.design.mainframe.alphafine.component.AlphaFinePane; import com.fr.design.mainframe.bbs.UserInfoLabel; import com.fr.design.mainframe.bbs.UserInfoPane; -import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.mainframe.toolbar.ToolBarMenuDockPlus; -import com.fr.design.mainframe.vcs.common.VcsHelper; import com.fr.design.menu.KeySetUtils; import com.fr.design.menu.MenuDef; import com.fr.design.menu.SeparatorDef; import com.fr.design.menu.ShortCut; import com.fr.design.module.DesignModuleFactory; -import com.fr.design.utils.DesignUtils; import com.fr.design.utils.concurrent.ThreadFactoryBuilder; import com.fr.design.utils.gui.GUICoreUtils; import com.fr.general.ComparatorUtils; @@ -46,17 +42,12 @@ import com.fr.log.FineLoggerFactory; import com.fr.module.Module; import com.fr.module.ModuleContext; import com.fr.runtime.FineRuntime; -import com.fr.stable.BuildContext; -import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; import com.fr.stable.StableUtils; import com.fr.stable.StringUtils; import com.fr.stable.lifecycle.LifecycleFatalError; import com.fr.stable.xml.XMLTools; -import com.fr.start.fx.SplashFx; -import com.fr.start.jni.SplashMac; import com.fr.start.module.StartupArgs; -import com.fr.start.preload.ImagePreLoader; import com.fr.start.server.ServerTray; import com.fr.workspace.WorkContext; @@ -72,8 +63,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; @@ -106,21 +95,6 @@ public class Designer extends BaseDesigner { //启动运行时 FineRuntime.start(); - BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); - // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 - if (DesignUtils.isStarted()) { - DesignUtils.clientSend(args); - FineLoggerFactory.getLogger().error("Designer port not available."); - System.exit(0); - return; - } - RestartHelper.deleteRecordFilesWhenStart(); - - preloadResource(); - - SplashContext.getInstance().registerSplash(createSplash()); - - SplashContext.getInstance().show(); Module designerRoot = ModuleContext.parseRoot("designer-startup.xml"); //传递启动参数 designerRoot.setSingleton(StartupArgs.class, new StartupArgs(args)); @@ -140,35 +114,6 @@ public class Designer extends BaseDesigner { } - private static void preloadResource() { - ExecutorService service = Executors.newCachedThreadPool(); - - service.submit(new Runnable() { - @Override - public void run() { - new ImagePreLoader(); - } - }); - - service.submit(new Runnable() { - @Override - public void run() { - TemplateInfoCollector.getInstance(); - } - }); - service.shutdown(); - } - - private static SplashStrategy createSplash() { - // 这里可以开接口加载自定义启动画面 - if (OperatingSystem.isWindows()) { - return new SplashFx(); - } else if (OperatingSystem.isMacOS()) { - return new SplashMac(); - } - return new SplashFx(); - } - /** * 创建新建文件的快捷方式数组。 * @@ -275,9 +220,6 @@ public class Designer extends BaseDesigner { jt.stopEditing(); jt.saveTemplate(); jt.requestFocus(); - if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) { - VcsHelper.dealWithVcs(jt); - } } }); return saveButton; @@ -331,19 +273,16 @@ public class Designer extends BaseDesigner { ) { @Override protected void upButtonClickEvent() { - JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; } WebPreviewUtils.preview(jt); - if (DesignerEnvManager.getEnvManager().getVcsConfigManager().isVcsEnable()) { - VcsHelper.dealWithVcs(jt); - } } @Override protected void downButtonClickEvent() { - final JTemplate jt = HistoryTemplateListPane.getInstance().getCurrentEditingTemplate(); + final JTemplate jt = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); if (jt == null) { return; } diff --git a/designer-realize/src/main/java/com/fr/start/SplashContext.java b/designer-realize/src/main/java/com/fr/start/SplashContext.java index f40403a4d0..cea537592e 100644 --- a/designer-realize/src/main/java/com/fr/start/SplashContext.java +++ b/designer-realize/src/main/java/com/fr/start/SplashContext.java @@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit; public class SplashContext { public static final String SPLASH_PATH = getSplashPath(); - public static final String SPLASH_CACHE_NAME = getSplashCacheName(); + public static final String SPLASH_CACHE_NAME = SPLASH_PATH.substring(SPLASH_PATH.lastIndexOf("/") + 1); private static final int FETCH_ONLINE_MAX_TIMES = 50; private static final SplashContext SPLASH_CONTEXT = new SplashContext(); @@ -166,18 +166,13 @@ public class SplashContext { } private static String getSplashPath() { - if (DesignerEnvManager.getEnvManager().getLanguage().equals(Locale.JAPAN)) { + Locale locale = DesignerEnvManager.getEnvManager().getLanguage(); + if (Locale.US.equals(locale) || Locale.KOREA.equals(locale)) { + return "/com/fr/design/images/splash_10_en.gif"; + } else if (Locale.JAPAN.equals(locale)) { return "/com/fr/design/images/splash_10_jp.gif"; - } else { + } else { return "/com/fr/design/images/splash_10.gif"; } } - - private static String getSplashCacheName() { - if (DesignerEnvManager.getEnvManager().getLanguage().equals(Locale.JAPAN)) { - return "splash_10_jp.gif"; - } else { - return "splash_10.gif"; - } - } } diff --git a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java index c4eea3bada..72d3217be2 100644 --- a/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/PreStartActivator.java @@ -2,63 +2,99 @@ package com.fr.start.module; import com.fr.design.DesignerEnvManager; import com.fr.design.RestartHelper; +import com.fr.design.fun.OemProcessor; +import com.fr.design.mainframe.template.info.TemplateInfoCollector; import com.fr.design.utils.DesignUtils; +import com.fr.design.utils.DesignerPort; import com.fr.general.CloudCenter; import com.fr.general.ComparatorUtils; import com.fr.general.GeneralContext; +import com.fr.log.FineLoggerFactory; import com.fr.module.Activator; +import com.fr.stable.BuildContext; +import com.fr.stable.OperatingSystem; import com.fr.stable.ProductConstants; +import com.fr.stable.StableUtils; +import com.fr.start.OemHandler; +import com.fr.start.SplashContext; +import com.fr.start.SplashStrategy; +import com.fr.start.fx.SplashFx; +import com.fr.start.jni.SplashMac; +import com.fr.start.preload.ImagePreLoader; import java.io.File; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; /** * Created by juhaoyu on 2018/1/8. */ public class PreStartActivator extends Activator { - private static final int MESSAGE_PORT = 51462; - - private static final int DEBUG_PORT = 51463; - @Override public void start() { - CloudCenter.getInstance(); - if (checkMultiStart()) { + BuildContext.setBuildFilePath("/com/fr/stable/build.properties"); + // 如果端口被占用了 说明程序已经运行了一次,也就是说,已经建立一个监听服务器,现在只要给服务器发送命令就好了 + final String[] args = getModule().upFindSingleton(StartupArgs.class).get(); + // 检查是否是-Ddebug = true 启动 并切换对应的端口以及环境配置文件 + checkDebugStart(); + if (DesignUtils.isStarted()) { + DesignUtils.clientSend(args); + FineLoggerFactory.getLogger().info("The Designer Has Been Started"); + System.exit(0); return; } + + RestartHelper.deleteRecordFilesWhenStart(); + + preloadResource(); + + SplashContext.getInstance().registerSplash(createSplash()); + + SplashContext.getInstance().show(); + + // 完成初始化 + //noinspection ResultOfMethodCallIgnored + CloudCenter.getInstance(); + + // 创建监听服务 + DesignUtils.createListeningServer(DesignUtils.getPort(), startFileSuffix()); + initLanguage(); } - private boolean checkMultiStart() { + @Override + public void stop() { + + } + private void checkDebugStart() { if (isDebug()) { setDebugEnv(); - } else { - DesignUtils.setPort(getStartPort()); } - - return false; } - private int getStartPort() { - - return MESSAGE_PORT; - } - - //在VM options里加入-Ddebug=true激活 + /** + * 在VM options里加入-Ddebug=true激活 + * + * @return isDebug + */ private boolean isDebug() { - return ComparatorUtils.equals("true", System.getProperty("debug")); } //端口改一下,环境配置文件改一下。便于启动两个设计器,进行对比调试 private void setDebugEnv() { - - DesignUtils.setPort(DEBUG_PORT); - DesignerEnvManager.setEnvFile(new File(ProductConstants.getEnvHome() + File.separator + ProductConstants.APP_NAME + "Env_debug.xml")); + DesignUtils.setPort(DesignerPort.DEBUG_MESSAGE_PORT); + String debugXMlFilePath = StableUtils.pathJoin( + ProductConstants.getEnvHome(), + ProductConstants.APP_NAME + "Env_debug.xml" + ); + DesignerEnvManager.setEnvFile( + new File(debugXMlFilePath)); } private void initLanguage() { @@ -66,8 +102,48 @@ public class PreStartActivator extends Activator { GeneralContext.setLocale(DesignerEnvManager.getEnvManager(false).getLanguage()); } - @Override - public void stop() { + private String[] startFileSuffix() { + return new String[]{".cpt", ".xls", ".xlsx", ".frm", ".form", ".cht", ".chart"}; + } + private static void preloadResource() { + ExecutorService service = Executors.newCachedThreadPool(); + + service.submit(new Runnable() { + @Override + public void run() { + new ImagePreLoader(); + } + }); + + service.submit(new Runnable() { + @Override + public void run() { + TemplateInfoCollector.getInstance(); + } + }); + service.shutdown(); + } + + private SplashStrategy createSplash() { + OemProcessor oemProcessor = OemHandler.findOem(); + if (oemProcessor != null) { + SplashStrategy splashStrategy = null; + try { + splashStrategy = oemProcessor.createSplashStrategy(); + } catch (Throwable e) { + FineLoggerFactory.getLogger().error(e.getMessage(), e); + } + if (splashStrategy != null) { + return splashStrategy; + } + } + // 这里可以开接口加载自定义启动画面 + if (OperatingSystem.isWindows()) { + return new SplashFx(); + } else if (OperatingSystem.isMacOS()) { + return new SplashMac(); + } + return new SplashFx(); } } diff --git a/designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java b/designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java index b9e165b264..41f662a880 100644 --- a/designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/StartFinishActivator.java @@ -1,36 +1,19 @@ package com.fr.start.module; import com.fr.design.fun.impl.GlobalListenerProviderManager; -import com.fr.design.utils.DesignUtils; import com.fr.module.Activator; /** * Created by juhaoyu on 2018/1/8. */ public class StartFinishActivator extends Activator { - - private static final int MESSAGE_PORT = 51462; - + @Override public void start() { - - DesignUtils.creatListeningServer(getStartPort(), startFileSuffix()); GlobalListenerProviderManager.getInstance().init(); } - - private int getStartPort() { - - return MESSAGE_PORT; - } - - - private String[] startFileSuffix() { - - return new String[]{".cpt", ".xls", ".xlsx", ".frm", ".form", ".cht", ".chart"}; - } - + @Override public void stop() { - } } diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_10_en.gif b/designer-realize/src/main/resources/com/fr/design/images/splash_10_en.gif new file mode 100644 index 0000000000..00b98250d3 Binary files /dev/null and b/designer-realize/src/main/resources/com/fr/design/images/splash_10_en.gif differ diff --git a/designer-realize/src/main/resources/com/fr/design/images/splash_10_jp.gif b/designer-realize/src/main/resources/com/fr/design/images/splash_10_jp.gif index 4f5d4ce0a8..860963c956 100644 Binary files a/designer-realize/src/main/resources/com/fr/design/images/splash_10_jp.gif and b/designer-realize/src/main/resources/com/fr/design/images/splash_10_jp.gif differ