93 changed files with 2559 additions and 535 deletions
@ -0,0 +1,349 @@ |
|||||||
|
package com.fr.design.file; |
||||||
|
|
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
|
import com.fr.design.gui.ibutton.UIButton; |
||||||
|
import com.fr.design.gui.imenu.UIMenuItem; |
||||||
|
import com.fr.design.gui.imenu.UIScrollPopUpMenu; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.mainframe.JTemplate; |
||||||
|
import com.fr.design.utils.TemplateUtils; |
||||||
|
import com.fr.general.IOUtils; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.stable.collections.CollectionUtils; |
||||||
|
|
||||||
|
import javax.swing.BorderFactory; |
||||||
|
import javax.swing.Icon; |
||||||
|
import javax.swing.JPanel; |
||||||
|
import javax.swing.SwingConstants; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.Component; |
||||||
|
import java.awt.Dimension; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.awt.event.MouseAdapter; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 右侧下拉菜单的工厂类 |
||||||
|
* @author Carlson |
||||||
|
* @since 11.0 |
||||||
|
* created on 2023-04-14 |
||||||
|
**/ |
||||||
|
public class MultiTemplateTabMenuFactory { |
||||||
|
|
||||||
|
private static final Icon CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/close_icon.png"); |
||||||
|
private static final Icon MOUSE_OVER_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/mouseoverclose icon.png"); |
||||||
|
private static final Icon MOUSE_PRESS_CLOSE = IOUtils.readIcon("/com/fr/design/images/buttonicon/pressclose icon.png"); |
||||||
|
|
||||||
|
private static final int ITEM_SIZE = 25; |
||||||
|
|
||||||
|
private UIScrollPopUpMenu menu = null; |
||||||
|
|
||||||
|
private static MultiTemplateTabMenuFactory INSTANCE = new MultiTemplateTabMenuFactory(); |
||||||
|
|
||||||
|
private MultiTemplateTabMenuFactory() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回右侧下拉菜单的工厂类 |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static MultiTemplateTabMenuFactory getInstance() { |
||||||
|
return INSTANCE; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* tab上的下拉菜单 |
||||||
|
*/ |
||||||
|
public UIScrollPopUpMenu createMenu() { |
||||||
|
menu = new UIScrollPopUpMenu(); |
||||||
|
menu.setBorder(BorderFactory.createEmptyBorder(-3, 3, 3, 0)); |
||||||
|
|
||||||
|
menu.add(initCloseOther()); |
||||||
|
menu.add(createEmptyRow()); |
||||||
|
menu.addSeparator(); |
||||||
|
menu.add(createEmptyRow()); |
||||||
|
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Current_Category_Templates"))); |
||||||
|
Component[] items = createCurrentCategory(); |
||||||
|
for (Component item : items) { |
||||||
|
menu.add(item); |
||||||
|
} |
||||||
|
items = createOtherCategory(); |
||||||
|
if (items.length > 0) { |
||||||
|
menu.addSeparator(); |
||||||
|
menu.add(createEmptyRow()); |
||||||
|
menu.add(createCategory(Toolkit.i18nText("Fine-Design_Basic_Tab_Other_Category_Templates"))); |
||||||
|
for (Component item : items) { |
||||||
|
menu.add(item); |
||||||
|
} |
||||||
|
} |
||||||
|
Dimension dimension = menu.getPreferredSize(); |
||||||
|
dimension.width += ITEM_SIZE; |
||||||
|
menu.setPreferredSize(dimension); |
||||||
|
return menu; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 关闭其它按钮 |
||||||
|
*/ |
||||||
|
private UIMenuItem initCloseOther() { |
||||||
|
UIMenuItem closeOther = new UIMenuItem(Toolkit.i18nText("Fine-Design_Basic_Tab_Close_Other_Templates_Of_Current_Category")); |
||||||
|
closeOther.setHorizontalAlignment(SwingConstants.CENTER); |
||||||
|
Dimension dimension = closeOther.getPreferredSize(); |
||||||
|
dimension.height = ITEM_SIZE; |
||||||
|
closeOther.setPreferredSize(dimension); |
||||||
|
String currentOperator = getCurrentTabOperatorType(); |
||||||
|
closeOther.addActionListener(new ActionListener() { |
||||||
|
@Override |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
MultiTemplateTabPane.getInstance().closeOtherByOperatorType(currentOperator); |
||||||
|
} |
||||||
|
}); |
||||||
|
if (MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(currentOperator).size() <= 1) { |
||||||
|
closeOther.setEnabled(false); |
||||||
|
} |
||||||
|
return closeOther; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 美观用 |
||||||
|
*/ |
||||||
|
private JPanel createEmptyRow() { |
||||||
|
return new JPanel() { |
||||||
|
@Override |
||||||
|
public Dimension getPreferredSize() { |
||||||
|
Dimension d = super.getPreferredSize(); |
||||||
|
d.height = 1; |
||||||
|
return d; |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 模板分类item |
||||||
|
*/ |
||||||
|
private UIButton createCategory(String categoryName) { |
||||||
|
UIButton button = new UIButton(categoryName); |
||||||
|
button.setBorderPainted(false); |
||||||
|
button.setExtraPainted(false); |
||||||
|
button.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE)); |
||||||
|
button.setOpaque(true); |
||||||
|
button.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
button.setHorizontalAlignment(SwingConstants.LEFT); |
||||||
|
button.setForeground(UIConstants.FLESH_BLUE); |
||||||
|
return button; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建 当前分类模板 item数组 |
||||||
|
*/ |
||||||
|
private Component[] createCurrentCategory() { |
||||||
|
return createListDownItem(MultiTemplateTabPane.getInstance().getOpenedJTemplatesByOperator(getCurrentTabOperatorType())); |
||||||
|
} |
||||||
|
|
||||||
|
private String getCurrentTabOperatorType(){ |
||||||
|
JTemplate jTemplate= HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||||
|
return jTemplate.getTemplateTabOperatorType(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建 其它分类模板 item数组 |
||||||
|
*/ |
||||||
|
private Component[] createOtherCategory() { |
||||||
|
String currentOperator = getCurrentTabOperatorType(); |
||||||
|
List<JTemplate<?, ?>> openedTemplates = new ArrayList<>(); |
||||||
|
Map<String, List<JTemplate<?, ?>>> map = MultiTemplateTabPane.getInstance().getOpenedJTemplatesByCategory(); |
||||||
|
for (Map.Entry<String, List<JTemplate<?, ?>>> entry : map.entrySet()) { |
||||||
|
if (!StringUtils.equals(currentOperator, entry.getKey())) { |
||||||
|
openedTemplates.addAll(entry.getValue()); |
||||||
|
} |
||||||
|
} |
||||||
|
return createListDownItem(openedTemplates); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据template列表创建多个item |
||||||
|
*/ |
||||||
|
private Component[] createListDownItem(List<JTemplate<?, ?>> openedTemplates) { |
||||||
|
if (!CollectionUtils.isEmpty(openedTemplates)) { |
||||||
|
Component[] templates = new Component[openedTemplates.size()]; |
||||||
|
for (int i = 0; i < openedTemplates.size(); i++) { |
||||||
|
templates[i] = createListDownMenuItem(openedTemplates.get(i)); |
||||||
|
} |
||||||
|
return templates; |
||||||
|
} |
||||||
|
return new Component[0]; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据template对象创建item |
||||||
|
*/ |
||||||
|
private Component createListDownMenuItem(JTemplate<?, ?> template) { |
||||||
|
JPanel jPanel = new JPanel(); |
||||||
|
jPanel.setPreferredSize(new Dimension(menu.getWidth(), ITEM_SIZE)); |
||||||
|
jPanel.setLayout(new BorderLayout()); |
||||||
|
|
||||||
|
MenuItemButtonGroup menuItemButtonGroup = new MenuItemButtonGroup(template); |
||||||
|
if (template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()) { |
||||||
|
menuItemButtonGroup.templateButton.setForeground(UIConstants.FLESH_BLUE); |
||||||
|
} |
||||||
|
|
||||||
|
jPanel.add(menuItemButtonGroup.iconButton, BorderLayout.WEST); |
||||||
|
jPanel.add(menuItemButtonGroup.templateButton, BorderLayout.CENTER); |
||||||
|
jPanel.add(menuItemButtonGroup.closeButton, BorderLayout.EAST); |
||||||
|
|
||||||
|
return jPanel; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* menu的item由模板图标、模板名、模板关闭按钮组成 |
||||||
|
*/ |
||||||
|
private class MenuItemButtonGroup { |
||||||
|
|
||||||
|
private final UIButton iconButton; |
||||||
|
private final UIButton templateButton; |
||||||
|
private final UIButton closeButton; |
||||||
|
|
||||||
|
public MenuItemButtonGroup(JTemplate<?, ?> template) { |
||||||
|
iconButton = createIconButton(template); |
||||||
|
templateButton = createTemplateButton(template); |
||||||
|
closeButton = createCloseButton(); |
||||||
|
initListener(template); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* item[0] 模板图标按钮初始化 |
||||||
|
*/ |
||||||
|
private UIButton createIconButton(JTemplate<?, ?> template) { |
||||||
|
UIButton button = new UIButton(template.getIcon(), template.getIcon(), template.getIcon()); |
||||||
|
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE)); |
||||||
|
button.setOpaque(true); |
||||||
|
button.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
return button; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* item[1] 切换模板按钮初始化 |
||||||
|
*/ |
||||||
|
private UIButton createTemplateButton(JTemplate<?, ?> template) { |
||||||
|
UIButton button = new UIButton(TemplateUtils.createLockeTemplatedName(template, template.getTemplateName())); |
||||||
|
button.setBorderPainted(false); |
||||||
|
button.setExtraPainted(false); |
||||||
|
button.setPreferredSize(new Dimension(menu.getWidth() - ITEM_SIZE * 2, ITEM_SIZE)); |
||||||
|
button.setOpaque(true); |
||||||
|
button.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
button.setHorizontalAlignment(SwingConstants.LEFT); |
||||||
|
return button; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* item[2] 关闭模板图标按钮初始化 |
||||||
|
*/ |
||||||
|
private UIButton createCloseButton() { |
||||||
|
UIButton button = new UIButton(CLOSE, MOUSE_OVER_CLOSE, MOUSE_PRESS_CLOSE); |
||||||
|
button.setPreferredSize(new Dimension(ITEM_SIZE, ITEM_SIZE)); |
||||||
|
button.setOpaque(true); |
||||||
|
button.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
button.setVisible(false); |
||||||
|
return button; |
||||||
|
} |
||||||
|
|
||||||
|
private void initListener(JTemplate<?, ?> template) { |
||||||
|
initIconButtonListener(); |
||||||
|
initTemplateButtonListener(template); |
||||||
|
initCloseButtonListener(template); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* item[0] 模板图标按钮鼠标事件 |
||||||
|
*/ |
||||||
|
private void initIconButtonListener() { |
||||||
|
iconButton.addMouseListener(new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mouseEntered(MouseEvent e) { |
||||||
|
fireMouseEnteredEvent(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void mouseExited(MouseEvent e) { |
||||||
|
fireMouseExitedEvent(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* item[1] 切换模板按钮鼠标事件 |
||||||
|
*/ |
||||||
|
private void initTemplateButtonListener(JTemplate<?, ?> template) { |
||||||
|
templateButton.addMouseListener(new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mouseClicked(MouseEvent e) { |
||||||
|
menu.setVisible(false); |
||||||
|
MultiTemplateTabPane.getInstance().switchJTemplate(template); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void mouseEntered(MouseEvent e) { |
||||||
|
fireMouseEnteredEvent(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void mouseExited(MouseEvent e) { |
||||||
|
fireMouseExitedEvent(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* item[2] 关闭模板按钮鼠标事件 |
||||||
|
*/ |
||||||
|
private void initCloseButtonListener(JTemplate<?, ?> template) { |
||||||
|
closeButton.addMouseListener(new MouseAdapter() { |
||||||
|
@Override |
||||||
|
public void mouseClicked(MouseEvent e) { |
||||||
|
menu.setVisible(false); |
||||||
|
MultiTemplateTabPane.getInstance().setIsCloseCurrent(template == HistoryTemplateListCache.getInstance().getCurrentEditingTemplate()); |
||||||
|
MultiTemplateTabPane.getInstance().closeFormat(template); |
||||||
|
MultiTemplateTabPane.getInstance().closeSpecifiedTemplate(template); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void mouseEntered(MouseEvent e) { |
||||||
|
fireMouseEnteredEvent(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void mouseExited(MouseEvent e) { |
||||||
|
fireMouseExitedEvent(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* mouse移入item范围 |
||||||
|
*/ |
||||||
|
private void fireMouseEnteredEvent() { |
||||||
|
iconButton.setBackground(UIConstants.HOVER_BLUE); |
||||||
|
templateButton.setBackground(UIConstants.HOVER_BLUE); |
||||||
|
closeButton.setBackground(UIConstants.HOVER_BLUE); |
||||||
|
closeButton.setVisible(true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* mouse移出item范围 |
||||||
|
*/ |
||||||
|
private void fireMouseExitedEvent() { |
||||||
|
iconButton.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
templateButton.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
closeButton.setBackground(UIConstants.NORMAL_BACKGROUND); |
||||||
|
closeButton.setVisible(false); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,47 @@ |
|||||||
|
package com.fr.design.i18n; |
||||||
|
|
||||||
|
import com.fr.general.CloudCenter; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
/** |
||||||
|
* 国际化链接获取工具 |
||||||
|
* 根据配置文件key获取云中心key对应的链接或者默认链接 |
||||||
|
* |
||||||
|
* @author obo |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/7 |
||||||
|
*/ |
||||||
|
public final class LocaleLinkProvider { |
||||||
|
|
||||||
|
private LocaleLinkProvider(){}; |
||||||
|
|
||||||
|
/** |
||||||
|
* 单一实例 |
||||||
|
*/ |
||||||
|
private static final LocaleLinkProvider INSTANCE = new LocaleLinkProvider(); |
||||||
|
|
||||||
|
/** |
||||||
|
* 返回LocaleLinkProvider的单一实例 |
||||||
|
* |
||||||
|
* @return LocaleLinkProvider单一实例 |
||||||
|
*/ |
||||||
|
public static LocaleLinkProvider getInstance(){ |
||||||
|
return INSTANCE; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据配置文件项中的key获取链接 |
||||||
|
* |
||||||
|
* @param propsKey 配置项key |
||||||
|
* @param defaultKey 默认链接项key |
||||||
|
* @return 对应的生成器 |
||||||
|
*/ |
||||||
|
public String getLink(String propsKey, String defaultKey) { |
||||||
|
String cloudKey = DesignI18nImpl.getInstance().i18nText(propsKey); |
||||||
|
String url = CloudCenter.getInstance().acquireUrlByKind(cloudKey); |
||||||
|
if(StringUtils.isEmpty(url)) { |
||||||
|
return DesignI18nImpl.getInstance().i18nText(defaultKey); |
||||||
|
} |
||||||
|
return url; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.design.i18n.LocaleLinkProvider; |
||||||
|
import com.fr.general.locale.LocaleMark; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 根据图片信息生成获取国际化服务器图标工具 |
||||||
|
* |
||||||
|
* @author obo |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/19 |
||||||
|
*/ |
||||||
|
public class DataMaskMark implements LocaleMark<String> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 云中心数据脱敏帮助链接链接在配置文件中对应的配置文件key |
||||||
|
*/ |
||||||
|
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Data_Mask"; |
||||||
|
|
||||||
|
/** |
||||||
|
* 云中心数据脱敏默认帮助链接在配置文件中对应的配置文件key |
||||||
|
*/ |
||||||
|
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design_Report_Desensitization_Help_Document_Url"; |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getValue() { |
||||||
|
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,28 @@ |
|||||||
|
package com.fr.design.locale.impl; |
||||||
|
|
||||||
|
import com.fr.design.i18n.LocaleLinkProvider; |
||||||
|
import com.fr.general.locale.LocaleMark; |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据国际化获取启用行式引擎执行层式报表帮助文档链接 |
||||||
|
* |
||||||
|
* @author obo |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/19 |
||||||
|
*/ |
||||||
|
public class LineEngineMark implements LocaleMark<String> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 云中心启用行式引擎执行层式报表帮助链接链接在配置文件中对应的配置文件key |
||||||
|
*/ |
||||||
|
private static final String PROPS_LINK_KEY = "Fine-Design-CloudCenter_Line_Engine"; |
||||||
|
|
||||||
|
/** |
||||||
|
* 云中心启用行式引擎执行层式报表默认帮助链接在配置文件中对应的配置文件key |
||||||
|
*/ |
||||||
|
private static final String PROPS_LINK_KEY_DEFAULT = "Fine-Design-CloudCenter_Line_Engine_Default"; |
||||||
|
@Override |
||||||
|
public String getValue() { |
||||||
|
return LocaleLinkProvider.getInstance().getLink(PROPS_LINK_KEY, PROPS_LINK_KEY_DEFAULT); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
package com.fr.design.worker.save.type; |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存的类别 |
||||||
|
* |
||||||
|
* @author John.Ying |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/14 |
||||||
|
*/ |
||||||
|
public class SaveType { |
||||||
|
|
||||||
|
private TypeEnum type; |
||||||
|
//保存时间是否慢(是否展示了保存中的UI界面)
|
||||||
|
private boolean slowly; |
||||||
|
|
||||||
|
public TypeEnum getType() { |
||||||
|
return type; |
||||||
|
} |
||||||
|
|
||||||
|
public void setType(TypeEnum saveType) { |
||||||
|
this.type = saveType; |
||||||
|
} |
||||||
|
|
||||||
|
public boolean isSlowly() { |
||||||
|
return slowly; |
||||||
|
} |
||||||
|
|
||||||
|
public void setSlowly(boolean slowly) { |
||||||
|
this.slowly = slowly; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存类型:save or saveAs or empty |
||||||
|
*/ |
||||||
|
public enum TypeEnum { |
||||||
|
/** |
||||||
|
* 保存 |
||||||
|
*/ |
||||||
|
SAVE, |
||||||
|
/** |
||||||
|
* 另存 |
||||||
|
*/ |
||||||
|
SAVE_AS, |
||||||
|
/** |
||||||
|
* 空保存 |
||||||
|
*/ |
||||||
|
EMPTY; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
package com.fr.design.worker.save.type; |
||||||
|
|
||||||
|
|
||||||
|
import com.fr.concurrent.FineExecutors; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.design.mainframe.DesignerFrameFileDealerPane; |
||||||
|
import com.fr.design.mainframe.EastRegionContainerPane; |
||||||
|
import com.fr.design.mainframe.JTemplate; |
||||||
|
import com.fr.design.ui.util.UIUtil; |
||||||
|
import com.fr.third.org.apache.commons.lang3.time.StopWatch; |
||||||
|
|
||||||
|
import javax.swing.SwingWorker; |
||||||
|
import java.util.concurrent.Callable; |
||||||
|
import java.util.concurrent.ExecutorService; |
||||||
|
|
||||||
|
/** |
||||||
|
* 判断保存类别时执行的worker |
||||||
|
* |
||||||
|
* @author John.Ying |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/14 |
||||||
|
*/ |
||||||
|
public class SaveTypeWorker extends SwingWorker<SaveType, Void> { |
||||||
|
|
||||||
|
public static final ExecutorService SAVE_TYPE_POOL = FineExecutors.newSingleThreadExecutor(); |
||||||
|
|
||||||
|
private final Callable<SaveType.TypeEnum> callable; |
||||||
|
|
||||||
|
private static final int TIME_OUT = 400; |
||||||
|
|
||||||
|
private final JTemplate<?, ?> template; |
||||||
|
|
||||||
|
private final SaveType saveType; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public SaveTypeWorker(Callable<SaveType.TypeEnum> callable, JTemplate<?, ?> template) { |
||||||
|
this.callable = callable; |
||||||
|
this.template = template; |
||||||
|
this.saveType = new SaveType(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected SaveType doInBackground() throws Exception { |
||||||
|
this.saveType.setType(callable.call()); |
||||||
|
return this.saveType; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void done() { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 启动saveTypeWorker |
||||||
|
*/ |
||||||
|
public void start() { |
||||||
|
StopWatch stopWatch = StopWatch.createStarted(); |
||||||
|
this.template.setSaving(true); |
||||||
|
this.execute(); |
||||||
|
SAVE_TYPE_POOL.execute(() -> { |
||||||
|
while (true) { |
||||||
|
//大于最大等待时间或者worker已经完成该线程都要结束循环
|
||||||
|
if (stopWatch.getTime() > TIME_OUT || isDone()) { |
||||||
|
//如果是大于最大等待时间结束的,就需要进行等待中界面的覆盖
|
||||||
|
if (!isDone()) { |
||||||
|
saveType.setSlowly(true); |
||||||
|
UIUtil.invokeLaterIfNeeded(() -> { |
||||||
|
// 开始禁用
|
||||||
|
EastRegionContainerPane.getInstance().updateAllPropertyPane(); |
||||||
|
DesignerContext.getDesignerFrame().getCenterTemplateCardPane().showCover(); |
||||||
|
DesignerFrameFileDealerPane.getInstance().stateChange(); |
||||||
|
}); |
||||||
|
} |
||||||
|
stopWatch.stop(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.fr.design.designer.properties.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||||
|
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.NumberEditorMobileDefinePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数字控件属性面板注册 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/30 |
||||||
|
*/ |
||||||
|
public class NumberEditorMobilePropertyUI extends AbstractWidgetPropertyUIProvider { |
||||||
|
private XCreator xCreator; |
||||||
|
|
||||||
|
public NumberEditorMobilePropertyUI(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractPropertyTable createWidgetAttrTable() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BasicPane createWidgetAttrPane() { |
||||||
|
return new NumberEditorMobileDefinePane(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String tableTitle() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.fr.design.designer.properties.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||||
|
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.PasswordMobileDefinePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* 密码控件移动端属性注册 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/30 |
||||||
|
*/ |
||||||
|
public class PasswordMobilePropertyUI extends AbstractWidgetPropertyUIProvider { |
||||||
|
private XCreator xCreator; |
||||||
|
|
||||||
|
public PasswordMobilePropertyUI(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractPropertyTable createWidgetAttrTable() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BasicPane createWidgetAttrPane() { |
||||||
|
return new PasswordMobileDefinePane(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String tableTitle() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.fr.design.designer.properties.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.fun.impl.AbstractWidgetPropertyUIProvider; |
||||||
|
import com.fr.design.gui.itable.AbstractPropertyTable; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.TextAreaAdvancedDefinePane; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本域控件移动端属性 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/29 |
||||||
|
*/ |
||||||
|
public class TextAreaMobilePropertyUI extends AbstractWidgetPropertyUIProvider { |
||||||
|
private XCreator xCreator; |
||||||
|
|
||||||
|
public TextAreaMobilePropertyUI(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public AbstractPropertyTable createWidgetAttrTable() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public BasicPane createWidgetAttrPane() { |
||||||
|
return new TextAreaAdvancedDefinePane(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String tableTitle() { |
||||||
|
return com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Mobile_Attr"); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,126 @@ |
|||||||
|
package com.fr.design.widget.ui.btn; |
||||||
|
|
||||||
|
import com.fr.design.ExtraDesignClassManager; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.dialog.BasicPane; |
||||||
|
import com.fr.design.fun.WidgetAdvancedPaneProvider; |
||||||
|
import com.fr.design.gui.icombobox.DictionaryComboBox; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.layout.TableLayout; |
||||||
|
import com.fr.design.layout.TableLayoutHelper; |
||||||
|
import com.fr.design.widget.btn.ButtonWithHotkeysDetailPane; |
||||||
|
import com.fr.form.ui.Button; |
||||||
|
import com.fr.general.GeneralContext; |
||||||
|
import com.fr.plugin.observer.PluginEvent; |
||||||
|
import com.fr.plugin.observer.PluginEventListener; |
||||||
|
import org.jetbrains.annotations.Nullable; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.Component; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 用来处理额外的按钮属性 |
||||||
|
* |
||||||
|
* @author John.Ying |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/19 |
||||||
|
*/ |
||||||
|
public abstract class AbstractExtraButtonPane<T extends Button> extends ButtonWithHotkeysDetailPane<T> { |
||||||
|
protected JPanel extraPane; |
||||||
|
protected boolean containsExtraPane; |
||||||
|
protected static double F = TableLayout.FILL; |
||||||
|
protected static double P = TableLayout.PREFERRED; |
||||||
|
|
||||||
|
protected void initExtraPane() { |
||||||
|
initPluginListener(); |
||||||
|
refreshExtraAdvancedPane(classType()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 根据按钮类别判断需要返回什么类型的属性界面 |
||||||
|
*/ |
||||||
|
protected void refreshExtraAdvancedPane(Class cls) { |
||||||
|
extraPaneList.clear(); |
||||||
|
boolean containsExtraPane = false; |
||||||
|
Set<WidgetAdvancedPaneProvider<T>> providers = ExtraDesignClassManager.getInstance().getArray(WidgetAdvancedPaneProvider.XML_TAG); |
||||||
|
for (WidgetAdvancedPaneProvider<T> provider : providers) { |
||||||
|
if (!provider.accept(cls)) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
insertShortCut(provider.getInsertPosition(extraPaneList.size()), provider.createExtraAdvancedPane()); |
||||||
|
containsExtraPane = true; |
||||||
|
} |
||||||
|
if (containsExtraPane) { |
||||||
|
extraPane = FRGUIPaneFactory.createYBoxEmptyBorderPane(); |
||||||
|
for (BasicBeanPane<T> pane : extraPaneList) { |
||||||
|
extraPane.add(pane); |
||||||
|
} |
||||||
|
} |
||||||
|
this.containsExtraPane = containsExtraPane; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected void initPluginListener() { |
||||||
|
GeneralContext.listenPluginRunningChanged(new PluginEventListener() { |
||||||
|
@Override |
||||||
|
public void on(PluginEvent event) { |
||||||
|
refreshExtraAdvancedPane(classType()); |
||||||
|
} |
||||||
|
}, pluginContext -> pluginContext.getRuntime().contain(WidgetAdvancedPaneProvider.XML_TAG)); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 插入配置项面板 |
||||||
|
* |
||||||
|
* @param index 插入的位置 |
||||||
|
* @param pane 配置项面板 |
||||||
|
*/ |
||||||
|
protected void insertShortCut(int index, BasicBeanPane<T> pane) { |
||||||
|
int size = extraPaneList.size(); |
||||||
|
index = Math.min(index, size); |
||||||
|
extraPaneList.add(index, pane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(T button) { |
||||||
|
super.populate(button); |
||||||
|
for (BasicBeanPane<T> pane : extraPaneList) { |
||||||
|
pane.populateBean(button); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public T update() { |
||||||
|
T button = super.update(); |
||||||
|
for (BasicBeanPane<T> pane : extraPaneList) { |
||||||
|
pane.updateBean(button); |
||||||
|
} |
||||||
|
return button; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected DictionaryComboBox createCustomButtonTypeComboBox() { |
||||||
|
return createButtonTypeComboBox(containsExtraPane); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 生成额外的属性界面 |
||||||
|
*/ |
||||||
|
protected Component createExtraPane(@Nullable BasicPane pane) { |
||||||
|
initExtraPane(); |
||||||
|
Component[][] components = new Component[][]{ |
||||||
|
new Component[]{pane, null}, |
||||||
|
new Component[]{extraPane, null} |
||||||
|
}; |
||||||
|
double[] rowSize = {P, P}; |
||||||
|
double[] columnSize = {P, F}; |
||||||
|
int[][] rowCount = {{1, 1},{1, 1}}; |
||||||
|
return TableLayoutHelper.createGapTableLayoutPane(components, rowSize, columnSize, rowCount, 10, 7); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,94 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.gui.frpane.AttributeChangeListener; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.FlowLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> 文本类组件移动端高级属性的定义面板,基础扩展可以直接继承此面板 |
||||||
|
* <p> 往内部添加其他配置 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/30 |
||||||
|
*/ |
||||||
|
public class BaseTextEditorMobileDefinePane extends MobileWidgetDefinePane { |
||||||
|
|
||||||
|
private XCreator xCreator; |
||||||
|
protected MobileTextEditSettingPane textSettingPane; |
||||||
|
|
||||||
|
public BaseTextEditorMobileDefinePane(XCreator xCreator) { |
||||||
|
this.xCreator = xCreator; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void initPropertyGroups(Object source) { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); |
||||||
|
addPropertyPanesToContainer(container); |
||||||
|
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH); |
||||||
|
this.repaint(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 添加其他属性面板 |
||||||
|
* |
||||||
|
* @param container 展开容器 |
||||||
|
*/ |
||||||
|
protected void addPropertyPanesToContainer(JPanel container) { |
||||||
|
initSettingPane(container); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始化文本类基础面板 |
||||||
|
* |
||||||
|
* @param container |
||||||
|
*/ |
||||||
|
protected void initSettingPane(JPanel container) { |
||||||
|
textSettingPane = new MobileTextEditSettingPane(); |
||||||
|
container.add(textSettingPane); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(FormDesigner designer) { |
||||||
|
TextEditor textEditor = (TextEditor) xCreator.toData(); |
||||||
|
textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
this.bindListeners2Widgets(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void bindListeners2Widgets() { |
||||||
|
reInitAllListeners(); |
||||||
|
AttributeChangeListener changeListener = new AttributeChangeListener() { |
||||||
|
@Override |
||||||
|
public void attributeChange() { |
||||||
|
update(); |
||||||
|
} |
||||||
|
}; |
||||||
|
this.addAttributeChangeListener(changeListener); |
||||||
|
} |
||||||
|
|
||||||
|
private void reInitAllListeners() { |
||||||
|
initListener(this); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
TextEditor textEditor = (TextEditor) xCreator.toData(); |
||||||
|
textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
|
} |
||||||
|
|
||||||
|
public XCreator getxCreator() { |
||||||
|
return xCreator; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,33 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.form.ui.NumberEditor; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数字控件 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/30 |
||||||
|
*/ |
||||||
|
public class NumberEditorMobileDefinePane extends BaseTextEditorMobileDefinePane { |
||||||
|
public NumberEditorMobileDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(FormDesigner designer) { |
||||||
|
NumberEditor numberEditor = (NumberEditor) getxCreator().toData(); |
||||||
|
textSettingPane.populateBean(numberEditor.getMobileTextEditAttr()); |
||||||
|
this.bindListeners2Widgets(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
NumberEditor numberEditor = (NumberEditor) getxCreator().toData(); |
||||||
|
textSettingPane.updateBean(numberEditor.getMobileTextEditAttr()); |
||||||
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobilePasswordEditSettingPane; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 密码控件移动端高级属性 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/30 |
||||||
|
*/ |
||||||
|
public class PasswordMobileDefinePane extends BaseTextEditorMobileDefinePane { |
||||||
|
public PasswordMobileDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initSettingPane(JPanel container) { |
||||||
|
textSettingPane = new MobilePasswordEditSettingPane(); |
||||||
|
container.add(textSettingPane); |
||||||
|
} |
||||||
|
} |
@ -1,63 +0,0 @@ |
|||||||
package com.fr.design.widget.ui.designer.mobile; |
|
||||||
|
|
||||||
import com.fr.base.mobile.MobileScanCodeAttr; |
|
||||||
import com.fr.design.designer.creator.XCreator; |
|
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
|
||||||
import com.fr.design.gui.frpane.AttributeChangeListener; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.mainframe.DesignerContext; |
|
||||||
import com.fr.design.mainframe.FormDesigner; |
|
||||||
import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; |
|
||||||
import com.fr.form.ui.TextEditor; |
|
||||||
|
|
||||||
import java.awt.BorderLayout; |
|
||||||
|
|
||||||
|
|
||||||
public class ScanCodeMobileDefinePane extends MobileWidgetDefinePane { |
|
||||||
|
|
||||||
private XCreator xCreator; |
|
||||||
private MobileTextFieldInputSettingPane settingPane; |
|
||||||
|
|
||||||
public ScanCodeMobileDefinePane(XCreator xCreator) { |
|
||||||
this.xCreator = xCreator; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void initPropertyGroups(Object source) { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
settingPane = new MobileTextFieldInputSettingPane(); |
|
||||||
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); |
|
||||||
this.repaint(); |
|
||||||
} |
|
||||||
|
|
||||||
private void bindListeners2Widgets() { |
|
||||||
reInitAllListeners(); |
|
||||||
AttributeChangeListener changeListener = new AttributeChangeListener() { |
|
||||||
@Override |
|
||||||
public void attributeChange() { |
|
||||||
update(); |
|
||||||
} |
|
||||||
}; |
|
||||||
this.addAttributeChangeListener(changeListener); |
|
||||||
} |
|
||||||
|
|
||||||
private void reInitAllListeners() { |
|
||||||
initListener(this); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(FormDesigner designer) { |
|
||||||
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); |
|
||||||
settingPane.populateBean(mobileScanCodeAttr); |
|
||||||
this.bindListeners2Widgets(); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void update() { |
|
||||||
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) xCreator.toData()).getMobileScanCodeAttr(); |
|
||||||
settingPane.updateBean(mobileScanCodeAttr); |
|
||||||
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,25 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextAreaSettingPane; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本域控件 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/29 |
||||||
|
*/ |
||||||
|
public class TextAreaAdvancedDefinePane extends BaseTextEditorMobileDefinePane { |
||||||
|
public TextAreaAdvancedDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initSettingPane(JPanel container) { |
||||||
|
textSettingPane = new MobileTextAreaSettingPane(); |
||||||
|
container.add(textSettingPane); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile; |
||||||
|
|
||||||
|
import com.fr.design.designer.creator.XCreator; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.design.mainframe.FormDesigner; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本控件移动端属性 |
||||||
|
* 输入方式: |
||||||
|
* 输入框属性: |
||||||
|
* |
||||||
|
* @author hades |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2018/11/27 |
||||||
|
*/ |
||||||
|
public class TextEditorMobileDefinePane extends BaseTextEditorMobileDefinePane { |
||||||
|
/** |
||||||
|
* 输入方式 |
||||||
|
*/ |
||||||
|
private MobileTextFieldInputSettingPane inputSettingPane; |
||||||
|
|
||||||
|
public TextEditorMobileDefinePane(XCreator xCreator) { |
||||||
|
super(xCreator); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void initSettingPane(JPanel container) { |
||||||
|
inputSettingPane = new MobileTextFieldInputSettingPane(); |
||||||
|
textSettingPane = new MobileTextEditSettingPane(); |
||||||
|
container.add(inputSettingPane); |
||||||
|
container.add(textSettingPane); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(FormDesigner designer) { |
||||||
|
super.populate(designer); |
||||||
|
TextEditor textEditor = (TextEditor) getxCreator().toData(); |
||||||
|
inputSettingPane.populateBean(textEditor.getMobileScanCodeAttr()); |
||||||
|
this.bindListeners2Widgets(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update() { |
||||||
|
super.update(); |
||||||
|
TextEditor textEditor = (TextEditor) getxCreator().toData(); |
||||||
|
inputSettingPane.updateBean(textEditor.getMobileScanCodeAttr()); |
||||||
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile.component; |
||||||
|
|
||||||
|
import com.fr.base.mobile.MobileTextEditAttr; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 密码控件编辑属性设置面板 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/30 |
||||||
|
*/ |
||||||
|
public class MobilePasswordEditSettingPane extends MobileTextEditSettingPane { |
||||||
|
// 显示密码
|
||||||
|
private UICheckBox showPassword; |
||||||
|
|
||||||
|
public MobilePasswordEditSettingPane() { |
||||||
|
super(); |
||||||
|
showPassword = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Show_Password"), false); |
||||||
|
this.add(showPassword, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected boolean getClearDefaultState() { |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(MobileTextEditAttr ob) { |
||||||
|
super.populateBean(ob); |
||||||
|
// 要兼容处理一下,为null 的话赋默认值,默认开启
|
||||||
|
this.showPassword.setSelected(ob.isShowPassword() == null || ob.isShowPassword()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(MobileTextEditAttr ob) { |
||||||
|
super.updateBean(ob); |
||||||
|
ob.setShowPassword(showPassword.isSelected()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile.component; |
||||||
|
|
||||||
|
import com.fr.base.mobile.MobileTextEditAttr; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本域控件 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/29 |
||||||
|
*/ |
||||||
|
public class MobileTextAreaSettingPane extends MobileTextEditSettingPane { |
||||||
|
// 显示字数统计
|
||||||
|
private UICheckBox showWordCount; |
||||||
|
|
||||||
|
public MobileTextAreaSettingPane() { |
||||||
|
super(); |
||||||
|
showWordCount = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Show_Word_Count"), false); |
||||||
|
this.add(showWordCount, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(MobileTextEditAttr ob) { |
||||||
|
super.populateBean(ob); |
||||||
|
// 要兼容处理一下,为null 的话赋默认值,默认不开启
|
||||||
|
this.showWordCount.setSelected(ob.isShowWordCount() != null && ob.isShowWordCount()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(MobileTextEditAttr ob) { |
||||||
|
super.updateBean(ob); |
||||||
|
ob.setShowWordCount(showWordCount.isSelected()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.fr.design.widget.ui.designer.mobile.component; |
||||||
|
|
||||||
|
import com.fr.base.mobile.MobileTextEditAttr; |
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.gui.icheckbox.UICheckBox; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.VerticalFlowLayout; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
import java.awt.FlowLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本类基础设置 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/3/29 |
||||||
|
*/ |
||||||
|
public class MobileTextEditSettingPane extends BasicBeanPane<MobileTextEditAttr> { |
||||||
|
// 允许一键清空
|
||||||
|
protected UICheckBox allowOneClickClear; |
||||||
|
|
||||||
|
public MobileTextEditSettingPane() { |
||||||
|
initLayout(); |
||||||
|
allowOneClickClear = new UICheckBox(Toolkit.i18nText("Fine-Design_Mobile_Allow_One_Click_Clear"), getClearDefaultState()); |
||||||
|
this.add(allowOneClickClear, BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
protected boolean getClearDefaultState() { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
protected void initLayout() { |
||||||
|
VerticalFlowLayout verticalFlowLayout = new VerticalFlowLayout(FlowLayout.LEADING, 0, 5); |
||||||
|
verticalFlowLayout.setAlignLeft(true); |
||||||
|
this.setLayout(verticalFlowLayout); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populateBean(MobileTextEditAttr ob) { |
||||||
|
allowOneClickClear.setSelected(ob.isAllowOneClickClear() != null && ob.isAllowOneClickClear()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public MobileTextEditAttr updateBean() { |
||||||
|
// do nothing
|
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void updateBean(MobileTextEditAttr ob) { |
||||||
|
ob.setAllowOneClickClear(allowOneClickClear.isSelected()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,41 @@ |
|||||||
|
package com.fr.design.widget.ui.mobile; |
||||||
|
|
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.widget.mobile.WidgetMobilePane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; |
||||||
|
import com.fr.form.ui.NumberEditor; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 数字控件移动端属性 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/11 |
||||||
|
*/ |
||||||
|
public class NumberEditorMobilePane extends WidgetMobilePane { |
||||||
|
private MobileTextEditSettingPane textSettingPane; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void init() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
textSettingPane = new MobileTextEditSettingPane(); |
||||||
|
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, textSettingPane), BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(Widget widget) { |
||||||
|
NumberEditor numberEditor = (NumberEditor) widget; |
||||||
|
textSettingPane.populateBean(numberEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(Widget widget) { |
||||||
|
NumberEditor numberEditor = (NumberEditor) widget; |
||||||
|
textSettingPane.updateBean(numberEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package com.fr.design.widget.ui.mobile; |
||||||
|
|
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.widget.mobile.WidgetMobilePane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobilePasswordEditSettingPane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 密码控件移动端属性 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/11 |
||||||
|
*/ |
||||||
|
public class PasswordMobilePane extends WidgetMobilePane { |
||||||
|
private MobileTextEditSettingPane textSettingPane; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void init() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
textSettingPane = new MobilePasswordEditSettingPane(); |
||||||
|
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, textSettingPane), BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(Widget widget) { |
||||||
|
TextEditor textEditor = (TextEditor) widget; |
||||||
|
textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(Widget widget) { |
||||||
|
TextEditor textEditor = (TextEditor) widget; |
||||||
|
textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
} |
@ -1,39 +0,0 @@ |
|||||||
package com.fr.design.widget.ui.mobile; |
|
||||||
|
|
||||||
import com.fr.base.mobile.MobileScanCodeAttr; |
|
||||||
import com.fr.design.foldablepane.UIExpandablePane; |
|
||||||
import com.fr.design.i18n.Toolkit; |
|
||||||
import com.fr.design.layout.FRGUIPaneFactory; |
|
||||||
import com.fr.design.widget.mobile.WidgetMobilePane; |
|
||||||
import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; |
|
||||||
import com.fr.form.ui.TextEditor; |
|
||||||
import com.fr.form.ui.Widget; |
|
||||||
|
|
||||||
import java.awt.BorderLayout; |
|
||||||
|
|
||||||
|
|
||||||
public class ScanCodeMobilePane extends WidgetMobilePane { |
|
||||||
|
|
||||||
private MobileTextFieldInputSettingPane settingPane; |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void init() { |
|
||||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
|
||||||
settingPane = new MobileTextFieldInputSettingPane(); |
|
||||||
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, settingPane), BorderLayout.NORTH); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void populate(Widget widget) { |
|
||||||
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); |
|
||||||
settingPane.populateBean(mobileScanCodeAttr); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void update(Widget widget) { |
|
||||||
MobileScanCodeAttr mobileScanCodeAttr = ((TextEditor) widget).getMobileScanCodeAttr(); |
|
||||||
settingPane.updateBean(mobileScanCodeAttr); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,42 @@ |
|||||||
|
package com.fr.design.widget.ui.mobile; |
||||||
|
|
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.widget.mobile.WidgetMobilePane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextAreaSettingPane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本域控件移动端属性 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/11 |
||||||
|
*/ |
||||||
|
public class TextAreaMobilePane extends WidgetMobilePane { |
||||||
|
private MobileTextEditSettingPane textSettingPane; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void init() { |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
textSettingPane = new MobileTextAreaSettingPane(); |
||||||
|
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, textSettingPane), BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(Widget widget) { |
||||||
|
TextEditor textEditor = (TextEditor) widget; |
||||||
|
textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(Widget widget) { |
||||||
|
TextEditor textEditor = (TextEditor) widget; |
||||||
|
textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,59 @@ |
|||||||
|
package com.fr.design.widget.ui.mobile; |
||||||
|
|
||||||
|
import com.fr.design.foldablepane.UIExpandablePane; |
||||||
|
import com.fr.design.i18n.Toolkit; |
||||||
|
import com.fr.design.layout.FRGUIPaneFactory; |
||||||
|
import com.fr.design.widget.mobile.WidgetMobilePane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextEditSettingPane; |
||||||
|
import com.fr.design.widget.ui.designer.mobile.component.MobileTextFieldInputSettingPane; |
||||||
|
import com.fr.form.ui.TextEditor; |
||||||
|
import com.fr.form.ui.Widget; |
||||||
|
|
||||||
|
import javax.swing.JPanel; |
||||||
|
import java.awt.BorderLayout; |
||||||
|
|
||||||
|
/** |
||||||
|
* 文本控件移动端属性面板 |
||||||
|
* |
||||||
|
* @author Coral.Chen |
||||||
|
* @since 11.0 |
||||||
|
* Created on 2023/4/12 |
||||||
|
*/ |
||||||
|
public class TextEditorMobilePane extends WidgetMobilePane { |
||||||
|
|
||||||
|
/** |
||||||
|
* 输入方式 |
||||||
|
*/ |
||||||
|
private MobileTextFieldInputSettingPane settingPane; |
||||||
|
/** |
||||||
|
* 输入框属性配置 |
||||||
|
*/ |
||||||
|
private MobileTextEditSettingPane textSettingPane; |
||||||
|
|
||||||
|
@Override |
||||||
|
protected void init() { |
||||||
|
JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_S_Pane(true); |
||||||
|
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||||
|
settingPane = new MobileTextFieldInputSettingPane(); |
||||||
|
textSettingPane = new MobileTextEditSettingPane(); |
||||||
|
container.add(settingPane); |
||||||
|
container.add(textSettingPane); |
||||||
|
this.add(new UIExpandablePane(Toolkit.i18nText("Fine-Design_Report_Advanced"), 280, 20, container), BorderLayout.NORTH); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void populate(Widget widget) { |
||||||
|
TextEditor textEditor = (TextEditor) widget; |
||||||
|
settingPane.populateBean(textEditor.getMobileScanCodeAttr()); |
||||||
|
textSettingPane.populateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void update(Widget widget) { |
||||||
|
TextEditor textEditor = (TextEditor) widget; |
||||||
|
settingPane.updateBean(textEditor.getMobileScanCodeAttr()); |
||||||
|
textSettingPane.updateBean(textEditor.getMobileTextEditAttr()); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue