From 15eb59fd13c5e5980454afca9525923156cb6bcd Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Fri, 8 Oct 2021 16:47:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?REPORT-58538=20=E9=80=82=E9=85=8D=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=94=AF=E6=8C=81=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/fr/design/DesignerEnvManager.java | 10 ++++ .../data/datapane/TableDataTreePane.java | 55 ++++++++++++++++++- .../tabledata/wrapper/TableDataFactory.java | 5 +- 3 files changed, 68 insertions(+), 2 deletions(-) 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 717faebe15..f00e1a8558 100644 --- a/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java +++ b/designer-base/src/main/java/com/fr/design/DesignerEnvManager.java @@ -195,6 +195,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { private static List mapWorkerList = new ArrayList(); private boolean imageCompress = false;//图片压缩 private boolean showImageCompressMoveTip = true; + private boolean showServerDatasetAuthTip = true; // 开启内嵌web页面的调试窗口 private boolean openDebug = false; @@ -1674,6 +1675,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { this.showImageCompressMoveTip = showImageCompressMoveTip; } + public boolean isShowServerDatasetAuthTip() { + return showServerDatasetAuthTip; + } + + public void setShowServerDatasetAuthTip(boolean showServerDatasetAuthTip) { + this.showServerDatasetAuthTip = showServerDatasetAuthTip; + } public boolean isOpenDebug() { return openDebug; @@ -1852,6 +1860,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { } this.setEmbedServerLazyStartup(reader.getAttrAsBoolean("embedServerLazyStartup", false)); this.setShowTemplateMissingPlugin(reader.getAttrAsBoolean("showTemplateMissingPlugin", true)); + this.setShowServerDatasetAuthTip(reader.getAttrAsBoolean("showServerDatasetAuthTip", true)); } private void readReportPaneAttributions(XMLableReader reader) { @@ -2125,6 +2134,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter { if (!this.isShowTemplateMissingPlugin()) { writer.attr("showTemplateMissingPlugin", this.isShowTemplateMissingPlugin()); } + writer.attr("showServerDatasetAuthTip", this.isShowServerDatasetAuthTip()); writer.end(); } 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 493d40d796..4fbe97e697 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 @@ -5,6 +5,7 @@ import com.fr.data.TableDataSource; import com.fr.data.impl.DBTableData; import com.fr.data.impl.TableDataSourceDependent; import com.fr.design.DesignModelAdapter; +import com.fr.design.DesignerEnvManager; import com.fr.design.ExtraDesignClassManager; import com.fr.design.actions.UpdateAction; import com.fr.design.constants.UIConstants; @@ -53,10 +54,12 @@ import com.fr.plugin.manage.PluginFilter; import com.fr.plugin.observer.PluginEvent; import com.fr.plugin.observer.PluginEventListener; import com.fr.stable.core.PropertyChangeAdapter; +import com.fr.workspace.WorkContext; import org.jetbrains.annotations.NotNull; import javax.swing.BorderFactory; import javax.swing.Icon; +import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.SwingUtilities; @@ -64,6 +67,7 @@ import javax.swing.SwingWorker; import javax.swing.ToolTipManager; import javax.swing.tree.TreePath; import java.awt.BorderLayout; +import java.awt.Color; import java.awt.GridLayout; import java.awt.dnd.DnDConstants; import java.awt.event.ActionEvent; @@ -106,6 +110,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { private EsdOnAction esdAction; private EsdOffAction esdOffAction; private PreviewTableDataAction previewTableDataAction; + private JPanel serverDatasetAuthTipJPanel = new JPanel(); private TableDataTreePane() { initPane(); @@ -149,10 +154,12 @@ public class TableDataTreePane extends BasicTableDataTreePane { UIScrollPane scrollPane = new UIScrollPane(tableDataTree); scrollPane.setBorder(null); + initServerDatasetAuthTipJPanel(); initButtonGroup(); JPanel jPanel = new JPanel(new BorderLayout(0, 0)); - JPanel buttonPane = new JPanel(new GridLayout()); + JPanel buttonPane = new JPanel(FRGUIPaneFactory.createBorderLayout()); buttonPane.add(buttonGroup, BorderLayout.CENTER); + buttonPane.add(serverDatasetAuthTipJPanel, BorderLayout.SOUTH); jPanel.add(buttonPane, BorderLayout.NORTH); jPanel.add(scrollPane, BorderLayout.CENTER); this.add(jPanel, BorderLayout.CENTER); @@ -172,6 +179,38 @@ public class TableDataTreePane extends BasicTableDataTreePane { checkButtonEnabled(); } + private void initServerDatasetAuthTipJPanel() { + String[] lineTips = Toolkit.i18nText("Fine-Design_Server_Dataset_Auth_Tip").split("\n"); + serverDatasetAuthTipJPanel = new JPanel(); + serverDatasetAuthTipJPanel.setLayout(new GridLayout(lineTips.length, 1)); + for (int i = 0; i < lineTips.length; i++) { + String lineTip = lineTips[i]; + List jLabels = new ArrayList<>(); + jLabels.add(new JLabel(lineTip)); + if (i == (lineTips.length - 1)) { + JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind")); + jLabel.setForeground(Color.pink); + jLabel.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + DesignerEnvManager.getEnvManager().setShowServerDatasetAuthTip(false); + serverDatasetAuthTipJPanel.setVisible(false); + } + }); + jLabels.add(jLabel); + } + serverDatasetAuthTipJPanel.add(getLineTipJPanel(jLabels)); + } + } + + private JPanel getLineTipJPanel(List jLabels) { + JPanel jPanel = new JPanel(FRGUIPaneFactory.createLabelFlowLayout()); + for (JLabel jLabel : jLabels) { + jPanel.add(jLabel); + } + return jPanel; + } + private void createPluginListener() { //菜单栏监听 GeneralContext.listenPluginRunningChanged(new PluginEventListener(PLUGIN_LISTENER_PRIORITY) { @@ -532,6 +571,11 @@ public class TableDataTreePane extends BasicTableDataTreePane { String[] textArray = {Toolkit.i18nText("Fine-Design_Basic_Tabledata_Source_Type_Template"), Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")}; buttonGroup = new UIHeadGroup(textArray) { public void tabChanged(int index) { + if (isShowServerDatasetAuthTipJPanel(textArray[index])) { + serverDatasetAuthTipJPanel.setVisible(true); + } else { + serverDatasetAuthTipJPanel.setVisible(false); + } if (op != null) { op.setDataMode(modeArray[buttonGroup.getSelectedIndex()]); addMenuDef.setEnabled(modeArray[buttonGroup.getSelectedIndex()] == TEMPLATE_TABLE_DATA); @@ -539,6 +583,15 @@ public class TableDataTreePane extends BasicTableDataTreePane { } } + + private boolean isShowServerDatasetAuthTipJPanel(String name) { + if (ComparatorUtils.equals(name, Toolkit.i18nText("Fine-Design_Basic_DS_Server_TableData")) + && DesignerEnvManager.getEnvManager().isShowServerDatasetAuthTip() + && !WorkContext.getCurrent().isLocal()) { + return true; + } + return false; + } }; buttonGroup.setNeedLeftRightOutLine(false); } diff --git a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java index adce85f3b6..6bc9e21ed6 100644 --- a/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java +++ b/designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java @@ -26,6 +26,8 @@ import com.fr.general.ComparatorUtils; import com.fr.log.FineLoggerFactory; import com.fr.stable.ArrayUtils; import com.fr.stable.StringUtils; +import com.fr.workspace.WorkContext; +import com.fr.workspace.server.authority.user.UserAuthority; import java.lang.reflect.Constructor; import java.util.ArrayList; @@ -175,7 +177,8 @@ public abstract class TableDataFactory { public static String[] getSortOfChineseNameOfServerData(TableDataConfig tableDataConfig) { clearAll(); try { - java.util.Iterator nameIt = tableDataConfig.getTableDatas().keySet().iterator(); + UserAuthority userAuthority = WorkContext.getCurrent().get(UserAuthority.class); + Iterator nameIt = userAuthority.getAuthServerDataSetNames().iterator(); while (nameIt.hasNext()) { String name = nameIt.next(); addName(name, tableDataConfig.getTableData(name)); From 5c48402d9346417162670827ed04c4f666d17131 Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Sat, 9 Oct 2021 09:50:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?REPORT-58538=20=E9=80=82=E9=85=8D=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=94=AF=E6=8C=81=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/TableDataTreePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 4fbe97e697..a22c68dbc7 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 @@ -189,7 +189,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { jLabels.add(new JLabel(lineTip)); if (i == (lineTips.length - 1)) { JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind")); - jLabel.setForeground(Color.pink); + jLabel.setForeground(Color.blue); jLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { From dfca002ab8aec097be2de35512590cc81d76523c Mon Sep 17 00:00:00 2001 From: "Henry.Wang" Date: Sat, 9 Oct 2021 10:01:56 +0800 Subject: [PATCH 3/3] =?UTF-8?q?REPORT-58538=20=E9=80=82=E9=85=8D=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E6=94=AF=E6=8C=81=E6=9C=8D=E5=8A=A1=E5=99=A8=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/data/datapane/TableDataTreePane.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 a22c68dbc7..0850cf05a1 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 @@ -189,7 +189,7 @@ public class TableDataTreePane extends BasicTableDataTreePane { jLabels.add(new JLabel(lineTip)); if (i == (lineTips.length - 1)) { JLabel jLabel = new JLabel(Toolkit.i18nText("Fine-Design_Basic_Alphafine_No_Remind")); - jLabel.setForeground(Color.blue); + jLabel.setForeground(Color.lightGray); jLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) {