forked from fanruan/design
Browse Source
Merge in ~NEIL/design from final/10.0 to feature/10.0 * commit 'c4d9d5213862f1acef4b738380025af8d42cc81c': (375 commits) 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 合代码冲突 REPORT-32162 替换 ui 的时候,需要在事件分发线程中 CHART-14022 所有可以设置通用格式的面板排布都不对 CHART-13962 为趋势线条件属性设置默认值 删除多余代码 REPORT-32043 10.0冒烟:设计器启动经常白屏,卡住 MOBILE-27000 移动端控件图标支持自定义颜色 REPORT-32105 表单关闭后 JForm对象未释放 导致设计器最终发生oom REPORT-32073 fix 换个好名字 REPORT-32073【冒烟测试】模板web属性-工具栏编辑之后,点确定,弹窗无法缩回 REPORT-32088【组件加密】@harrison集群安装出现初始化失败 插件接口的位置有点问题, 不能放到 form 下, 要放到 design 下 ...persist/11.0
neil
5 years ago
405 changed files with 10733 additions and 2845 deletions
@ -0,0 +1,59 @@
|
||||
package com.fr.common.detect; |
||||
|
||||
import com.fr.concurrent.NamedThreadFactory; |
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.module.ModuleContext; |
||||
import com.fr.web.WebSocketConfig; |
||||
|
||||
import java.net.Socket; |
||||
import java.util.concurrent.ExecutorService; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/10 |
||||
*/ |
||||
public class CommonPortDetector { |
||||
|
||||
private static final CommonPortDetector INSTANCE = new CommonPortDetector(); |
||||
private ExecutorService service = ModuleContext.getExecutor().newSingleThreadExecutor(new NamedThreadFactory("CommonPortDetector")); |
||||
|
||||
public static CommonPortDetector getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
public void execute() { |
||||
service.submit(new Runnable() { |
||||
@Override |
||||
public void run() { |
||||
detectTomcatPort(); |
||||
detectWebSocketPort(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void detectTomcatPort() { |
||||
int port = DesignerEnvManager.getEnvManager().getEmbedServerPort(); |
||||
if (checkPort(port)) { |
||||
FineLoggerFactory.getLogger().error("EmbedTomcat Port: {} is not available, maybe occupied by other programs, please check it!", port); |
||||
} |
||||
} |
||||
|
||||
private void detectWebSocketPort() { |
||||
Integer[] ports = WebSocketConfig.getInstance().getPort(); |
||||
for (int port : ports) { |
||||
if (checkPort(port)) { |
||||
FineLoggerFactory.getLogger().error("WebSocKet Port: {} is not available, maybe occupied by other programs, please check it!", port); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private boolean checkPort(int port) { |
||||
try (Socket socket = new Socket("localhost", port)) { |
||||
return true; |
||||
} catch (Exception e) { |
||||
return false; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.common.report; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/27 |
||||
*/ |
||||
public enum ReportState { |
||||
|
||||
STOP("stop"), ACTIVE("active"); |
||||
|
||||
private String value; |
||||
|
||||
ReportState(String value) { |
||||
this.value = value; |
||||
} |
||||
|
||||
public String getValue() { |
||||
return this.value; |
||||
} |
||||
} |
@ -0,0 +1,50 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.plugin.injectable.PluginModule; |
||||
|
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
@SuppressWarnings({"rawtypes", "unchecked"}) |
||||
public abstract class ClipboardFilter { |
||||
|
||||
public static <T> T cut(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).cut(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
|
||||
public static <T> T copy(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).copy(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
|
||||
public static <T> T paste(T selection) { |
||||
|
||||
ExtraDesignClassManager manager = PluginModule.getAgent(PluginModule.ExtraDesign); |
||||
Set<ClipboardHandlerProvider> providers = manager.getArray(ClipboardHandlerProvider.XML_TAG); |
||||
for (ClipboardHandlerProvider provider : providers) { |
||||
if (provider.support(selection)) { |
||||
selection = ((ClipboardHandlerProvider<T>) provider).paste(selection); |
||||
} |
||||
} |
||||
return selection; |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.fr.design.base.clipboard; |
||||
|
||||
import java.awt.datatransfer.Clipboard; |
||||
import java.awt.datatransfer.ClipboardOwner; |
||||
import java.awt.datatransfer.DataFlavor; |
||||
import java.awt.datatransfer.FlavorListener; |
||||
import java.awt.datatransfer.Transferable; |
||||
import java.awt.datatransfer.UnsupportedFlavorException; |
||||
import java.io.IOException; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/11 |
||||
**/ |
||||
public class DesignerClipboard extends Clipboard { |
||||
|
||||
private Clipboard clipboard; |
||||
|
||||
public DesignerClipboard(Clipboard clipboard) { |
||||
super(clipboard.getName()); |
||||
this.clipboard = clipboard; |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void setContents(Transferable contents, ClipboardOwner owner) { |
||||
//处理 contents/owner
|
||||
Transferable filtered = ClipboardFilter.copy(contents); |
||||
clipboard.setContents(filtered, owner); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized Transferable getContents(Object requestor) { |
||||
Transferable contents = clipboard.getContents(requestor); |
||||
//处理 contents
|
||||
Transferable filtered = ClipboardFilter.paste(contents); |
||||
return filtered; |
||||
} |
||||
|
||||
@Override |
||||
public DataFlavor[] getAvailableDataFlavors() { |
||||
return clipboard.getAvailableDataFlavors(); |
||||
} |
||||
|
||||
@Override |
||||
public boolean isDataFlavorAvailable(DataFlavor flavor) { |
||||
return clipboard.isDataFlavorAvailable(flavor); |
||||
} |
||||
|
||||
@Override |
||||
public Object getData(DataFlavor flavor) throws UnsupportedFlavorException, IOException { |
||||
return clipboard.getData(flavor); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void addFlavorListener(FlavorListener listener) { |
||||
clipboard.addFlavorListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized void removeFlavorListener(FlavorListener listener) { |
||||
clipboard.removeFlavorListener(listener); |
||||
} |
||||
|
||||
@Override |
||||
public synchronized FlavorListener[] getFlavorListeners() { |
||||
return clipboard.getFlavorListeners(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.data; |
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/4/27 |
||||
*/ |
||||
public abstract class BasicTableDataUtils { |
||||
|
||||
private static final int LEN = 2; |
||||
|
||||
|
||||
public static boolean checkName(String name) { |
||||
if (isInValidName(name)) { |
||||
FineJOptionPane.showMessageDialog(null, |
||||
Toolkit.i18nText("Fine-Design_Basic_DataSet_Rename_Warning", name), |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
FineJOptionPane.WARNING_MESSAGE); |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public static boolean isInValidName(String name) { |
||||
String[] values = name.split("\\."); |
||||
if (values.length == LEN) { |
||||
return (StringUtils.isNotEmpty(values[0]) && StringUtils.isNotEmpty(values[1])) |
||||
|| (StringUtils.isEmpty(values[0]) && StringUtils.isNotEmpty(values[1])); |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.fr.design.event; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/19 |
||||
*/ |
||||
public interface RemoveListener { |
||||
|
||||
void doRemoveAction(); |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
/** |
||||
* @author yaohwu |
||||
* created by yaohwu at 2020/4/26 15:50 |
||||
*/ |
||||
public interface CellExpandAttrPanelProvider extends Mutable { |
||||
|
||||
String MARK_STRING = "CellExpandAttrPanelProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* @return 创建单元格属性-扩展设置中的额外面板 |
||||
*/ |
||||
BasicBeanPane<TemplateCellElement> createPanel(); |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
public interface ClipboardHandlerProvider<T> extends Mutable { |
||||
|
||||
String XML_TAG = "ClipboardHandlerProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 剪切 |
||||
* |
||||
* @param selection 选中 |
||||
* @return 处理后的内容 |
||||
*/ |
||||
T cut(T selection); |
||||
|
||||
/** |
||||
* 复制 |
||||
* |
||||
* @param selection 选中 |
||||
* @return 处理后的内容 |
||||
*/ |
||||
T copy(T selection); |
||||
|
||||
/** |
||||
* 粘贴 |
||||
* |
||||
* @param selection 选中 |
||||
* @return 处理后的内容 |
||||
*/ |
||||
T paste(T selection); |
||||
|
||||
/** |
||||
* 支持的类型 |
||||
* |
||||
* @param selection 内容 |
||||
* @return 是否 |
||||
*/ |
||||
boolean support(Object selection); |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.mainframe.DockingView; |
||||
import com.fr.stable.fun.mark.Immutable; |
||||
|
||||
import javax.swing.JPanel; |
||||
|
||||
/** |
||||
* 组件库面板处理器 |
||||
* |
||||
* created by Harrison on 2020/03/16 |
||||
**/ |
||||
public interface ComponentLibraryPaneProcessor extends Immutable { |
||||
|
||||
String XML_TAG = "ComponentLibraryPaneProcessor"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 创建展示面板 |
||||
* |
||||
* @param isEdit 是否可以编辑 |
||||
* @return 展示面板 |
||||
*/ |
||||
UIScrollPane createShowPanel(boolean isEdit); |
||||
|
||||
/** |
||||
* 创建菜单的上部面板 |
||||
* |
||||
* @return 面板 |
||||
*/ |
||||
JPanel createMenuNorthPane(); |
||||
|
||||
/** |
||||
* 创建复选框 |
||||
* |
||||
* @return 复选框 |
||||
*/ |
||||
UIComboBox createMenuComBox(); |
||||
|
||||
void parentView(DockingView dockingView); |
||||
|
||||
/** |
||||
* 父面板 |
||||
* |
||||
* @param panel 面板 |
||||
*/ |
||||
void parentPane(JPanel panel); |
||||
|
||||
/** |
||||
* 创建完成 |
||||
*/ |
||||
void complete(); |
||||
|
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Mutable; |
||||
import com.fr.start.BaseDesigner; |
||||
|
||||
/** |
||||
* 设计器启动类替换接口 |
||||
* |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/5/7 |
||||
*/ |
||||
|
||||
public interface DesignerStartClassProcessor extends Mutable { |
||||
|
||||
String MARK_STRING = "DesignerStartClassProcessor"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
|
||||
Class<? extends BaseDesigner> transform(); |
||||
|
||||
} |
@ -0,0 +1,43 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.stable.fun.mark.Immutable; |
||||
|
||||
import javax.swing.JComponent; |
||||
import java.awt.Dimension; |
||||
import java.awt.image.BufferedImage; |
||||
|
||||
|
||||
/** |
||||
* Created by kerry on 2020-04-09 |
||||
* 临时接口,后续自适应内置后删除 |
||||
*/ |
||||
public interface FormAdaptiveConfigUIProcessor extends Immutable { |
||||
|
||||
String MARK_STRING = "FormAdaptiveConfigUIProcessor"; |
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 获取表单自适应配置菜单 |
||||
* @return 表单自适应配置菜单 |
||||
*/ |
||||
ShortCut getConfigShortCut(JTemplate jTemplate); |
||||
|
||||
/** |
||||
* 绘制自适应下报表块在表单界面中显示图片 |
||||
* @param size 绘制尺寸 |
||||
* @param elementCasePane 报表块内容对象 |
||||
* @return 自适应下报表块在表单界面中显示的图片 |
||||
*/ |
||||
BufferedImage paintFormElementCaseImage(Dimension size, JComponent elementCasePane); |
||||
|
||||
|
||||
/** |
||||
* 获取新自适应下字体显示的dpi |
||||
* @return dpi |
||||
*/ |
||||
int fontResolution(); |
||||
|
||||
} |
||||
|
@ -0,0 +1,25 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.general.cardtag.mobile.MobileTemplateStyle; |
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/31 |
||||
*/ |
||||
public interface MobileTemplateStyleProvider extends Mutable { |
||||
|
||||
String XML_TAG = "MobileTemplateStyleProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
Class<? extends MobileTemplateStyle> classFroMobileTemplateStyle(); |
||||
|
||||
|
||||
Class<? extends BasicBeanPane<MobileTemplateStyle>> classFroMobileTemplateStyleAppearance(); |
||||
|
||||
String displayName(); |
||||
|
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Mutable; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-04-09 |
||||
*/ |
||||
public interface ReportLengthUNITProvider extends Mutable { |
||||
String MARK_STRING = "ReportLengthUNITProvider"; |
||||
|
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
/** |
||||
* 标尺单位显示字符 |
||||
* @return 标尺单位字符 |
||||
*/ |
||||
String unitText(); |
||||
|
||||
/** |
||||
* 标尺单位类型(之前是将int类型的值直接保存在数据库里面的) |
||||
* @return 返回标尺单位类型 |
||||
*/ |
||||
int unitType(); |
||||
|
||||
/** |
||||
* UNIT转标尺单位值 |
||||
* @param value UNIT |
||||
* @return 标尺单位值 |
||||
*/ |
||||
float unit2Value4Scale(UNIT value); |
||||
|
||||
/** |
||||
* 标尺单位值转UNIT |
||||
* @param value 标尺单位值 |
||||
* @return UNIT |
||||
*/ |
||||
UNIT float2UNIT(float value); |
||||
} |
@ -0,0 +1,39 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.fun.CellExpandAttrPanelProvider; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* @author yaohwu |
||||
* created by yaohwu at 2020/4/26 16:08 |
||||
*/ |
||||
@API(level = CellExpandAttrPanelProvider.CURRENT_LEVEL) |
||||
public class AbstractCellExpandAttrPanelProvider implements CellExpandAttrPanelProvider { |
||||
|
||||
/** |
||||
* 当前接口的API等级,用于判断是否需要升级插件 |
||||
* |
||||
* @return API等级 |
||||
*/ |
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CellExpandAttrPanelProvider.CURRENT_LEVEL; |
||||
} |
||||
|
||||
/** |
||||
* 获取当前provider的标记(可以使用类路径保证唯一)以避免provider的重复加载 |
||||
* |
||||
* @return 当前provider的标记 |
||||
*/ |
||||
@Override |
||||
public String mark4Provider() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public BasicBeanPane<TemplateCellElement> createPanel() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,17 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.ClipboardHandlerProvider; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* created by Harrison on 2020/05/14 |
||||
**/ |
||||
@API(level = ClipboardHandlerProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractClipboardHandlerProvider<T> extends AbstractProvider implements ClipboardHandlerProvider<T> { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return ClipboardHandlerProvider.CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.DesignerStartClassProcessor; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/5/7 |
||||
*/ |
||||
@API(level = DesignerStartClassProcessor.CURRENT_LEVEL) |
||||
public abstract class AbstractDesignerStartClassProcessorProcessor implements DesignerStartClassProcessor { |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
|
||||
import com.fr.design.fun.FormAdaptiveConfigUIProcessor; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-04-09 |
||||
*/ |
||||
@API(level = FormAdaptiveConfigUIProcessor.CURRENT_LEVEL) |
||||
public abstract class AbstractFormAdaptiveConfigUIProcessor implements FormAdaptiveConfigUIProcessor { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public int layerIndex() { |
||||
return DEFAULT_LAYER_INDEX; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.MobileTemplateStyleProvider; |
||||
import com.fr.design.fun.MobileWidgetStyleProvider; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2020/3/31 |
||||
*/ |
||||
@API(level = MobileWidgetStyleProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractMobileTemplateStyleProvider extends AbstractProvider implements MobileTemplateStyleProvider { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
|
||||
import com.fr.design.fun.ReportLengthUNITProvider; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.stable.fun.impl.AbstractProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
import com.fr.stable.unit.UNIT; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-04-09 |
||||
*/ |
||||
@API(level = ReportLengthUNITProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractReportLengthUNITProvider extends AbstractProvider implements ReportLengthUNITProvider { |
||||
|
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public String unitText() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
@Override |
||||
public int unitType() { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public float unit2Value4Scale(UNIT value) { |
||||
return 0; |
||||
} |
||||
|
||||
@Override |
||||
public UNIT float2UNIT(float value) { |
||||
return UNIT.ZERO; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,38 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import com.fr.chart.base.ChartConstants; |
||||
import com.fr.design.constants.UIConstants; |
||||
import com.fr.design.style.color.ColorControlWindow; |
||||
import com.fr.design.style.color.ColorControlWindowWithAuto; |
||||
import com.fr.general.ComparatorUtils; |
||||
|
||||
import java.awt.Color; |
||||
|
||||
public class UIColorButtonWithAuto extends UIColorButton { |
||||
|
||||
protected void checkColorChange(Color oldColor, Color newColor) { |
||||
if (ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && !ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { |
||||
setIcon(UIConstants.FONT_ICON); |
||||
} |
||||
|
||||
if (!ComparatorUtils.equals(oldColor, ChartConstants.AUTO_FONT_COLOR) && ComparatorUtils.equals(newColor, ChartConstants.AUTO_FONT_COLOR)) { |
||||
setIcon(UIConstants.AUTO_FONT_ICON); |
||||
} |
||||
|
||||
super.checkColorChange(oldColor, newColor); |
||||
} |
||||
|
||||
protected ColorControlWindow getColorControlWindow() { |
||||
if (getPopupWin() == null) { |
||||
ColorControlWindowWithAuto colorControlWindowWithAuto = new ColorControlWindowWithAuto(UIColorButtonWithAuto.this) { |
||||
protected void colorChanged() { |
||||
UIColorButtonWithAuto.this.setColor(this.getColor()); |
||||
} |
||||
}; |
||||
|
||||
setPopupWin(colorControlWindowWithAuto); |
||||
} |
||||
|
||||
return getPopupWin(); |
||||
} |
||||
} |
@ -0,0 +1,123 @@
|
||||
package com.fr.design.mainframe.mobile.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.icombobox.UIComboBoxRenderer; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.DefaultComboBoxModel; |
||||
import javax.swing.JLabel; |
||||
import javax.swing.JList; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Font; |
||||
import java.util.Vector; |
||||
|
||||
public class MobileStyleFontConfigPane extends JPanel { |
||||
public static final int FONT_NONE = 0; |
||||
private static final int MAX_FONT_SIZE = 18; |
||||
private static final int MIN_FONT_SIZE = 12; |
||||
private static final Dimension BUTTON_SIZE = new Dimension(20, 18); |
||||
|
||||
public static Vector<Integer> getFontSizes() { |
||||
Vector<Integer> FONT_SIZES = new Vector<Integer>(); |
||||
FONT_SIZES.add(FONT_NONE); |
||||
for (int i = MIN_FONT_SIZE; i <= MAX_FONT_SIZE; i++) { |
||||
FONT_SIZES.add(i); |
||||
} |
||||
return FONT_SIZES; |
||||
} |
||||
|
||||
private UIComboBox fontSizeComboBox; |
||||
private UIToggleButton underline; |
||||
private UIToggleButton italic; |
||||
private UIToggleButton bold; |
||||
|
||||
public MobileStyleFontConfigPane() { |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
|
||||
fontSizeComboBox = new UIComboBox(); |
||||
fontSizeComboBox.setModel(new DefaultComboBoxModel(getFontSizes())); |
||||
fontSizeComboBox.setSelectedItem(0); |
||||
fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); |
||||
fontSizeComboBox.setRenderer(new LineCellRenderer()); |
||||
underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); |
||||
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
|
||||
this.setButtonsTips(); |
||||
this.setButtonsSize(BUTTON_SIZE); |
||||
|
||||
Component[] components_font = new Component[]{ |
||||
fontSizeComboBox, underline, italic, bold |
||||
}; |
||||
|
||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
||||
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_LARGE)); |
||||
|
||||
this.setLayout(new BorderLayout(0,0)); |
||||
this.add(buttonPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void setButtonsTips() { |
||||
underline.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Underline")); |
||||
italic.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Italic")); |
||||
bold.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Bold")); |
||||
} |
||||
|
||||
private void setButtonsSize(Dimension size) { |
||||
underline.setPreferredSize(size); |
||||
italic.setPreferredSize(size); |
||||
bold.setPreferredSize(size); |
||||
} |
||||
|
||||
|
||||
public void populateBean(FRFont frFont) { |
||||
fontSizeComboBox.setSelectedItem(frFont.getSize()); |
||||
bold.setSelected(frFont.isBold()); |
||||
italic.setSelected(frFont.isItalic()); |
||||
underline.setSelected(frFont.getUnderline() != Constants.LINE_NONE); |
||||
} |
||||
|
||||
public FRFont updateBean() { |
||||
int style = Font.PLAIN; |
||||
style += this.bold.isSelected() ? Font.BOLD : Font.PLAIN; |
||||
style += this.italic.isSelected() ? Font.ITALIC : Font.PLAIN; |
||||
return FRFont.getInstance( |
||||
FRFont.DEFAULT_FONTNAME, |
||||
style, |
||||
Float.parseFloat(fontSizeComboBox.getSelectedItem().toString()), |
||||
Color.BLACK, |
||||
underline.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE |
||||
); |
||||
} |
||||
|
||||
private class LineCellRenderer extends UIComboBoxRenderer { |
||||
public LineCellRenderer() { |
||||
super(); |
||||
} |
||||
|
||||
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { |
||||
JLabel renderer =(JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); |
||||
int currentValue = ((Integer) value).intValue(); |
||||
if (currentValue == MobileStyleFontConfigPane.FONT_NONE) { |
||||
renderer.setText(StringUtils.BLANK + com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_None")); |
||||
} |
||||
return renderer; |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,396 @@
|
||||
package com.fr.design.mainframe.mobile.ui; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Utils; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icombobox.LineComboBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UnsignedIntUISpinner; |
||||
import com.fr.design.gui.style.FRFontPane; |
||||
import com.fr.design.gui.style.NumberDragBar; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.style.color.ColorSelectBox; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.form.ui.mobile.MobileBookMarkStyle; |
||||
import com.fr.form.ui.mobile.impl.SidebarMobileBookMarkStyle; |
||||
import com.fr.stable.CoreConstants; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 10.0 |
||||
* Created by Starryi on 2020/02/28 |
||||
*/ |
||||
public class SidebarMobileBookMarkStyleCustomDefinePane extends BasicBeanPane<MobileBookMarkStyle> { |
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
private static final int COLUMN_HEIGHT = 20; |
||||
private static final int COLUMN_WIDTH = 160; |
||||
|
||||
private UnsignedIntUISpinner buttonWidthSpinner; |
||||
private UnsignedIntUISpinner buttonHeightSpinner; |
||||
private UnsignedIntUISpinner buttonGapSpinner; |
||||
private UnsignedIntUISpinner buttonBorderRadiusSpinner; |
||||
|
||||
private ColorSelectBox normalBackgroundColorBox; |
||||
private NumberDragBar normalOpacityDragBar; |
||||
private UnsignedIntUISpinner normalOpacitySpinner; |
||||
private LineComboBox normalBorderWidthComBox; |
||||
private ColorSelectBox normalBorderColorBox; |
||||
private UIComboBox normalFontNameComboBox; |
||||
private UIComboBox normalFontSizeComboBox; |
||||
private UIColorButton normalFontColorButton; |
||||
private UIToggleButton normalFontItalicButton; |
||||
private UIToggleButton normalFontBoldButton; |
||||
|
||||
private ColorSelectBox selectedBackgroundColorBox; |
||||
private NumberDragBar selectedOpacityDragBar; |
||||
private UnsignedIntUISpinner selectedOpacitySpinner; |
||||
private LineComboBox selectedBorderWidthComBox; |
||||
private ColorSelectBox selectedBorderColorBox; |
||||
private UIComboBox selectedFontNameComboBox; |
||||
private UIComboBox selectedFontSizeComboBox; |
||||
private UIColorButton selectedFontColorButton; |
||||
private UIToggleButton selectedFontItalicButton; |
||||
private UIToggleButton selectedFontBoldButton; |
||||
|
||||
private SidebarMobileBookMarkStyle DEFAULT_STYLE = new SidebarMobileBookMarkStyle(); |
||||
|
||||
public SidebarMobileBookMarkStyleCustomDefinePane() { |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0)); |
||||
|
||||
final JPanel contentPanel = FRGUIPaneFactory.createYBoxEmptyBorderPane(); |
||||
|
||||
contentPanel.add(this.createNavButtonStylePanel()); |
||||
contentPanel.add(this.createNormalStateStylePanel()); |
||||
contentPanel.add(this.createSelectedStateStylePanel()); |
||||
|
||||
JPanel scrollPanel = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return contentPanel; |
||||
} |
||||
}; |
||||
scrollPanel.setPreferredSize(new Dimension(-2, -2)); |
||||
this.add(scrollPanel, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JPanel createNavButtonStylePanel() { |
||||
|
||||
buttonWidthSpinner = new UnsignedIntUISpinner(20, 150, 1, DEFAULT_STYLE.getWidth()); |
||||
buttonHeightSpinner = new UnsignedIntUISpinner(20, 100, 1, DEFAULT_STYLE.getHeight()); |
||||
buttonGapSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getGap()); |
||||
buttonBorderRadiusSpinner = new UnsignedIntUISpinner(0, Integer.MAX_VALUE, 1, DEFAULT_STYLE.getBorderRadius()); |
||||
|
||||
UILabel sizeLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Size") + ":", |
||||
SwingConstants.RIGHT); |
||||
JPanel sizePane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0); |
||||
sizePane.add(buttonWidthSpinner); |
||||
sizePane.add(buttonHeightSpinner); |
||||
|
||||
JPanel sizeTipsPane = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 4, 0); |
||||
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Width"), |
||||
SwingConstants.CENTER)); |
||||
sizeTipsPane.add(new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Height"), |
||||
SwingConstants.CENTER)); |
||||
|
||||
UILabel gapLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Gap") + ":", |
||||
SwingConstants.RIGHT); |
||||
UILabel borderRadiusLabel = new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Border_Radius") + ":", |
||||
SwingConstants.RIGHT); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT}; |
||||
double[] columnSize = {p, COLUMN_WIDTH}; |
||||
double[] verticalGaps = {0, 10, 10}; |
||||
|
||||
JPanel navButtonSettingsPanel = TableLayoutHelper.createDiffVGapTableLayoutPane(new JComponent[][]{ |
||||
{sizeLabel, sizePane}, |
||||
{null, sizeTipsPane}, |
||||
{gapLabel, buttonGapSpinner}, |
||||
{borderRadiusLabel, buttonBorderRadiusSpinner}, |
||||
}, rowSize, columnSize, 5, verticalGaps); |
||||
|
||||
navButtonSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||
|
||||
JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
containerPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Button_Style"), |
||||
Color.decode("#2F8EF1"))); |
||||
containerPane.add(navButtonSettingsPanel); |
||||
|
||||
return containerPane; |
||||
} |
||||
|
||||
private JPanel createNormalStateStylePanel() { |
||||
double p = TableLayout.PREFERRED; |
||||
|
||||
normalBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH); |
||||
normalBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getBackgroundColor()); |
||||
normalOpacityDragBar = new NumberDragBar(0, 100); |
||||
normalOpacityDragBar.setValue(DEFAULT_STYLE.getOpacity()); |
||||
normalOpacityDragBar.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
normalOpacitySpinner.setValue(normalOpacityDragBar.getValue()); |
||||
} |
||||
}); |
||||
normalOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getOpacity()); |
||||
normalOpacitySpinner.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
normalOpacityDragBar.setValue((int) normalOpacitySpinner.getValue()); |
||||
} |
||||
}); |
||||
normalBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); |
||||
normalBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getBorderLineStyle()); |
||||
normalBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); |
||||
normalBorderColorBox.setSelectObject(DEFAULT_STYLE.getBorderColor()); |
||||
normalFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
normalFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily()); |
||||
normalFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); |
||||
normalFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getFontSize()); |
||||
normalFontColorButton = new UIColorButton(); |
||||
normalFontColorButton.setColor(DEFAULT_STYLE.getFontColor()); |
||||
normalFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
normalFontItalicButton.setSelected(DEFAULT_STYLE.isFontItalic()); |
||||
normalFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
normalFontBoldButton.setSelected(DEFAULT_STYLE.isFontBold()); |
||||
|
||||
JPanel opacityPane = new JPanel(new BorderLayout(0, 0)); |
||||
JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); |
||||
jp.add(normalOpacityDragBar); |
||||
jp.add(normalOpacitySpinner); |
||||
opacityPane.add(jp, BorderLayout.CENTER); |
||||
|
||||
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( |
||||
new JComponent[][]{{normalFontSizeComboBox, normalFontColorButton, normalFontItalicButton, normalFontBoldButton}}, |
||||
new double[]{COLUMN_HEIGHT}, |
||||
new double[]{p, p, p, p}, |
||||
7, 0 |
||||
); |
||||
|
||||
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT}; |
||||
double[] columnSize = {p, COLUMN_WIDTH, p}; |
||||
|
||||
JPanel normalStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT), |
||||
normalBackgroundColorBox |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT), |
||||
opacityPane, |
||||
new UILabel("%") |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT), |
||||
normalBorderWidthComBox |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT), |
||||
normalBorderColorBox |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT), |
||||
normalFontNameComboBox, |
||||
fontExtraPane |
||||
} |
||||
}, rowSize, columnSize, 5, 10); |
||||
normalStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||
|
||||
JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
containerPane.setBorder( |
||||
GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Normal_Style"), |
||||
Color.decode("#2F8EF1")) |
||||
); |
||||
containerPane.add(normalStateStyleSettingsPanel); |
||||
|
||||
return containerPane; |
||||
} |
||||
|
||||
private JPanel createSelectedStateStylePanel() { |
||||
double p = TableLayout.PREFERRED; |
||||
|
||||
selectedBackgroundColorBox = new ColorSelectBox(COLUMN_WIDTH); |
||||
selectedBackgroundColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBackgroundColor()); |
||||
selectedOpacityDragBar = new NumberDragBar(0, 100); |
||||
selectedOpacityDragBar.setValue(DEFAULT_STYLE.getSelectedOpacity()); |
||||
selectedOpacityDragBar.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
selectedOpacitySpinner.setValue(selectedOpacityDragBar.getValue()); |
||||
} |
||||
}); |
||||
selectedOpacitySpinner = new UnsignedIntUISpinner(0, 100, 1, DEFAULT_STYLE.getSelectedOpacity()); |
||||
selectedOpacitySpinner.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
selectedOpacityDragBar.setValue((int) selectedOpacitySpinner.getValue()); |
||||
} |
||||
}); |
||||
selectedBorderWidthComBox = new LineComboBox(CoreConstants.UNDERLINE_STYLE_ARRAY); |
||||
selectedBorderWidthComBox.setSelectedLineStyle(DEFAULT_STYLE.getSelectedBorderLineStyle()); |
||||
selectedBorderColorBox = new ColorSelectBox(COLUMN_WIDTH); |
||||
selectedBorderColorBox.setSelectObject(DEFAULT_STYLE.getSelectedBorderColor()); |
||||
selectedFontNameComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
selectedFontNameComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontFamily()); |
||||
selectedFontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); |
||||
selectedFontSizeComboBox.setSelectedItem(DEFAULT_STYLE.getSelectedFontSize()); |
||||
selectedFontColorButton = new UIColorButton(); |
||||
selectedFontColorButton.setColor(DEFAULT_STYLE.getSelectedFontColor()); |
||||
selectedFontItalicButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
selectedFontItalicButton.setSelected(DEFAULT_STYLE.isSelectedFontItalic()); |
||||
selectedFontBoldButton = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
selectedFontBoldButton.setSelected(DEFAULT_STYLE.isSelectedFontBold()); |
||||
|
||||
JPanel opacityPane = new JPanel(new BorderLayout(0, 0)); |
||||
JPanel jp = FRGUIPaneFactory.createNColumnGridInnerContainer_Pane(2, 5, 0); |
||||
jp.add(selectedOpacityDragBar); |
||||
jp.add(selectedOpacitySpinner); |
||||
opacityPane.add(jp, BorderLayout.CENTER); |
||||
|
||||
JPanel fontExtraPane = TableLayoutHelper.createGapTableLayoutPane( |
||||
new JComponent[][]{{selectedFontSizeComboBox, selectedFontColorButton, selectedFontItalicButton, selectedFontBoldButton}}, |
||||
new double[]{COLUMN_HEIGHT}, |
||||
new double[]{p, p, p, p}, |
||||
7, 0 |
||||
); |
||||
|
||||
double[] rowSize = {COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT, COLUMN_HEIGHT}; |
||||
double[] columnSize = {p, COLUMN_WIDTH, p}; |
||||
|
||||
JPanel selectedStateStyleSettingsPanel = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Background_Color") + ":", SwingConstants.RIGHT), |
||||
selectedBackgroundColorBox |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Opacity") + ":", SwingConstants.RIGHT), |
||||
opacityPane, |
||||
new UILabel("%") |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Width") + ":", SwingConstants.RIGHT), |
||||
selectedBorderWidthComBox |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Border_Color") + ":", SwingConstants.RIGHT), |
||||
selectedBorderColorBox |
||||
}, |
||||
{ |
||||
new UILabel(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Font") + ":", SwingConstants.RIGHT), |
||||
selectedFontNameComboBox, |
||||
fontExtraPane |
||||
} |
||||
}, rowSize, columnSize, 5, 10); |
||||
selectedStateStyleSettingsPanel.setBorder(BorderFactory.createEmptyBorder(0, 20, 0, 0)); |
||||
|
||||
JPanel containerPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
containerPane.setBorder( |
||||
GUICoreUtils.createTitledBorder(Toolkit.i18nText("Fine-Design_Mobile_BookMark_Style_Sidebar_Selected_Style"), |
||||
Color.decode("#2F8EF1")) |
||||
); |
||||
containerPane.add(selectedStateStyleSettingsPanel); |
||||
|
||||
return containerPane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileBookMarkStyle ob) { |
||||
SidebarMobileBookMarkStyle style = null; |
||||
if (ob instanceof SidebarMobileBookMarkStyle) { |
||||
style = (SidebarMobileBookMarkStyle) ob; |
||||
} |
||||
if (style == null) { |
||||
return; |
||||
} |
||||
|
||||
buttonWidthSpinner.setValue(style.getWidth()); |
||||
buttonHeightSpinner.setValue(style.getHeight()); |
||||
buttonGapSpinner.setValue(style.getGap()); |
||||
buttonBorderRadiusSpinner.setValue(style.getBorderRadius()); |
||||
|
||||
normalBackgroundColorBox.setSelectObject(style.getBackgroundColor()); |
||||
normalOpacityDragBar.setValue(style.getOpacity()); |
||||
normalOpacitySpinner.setValue(style.getOpacity()); |
||||
normalBorderWidthComBox.setSelectedLineStyle(style.getBorderLineStyle()); |
||||
normalBorderColorBox.setSelectObject(style.getBorderColor()); |
||||
normalFontNameComboBox.setSelectedItem(style.getFontFamily()); |
||||
normalFontSizeComboBox.setSelectedItem(style.getFontSize()); |
||||
normalFontColorButton.setColor(style.getFontColor()); |
||||
normalFontItalicButton.setSelected(style.isFontItalic()); |
||||
normalFontBoldButton.setSelected(style.isFontBold()); |
||||
|
||||
selectedBackgroundColorBox.setSelectObject(style.getSelectedBackgroundColor()); |
||||
selectedOpacityDragBar.setValue(style.getSelectedOpacity()); |
||||
selectedOpacitySpinner.setValue(style.getSelectedOpacity()); |
||||
selectedBorderWidthComBox.setSelectedLineStyle(style.getSelectedBorderLineStyle()); |
||||
selectedBorderColorBox.setSelectObject(style.getSelectedBorderColor()); |
||||
selectedFontNameComboBox.setSelectedItem(style.getSelectedFontFamily()); |
||||
selectedFontSizeComboBox.setSelectedItem(style.getSelectedFontSize()); |
||||
selectedFontColorButton.setColor(style.getSelectedFontColor()); |
||||
selectedFontItalicButton.setSelected(style.isSelectedFontItalic()); |
||||
selectedFontBoldButton.setSelected(style.isSelectedFontBold()); |
||||
} |
||||
|
||||
@Override |
||||
public MobileBookMarkStyle updateBean() { |
||||
SidebarMobileBookMarkStyle style = new SidebarMobileBookMarkStyle(); |
||||
|
||||
style.setWidth((int) buttonWidthSpinner.getValue()); |
||||
style.setHeight((int) buttonHeightSpinner.getValue()); |
||||
style.setGap((int) buttonGapSpinner.getValue()); |
||||
style.setBorderRadius((int) buttonBorderRadiusSpinner.getValue()); |
||||
|
||||
style.setBackgroundColor(normalBackgroundColorBox.getSelectObject()); |
||||
style.setOpacity((int) normalOpacitySpinner.getValue()); |
||||
style.setBorderLineStyle(normalBorderWidthComBox.getSelectedLineStyle()); |
||||
style.setBorderColor(normalBorderColorBox.getSelectObject()); |
||||
if (normalFontNameComboBox.getSelectedItem() != null) { |
||||
style.setFontFamily((String) normalFontNameComboBox.getSelectedItem()); |
||||
} |
||||
if (normalFontSizeComboBox.getSelectedItem() != null) { |
||||
style.setFontSize((Integer) normalFontSizeComboBox.getSelectedItem()); |
||||
} |
||||
style.setFontColor(normalFontColorButton.getColor()); |
||||
style.setFontItalic(normalFontItalicButton.isSelected()); |
||||
style.setFontBold(normalFontBoldButton.isSelected()); |
||||
|
||||
style.setSelectedBackgroundColor(selectedBackgroundColorBox.getSelectObject()); |
||||
style.setSelectedOpacity((int) selectedOpacitySpinner.getValue()); |
||||
style.setSelectedBorderLineStyle(selectedBorderWidthComBox.getSelectedLineStyle()); |
||||
style.setSelectedBorderColor(selectedBorderColorBox.getSelectObject()); |
||||
if (selectedFontNameComboBox.getSelectedItem() != null) { |
||||
style.setSelectedFontFamily((String) selectedFontNameComboBox.getSelectedItem()); |
||||
} |
||||
if (selectedFontSizeComboBox.getSelectedItem() != null) { |
||||
style.setSelectedFontSize((Integer) selectedFontSizeComboBox.getSelectedItem()); |
||||
} |
||||
style.setSelectedFontColor(selectedFontColorButton.getColor()); |
||||
style.setSelectedFontItalic(selectedFontItalicButton.isSelected()); |
||||
style.setSelectedFontBold(selectedFontBoldButton.isSelected()); |
||||
|
||||
return style; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue