Browse Source

REPORT-58538 适配平台支持服务器数据集权限

bugfix/11.0
Henry.Wang 3 years ago
parent
commit
15eb59fd13
  1. 10
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 55
      designer-base/src/main/java/com/fr/design/data/datapane/TableDataTreePane.java
  3. 5
      designer-base/src/main/java/com/fr/design/data/tabledata/wrapper/TableDataFactory.java

10
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -195,6 +195,7 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private static List<SwingWorker> mapWorkerList = new ArrayList<SwingWorker>();
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();
}

55
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<JLabel> 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<JLabel> 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);
}

5
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<String> nameIt = tableDataConfig.getTableDatas().keySet().iterator();
UserAuthority userAuthority = WorkContext.getCurrent().get(UserAuthority.class);
Iterator<String> nameIt = userAuthority.getAuthServerDataSetNames().iterator();
while (nameIt.hasNext()) {
String name = nameIt.next();
addName(name, tableDataConfig.getTableData(name));

Loading…
Cancel
Save