You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.9 KiB
58 lines
1.9 KiB
package com.fr.widgettheme.util; |
|
|
|
import com.fr.base.io.AttrMark; |
|
import com.fr.base.io.IOFile; |
|
import com.fr.design.file.HistoryTemplateListCache; |
|
import com.fr.design.mainframe.JTemplate; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.widgettheme.control.attr.WidgetDisplayEnhanceMarkAttr; |
|
|
|
/** |
|
* 控件主题设计器部分工具类 |
|
* |
|
* @author obo |
|
* @since 11.0 |
|
* Created on 2023/11/13 |
|
*/ |
|
public class WidgetThemeDesignerUtils { |
|
|
|
private WidgetThemeDesignerUtils() { |
|
} |
|
|
|
/** |
|
* 从 WorkBook 中加载 WatermarkAttr 属性对象 |
|
* |
|
* @param template AttrMark 对象,包括 WorkBook |
|
* @return StrongestControlMarkAttr 对象 |
|
*/ |
|
public static WidgetDisplayEnhanceMarkAttr getStrongestControlAttrFromTemplate(AttrMark template) { |
|
return template.getAttrMark(WidgetDisplayEnhanceMarkAttr.XML_TAG); |
|
} |
|
|
|
/** |
|
* 判断是否启用了控件显示增强 |
|
* |
|
* @return 开启与否 |
|
*/ |
|
public static boolean enableWidgetEnhance() { |
|
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
|
if (JTemplate.isValid(jTemplate)) { |
|
IOFile ioFile = (IOFile) jTemplate.getTarget(); |
|
WidgetDisplayEnhanceMarkAttr mark = ioFile.getAttrMark(WidgetDisplayEnhanceMarkAttr.XML_TAG); |
|
return mark != null && mark.isWidgetEnhance(); |
|
} |
|
return false; |
|
} |
|
|
|
/** |
|
* 判断当前widget是否为新多选下拉树控件 |
|
*/ |
|
public static boolean isNewComboBoxTreeEditor(Object widget) { |
|
String className = widget.getClass().getName(); |
|
if (widget instanceof Class) { |
|
className = ((Class) widget).getName(); |
|
} |
|
return StringUtils.equals(className, "com.fr.plugin.widget.newcomboboxtree.NewComboBoxTreeEditor") |
|
|| StringUtils.equals(className, "com.fr.plugin.widget.newcomboboxtree.XNewComboBoxTreeEditor"); |
|
} |
|
}
|
|
|