Browse Source

Merge branch 'fbp/release' of ssh://code.fineres.com:7999/~renekton/design into fbp/release

fbp/merge
renekton 2 months ago
parent
commit
3816c1570c
  1. 2
      designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java
  2. 3
      designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java
  3. 5
      designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java
  4. 44
      designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java
  5. 1
      designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java
  6. 83
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java
  7. 76
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java
  8. 32
      designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java
  9. 2
      designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java
  10. 98
      designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js
  11. 4
      designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java
  12. 51
      designer-realize/src/main/java/com/fanruan/config/SetupDataDesignerRemoteOperator.java
  13. 58
      designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java
  14. 7
      designer-realize/src/main/java/com/fr/start/DesignLauncher.java

2
designer-base/src/main/java/com/fr/design/actions/file/export/AbstractExportAction.java

@ -170,7 +170,7 @@ public abstract class AbstractExportAction<E extends JTemplate<?, ?>> extends JT
this.setProgress(100);
FineLoggerFactory.getLogger().info("\"" + name + "\"" + Toolkit.i18nText("Fine-Design_Report_Finish_Export") + "!");
FineJOptionPane.showMessageDialog(
FineJOptionPane.showSuccessMessageDialog(
DesignerContext.getDesignerFrame(),
Toolkit.i18nText("Fine-Design_Report_Exported_Successfully") + "\n" + name);

3
designer-base/src/main/java/com/fr/design/data/datapane/preview/ConnectionInfoBeanHelper.java

@ -27,7 +27,6 @@ import com.fr.module.tool.ActivatorToolBox;
import com.fr.security.encryption.transmission.TransmissionEncryptionManager;
import com.fr.stable.Constants;
import com.fr.stable.StringUtils;
import com.fr.third.fasterxml.jackson.core.JsonProcessingException;
import com.fr.third.fasterxml.jackson.databind.ObjectMapper;
import com.fr.third.springframework.beans.BeanUtils;
import com.fr.workspace.server.repository.WorkplaceConstants;
@ -180,7 +179,7 @@ public class ConnectionInfoBeanHelper {
.redirectPort(jdbcConnection.getSsh().getRedirectPort())
.redirectIp((jdbcConnection.getSsh()).getRedirectIp())
.sshTimeOut(((BaseSsh) jdbcConnection.getSsh()).getTimeOut())
.sshSecret(withPassword ? ((BaseSsh) jdbcConnection.getSsh()).getSecret() : DecisionServiceConstants.DEFAULT_PASSWORD)
.sshSecret(withPassword ? DataEncryptionHelper.encrypt(((BaseSsh) jdbcConnection.getSsh()).getSecret()) : DecisionServiceConstants.DEFAULT_PASSWORD)
.sshPrivateKeyPath(jdbcConnection.getSsh().getSshType() == SshType.KEY ? ((KeyVerifySsh) jdbcConnection.getSsh()).getPrivateKeyPath() : StringUtils.EMPTY)
.usingSsl((jdbcConnection.getSsl()).isUsingSsl())
.sslType(jdbcConnection.getSsl().getSslType().toString())

5
designer-base/src/main/java/com/fr/design/dialog/UIDetailErrorLinkDialog.java

@ -5,6 +5,7 @@ import com.fine.theme.utils.FineUIScale;
import com.fine.theme.utils.FineUIStyle;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.base.GraphHelper;
import com.fr.design.border.FineBorderFactory;
import com.fr.design.dialog.link.MessageWithLink;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.icontainer.UIScrollPane;
@ -14,7 +15,6 @@ import com.fr.design.i18n.Toolkit;
import com.fr.design.layout.FRGUIPaneFactory;
import com.fr.design.utils.DesignUtils;
import com.fr.design.utils.gui.GUICoreUtils;
import com.fr.general.IOUtils;
import com.fr.stable.StringUtils;
import java.awt.BorderLayout;
import java.awt.Color;
@ -30,7 +30,6 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
@ -179,9 +178,11 @@ public class UIDetailErrorLinkDialog extends UIDialog {
public StackPane(String stack) {
setLayout(new BorderLayout());
UITextArea textArea = new UITextArea();
textArea.setBorder(null);
textArea.setEditable(false);
textArea.setText(stack);
UIScrollPane scrollPane = new UIScrollPane(textArea);
scrollPane.setBorder(FineBorderFactory.createWrappedRoundBorder());
add(scrollPane);
// 滚动条默认在顶部
SwingUtilities.invokeLater(new Runnable() {

44
designer-base/src/main/java/com/fr/design/file/TemplateTreePane.java

@ -37,11 +37,17 @@ import com.fr.workspace.base.UserInfo;
import com.fr.workspace.server.repository.vcs.VcsRepository;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import javax.swing.ToolTipManager;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import java.awt.*;
import java.awt.BorderLayout;
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
@ -53,8 +59,6 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Enumeration;
import java.util.Objects;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
@ -88,12 +92,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
ToolTipManager.sharedInstance().registerComponent(reportletsTree);
FileLockStateObservable.getInstance().addObserver(new Observer() {
@Override
public void update(Observable o, Object arg) {
TemplateTreePane.this.refresh();
}
});
FileLockStateObservable.getInstance().addObserver((o, arg) -> TemplateTreePane.this.refresh());
/*
* Tree.MouseAdapter
@ -102,6 +101,9 @@ public class TemplateTreePane extends JPanel implements FileOperations {
@Override
public void mousePressed(MouseEvent evt) {
if (isDirectorySelection()) {
return;
}
if (evt.getClickCount() == 2) {
DesignCacheManager.processByCacheTableData(() -> openFile());
}
@ -157,6 +159,16 @@ public class TemplateTreePane extends JPanel implements FileOperations {
});
}
/**
* 选中的是否目录
*
* @return 是否目录
*/
private boolean isDirectorySelection() {
FileNode fileNode = reportletsTree.getSelectedFileNode();
return fileNode != null && fileNode.isDirectory();
}
public TemplateFileTree getTemplateFileTree() {
return this.reportletsTree;
}
@ -256,7 +268,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
@Nullable
private JTemplate<?, ?> getOpenedTemplate(String path) {
private JTemplate<?, ?> getOpenedTemplate(String path) {
for (JTemplate<?, ?> template : HistoryTemplateListCache.getInstance().getHistoryList()) {
if (ComparatorUtils.equals(template.getEditingFILE().getPath(), path)) {
return template;
@ -380,7 +392,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
TreePath[] paths = reportletsTree.getSelectionPaths();
if (paths == null) {
reportletsTree.refresh();
} else {
} else {
for (TreePath path : Objects.requireNonNull(reportletsTree.getSelectionPaths())) {
reportletsTree.refreshParent(path);
}
@ -389,7 +401,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
private void deleteNodes(Collection<ExpandMutableTreeNode> nodes) {
new SwingWorker<Boolean,Void>(){
new SwingWorker<Boolean, Void>() {
@Override
protected Boolean doInBackground() throws Exception {
boolean success = true;
@ -415,6 +427,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
return success;
}
@Override
protected void done() {
try {
@ -518,6 +531,7 @@ public class TemplateTreePane extends JPanel implements FileOperations {
}
return false;
}
public void setToolbarStateChangeListener(FileToolbarStateChangeListener listener) {
this.toolBarStateChangeListener = listener;
}
@ -526,8 +540,8 @@ public class TemplateTreePane extends JPanel implements FileOperations {
/**
* 仅支持在拥有完整权限的文件夹下进行新建和重命名操作那么是可以看到改文件夹下所有文件的
*
* @param newName 原名
* @param suffix 后缀名
* @param newName 原名
* @param suffix 后缀名
* @param baseOnSelf 检验目录时是基于自身目录的子节点还是基于父目录的子节点进行校验
* @return 是否有重名的
*/

1
designer-base/src/main/java/com/fr/design/mainframe/EastRegionContainerPane.java

@ -1041,6 +1041,7 @@ public class EastRegionContainerPane extends UIEastResizableContainer {
button.setIcon(new LazyIcon(getBtnIconId(), ICON_WIDTH));
button.setDisabledIcon(new LazyIcon(btnIconName + ICON_SUFFIX_DISABLED, ICON_WIDTH));
} else {
iconSuffix = ICON_SUFFIX_NORMAL_DEPRECATED;
button.setIcon(IconUtils.readIcon(getBtnIconUrl()));
button.setDisabledIcon(IconUtils.readIcon(getIconBaseDir() + btnIconName + ICON_SUFFIX_DISABLED_DEPRECATED));
}

83
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkHelper.java

@ -0,0 +1,83 @@
package com.fr.design.remote.ui.debug;
import com.fr.stable.StringUtils;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* 帮助类
*
* @author vito
* @since 11.0
* Created on 2024/10/11
*/
public class RemoteDesignNetWorkHelper {
private static final int UNIT = 1000;
private static final int UNIT_BYTES = 1024;
private static final String SECOND = "s";
private static final int K = 1024;
private static final int MS = 1000;
static String dateFormat(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
return dateFormat.format(date);
}
static String simpleTime(long time) {
if (time < 0) {
return time + "";
} else if (time < MS) {
return time + " ms";
} else {
DecimalFormat df = new DecimalFormat("#.0");
return df.format((float) time / MS) + " s";
}
}
static String simpleSize(long bytes) {
if (bytes < 0) {
return bytes + "";
} else if (bytes < K) {
return bytes + " B";
} else {
DecimalFormat df = new DecimalFormat("#.00");
return df.format((float) bytes / K) + " K";
}
}
static long parseCostToMS(String timeStr) {
String[] split = timeStr.split(" ");
if (split.length > 1) {
double number = Double.parseDouble(split[0]);
String unit = split[1].toLowerCase();
if (StringUtils.equals(unit, SECOND)) {
return (long) (number * UNIT);
}
return (long) number;
}
return 0;
}
static long parseSizeToBytes(String sizeStr) {
String[] split = sizeStr.split(" ");
if (split.length > 1) {
double number = Double.parseDouble(split[0]);
String unit = split[1].toUpperCase();
switch (unit) {
case "K":
return (long) (number * UNIT_BYTES);
case "M":
return (long) (number * UNIT_BYTES * UNIT_BYTES);
case "G":
return (long) (number * UNIT_BYTES * UNIT_BYTES * UNIT_BYTES);
default:
return (long) number;
}
}
return 0;
}
}

76
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTablePane.java

@ -4,6 +4,7 @@ import com.fanruan.workplace.http.debug.RequestInfo;
import com.fine.theme.icon.LazyIcon;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.design.gui.ibutton.UIButton;
import com.fr.design.gui.ibutton.UIToggleButton;
import com.fr.event.Event;
import com.fr.event.EventDispatcher;
import com.fr.event.Listener;
@ -13,17 +14,19 @@ import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.JToolBar;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn;
import java.awt.BorderLayout;
import java.awt.Component;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;
import static com.fanruan.workplace.http.debug.RemoteDesignDebugEvent.REMOTE_HTTP_REQUEST;
import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.dateFormat;
import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.simpleSize;
import static com.fr.design.remote.ui.debug.RemoteDesignNetWorkHelper.simpleTime;
/**
* 远程设计网络调试面板
@ -33,25 +36,29 @@ import static com.fanruan.workplace.http.debug.RemoteDesignDebugEvent.REMOTE_HTT
* Created on 2024/9/24
*/
public class RemoteDesignNetWorkTablePane extends JPanel {
private static final int K = 1024;
private static final int TWO = 2;
private JTable uiTable;
private DefaultTableModel model;
private final AtomicLong count = new AtomicLong(0);
private boolean scrollRectToVisible = false;
private final Listener<RequestInfo> remoteDesignDebugListener = new Listener<RequestInfo>() {
@Override
public void on(Event event, RequestInfo requestInfo) {
model.addRow(new Object[]{
requestInfo.getStatus(),
dateFormat(requestInfo.getDate()),
requestInfo.getPath().substring(WorkContext.getCurrent().getPath().length() - 1),
requestInfo.getConsume() + "ms",
simpleSize(requestInfo.getRequestSize()),
simpleSize(requestInfo.getResponseSize()),
requestInfo.getSendBody(),
requestInfo.getReturnBody(),
SwingUtilities.invokeLater(() -> {
model.addRow(new Object[]{
count.incrementAndGet(),
dateFormat(requestInfo.getDate()),
requestInfo.getPath().substring(WorkContext.getCurrent().getPath().length() - 1),
requestInfo.getStatus(),
simpleTime(requestInfo.getConsume()),
simpleSize(requestInfo.getRequestSize()),
simpleSize(requestInfo.getResponseSize()),
requestInfo.getSendBody(),
requestInfo.getReturnBody(),
});
adjustColumnWidths(uiTable);
});
adjustColumnWidths(uiTable);
}
};
@ -69,15 +76,17 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
private void initTable() {
model = new DefaultTableModel();
model.addColumn("status");
model.addColumn("No.");
model.addColumn("time");
model.addColumn("path");
model.addColumn("status");
model.addColumn("cost");
model.addColumn("request size");
model.addColumn("response size");
model.addColumn("request");
model.addColumn("response");
uiTable = new JTable(model);
uiTable.setRowSorter(new RemoteDesignNetWorkTableRowSorter(model));
add(new JScrollPane(uiTable), BorderLayout.CENTER);
}
@ -86,7 +95,8 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
jToolBar.setBorder(new EmptyBorder(5, 0, 10, 0));
UIButton run = new UIButton(new LazyIcon("run"));
UIButton forbid = new UIButton(new LazyIcon("forbid"));
UIButton refresh = new UIButton(new LazyIcon("remove"));
UIButton remove = new UIButton(new LazyIcon("remove"));
UIToggleButton refresh = new UIToggleButton(new LazyIcon("refresh"));
run.setEnabled(false);
run.setToolTipText("Start Record");
run.addActionListener(e -> {
@ -100,10 +110,16 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
run.setEnabled(true);
forbid.setEnabled(false);
});
refresh.setToolTipText("Clear Records");
refresh.addActionListener(e -> model.setRowCount(0));
remove.setToolTipText("Clear Records");
remove.addActionListener(e -> {
model.setRowCount(0);
count.set(0);
});
refresh.setToolTipText("Always Scroll To Visible");
refresh.addChangeListener(e -> scrollRectToVisible = !scrollRectToVisible);
jToolBar.add(run);
jToolBar.add(forbid);
jToolBar.add(remove);
jToolBar.add(refresh);
add(jToolBar, BorderLayout.NORTH);
}
@ -120,36 +136,24 @@ public class RemoteDesignNetWorkTablePane extends JPanel {
EventDispatcher.listen(REMOTE_HTTP_REQUEST, remoteDesignDebugListener);
}
private static void adjustColumnWidths(JTable table) {
private void adjustColumnWidths(JTable table) {
int row = table.getRowCount() - 1;
// 从最后一行来调整大小
for (int column = 0; column < table.getColumnCount() - TWO; column++) {
TableColumn tableColumn = table.getColumnModel().getColumn(column);
int preferredWidth = 20;
int maxWidth = tableColumn.getMaxWidth();
tableColumn.setMinWidth(0);
// 从最后一行来调整大小
int row = table.getRowCount() - 1;
TableCellRenderer cellRenderer = table.getCellRenderer(row, column);
Component component = table.prepareRenderer(cellRenderer, row, column);
int width = component.getPreferredSize().width + table.getIntercellSpacing().width;
preferredWidth = Math.max(preferredWidth, Math.min(width, maxWidth));
tableColumn.setPreferredWidth(preferredWidth);
}
}
private static String dateFormat(Date date) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return dateFormat.format(date);
}
private static String simpleSize(long bytes) {
if (bytes < 0) {
return bytes + "";
} else if (bytes < K) {
return bytes + " B";
} else {
DecimalFormat df = new DecimalFormat("#.00");
return df.format((float) bytes / K) + " K";
if (scrollRectToVisible) {
table.scrollRectToVisible(table.getCellRect(row, 0, true));
}
}
}

32
designer-base/src/main/java/com/fr/design/remote/ui/debug/RemoteDesignNetWorkTableRowSorter.java

@ -0,0 +1,32 @@
package com.fr.design.remote.ui.debug;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableRowSorter;
import java.util.Comparator;
/**
* 行排序器
*
* @author vito
* @since 11.0
* Created on 2024/10/11
*/
public class RemoteDesignNetWorkTableRowSorter extends TableRowSorter<DefaultTableModel> {
public RemoteDesignNetWorkTableRowSorter(DefaultTableModel model) {
super(model);
setComparator(0, (Comparator<Long>) Long::compareTo);
setComparator(4, Comparator.comparingLong(RemoteDesignNetWorkHelper::parseCostToMS));
setComparator(5, Comparator.comparingLong(RemoteDesignNetWorkHelper::parseSizeToBytes));
setComparator(6, Comparator.comparingLong(RemoteDesignNetWorkHelper::parseSizeToBytes));
}
@Override
public boolean isSortable(int column) {
return column == 0
|| column == 4
|| column == 5
|| column == 6;
}
}

2
designer-base/src/main/java/com/fr/design/style/color/NewColorSelectPane.java

@ -462,7 +462,7 @@ public class NewColorSelectPane extends BasicPane implements ColorSelectable {
int size = colors.length;
for (int i = 1; i <= total; i++) {
ColorCell cell = (ColorCell) this.pane.getComponent(i);
Color color = i < size ? colors[size - i - 1] : UsedColorPane.DEFAULT_COLOR;
Color color = i <= size ? colors[size - i] : UsedColorPane.DEFAULT_COLOR;
cell.setColor(color == null ? UsedColorPane.DEFAULT_COLOR : color);
}
}

98
designer-base/src/main/resources/com/fr/design/data/tabledata/datacenter/web/data-choose.main.js

File diff suppressed because one or more lines are too long

4
designer-realize/src/main/java/com/fanruan/boot/env/DesignEnvComponent.java vendored

@ -12,6 +12,7 @@ import com.fanruan.carina.annotions.Stop;
import com.fanruan.carina.annotions.Supplemental;
import com.fanruan.config.ConfigProviderFactory;
import com.fanruan.config.LocalConfigSource;
import com.fanruan.config.SetupDataDesignerRemoteOperator;
import com.fanruan.config.realm.ConfigRealm;
import com.fanruan.dao.context.DBContextProvider;
import com.fanruan.dao.context.DBContextStarter;
@ -51,6 +52,7 @@ import com.fr.config.holder.ConfigChangeListener;
import com.fr.config.holder.ValidateConfigManger;
import com.fr.config.impl.ConfConfigProviderImpl;
import com.fr.config.impl.ConfigInsecurityElementProviderImpl;
import com.fr.config.utils.SetupDataHelper;
import com.fr.decision.service.context.ServiceContext;
import com.fr.design.backup.EnvBackupHelper;
import com.fr.env.detect.EnvDetectorCenter;
@ -351,6 +353,7 @@ public class DesignEnvComponent {
DaoContext.setXmlEntityDao(new RemoteXmlEntityDao());
DaoContext.setClassHelperDao(new RemoteClassHelperDao());
DaoContext.setEntityDao(new RemoteEntityDao());
SetupDataHelper.getInstance().registerOperator(SetupDataDesignerRemoteOperator.getInstance());
} else {
//本地
TransactorFactory.setTransactor(new HibernateTransactor());
@ -369,6 +372,7 @@ public class DesignEnvComponent {
private void stopConfConfig() {
SetupDataHelper.getInstance().resetOperator();
DaoContext.setClassHelperDao(null);
DaoContext.setEntityDao(null);
DaoContext.setXmlEntityDao(null);

51
designer-realize/src/main/java/com/fanruan/config/SetupDataDesignerRemoteOperator.java

@ -0,0 +1,51 @@
package com.fanruan.config;
import com.fanruan.repository.ConfigRepository;
import com.fr.config.utils.ConfData;
import com.fr.config.utils.ConfigReadUtils;
import com.fr.config.utils.PrefixHandler;
import com.fr.config.utils.SetupDataOperator;
import com.fr.stable.StringUtils;
/**
* 设计器远程下获取Updata的操作类
*
* @author Destiny.Lin
* @since 11.0
* Created on 2024/10/14
*/
public class SetupDataDesignerRemoteOperator implements SetupDataOperator {
private static final SetupDataDesignerRemoteOperator INSTANCE = new SetupDataDesignerRemoteOperator();
/**
* 单例
*/
public static SetupDataDesignerRemoteOperator getInstance() {
return INSTANCE;
}
@Override
public ConfData getData(String prefix, String tenantId) {
return ConfigRepository.getInstance().getConfigByConfigsCache(getConfigNameSpace(prefix), () -> {
ConfData data = new ConfData();
data.setDataMap(ConfigReadUtils.getData(prefix, tenantId));
data.setMap(ConfigReadUtils.getClassInfo(prefix, tenantId));
return data;
});
}
private String getConfigNameSpace(String id) {
if (StringUtils.isEmpty(id)) {
throw new IllegalArgumentException("id cannot be null");
}
int length = id.length();
for (int i = 0; i < length; i++) {
if (PrefixHandler.SEPERATOR == id.charAt(i)) {
return id.substring(0, i);
}
}
throw new IllegalArgumentException("cannot resolve namespace of " + id);
}
}

58
designer-realize/src/main/java/com/fr/design/widget/ui/ButtonGroupDictPane.java

@ -1,8 +1,9 @@
package com.fr.design.widget.ui;
import com.fine.swing.ui.layout.Row;
import com.formdev.flatlaf.util.ScaledEmptyBorder;
import com.fr.data.Dictionary;
import com.fr.design.gui.core.ReactiveCardPane;
import com.fr.design.gui.icheckbox.UICheckBox;
import com.fr.design.gui.ilable.UILabel;
import com.fr.design.gui.ispinner.UIBasicSpinner;
@ -11,11 +12,8 @@ import com.fr.design.mainframe.widget.accessibles.AccessibleDictionaryEditor;
import com.fr.design.widget.FRWidgetFactory;
import com.fr.form.ui.ButtonGroup;
import javax.swing.BorderFactory;
import javax.swing.JPanel;
import javax.swing.SpinnerNumberModel;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static com.fine.swing.ui.layout.Layouts.cell;
import static com.fine.swing.ui.layout.Layouts.column;
@ -29,7 +27,7 @@ public class ButtonGroupDictPane extends JPanel {
private UICheckBox adaptiveCheckbox;
private UILabel columnLabel;
private AccessibleDictionaryEditor dictPane;
private ReactiveCardPane reactiveCardPane;
private Row showColumn;
public ButtonGroupDictPane() {
@ -41,51 +39,29 @@ public class ButtonGroupDictPane extends JPanel {
*/
public void initComponents() {
dictPane = new AccessibleDictionaryEditor();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true);
adaptiveCheckbox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
adaptiveCheckbox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
boolean selected = adaptiveCheckbox.isSelected();
if (selected) {
reactiveCardPane.select("adaptive").populate();
} else {
reactiveCardPane.select("inadaptive").populate();
}
}
});
UILabel dictLabel = new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_DS_Dictionary"));
this.columnLabel = FRWidgetFactory.createLineWrapLabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Button_Group_Display_Columns") + ":", dictLabel.getPreferredSize().width);
columnSpinner = new UIBasicSpinner(new SpinnerNumberModel(0, 0, Integer.MAX_VALUE, 1));
reactiveCardPane = ReactiveCardPane.create()
.addSupplier("adaptive", () -> column(
10,
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(adaptiveCheckbox)),
row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT))
).getComponent()
).addSupplier("inadaptive", () -> column(
10,
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(adaptiveCheckbox))
).getComponent());
reactiveCardPane.select("inadaptive").populate();
this.add(reactiveCardPane);
showColumn = row(cell(columnLabel).weight(LEFT_WEIGHT), cell(columnSpinner).weight(RIGHT_WEIGHT)).getComponent();
this.setLayout(FRGUIPaneFactory.createBorderLayout());
adaptiveCheckbox = new UICheckBox(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Adaptive"), true);
adaptiveCheckbox.setBorder(new ScaledEmptyBorder(0, 0, 0, 0));
adaptiveCheckbox.addActionListener(e -> {
boolean selected = adaptiveCheckbox.isSelected();
showColumn.setVisible(!selected);
});
this.add(column(10,
row(cell(dictLabel).weight(LEFT_WEIGHT), cell(dictPane).weight(RIGHT_WEIGHT)),
row(cell(adaptiveCheckbox)),
cell(showColumn)
).getComponent());
}
public void populate(ButtonGroup buttonGroup) {
dictPane.setValue(buttonGroup.getDictionary());
adaptiveCheckbox.setSelected(buttonGroup.isAdaptive());
boolean selected = adaptiveCheckbox.isSelected();
if (selected) {
reactiveCardPane.select("adaptive").populate();
} else {
reactiveCardPane.select("inadaptive").populate();
}
showColumn.setVisible(!selected);
columnSpinner.setValue(buttonGroup.getColumnsInRow());
}

7
designer-realize/src/main/java/com/fr/start/DesignLauncher.java

@ -34,6 +34,11 @@ public class DesignLauncher extends XmlCarinaLauncher {
return context;
}
@Override
protected void initEncryption() throws CarinaException {
}
@Override
protected void initTenant() throws CarinaException {
}
@ -41,7 +46,7 @@ public class DesignLauncher extends XmlCarinaLauncher {
@Override
protected void initServiceDiscovery() throws CarinaException {
try {
Carina.properties(DiscoveryProperties.class).setServer("local");
Carina.properties(DiscoveryProperties.class).setType("local");
// 服务发现初始化
DiscoveryFactory.initialize();
} catch (Exception e) {

Loading…
Cancel
Save