Browse Source
* commit '21b1b650fae272a43f8b1713584fe9b201499788': REPORT-94391 && REPORT-94374【FVS支持多开】兼容问题-新jar+旧插件,文件选项有两个关闭按钮;【FVS支持多开】frm关闭其他模板按钮,把所有打开的模板都关闭了 REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置--代码格式 REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置--注释 REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置--注释 REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置--注释 REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置--格式调整 REPORT-92628 控件支持主题切换-部分控件未实现主题样式设置feature/x
superman
2 years ago
13 changed files with 249 additions and 62 deletions
@ -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); |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue