zheng
3 years ago
576 changed files with 35766 additions and 2601 deletions
@ -0,0 +1,47 @@
|
||||
package com.fr.design.actions.file; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.locale.InterProviderFactory; |
||||
import com.fr.nx.app.designer.transform.ui.BatchTransformPane; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
import java.awt.Dialog; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* Created by kerry on 2019-12-10 |
||||
*/ |
||||
public class BatchCompileAction extends UpdateAction { |
||||
public BatchCompileAction() { |
||||
this.setMenuKeySet(COMPILE); |
||||
this.setName(getMenuKeySet().getMenuKeySetName() + "..."); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/nx/app/designer/transform/batch_transform.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
BatchTransformPane batchTransformPane = new BatchTransformPane(); |
||||
Dialog dialog = batchTransformPane.showDialog(); |
||||
dialog.setVisible(true); |
||||
} |
||||
|
||||
private static final MenuKeySet COMPILE = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'C'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return InterProviderFactory.getProvider().getLocText("Fine-Plugin_Engine_Batch_Transform"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,49 @@
|
||||
package com.fr.design.actions.server; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.menu.MenuKeySet; |
||||
import com.fr.design.utils.DesignUtils; |
||||
import com.fr.locale.InterProviderFactory; |
||||
import com.fr.nx.app.web.URLConstants; |
||||
import com.fr.stable.StableUtils; |
||||
|
||||
import javax.swing.KeyStroke; |
||||
import java.awt.event.ActionEvent; |
||||
|
||||
/** |
||||
* @author Maksim |
||||
* Created in 2020/11/5 11:44 上午 |
||||
*/ |
||||
public class LocalAnalyzerAction extends UpdateAction { |
||||
|
||||
public LocalAnalyzerAction() { |
||||
this.setMenuKeySet(ANALYZER); |
||||
this.setName(getMenuKeySet().getMenuKeySetName()); |
||||
this.setMnemonic(getMenuKeySet().getMnemonic()); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/nx/app/designer/transform/analyzer.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String path = StableUtils.pathJoin("/nx", URLConstants.ANALYZE_VIEW); |
||||
DesignUtils.visitEnvServerByParameters(path, new String[]{}, new String[]{}); |
||||
} |
||||
|
||||
private static final MenuKeySet ANALYZER = new MenuKeySet() { |
||||
@Override |
||||
public char getMnemonic() { |
||||
return 'R'; |
||||
} |
||||
|
||||
@Override |
||||
public String getMenuName() { |
||||
return InterProviderFactory.getProvider().getLocText("Fine-Plugin-Engine_Analyzer_Menu_Name"); |
||||
} |
||||
|
||||
@Override |
||||
public KeyStroke getKeyStroke() { |
||||
return null; |
||||
} |
||||
}; |
||||
} |
@ -0,0 +1,32 @@
|
||||
package com.fr.design.border; |
||||
|
||||
import com.fr.design.constants.UIConstants; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.border.TitledBorder; |
||||
import java.awt.Color; |
||||
|
||||
public class UITitledMatteBorder extends TitledBorder { |
||||
public static UITitledMatteBorder createTitledTopBorder(String title, Color color) { |
||||
return new UITitledMatteBorder(title, 1, 0, 0, 0, color); |
||||
} |
||||
|
||||
public static UITitledMatteBorder createTitledBorder(String title, Color color) { |
||||
return new UITitledMatteBorder(title, 1, 1, 1, 1, color); |
||||
} |
||||
|
||||
public static UITitledMatteBorder createTitledBorder(String title, int top, int left, int bottom, int right, Color color) { |
||||
return new UITitledMatteBorder(title, top, left, bottom, right, color); |
||||
} |
||||
|
||||
private UITitledMatteBorder(String title, int top, int left, int bottom, int right, Color color) { |
||||
super( |
||||
BorderFactory.createMatteBorder(top, left, bottom, right, UIConstants.TITLED_BORDER_COLOR), |
||||
title, |
||||
TitledBorder.LEADING, |
||||
TitledBorder.TOP, |
||||
null, |
||||
color |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,101 @@
|
||||
package com.fr.design.cell; |
||||
|
||||
import com.fr.base.NameStyle; |
||||
import com.fr.base.ScreenResolution; |
||||
import com.fr.base.Style; |
||||
import com.fr.general.IOUtils; |
||||
|
||||
import javax.swing.JPanel; |
||||
import java.awt.AlphaComposite; |
||||
import java.awt.Color; |
||||
import java.awt.Composite; |
||||
import java.awt.Dimension; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.image.BufferedImage; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/9/3 |
||||
*/ |
||||
public class CellStylePreviewPane extends JPanel { |
||||
|
||||
private static final BufferedImage transparentBackgroundImage = IOUtils.readImage("/com/fr/design/images/transparent_background.png"); |
||||
private final float transparentBackgroundWidth; |
||||
private final float transparentBackgroundHeight; |
||||
private String paintText = "Report"; |
||||
private Style style = Style.DEFAULT_STYLE; |
||||
|
||||
public CellStylePreviewPane() { |
||||
transparentBackgroundWidth = transparentBackgroundImage.getWidth(null); |
||||
transparentBackgroundHeight = transparentBackgroundImage.getHeight(null); |
||||
} |
||||
|
||||
public void setStyle(Style style) { |
||||
this.style = style; |
||||
if (style instanceof NameStyle) { |
||||
paintText = ((NameStyle) style).getName(); |
||||
} |
||||
repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void paint(Graphics g) { |
||||
Graphics2D g2d = (Graphics2D) g; |
||||
|
||||
paintTransparentBackground(g2d, style); |
||||
|
||||
paintCellStyle(g2d, style); |
||||
} |
||||
|
||||
private void paintTransparentBackground(Graphics2D g2d, Style style) { |
||||
Color fontColor = style.getFRFont().getForeground(); |
||||
float g = fontColor.getRed() * 0.299F + fontColor.getGreen() * 0.587F * fontColor.getBlue() * 0.114F; |
||||
float alpha = 1.0F; |
||||
if (g < 50) { |
||||
alpha = 0.2F; |
||||
} else if (g < 160){ |
||||
alpha = 0.5F; |
||||
} |
||||
|
||||
float scaleWidth = 1.0F * getWidth() / transparentBackgroundWidth; |
||||
float scaleHeight = 1.0F * getHeight() / transparentBackgroundHeight; |
||||
float maxScale = Math.max(scaleWidth, scaleHeight); |
||||
|
||||
if (maxScale <= 1) { |
||||
scaleWidth = scaleHeight = 1; |
||||
} else { |
||||
scaleHeight = scaleWidth = maxScale; |
||||
} |
||||
|
||||
Composite oldComposite = g2d.getComposite(); |
||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); |
||||
g2d.drawImage(transparentBackgroundImage, 0, 0, (int) (transparentBackgroundWidth * scaleWidth), (int) (transparentBackgroundHeight * scaleHeight), null); |
||||
g2d.setComposite(oldComposite); |
||||
} |
||||
|
||||
private void paintCellStyle(Graphics2D g2d, Style style) { |
||||
int resolution = ScreenResolution.getScreenResolution(); |
||||
|
||||
int width = getWidth(); |
||||
int height = getHeight(); |
||||
|
||||
if (style == Style.DEFAULT_STYLE) { |
||||
// 如果是默认的style,就只写"Report"上去
|
||||
Style.paintContent(g2d, paintText, style, width, height, resolution); |
||||
return; |
||||
} |
||||
|
||||
Style.paintBackground(g2d, style, width, height); |
||||
|
||||
Style.paintContent(g2d, paintText, style, width, height, resolution); |
||||
|
||||
Style.paintBorder(g2d, style, width, height); |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getMinimumSize() { |
||||
return getPreferredSize(); |
||||
} |
||||
} |
@ -0,0 +1,136 @@
|
||||
package com.fr.design.data; |
||||
|
||||
import com.fr.base.io.IOFile; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.esd.core.strategy.config.StrategyConfig; |
||||
import com.fr.esd.core.strategy.config.StrategyConfigHelper; |
||||
import com.fr.esd.core.strategy.config.service.StrategyConfigService; |
||||
import com.fr.esd.core.strategy.persistence.StrategyConfigsAttr; |
||||
import com.fr.esd.event.DSMapping; |
||||
import com.fr.esd.event.DsNameTarget; |
||||
import com.fr.esd.event.StrategyEventsNotifier; |
||||
import com.fr.esd.event.xml.XMLSavedHook; |
||||
import com.fr.file.FILE; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
import com.fr.workspace.WorkContext; |
||||
|
||||
import java.util.HashMap; |
||||
import java.util.HashSet; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* @author rinoux |
||||
* @version 10.0 |
||||
* Created by rinoux on 2020/10/28 |
||||
*/ |
||||
public class StrategyConfigAttrUtils { |
||||
|
||||
/** |
||||
* 获取当前编辑模版的数据集缓存配置属性 |
||||
* |
||||
* @return |
||||
*/ |
||||
private static StrategyConfigsAttr getStrategyConfigsAttr() { |
||||
StrategyConfigsAttr attr; |
||||
JTemplate<?, ?> jTemplate = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (jTemplate != null) { |
||||
IOFile ioFile = (IOFile) jTemplate.getTarget(); |
||||
|
||||
attr = ioFile.getAttrMark(StrategyConfigsAttr.ATTR_MARK); |
||||
if (attr == null) { |
||||
attr = new StrategyConfigsAttr(); |
||||
ioFile.addAttrMark(attr); |
||||
} |
||||
|
||||
//新建模版此时不存在,不需要注册钩子
|
||||
if (attr.getXmlSavedHook() == null && WorkContext.getWorkResource().exist(jTemplate.getPath())) { |
||||
attr.setXmlSavedHook(new StrategyConfigsAttrSavedHook(jTemplate.getPath(), attr)); |
||||
} |
||||
return attr; |
||||
} else { |
||||
throw new IllegalStateException("[ESD]No editing template found."); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取模版数据集配置 |
||||
* |
||||
* @param dsName |
||||
* @return |
||||
*/ |
||||
public static StrategyConfig getStrategyConfig(String dsName) { |
||||
|
||||
return getStrategyConfigsAttr().getStrategyConfig(dsName); |
||||
} |
||||
|
||||
/** |
||||
* 移除模版数据集配置 |
||||
* |
||||
* @param dsName |
||||
* @return |
||||
*/ |
||||
public static StrategyConfig removeStrategyConfig(String dsName) { |
||||
|
||||
return getStrategyConfigsAttr().removeStrategyConfig(dsName); |
||||
} |
||||
|
||||
/** |
||||
* 添加模版数据集配置 |
||||
* |
||||
* @param strategyConfig |
||||
*/ |
||||
public static void addStrategyConfig(StrategyConfig strategyConfig) { |
||||
|
||||
getStrategyConfigsAttr().addStrategyConfig(strategyConfig); |
||||
} |
||||
|
||||
|
||||
private static class StrategyConfigsAttrSavedHook implements XMLSavedHook<StrategyConfigsAttr> { |
||||
|
||||
private static final long serialVersionUID = -8843201977112289321L; |
||||
|
||||
private final String tplPath; |
||||
private final Map<String, StrategyConfig> origStrategyConfigs; |
||||
|
||||
public StrategyConfigsAttrSavedHook(String tplPath, StrategyConfigsAttr raw) { |
||||
this.tplPath = tplPath; |
||||
this.origStrategyConfigs = new HashMap<>(); |
||||
this.initOrigStrategyConfigs(raw); |
||||
} |
||||
|
||||
|
||||
private void initOrigStrategyConfigs(StrategyConfigsAttr raw) { |
||||
origStrategyConfigs.clear(); |
||||
raw.getStrategyConfigs().forEach((k, v) -> { |
||||
try { |
||||
origStrategyConfigs.put(k, v.clone()); |
||||
} catch (CloneNotSupportedException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
@Override |
||||
public void doAfterSaved(StrategyConfigsAttr saved) { |
||||
|
||||
FineLoggerFactory.getLogger().info("[ESD]Write StrategyConfigsAttr done, now check change."); |
||||
Set<String> dsNames = new HashSet<>(); |
||||
dsNames.addAll(origStrategyConfigs.keySet()); |
||||
dsNames.addAll(saved.getStrategyConfigs().keySet()); |
||||
|
||||
if (StringUtils.isNotEmpty(tplPath)) { |
||||
dsNames.forEach(dsName -> { |
||||
if (StringUtils.isNotEmpty(dsName)) { |
||||
StrategyEventsNotifier.compareAndFireConfigEvents(origStrategyConfigs.get(dsName), saved.getStrategyConfig(dsName), new DSMapping(tplPath, new DsNameTarget(dsName))); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
initOrigStrategyConfigs(saved); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,226 @@
|
||||
package com.fr.design.data.datapane; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.ActionLabel; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.esd.common.CacheConstants; |
||||
import com.fr.esd.core.strategy.config.StrategyConfig; |
||||
import com.fr.esd.core.strategy.config.StrategyConfigHelper; |
||||
import com.fr.esd.util.ESDUtils; |
||||
import com.fr.locale.InterProviderFactory; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.AbstractAction; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Color; |
||||
import java.awt.Component; |
||||
import java.awt.Desktop; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.net.URI; |
||||
import java.util.ArrayList; |
||||
import java.util.Collections; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author rinoux |
||||
* @version 10.0 |
||||
* Created by rinoux on 2020/7/22 |
||||
*/ |
||||
public class ESDStrategyConfigPane extends BasicBeanPane<StrategyConfig> { |
||||
private static final String CRON_HELP_URL = "http://help.fanruan.com/finereport/doc-view-693.html"; |
||||
|
||||
private UIRadioButton selectAutoUpdate; |
||||
private UIRadioButton selectBySchema; |
||||
private UICheckBox shouldEvolve; |
||||
private UILabel updateIntervalCheckTips; |
||||
private UITextField updateInterval; |
||||
private UITextField schemaTime; |
||||
private ActionLabel actionLabel; |
||||
private UILabel schemaTimeCheckTips; |
||||
private final boolean global; |
||||
private StrategyConfig strategyConfig; |
||||
|
||||
|
||||
public ESDStrategyConfigPane(boolean global) { |
||||
this.global = global; |
||||
init(); |
||||
} |
||||
|
||||
private void init() { |
||||
setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
||||
|
||||
this.selectAutoUpdate = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Every_Interval")); |
||||
|
||||
this.updateInterval = new UITextField(4); |
||||
this.shouldEvolve = new UICheckBox(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Auto_Evolved_Strategy"), false); |
||||
this.shouldEvolve.setEnabled(false); |
||||
this.updateIntervalCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Interval_Format")); |
||||
this.updateIntervalCheckTips.setForeground(Color.RED); |
||||
this.updateIntervalCheckTips.setVisible(false); |
||||
|
||||
this.selectBySchema = new UIRadioButton(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron")); |
||||
this.schemaTime = new UITextField(10); |
||||
this.schemaTimeCheckTips = new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Error_Time_Format")); |
||||
this.schemaTimeCheckTips.setVisible(false); |
||||
this.schemaTimeCheckTips.setForeground(Color.RED); |
||||
|
||||
|
||||
this.selectAutoUpdate.addActionListener(new AbstractAction() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
ESDStrategyConfigPane.this.selectBySchema.setSelected(!ESDStrategyConfigPane.this.selectAutoUpdate.isSelected()); |
||||
ESDStrategyConfigPane.this.schemaTime.setEnabled(false); |
||||
ESDStrategyConfigPane.this.updateInterval.setEnabled(true); |
||||
ESDStrategyConfigPane.this.shouldEvolve.setEnabled(true); |
||||
} |
||||
}); |
||||
|
||||
this.selectBySchema.addActionListener(new AbstractAction() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
ESDStrategyConfigPane.this.selectAutoUpdate.setSelected(!ESDStrategyConfigPane.this.selectBySchema.isSelected()); |
||||
ESDStrategyConfigPane.this.schemaTime.setEnabled(true); |
||||
ESDStrategyConfigPane.this.updateInterval.setEnabled(false); |
||||
ESDStrategyConfigPane.this.shouldEvolve.setEnabled(false); |
||||
} |
||||
}); |
||||
|
||||
JPanel pane = FRGUIPaneFactory.createVerticalTitledBorderPane(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Update_Strategy")); |
||||
add(pane, BorderLayout.NORTH); |
||||
|
||||
JPanel row1 = GUICoreUtils.createFlowPane(new Component[]{ |
||||
this.selectAutoUpdate, |
||||
this.updateInterval, |
||||
new UILabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Minute_Update_Cache")), |
||||
this.shouldEvolve, |
||||
this.updateIntervalCheckTips |
||||
}, 0, 5); |
||||
pane.add(row1); |
||||
|
||||
ActionLabel actionLabel = new ActionLabel(InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cron_Help")); |
||||
actionLabel.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
try { |
||||
Desktop.getDesktop().browse(new URI(CRON_HELP_URL)); |
||||
} catch (Exception exp) { |
||||
FineLoggerFactory.getLogger().error(exp.getMessage(), e); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
JPanel row2 = GUICoreUtils.createFlowPane(new Component[]{ |
||||
this.selectBySchema, |
||||
this.schemaTime, |
||||
actionLabel, |
||||
this.schemaTimeCheckTips |
||||
}, 0, 5); |
||||
pane.add(row2); |
||||
} |
||||
|
||||
|
||||
public void populateBean(StrategyConfig ob) { |
||||
|
||||
if (ob == null && !global) { |
||||
ob = StrategyConfigHelper.createStrategyConfig(true, false, true); |
||||
} |
||||
this.strategyConfig = ob; |
||||
|
||||
this.updateInterval.setText(ob.getUpdateInterval() <= 0 ? "0" : String.valueOf(ob.getUpdateInterval() / (double) CacheConstants.MILLIS_OF_MINUTE)); |
||||
this.schemaTime.setText(StringUtils.join(",", ob.getUpdateSchema().toArray(new String[0]))); |
||||
this.shouldEvolve.setSelected(ob.shouldEvolve()); |
||||
this.selectBySchema.setSelected(ob.isScheduleBySchema()); |
||||
this.selectAutoUpdate.setSelected(!ob.isScheduleBySchema()); |
||||
|
||||
if (global) { |
||||
//使用全局配置,禁用面板编辑
|
||||
disablePane(); |
||||
} else { |
||||
setSchemaEnable(!this.selectAutoUpdate.isSelected()); |
||||
} |
||||
} |
||||
|
||||
|
||||
private void disablePane() { |
||||
this.selectAutoUpdate.setEnabled(false); |
||||
this.updateInterval.setEnabled(false); |
||||
this.shouldEvolve.setEnabled(false); |
||||
|
||||
this.selectBySchema.setEnabled(false); |
||||
this.schemaTime.setEnabled(false); |
||||
} |
||||
|
||||
private void setSchemaEnable(boolean enable) { |
||||
this.updateInterval.setEnabled(!enable); |
||||
this.shouldEvolve.setEnabled(!enable); |
||||
|
||||
this.schemaTime.setEnabled(enable); |
||||
} |
||||
|
||||
|
||||
public StrategyConfig updateBean() { |
||||
StrategyConfig config = null; |
||||
if (!this.global) { |
||||
try { |
||||
//这里是new的config
|
||||
config = this.strategyConfig.clone(); |
||||
|
||||
if (this.selectBySchema.isSelected()) { |
||||
List<String> schemaTimes = new ArrayList<>(); |
||||
String text = this.schemaTime.getText(); |
||||
|
||||
if (ESDUtils.checkUpdateTimeSchema(text)) { |
||||
if (ESDUtils.isCronExpression(text)) { |
||||
schemaTimes.add(text); |
||||
} else { |
||||
Collections.addAll(schemaTimes, text.split(",")); |
||||
} |
||||
} else { |
||||
this.schemaTimeCheckTips.setVisible(true); |
||||
throw new IllegalArgumentException("[ESD]Update schema time format error."); |
||||
} |
||||
config.setScheduleBySchema(true); |
||||
config.setUpdateSchema(schemaTimes); |
||||
} else { |
||||
String interval = this.updateInterval.getText(); |
||||
if (checkUpdateInterval(interval)) { |
||||
long intervalMillis = StringUtils.isEmpty(interval) ? 0 : (long) (Double.parseDouble(interval) * CacheConstants.MILLIS_OF_MINUTE); |
||||
config.setUpdateInterval(intervalMillis); |
||||
} else { |
||||
this.updateIntervalCheckTips.setVisible(true); |
||||
throw new IllegalArgumentException("[ESD]Error update interval format."); |
||||
} |
||||
|
||||
config.setShouldEvolve(this.shouldEvolve.isSelected()); |
||||
config.setScheduleBySchema(false); |
||||
} |
||||
} catch (CloneNotSupportedException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
} |
||||
|
||||
return config; |
||||
} |
||||
|
||||
|
||||
private boolean checkUpdateInterval(String intervalValue) { |
||||
try { |
||||
return !StringUtils.isEmpty(intervalValue) && !(Double.parseDouble(intervalValue) <= 0); |
||||
} catch (NumberFormatException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
|
||||
return false; |
||||
} |
||||
|
||||
|
||||
protected String title4PopupWindow() { |
||||
return InterProviderFactory.getDesignI18nProvider().i18nText("Fine-Design_ESD_Cache_Strategy_Config_Title"); |
||||
} |
||||
} |
@ -0,0 +1,48 @@
|
||||
package com.fr.design.data.datapane.connect; |
||||
|
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.editlock.EditLockUtils; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.file.ConnectionConfig; |
||||
import com.fr.report.LockItem; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 11.0 |
||||
* Created by hades on 2021/9/8 |
||||
*/ |
||||
public class ConnectionListDialogActionAdapter extends DialogActionAdapter { |
||||
|
||||
private final ConnectionManagerPane connectionManagerPane; |
||||
private final BasicDialog connectionListDialog; |
||||
private final ConnectionConfig connectionConfig; |
||||
|
||||
public ConnectionListDialogActionAdapter(ConnectionManagerPane connectionManagerPane, |
||||
BasicDialog connectionListDialog, |
||||
ConnectionConfig connectionConfig) { |
||||
this.connectionManagerPane = connectionManagerPane; |
||||
this.connectionListDialog = connectionListDialog; |
||||
this.connectionConfig = connectionConfig; |
||||
} |
||||
|
||||
@Override |
||||
public void doOk() { |
||||
if (!connectionManagerPane.isNamePermitted()) { |
||||
connectionListDialog.setDoOKSucceed(false); |
||||
return; |
||||
} |
||||
connectionManagerPane.update(connectionConfig); |
||||
DesignerContext.getDesignerBean("databasename").refreshBeanElement(); |
||||
// 关闭定义数据连接页面,为其解锁
|
||||
EditLockUtils.unlock(LockItem.CONNECTION); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void doCancel() { |
||||
// 关闭定义数据连接页面,为其解锁
|
||||
super.doCancel(); |
||||
EditLockUtils.unlock(LockItem.CONNECTION); |
||||
} |
||||
} |
@ -0,0 +1,37 @@
|
||||
package com.fr.design.data.tabledata.strategy; |
||||
|
||||
import com.fr.esd.core.strategy.config.StrategyConfig; |
||||
import com.fr.esd.query.StrategicTableData; |
||||
|
||||
/** |
||||
* @author rinoux |
||||
* @version 10.0 |
||||
* Created by rinoux on 2021/3/19 |
||||
*/ |
||||
public abstract class StrategyConfigHandler<T extends StrategicTableData> { |
||||
|
||||
private final T tableData; |
||||
|
||||
public StrategyConfigHandler(T tableData) { |
||||
this.tableData = tableData; |
||||
} |
||||
|
||||
protected T getTableData() { |
||||
return tableData; |
||||
} |
||||
|
||||
/** |
||||
* 查找配置 |
||||
* |
||||
* @return 缓存配置 |
||||
*/ |
||||
public abstract StrategyConfig find(); |
||||
|
||||
|
||||
/** |
||||
* 保存配置 |
||||
* |
||||
* @param config 缓存配置 |
||||
*/ |
||||
public abstract void save(T saved, StrategyConfig config); |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.data.tabledata.tabledatapane.db; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
|
||||
public enum StrategyConfigFrom { |
||||
GLOBAL(0, Toolkit.i18nText("Fine-Design_ESD_Use_Global_Settings")), |
||||
|
||||
INDIVIDUAL(1, Toolkit.i18nText("Fine-Design_ESD_Use_Individual_Settings")); |
||||
|
||||
int index; |
||||
|
||||
String displayText; |
||||
|
||||
StrategyConfigFrom(int index, String displayText) { |
||||
this.index = index; |
||||
this.displayText = displayText; |
||||
} |
||||
|
||||
|
||||
public int getIndex() { |
||||
return this.index; |
||||
} |
||||
|
||||
|
||||
public String getDisplayText() { |
||||
return this.displayText; |
||||
} |
||||
|
||||
|
||||
public String toString() { |
||||
return getDisplayText(); |
||||
} |
||||
} |
@ -0,0 +1,54 @@
|
||||
package com.fr.design.formula; |
||||
|
||||
import com.fr.parser.BinaryExpression; |
||||
import com.fr.parser.DatasetFunctionCall; |
||||
import com.fr.parser.FunctionCall; |
||||
import com.fr.stable.script.Node; |
||||
|
||||
import java.util.Arrays; |
||||
|
||||
/** |
||||
* @author Hoky |
||||
* @date 2021/8/30 |
||||
*/ |
||||
public class UnsupportedFormulaScanner { |
||||
public final static String[] UNSUPPORTED_FORMULAS = new String[]{"PROPORTION", "TOIMAGE", |
||||
"WEBIMAGE", "SORT", "CROSSLAYERTOTAL", "CIRCULAR", "LAYERTOTAL", "MOM", "HIERARCHY", |
||||
"FILENAME", "FILESIZE", "FILETYPE", "TREELAYER", "GETUSERDEPARTMENTS", "GETUSERJOBTITLES"}; |
||||
|
||||
private String unSupportFormula = ""; |
||||
|
||||
public boolean travelFormula(Node node) { |
||||
if (node instanceof FunctionCall) { |
||||
if (isUnsupportedFomula(((FunctionCall) node).getName())) { |
||||
unSupportFormula = ((FunctionCall) node).getName(); |
||||
return false; |
||||
} else { |
||||
for (Node argument : ((FunctionCall) node).getArguments()) { |
||||
if (!travelFormula(argument)) { |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
} else if (node instanceof BinaryExpression) { |
||||
for (Node array : ((BinaryExpression) node).getNodes()) { |
||||
if (!travelFormula(array)) { |
||||
return false; |
||||
} |
||||
} |
||||
} else if (node instanceof DatasetFunctionCall) { |
||||
DatasetFunctionCall datasetFunctionCall = (DatasetFunctionCall) node; |
||||
unSupportFormula = datasetFunctionCall.getSourceName() + "." + datasetFunctionCall.getFnName() + "()"; |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
public String getUnSupportFormula() { |
||||
return unSupportFormula; |
||||
} |
||||
|
||||
private static boolean isUnsupportedFomula(String formula) { |
||||
return Arrays.asList(UNSUPPORTED_FORMULAS).contains(formula.toUpperCase()); |
||||
} |
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.fun; |
||||
|
||||
import com.fr.stable.fun.mark.Mutable; |
||||
|
||||
|
||||
public interface PcFitProvider extends Mutable { |
||||
String XML_TAG = "PcFitProvider"; |
||||
int CURRENT_LEVEL = 1; |
||||
|
||||
//设计器上看到的选项
|
||||
String getContentDisplayValue(); |
||||
|
||||
//返回给前端的值
|
||||
int getContentDisplayKey(); |
||||
|
||||
//设计器上的提示信息
|
||||
String getContentDisplayTip(); |
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.design.fun.PcFitProvider; |
||||
import com.fr.stable.fun.mark.API; |
||||
|
||||
|
||||
@API(level = PcFitProvider.CURRENT_LEVEL) |
||||
public abstract class AbstractPcFitProvider implements PcFitProvider { |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
|
||||
@Override |
||||
public String mark4Provider() { |
||||
return getClass().getName(); |
||||
} |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.fr.design.fun.impl; |
||||
|
||||
import com.fr.file.FILE; |
||||
import com.fr.intelli.record.Focus; |
||||
import com.fr.intelli.record.Original; |
||||
import com.fr.record.analyzer.EnableMetrics; |
||||
|
||||
/** |
||||
* Created by rinoux on 2016/12/16. |
||||
*/ |
||||
@EnableMetrics |
||||
public class DesignerStartWithEmptyFile extends AbstractDesignerStartOpenFileProcessor { |
||||
|
||||
private static final DesignerStartWithEmptyFile INSTANCE = new DesignerStartWithEmptyFile(); |
||||
|
||||
private DesignerStartWithEmptyFile() { |
||||
} |
||||
|
||||
public static DesignerStartWithEmptyFile getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
@Override |
||||
@Focus(id = "com.fr.dzstartemptyfile", text = "Fine_Design_Start_Empty_File", source = Original.REPORT) |
||||
public FILE fileToShow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.gui.ibutton; |
||||
|
||||
import com.fr.design.gui.ipoppane.PopupHider; |
||||
import com.fr.design.style.color.ColorControlWindow; |
||||
|
||||
import javax.swing.Icon; |
||||
|
||||
|
||||
public class UINoThemeColorButton extends UIColorButton{ |
||||
|
||||
public UINoThemeColorButton(Icon icon) { |
||||
super(icon); |
||||
} |
||||
|
||||
protected ColorControlWindow initColorControlWindow(){ |
||||
return new NoThemeColorControlWindow(this); |
||||
} |
||||
|
||||
private class NoThemeColorControlWindow extends ColorControlWindow{ |
||||
|
||||
|
||||
public NoThemeColorControlWindow(PopupHider popupHider) { |
||||
super(popupHider); |
||||
} |
||||
|
||||
protected boolean supportThemeColor(){ |
||||
return false; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
protected void colorChanged() { |
||||
UINoThemeColorButton.this.setColor(this.getColor()); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.general.act.BorderPacker; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/11 |
||||
*/ |
||||
public abstract class AbstractBorderPackerPane extends BasicPane { |
||||
|
||||
public abstract void populateBean(BorderPacker style); |
||||
public abstract void updateBean(BorderPacker style); |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,99 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.frpane.UIPercentDragPane; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; |
||||
import com.fr.general.Background; |
||||
import com.fr.general.act.BackgroundPacker; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/11 |
||||
*/ |
||||
public abstract class AbstractTranslucentBackgroundSpecialPane<T extends BackgroundPacker> extends BasicPane { |
||||
|
||||
private final int uiLabelWidth; |
||||
private final int uiSettingWidth; |
||||
// 背景名称:如主题背景 或 标题背景
|
||||
private final String backgroundName; |
||||
// 背景
|
||||
protected BackgroundSpecialPane backgroundPane = new LayoutBackgroundSpecialPane(); |
||||
// 背景透明度
|
||||
protected UIPercentDragPane opacityPane = new UIPercentDragPane(); |
||||
|
||||
public AbstractTranslucentBackgroundSpecialPane(int uiLabelWidth, int uiSettingWidth, String backgroundName) { |
||||
this.uiLabelWidth = uiLabelWidth; |
||||
this.uiSettingWidth = uiSettingWidth; |
||||
this.backgroundName = backgroundName; |
||||
this.initializePane(); |
||||
} |
||||
|
||||
private void initializePane() { |
||||
setLayout(new BorderLayout(0, 0)); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] columnSize = {this.uiLabelWidth, this.uiSettingWidth > 0 ? this.uiSettingWidth : f}; |
||||
|
||||
// 确保BackgroundSpecialPane高度变化时,Label依然保持与其顶部对齐
|
||||
JPanel backgroundLabelPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
backgroundLabelPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); |
||||
backgroundLabelPane.add(new UILabel(backgroundName), BorderLayout.NORTH); |
||||
|
||||
JPanel backgroundComposedPane = TableLayoutHelper.createGapTableLayoutPane( |
||||
new JComponent[][]{ |
||||
{backgroundLabelPane, backgroundPane} |
||||
}, |
||||
new double[]{p}, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); |
||||
|
||||
JPanel opacityComposedPane = TableLayoutHelper.createGapTableLayoutPane( |
||||
new JComponent[][]{ |
||||
{new UILabel(""), new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Alpha"))}, |
||||
{new UILabel(""), opacityPane} |
||||
}, |
||||
new double[]{p, p}, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); |
||||
opacityComposedPane.setBorder(BorderFactory.createEmptyBorder(IntervalConstants.INTERVAL_L1, 0, 0, 0)); |
||||
opacityComposedPane.setVisible(false); |
||||
|
||||
backgroundPane.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
Background background = backgroundPane.update(); |
||||
opacityComposedPane.setVisible(background != null); |
||||
} |
||||
}); |
||||
|
||||
add(backgroundComposedPane, BorderLayout.NORTH, 0); |
||||
add(opacityComposedPane, BorderLayout.CENTER, 1); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
public abstract void populateBean(T style); |
||||
|
||||
public abstract void updateBean(T style); |
||||
|
||||
protected static class LayoutBackgroundSpecialPane extends BackgroundSpecialPane { |
||||
@Override |
||||
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { |
||||
return new GradientBackgroundQuickPane(140); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.general.act.BorderPacker; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/11 |
||||
*/ |
||||
public class ComponentBodyStylePane extends AbstractTranslucentBackgroundSpecialPane<BorderPacker> { |
||||
|
||||
public ComponentBodyStylePane(int uiLabelWidth) { |
||||
this(uiLabelWidth, -1); |
||||
} |
||||
|
||||
public ComponentBodyStylePane(int uiLabelWidth, int uiSettingWidth) { |
||||
super(uiLabelWidth, uiSettingWidth, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget-Style_Body_Fill")); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(BorderPacker style) { |
||||
this.backgroundPane.populateBean(style.getBackground()); |
||||
if (this.opacityPane != null) { |
||||
this.opacityPane.populateBean(style.getAlpha()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(BorderPacker style) { |
||||
style.setBackground(backgroundPane.update()); |
||||
style.setAlpha((float)opacityPane.updateBean()); |
||||
} |
||||
} |
@ -0,0 +1,109 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.general.act.BorderPacker; |
||||
|
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/11 |
||||
*/ |
||||
public class ComponentIntegralStylePane extends AbstractBorderPackerPane { |
||||
public static final String[] BORDER_STYLE = new String[]{ |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Common"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Shadow") |
||||
}; |
||||
|
||||
//渲染风格:有无阴影
|
||||
protected UIComboBox borderStyleCombo; |
||||
// 含图片类型边框的边框配置面板(图片类型边框 + 阴影时存在默认的阴影颜色)
|
||||
protected TranslucentBorderSpecialPane borderPane; |
||||
//边框圆角或圆角裁剪
|
||||
protected UISpinner cornerSpinner; |
||||
|
||||
private final int uiLabelWidth; |
||||
private final int uiSettingWidth; |
||||
private final boolean supportBorderImage; |
||||
private final boolean supportCornerRadius; |
||||
|
||||
public ComponentIntegralStylePane(int uiLabelWidth, |
||||
boolean supportBorderImage, boolean supportCornerRadius) { |
||||
this(uiLabelWidth, -1, supportBorderImage, supportCornerRadius); |
||||
} |
||||
|
||||
public ComponentIntegralStylePane(int uiLabelWidth, int uiSettingWidth) { |
||||
this(uiLabelWidth, uiSettingWidth, true, true); |
||||
} |
||||
|
||||
public ComponentIntegralStylePane( |
||||
int uiLabelWidth, int uiSettingWidth, |
||||
boolean supportBorderImage, boolean supportCornerRadius) { |
||||
this.uiLabelWidth = uiLabelWidth; |
||||
this.uiSettingWidth = uiSettingWidth; |
||||
this.supportBorderImage = supportBorderImage; |
||||
this.supportCornerRadius = supportCornerRadius; |
||||
|
||||
this.initializePane(); |
||||
} |
||||
|
||||
private void initializeComponents() { |
||||
borderStyleCombo = new UIComboBox(BORDER_STYLE); |
||||
borderPane = new TranslucentBorderSpecialPane(this.supportBorderImage); |
||||
cornerSpinner = new UISpinner(0,1000,1,0); |
||||
} |
||||
|
||||
protected void initializePane() { |
||||
setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.initializeComponents(); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] rowSize = supportCornerRadius ? new double[] {p, p, p} : new double[]{p, p}; |
||||
double[] columnSize = {this.uiLabelWidth, this.uiSettingWidth > 0 ? this.uiSettingWidth : f}; |
||||
|
||||
JPanel content = TableLayoutHelper.createGapTableLayoutPane(new JComponent[][]{ |
||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Render_Style")), borderStyleCombo}, |
||||
{this.borderPane, null}, |
||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Report_Radius")), cornerSpinner}, |
||||
}, |
||||
rowSize, columnSize, IntervalConstants.INTERVAL_L1, IntervalConstants.INTERVAL_L1); |
||||
|
||||
this.add(content, BorderLayout.NORTH); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(BorderPacker style) { |
||||
if (this.borderStyleCombo != null) { |
||||
this.borderStyleCombo.setSelectedIndex(style.getBorderStyle()); |
||||
} |
||||
if (cornerSpinner != null) { |
||||
this.cornerSpinner.setValue(style.getBorderRadius()); |
||||
} |
||||
if (this.borderPane != null) { |
||||
this.borderPane.populateBean(style); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(BorderPacker style) { |
||||
if (borderStyleCombo != null) { |
||||
style.setBorderStyle(borderStyleCombo.getSelectedIndex()); |
||||
} |
||||
if (cornerSpinner != null) { |
||||
style.setBorderRadius((int) cornerSpinner.getValue()); |
||||
} |
||||
if (borderPane != null) { |
||||
borderPane.updateBean(style); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,351 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.base.Utils; |
||||
import com.fr.base.svg.IconUtils; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.TableLayout; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.form.ui.LayoutBorderStyle; |
||||
import com.fr.form.ui.WidgetTitle; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.general.IOUtils; |
||||
import com.fr.general.act.BorderPacker; |
||||
import com.fr.general.act.TitlePacker; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.Icon; |
||||
import javax.swing.JComponent; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.Font; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/11 |
||||
*/ |
||||
public class ComponentTitleStylePane extends AbstractBorderPackerPane { |
||||
private static final Dimension BUTTON_SIZE = new Dimension(20, 20); |
||||
public static final TitlePacker DEFAULT_TITLE_PACKER = new WidgetTitle(); |
||||
|
||||
// 标题可见
|
||||
protected UICheckBox visibleCheckbox; |
||||
//标题文字内容
|
||||
protected TinyFormulaPane textContentPane; |
||||
//标题字体格式
|
||||
protected UIComboBox fontFamilyComboBox; |
||||
//标题字体大小
|
||||
protected UIComboBox fontSizeComboBox; |
||||
//标题字体颜色
|
||||
protected UIColorButton fontColorSelectPane; |
||||
//标题字体特殊效果:粗体、斜体、下划线
|
||||
private UIToggleButton fontBoldButton; |
||||
private UIToggleButton fontItalicButton; |
||||
private UIToggleButton fontUnderlineButton; |
||||
// 标题图文混排
|
||||
protected TextInsetImageBackgroundSpecialPane insetImagePane; |
||||
//对齐方式
|
||||
protected UIButtonGroup alignPane; |
||||
//标题整体背景
|
||||
protected TitleTranslucentBackgroundSpecialPane backgroundPane; |
||||
|
||||
// 是否支持用户编辑这些属性(不支持时: 设置面板总是不可见)
|
||||
private boolean isSupportTitleVisible = true; |
||||
private boolean isSupportTitleContent = true; |
||||
private boolean isSupportTitleOtherSetting = true; |
||||
|
||||
// 用于控制各部分设置的可见性
|
||||
private JPanel titleVisiblePane; |
||||
private JPanel titleContentPane; |
||||
private JPanel titleOtherSettingPane; |
||||
|
||||
private final int uiLabelWidth; |
||||
private final int uiSettingWidth; |
||||
|
||||
public ComponentTitleStylePane(int uiLabelWidth) { |
||||
this(uiLabelWidth, -1); |
||||
} |
||||
|
||||
public ComponentTitleStylePane( |
||||
int uiLabelWidth, int uiSettingWidth) { |
||||
this.uiLabelWidth = uiLabelWidth; |
||||
this.uiSettingWidth = uiSettingWidth; |
||||
this.initializePane(); |
||||
} |
||||
|
||||
private void initializeComponents() { |
||||
visibleCheckbox = new UICheckBox(); |
||||
|
||||
textContentPane = new TinyFormulaPane(); |
||||
|
||||
fontFamilyComboBox = new UIComboBox(Utils.getAvailableFontFamilyNames4Report()); |
||||
FRFont frFont = DEFAULT_TITLE_PACKER.getFrFont(); |
||||
if (frFont != null) { |
||||
String fontFamily = frFont.getFamily(); |
||||
// 使用style中默认的字体初始化titleFontFamilyComboBox,保证UI和数据的一致性
|
||||
this.fontFamilyComboBox.setSelectedItem(fontFamily); |
||||
} |
||||
fontFamilyComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Family")); |
||||
|
||||
fontSizeComboBox = new UIComboBox(FRFontPane.FONT_SIZES); |
||||
fontSizeComboBox.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Size")); |
||||
|
||||
fontColorSelectPane = new UIColorButton(); |
||||
fontColorSelectPane.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Foreground")); |
||||
fontColorSelectPane.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Foreground")); |
||||
|
||||
fontBoldButton = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
fontBoldButton.setPreferredSize(BUTTON_SIZE); |
||||
fontBoldButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Bold")); |
||||
fontBoldButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Bold")); |
||||
|
||||
fontItalicButton = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
fontItalicButton.setPreferredSize(BUTTON_SIZE); |
||||
fontItalicButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Italic")); |
||||
fontItalicButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Italic")); |
||||
|
||||
fontUnderlineButton = new UIToggleButton(IOUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); |
||||
fontUnderlineButton.setPreferredSize(BUTTON_SIZE); |
||||
fontUnderlineButton.setGlobalName(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); |
||||
fontUnderlineButton.setToolTipText(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_FRFont_Underline")); |
||||
|
||||
insetImagePane = new TextInsetImageBackgroundSpecialPane(); |
||||
|
||||
alignPane = new UIButtonGroup<>( |
||||
new Icon[]{ |
||||
IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_left_normal.png"), |
||||
IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_center_normal.png"), |
||||
IconUtils.readIcon("/com/fr/design/images/m_format/cellstyle/h_right_normal.png") |
||||
}, |
||||
new Integer[]{Constants.LEFT, Constants.CENTER, Constants.RIGHT}); |
||||
alignPane.setAllToolTips( |
||||
new String[] { |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Left"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Center"), |
||||
com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_StyleAlignment_Right") |
||||
}); |
||||
alignPane.setSelectedItem(DEFAULT_TITLE_PACKER.getPosition()); |
||||
|
||||
backgroundPane = new TitleTranslucentBackgroundSpecialPane(this.uiLabelWidth, this.uiSettingWidth); |
||||
} |
||||
|
||||
private void initializePane() { |
||||
this.setLayout(new BorderLayout(0, 0)); |
||||
this.initializeComponents(); |
||||
|
||||
titleVisiblePane = this.createTitleVisiblePane(); |
||||
titleContentPane = this.createTitleContentPane(); |
||||
titleOtherSettingPane = this.createTitleOtherSettingPane(); |
||||
|
||||
if (isSupportTitleVisible) { |
||||
titleVisiblePane.setVisible(true); |
||||
} |
||||
if (isSupportTitleVisible) { |
||||
titleContentPane.setVisible(false); |
||||
} |
||||
if (isSupportTitleVisible) { |
||||
titleOtherSettingPane.setVisible(false); |
||||
} |
||||
|
||||
addComponents(titleVisiblePane, titleContentPane, titleOtherSettingPane); |
||||
} |
||||
|
||||
private JPanel createTitleVisiblePane() { |
||||
JPanel container = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
|
||||
visibleCheckbox.setSelected(false); |
||||
|
||||
container.add(visibleCheckbox, BorderLayout.WEST); |
||||
container.add(new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Visible")), BorderLayout.CENTER); |
||||
|
||||
visibleCheckbox.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
boolean visible = visibleCheckbox.isSelected(); |
||||
if (titleContentPane != null) { |
||||
titleContentPane.setVisible(visible && isSupportTitleContent); |
||||
} |
||||
if (titleOtherSettingPane != null) { |
||||
titleOtherSettingPane.setVisible(visible && isSupportTitleOtherSetting); |
||||
} |
||||
} |
||||
}); |
||||
return container; |
||||
} |
||||
|
||||
private JPanel createTitleContentPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] rowSize = {p}; |
||||
double[] columnSize = {this.uiLabelWidth, this.uiSettingWidth > 0 ? this.uiSettingWidth : f}; |
||||
|
||||
return TableLayoutHelper.createCommonTableLayoutPane( |
||||
new JComponent[][]{{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Content")), textContentPane}}, |
||||
rowSize, columnSize, IntervalConstants.INTERVAL_L1); |
||||
} |
||||
|
||||
private JPanel createTitleOtherSettingPane() { |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] rowSize = {p, p, p, p, p}; |
||||
double[] columnSize = {this.uiLabelWidth, this.uiSettingWidth > 0 ? this.uiSettingWidth : f}; |
||||
|
||||
JComponent[][] components = new JComponent[][]{ |
||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Format")), fontFamilyComboBox}, |
||||
{null, createTitleFontButtonPane()}, |
||||
{insetImagePane, null}, |
||||
{new UILabel(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Text_Align")), alignPane}, |
||||
{backgroundPane, null} |
||||
}; |
||||
|
||||
return TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, IntervalConstants.INTERVAL_L1); |
||||
} |
||||
|
||||
protected JPanel createTitleFontButtonPane(){ |
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
double[] rowSize = {p}; |
||||
double[] columnSize = {f, p, p, p, p}; |
||||
|
||||
JPanel buttonPane = TableLayoutHelper.createCommonTableLayoutPane( new JComponent[][] { |
||||
{fontSizeComboBox, fontColorSelectPane, fontItalicButton, fontBoldButton, fontUnderlineButton}, |
||||
}, rowSize, columnSize, IntervalConstants.INTERVAL_W0); |
||||
|
||||
JPanel containerPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
containerPane.add(buttonPane, BorderLayout.NORTH); |
||||
|
||||
return containerPane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(BorderPacker style) { |
||||
TitlePacker widgetTitle = style == null ? new WidgetTitle() : style.getTitle(); |
||||
widgetTitle = widgetTitle == null ? new WidgetTitle() : widgetTitle; |
||||
boolean titleVisible = style != null && style.getType() != LayoutBorderStyle.STANDARD; |
||||
visibleCheckbox.setSelected(isSupportTitleVisible && titleVisible); |
||||
titleContentPane.setVisible(isSupportTitleContent && titleVisible); |
||||
titleOtherSettingPane.setVisible(isSupportTitleOtherSetting && titleVisible); |
||||
|
||||
this.textContentPane.populateBean(widgetTitle.getTextObject().toString()); |
||||
|
||||
FRFont frFont = widgetTitle.getFrFont(); |
||||
this.fontSizeComboBox.setSelectedItem(frFont.getSize()); |
||||
this.fontFamilyComboBox.setSelectedItem(frFont.getFamily()); |
||||
this.fontColorSelectPane.setColor(frFont.getForeground()); |
||||
this.fontColorSelectPane.repaint(); |
||||
fontBoldButton.setSelected(frFont.isBold()); |
||||
fontItalicButton.setSelected(frFont.isItalic()); |
||||
|
||||
int line = frFont.getUnderline(); |
||||
if (line == Constants.LINE_NONE) { |
||||
fontUnderlineButton.setSelected(false); |
||||
} else { |
||||
fontUnderlineButton.setSelected(true); |
||||
} |
||||
|
||||
alignPane.setSelectedItem(widgetTitle.getPosition()); |
||||
insetImagePane.populateBean(widgetTitle); |
||||
backgroundPane.populateBean(widgetTitle); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(BorderPacker style) { |
||||
style.setType(visibleCheckbox != null && visibleCheckbox.isSelected() ? LayoutBorderStyle.TITLE : LayoutBorderStyle.STANDARD); |
||||
TitlePacker title = style.getTitle() == null ? new WidgetTitle() : style.getTitle(); |
||||
title.setTextObject(textContentPane.updateBean()); |
||||
FRFont frFont = title.getFrFont(); |
||||
frFont = frFont.applySize((Integer) fontSizeComboBox.getSelectedItem()); |
||||
frFont = frFont.applyName(fontFamilyComboBox.getSelectedItem().toString()); |
||||
frFont = frFont.applyForeground(fontColorSelectPane.getColor()); |
||||
frFont = updateTitleFontItalicBold(frFont); |
||||
int line = fontUnderlineButton.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE; |
||||
frFont = frFont.applyUnderline(line); |
||||
title.setFrFont(frFont); |
||||
title.setPosition((Integer) alignPane.getSelectedItem()); |
||||
insetImagePane.updateBean(title); |
||||
backgroundPane.updateBean(title); |
||||
style.setTitle(title); |
||||
} |
||||
|
||||
private FRFont updateTitleFontItalicBold(FRFont frFont) { |
||||
int italic_bold = frFont.getStyle(); |
||||
boolean isItalic = italic_bold == Font.ITALIC || italic_bold == (Font.BOLD + Font.ITALIC); |
||||
boolean isBold = italic_bold == Font.BOLD || italic_bold == (Font.BOLD + Font.ITALIC); |
||||
if (fontItalicButton.isSelected() && !isItalic) { |
||||
italic_bold += Font.ITALIC; |
||||
} else if (!fontItalicButton.isSelected() && isItalic) { |
||||
italic_bold -= Font.ITALIC; |
||||
} |
||||
frFont = frFont.applyStyle(italic_bold); |
||||
if (fontBoldButton.isSelected() && !isBold) { |
||||
italic_bold += Font.BOLD; |
||||
} else if (!fontBoldButton.isSelected() && isBold) { |
||||
italic_bold -= Font.BOLD; |
||||
} |
||||
frFont = frFont.applyStyle(italic_bold); |
||||
return frFont; |
||||
} |
||||
|
||||
private void addComponents(JComponent... components) { |
||||
if (components == null) { |
||||
return; |
||||
} |
||||
JPanel container = this; |
||||
for (int i = 0; i < components.length; i++) { |
||||
JComponent component = components[i]; |
||||
if (component != null) { |
||||
container.add(component, BorderLayout.NORTH); |
||||
component.setBorder(BorderFactory.createEmptyBorder(i == 0 ? 0 : IntervalConstants.INTERVAL_L1, 0, 0, 0)); |
||||
if (i < components.length - 1) { |
||||
JPanel nextContainer = new JPanel(FRGUIPaneFactory.createBorderLayout()); |
||||
container.add(nextContainer, BorderLayout.CENTER); |
||||
container = nextContainer; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
|
||||
public void setSupportTitleVisible(boolean supporting) { |
||||
isSupportTitleVisible = supporting; |
||||
if (titleVisiblePane != null) { |
||||
titleVisiblePane.setVisible(supporting); |
||||
} |
||||
} |
||||
|
||||
public void setSupportTitleContent(boolean supporting) { |
||||
isSupportTitleContent = supporting; |
||||
if (titleContentPane != null) { |
||||
boolean titleVisible = visibleCheckbox.isSelected(); |
||||
if (isSupportTitleContent) { |
||||
titleContentPane.setVisible(titleVisible); |
||||
} else { |
||||
titleContentPane.setVisible(false); |
||||
} |
||||
} |
||||
} |
||||
|
||||
public void setSupportOtherSetting(boolean supporting) { |
||||
isSupportTitleOtherSetting = supporting; |
||||
if (titleOtherSettingPane != null) { |
||||
boolean titleVisible = visibleCheckbox.isSelected(); |
||||
if (isSupportTitleOtherSetting) { |
||||
titleOtherSettingPane.setVisible(titleVisible); |
||||
} else { |
||||
titleOtherSettingPane.setVisible(false); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,138 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.base.theme.FormTheme; |
||||
import com.fr.base.theme.TemplateTheme; |
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.event.GlobalNameListener; |
||||
import com.fr.design.event.GlobalNameObserver; |
||||
import com.fr.design.event.UIObserver; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.file.HistoryTemplateListCache; |
||||
import com.fr.design.gui.ibutton.UIButtonGroup; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
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.mainframe.JTemplate; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JPanel; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Component; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/19 |
||||
*/ |
||||
public class FollowingThemePane extends BasicPane implements UIObserver { |
||||
public static final int SETTING_LABEL_WIDTH = 60; |
||||
|
||||
public static final String[] FOLLOWING_THEME_STRING_ARRAYS = new String[]{ |
||||
Toolkit.i18nText("Fine-Design_Style_Follow_Theme"), |
||||
Toolkit.i18nText("Fine-Design_Style_Not_Follow_Theme"), |
||||
}; |
||||
|
||||
private final UIButtonGroup<String> followingThemeButtonGroup; |
||||
private final List<FollowingThemeActionChangeListener> changeListeners = new ArrayList<>(); |
||||
private UIObserverListener uiObserverListener; |
||||
|
||||
private JPanel container; |
||||
|
||||
public FollowingThemePane(String name) { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
|
||||
followingThemeButtonGroup = new UIButtonGroup<>(FOLLOWING_THEME_STRING_ARRAYS); |
||||
followingThemeButtonGroup.setSelectedIndex(1); |
||||
followingThemeButtonGroup.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
for (FollowingThemeActionChangeListener changeListener : changeListeners) { |
||||
changeListener.onFollowingTheme(isFollowingTheme()); |
||||
} |
||||
invalidate(); |
||||
|
||||
// 与主题相关的属性面板更新完毕后,再通知外层更新数据
|
||||
if (uiObserverListener != null) { |
||||
uiObserverListener.doChange(); |
||||
} |
||||
} |
||||
}); |
||||
|
||||
UILabel followingThemeLabel = new UILabel(name); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double f = TableLayout.FILL; |
||||
JPanel followingThemePane = |
||||
TableLayoutHelper.createGapTableLayoutPane( new Component[][]{new Component[] { followingThemeLabel, followingThemeButtonGroup}}, |
||||
new double[] { p }, new double[] { SETTING_LABEL_WIDTH, f }, 10, 0); |
||||
followingThemePane.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); |
||||
followingThemePane.setVisible(false); |
||||
|
||||
add(followingThemePane, BorderLayout.NORTH); |
||||
container = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
add(container, BorderLayout.CENTER); |
||||
} |
||||
|
||||
public void addFollowThemePane(JPanel content, FollowingThemeActionChangeListener changeListener) { |
||||
if (content != null) { |
||||
container.add(content, BorderLayout.NORTH); |
||||
changeListeners.add(changeListener); |
||||
|
||||
JPanel nextContainer = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
container.add(nextContainer, BorderLayout.CENTER); |
||||
container = nextContainer; |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void registerChangeListener(UIObserverListener uiObserverListener) { |
||||
this.uiObserverListener = uiObserverListener; |
||||
} |
||||
|
||||
@Override |
||||
public boolean shouldResponseChangeListener() { |
||||
return true; |
||||
} |
||||
|
||||
public interface FollowingThemeActionChangeListener { |
||||
void onFollowingTheme(boolean following); |
||||
} |
||||
|
||||
public TemplateTheme getUsingTheme() { |
||||
JTemplate<?, ?> template = HistoryTemplateListCache.getInstance().getCurrentEditingTemplate(); |
||||
if (template != null) { |
||||
return template.getTemplateTheme(); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
public void supportFollowingTheme(boolean supporting) { |
||||
getComponent(0).setVisible(supporting); |
||||
if (!supporting) { |
||||
setFollowingTheme(false); |
||||
} |
||||
} |
||||
|
||||
public void setFollowingTheme(boolean following) { |
||||
followingThemeButtonGroup.setSelectedIndex(following ? 0 : 1); |
||||
for (FollowingThemeActionChangeListener changeListener : changeListeners) { |
||||
changeListener.onFollowingTheme(isFollowingTheme()); |
||||
} |
||||
} |
||||
public boolean isFollowingTheme() { |
||||
return followingThemeButtonGroup.getSelectedIndex() == 0; |
||||
} |
||||
} |
@ -0,0 +1,102 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.design.ExtraDesignClassManager; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.fun.BackgroundQuickUIProvider; |
||||
import com.fr.design.mainframe.backgroundpane.BackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.ColorBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.GradientBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.ImageBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.NullBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.PatternBackgroundQuickPane; |
||||
import com.fr.design.mainframe.backgroundpane.TextureBackgroundQuickPane; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/19 |
||||
*/ |
||||
public class ReportBackgroundSpecialPane extends BackgroundPane { |
||||
public ReportBackgroundSpecialPane(){ |
||||
super(); |
||||
} |
||||
|
||||
@Override |
||||
protected BackgroundQuickPane[] supportKindsOfBackgroundUI() { |
||||
NullBackgroundQuickPane nullBackgroundPane = new NullBackgroundQuickPane(); |
||||
|
||||
ColorBackgroundQuickPane colorBackgroundPane = new ColorBackgroundQuickPane(); |
||||
colorBackgroundPane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
|
||||
ImageBackgroundQuickPane imageBackgroundPane = new ImageBackgroundQuickPane(); |
||||
imageBackgroundPane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
|
||||
GradientBackgroundQuickPane gradientBackgroundPane = createGradientBackgroundQuickPane(); |
||||
gradientBackgroundPane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
|
||||
TextureBackgroundQuickPane textureBackgroundPane = new TextureBackgroundQuickPane(); |
||||
textureBackgroundPane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
|
||||
PatternBackgroundQuickPane patternBackgroundPane = new PatternBackgroundQuickPane(); |
||||
patternBackgroundPane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
|
||||
|
||||
|
||||
List<BackgroundQuickPane> kinds = new ArrayList<BackgroundQuickPane>(); |
||||
|
||||
kinds.add(nullBackgroundPane); |
||||
kinds.add(colorBackgroundPane); |
||||
kinds.add(imageBackgroundPane); |
||||
kinds.add(gradientBackgroundPane); |
||||
kinds.add(textureBackgroundPane); |
||||
kinds.add(patternBackgroundPane); |
||||
|
||||
Set<BackgroundQuickUIProvider> providers = ExtraDesignClassManager.getInstance().getArray(BackgroundQuickUIProvider.MARK_STRING); |
||||
for (BackgroundQuickUIProvider provider : providers) { |
||||
BackgroundQuickPane newTypePane = provider.appearanceForBackground(); |
||||
newTypePane.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
fireStateChanged(); |
||||
} |
||||
}); |
||||
kinds.add(newTypePane); |
||||
} |
||||
|
||||
return kinds.toArray(new BackgroundQuickPane[kinds.size()]); |
||||
} |
||||
|
||||
protected GradientBackgroundQuickPane createGradientBackgroundQuickPane() { |
||||
// 使用默认的150宽度构建渐变条
|
||||
return new GradientBackgroundQuickPane(); |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.design.gui.style; |
||||
|
||||
import com.fr.general.act.TitlePacker; |
||||
|
||||
/** |
||||
* @author Starryi |
||||
* @version 1.0 |
||||
* Created by Starryi on 2021/8/11 |
||||
*/ |
||||
public class TitleTranslucentBackgroundSpecialPane extends AbstractTranslucentBackgroundSpecialPane<TitlePacker> { |
||||
|
||||
public TitleTranslucentBackgroundSpecialPane(int uiLabelWidth, int uiSettingWidth) { |
||||
super(uiLabelWidth, uiSettingWidth, com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Form_Widget_Style_Title_Background")); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(TitlePacker style) { |
||||
backgroundPane.populateBean(style.getBackground()); |
||||
opacityPane.populateBean(style.getBackgroundOpacity()); |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(TitlePacker style) { |
||||
style.setBackground(backgroundPane.update()); |
||||
style.setBackgroundOpacity((float)opacityPane.updateBean()); |
||||
} |
||||
} |
@ -0,0 +1,328 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.base.BaseFormula; |
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Parameter; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.formula.TinyFormulaPane; |
||||
import com.fr.design.gui.frpane.ReportletParameterViewPane; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.itableeditorpane.UITableEditAction; |
||||
import com.fr.design.gui.itextfield.UITextField; |
||||
import com.fr.design.gui.itree.filetree.ReportletPane; |
||||
import com.fr.design.hyperlink.AbstractHyperLinkPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.module.DesignModuleFactory; |
||||
import com.fr.design.parameter.ParameterReader; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.js.MobilePopupHyperlink; |
||||
import com.fr.stable.CommonUtils; |
||||
import com.fr.stable.FormulaProvider; |
||||
import com.fr.stable.ParameterProvider; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.List; |
||||
|
||||
public class ContentSettingPane extends AbstractHyperLinkPane<MobilePopupHyperlink> { |
||||
private JPanel popupTargetPane; |
||||
private UIRadioButton templatePopupButton; |
||||
private UIRadioButton textPopupButton; |
||||
private ButtonGroup popupTargetButtons; |
||||
|
||||
private JPanel templateContentPane; |
||||
private UITextField templatePathTextField; |
||||
private UICheckBox extendParametersCheckBox; |
||||
|
||||
private JPanel textSettingPanel; |
||||
private TinyFormulaPane textContentPane; |
||||
private CustomFontPane fontPane; |
||||
|
||||
public ContentSettingPane() { |
||||
super(); |
||||
this.initCompoennt(); |
||||
} |
||||
|
||||
public void addTargetRadioActionListener(ActionListener listener) { |
||||
templatePopupButton.addActionListener(listener); |
||||
textPopupButton.addActionListener(listener); |
||||
} |
||||
|
||||
public String getTargetType() { |
||||
if (templatePopupButton.isSelected()) { |
||||
return MobilePopupConstants.Target_Template; |
||||
} else { |
||||
return MobilePopupConstants.Target_Text; |
||||
} |
||||
|
||||
} |
||||
|
||||
private void initCompoennt() { |
||||
this.setLayout(FRGUIPaneFactory.createM_BorderLayout()); |
||||
this.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Content"))); |
||||
|
||||
popupTargetPane = this.createPopupTargetPane(); |
||||
this.add(popupTargetPane, BorderLayout.NORTH); |
||||
|
||||
templateContentPane= this.createTemplateContentPane(); |
||||
textSettingPanel = this.createTextSettingPane(); |
||||
} |
||||
|
||||
private JPanel createPopupTargetPane() { |
||||
templatePopupButton = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Template")); |
||||
templatePopupButton.addActionListener(radioActionListener); |
||||
|
||||
textPopupButton = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Text")); |
||||
textPopupButton.addActionListener(radioActionListener); |
||||
|
||||
popupTargetButtons = new ButtonGroup(); |
||||
popupTargetButtons.add(templatePopupButton); |
||||
popupTargetButtons.add(textPopupButton); |
||||
|
||||
JPanel popupButtonsPanel = new JPanel(); |
||||
popupButtonsPanel.setLayout( new FlowLayout(FlowLayout.LEFT, 10, 0)); |
||||
popupButtonsPanel.add(templatePopupButton); |
||||
popupButtonsPanel.add(textPopupButton); |
||||
return MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Target"), popupButtonsPanel); |
||||
} |
||||
|
||||
private ActionListener radioActionListener = new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
if(templatePopupButton.isSelected()) { |
||||
ContentSettingPane.this.add(templateContentPane); |
||||
ContentSettingPane.this.remove(textSettingPanel); |
||||
} else if (textPopupButton.isSelected()) { |
||||
ContentSettingPane.this.add(textSettingPanel); |
||||
ContentSettingPane.this.remove(templateContentPane); |
||||
} |
||||
ContentSettingPane.this.revalidate(); |
||||
ContentSettingPane.this.repaint(); |
||||
} |
||||
}; |
||||
|
||||
private JPanel createTemplateContentPane() { |
||||
JPanel templateContentPane = new JPanel(); |
||||
templateContentPane.setLayout(new BorderLayout(0,8)); |
||||
|
||||
templateContentPane.add(this.createTemplateSelectPanel(), BorderLayout.NORTH); |
||||
|
||||
parameterViewPane = this.createReportletParameterViewPane(); |
||||
templateContentPane.add(parameterViewPane, BorderLayout.CENTER); |
||||
|
||||
extendParametersCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Extends_Report_Parameters")); |
||||
templateContentPane.add(GUICoreUtils.createFlowPane(extendParametersCheckBox, FlowLayout.LEFT), BorderLayout.SOUTH); |
||||
|
||||
return templateContentPane; |
||||
} |
||||
|
||||
private JPanel createTemplateSelectPanel() { |
||||
JPanel templatePanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
// 路径输入框
|
||||
templatePathTextField = new UITextField(20); |
||||
templatePanel.add(templatePathTextField, BorderLayout.CENTER); |
||||
|
||||
// 选择路径按钮
|
||||
UIButton templateSelectButton = new UIButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Select")); |
||||
templateSelectButton.setPreferredSize(new Dimension(templateSelectButton.getPreferredSize().width, 20)); |
||||
templatePanel.add(templateSelectButton, BorderLayout.EAST); |
||||
templateSelectButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
final ReportletPane reportletPane = new ReportletPane(); |
||||
reportletPane.setSelectedReportletPath(templatePathTextField.getText()); |
||||
BasicDialog reportletDialog = reportletPane.showWindow(SwingUtilities.getWindowAncestor(ContentSettingPane.this)); |
||||
|
||||
reportletDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
templatePathTextField.setText(reportletPane.getSelectedReportletPath()); |
||||
} |
||||
}); |
||||
reportletDialog.setVisible(true); |
||||
} |
||||
}); |
||||
return MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Template"), templatePanel); |
||||
} |
||||
|
||||
private ReportletParameterViewPane createReportletParameterViewPane() { |
||||
ReportletParameterViewPane templateParameterViewPane = new ReportletParameterViewPane( |
||||
new UITableEditAction[]{ |
||||
new HyperlinkParametersAction() |
||||
}, |
||||
getChartParaType(), |
||||
getValueEditorPane(), |
||||
getValueEditorPane() |
||||
); |
||||
templateParameterViewPane.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Parameter"), null)); |
||||
templateParameterViewPane.setPreferredSize(new Dimension(this.getWidth(), 200)); |
||||
return templateParameterViewPane; |
||||
} |
||||
|
||||
private JPanel createTextSettingPane() { |
||||
JPanel textSettingPanel = new JPanel(); |
||||
textSettingPanel.setLayout(new BorderLayout(0,8)); |
||||
|
||||
textContentPane = new TinyFormulaPane(); |
||||
textContentPane.getUITextField().setColumns(20); |
||||
textSettingPanel.add( |
||||
MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Text"), textContentPane), |
||||
BorderLayout.CENTER); |
||||
|
||||
fontPane = new CustomFontPane(); |
||||
textSettingPanel.add( |
||||
MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Style"), fontPane), |
||||
BorderLayout.SOUTH); |
||||
return MobilePopupUIUtils.createTitleSplitLineContentPane("", textSettingPanel); |
||||
} |
||||
|
||||
private String getReportletName() { |
||||
String text = this.templatePathTextField.getText(); |
||||
return StringUtils.isBlank(text) ? StringUtils.EMPTY : text.substring(1); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobilePopupHyperlink link) { |
||||
this.populatePopupTargetBean(link.getPopupTarget()); |
||||
this.populateTemplateContentBean(link); |
||||
this.populateTextContentBean(link); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public MobilePopupHyperlink updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(MobilePopupHyperlink link) { |
||||
this.updatePopupTargetBean(link); |
||||
this.updateTemplateContentBean(link); |
||||
this.updateTextContentBean(link); |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
/** |
||||
* 自动添加模板参数的按钮操作 |
||||
*/ |
||||
private class HyperlinkParametersAction extends UITableEditAction { |
||||
public HyperlinkParametersAction() { |
||||
this.setName(Toolkit.i18nText("Fine-Design_Basic_Template_Parameter")); |
||||
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/p.gif")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
String tpl = getReportletName(); |
||||
if (StringUtils.isBlank(tpl)) { |
||||
JOptionPane.showMessageDialog( |
||||
ContentSettingPane.this, |
||||
Toolkit.i18nText("Fine-Design_Basic_Hyperlink_Please_Select_Reportlet") + ".", |
||||
Toolkit.i18nText("Fine-Design_Basic_Message"), |
||||
JOptionPane.WARNING_MESSAGE); |
||||
return; |
||||
} |
||||
|
||||
//根据模板路径返回参数
|
||||
//与当前模块、当前文件无关
|
||||
Parameter[] parameters = new Parameter[0]; |
||||
|
||||
ParameterReader[] readers = DesignModuleFactory.getParameterReaders(); |
||||
for (ParameterReader reader : readers) { |
||||
Parameter[] ps = reader.readParameterFromPath(tpl); |
||||
if (ps != null) { |
||||
parameters = ps; |
||||
} |
||||
} |
||||
parameterViewPane.populate(parameters); |
||||
} |
||||
|
||||
@Override |
||||
public void checkEnabled() { |
||||
//do nothing
|
||||
} |
||||
} |
||||
|
||||
private void populatePopupTargetBean(String target) { |
||||
if (StringUtils.equals(target, MobilePopupConstants.Target_Text)) { |
||||
popupTargetButtons.setSelected(textPopupButton.getModel(), true); |
||||
this.remove(templateContentPane); |
||||
this.add(textSettingPanel, BorderLayout.CENTER); |
||||
} else { |
||||
popupTargetButtons.setSelected(templatePopupButton.getModel(), true); |
||||
this.remove(textSettingPanel); |
||||
this.add(templateContentPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
} |
||||
|
||||
private void updatePopupTargetBean(MobilePopupHyperlink mobilePopupHyperlink) { |
||||
if (templatePopupButton.isSelected()) { |
||||
mobilePopupHyperlink.setPopupTarget(MobilePopupConstants.Target_Template); |
||||
} else if (textPopupButton.isSelected()) { |
||||
mobilePopupHyperlink.setPopupTarget(MobilePopupConstants.Target_Text); |
||||
} |
||||
} |
||||
|
||||
private void populateTemplateContentBean(MobilePopupHyperlink link) { |
||||
// 模板路径
|
||||
templatePathTextField.setText(link.getReportletPath()); |
||||
|
||||
// 参数面板
|
||||
List<ParameterProvider> parameterList = this.parameterViewPane.update(); |
||||
parameterList.clear(); |
||||
ParameterProvider[] parameters =link.getParameters(); |
||||
parameterViewPane.populate(parameters); |
||||
|
||||
// 继承参数
|
||||
extendParametersCheckBox.setSelected(link.isExtendParameters()); |
||||
} |
||||
|
||||
private void updateTemplateContentBean(MobilePopupHyperlink link) { |
||||
link.setReportletPath(templatePathTextField.getText()); |
||||
|
||||
List<ParameterProvider> parameterList = this.parameterViewPane.update(); |
||||
if (!parameterList.isEmpty()) { |
||||
Parameter[] parameters = new Parameter[parameterList.size()]; |
||||
parameterList.toArray(parameters); |
||||
link.setParameters(parameters); |
||||
} else { |
||||
link.setParameters(null); |
||||
} |
||||
|
||||
link.setExtendParameters(extendParametersCheckBox.isSelected()); |
||||
|
||||
} |
||||
|
||||
private void populateTextContentBean(MobilePopupHyperlink link) { |
||||
Object text = link.getPopupText(); |
||||
if (text instanceof FormulaProvider) { |
||||
textContentPane.populateBean(((FormulaProvider) text).getContent()); |
||||
} else { |
||||
textContentPane.populateBean(text == null ? StringUtils.EMPTY : text.toString()); |
||||
} |
||||
fontPane.populateBean(link.getFRFont()); |
||||
} |
||||
private void updateTextContentBean(MobilePopupHyperlink link) { |
||||
link.setPopupText(textContentPane.getUITextField().getText()); |
||||
String text = textContentPane.updateBean(); |
||||
if (CommonUtils.maybeFormula(text)) { |
||||
link.setPopupText(BaseFormula.createFormulaBuilder().build(textContentPane.updateBean())); |
||||
} else { |
||||
link.setPopupText(text); |
||||
} |
||||
|
||||
link.setFRFont(fontPane.updateBean()); |
||||
} |
||||
} |
@ -0,0 +1,100 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.util.Vector; |
||||
|
||||
public class CustomFontPane extends JPanel { |
||||
private static final int MAX_FONT_SIZE = 100; |
||||
private static final Dimension BUTTON_SIZE = new Dimension(20, 18); |
||||
|
||||
public static Vector<Integer> getFontSizes() { |
||||
Vector<Integer> FONT_SIZES = new Vector<Integer>(); |
||||
for (int i = 1; i < MAX_FONT_SIZE; i++) { |
||||
FONT_SIZES.add(i); |
||||
} |
||||
return FONT_SIZES; |
||||
} |
||||
|
||||
private UIComboBox fontSizeComboBox; |
||||
private UIToggleButton bold; |
||||
private UIToggleButton italic; |
||||
private UIToggleButton underline; |
||||
private UIColorButton colorSelectPane; |
||||
|
||||
public CustomFontPane() { |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
|
||||
fontSizeComboBox = new UIComboBox(getFontSizes()); |
||||
fontSizeComboBox.setPreferredSize(new Dimension(60, 20)); |
||||
fontSizeComboBox.setEditable(true); |
||||
|
||||
colorSelectPane = new UIColorButton(); |
||||
bold = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png")); |
||||
italic = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/italic.png")); |
||||
underline = new UIToggleButton(BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/underline.png")); |
||||
|
||||
this.setButtonsTips(); |
||||
this.setButtonsSize(BUTTON_SIZE); |
||||
|
||||
Component[] components_font = new Component[]{ |
||||
fontSizeComboBox, colorSelectPane, bold, underline, italic |
||||
}; |
||||
|
||||
JPanel buttonPane = new JPanel(new BorderLayout()); |
||||
buttonPane.add(GUICoreUtils.createFlowPane(components_font, FlowLayout.LEFT, LayoutConstants.HGAP_SMALL)); |
||||
|
||||
this.setLayout(new BorderLayout(0,0)); |
||||
this.add(buttonPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void setButtonsTips() { |
||||
colorSelectPane.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Foreground")); |
||||
italic.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Italic")); |
||||
bold.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Bold")); |
||||
underline.setToolTipText(Toolkit.i18nText("Fine-Design_Report_Underline")); |
||||
} |
||||
|
||||
private void setButtonsSize(Dimension size) { |
||||
colorSelectPane.setPreferredSize(size); |
||||
bold.setPreferredSize(size); |
||||
italic.setPreferredSize(size); |
||||
underline.setPreferredSize(size); |
||||
} |
||||
|
||||
|
||||
public void populateBean(FRFont frFont) { |
||||
fontSizeComboBox.setSelectedItem(frFont.getSize()); |
||||
colorSelectPane.setColor(frFont.getForeground()); |
||||
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()), |
||||
colorSelectPane.getColor(), |
||||
underline.isSelected() ? Constants.LINE_THIN : Constants.LINE_NONE |
||||
); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.stable.Constants; |
||||
|
||||
public interface MobilePopupConstants { |
||||
int[] BORDER_LINE_STYLE_ARRAY = new int[]{ |
||||
Constants.LINE_NONE, |
||||
Constants.LINE_THIN, |
||||
Constants.LINE_MEDIUM, |
||||
Constants.LINE_THICK, |
||||
}; |
||||
|
||||
String Target_Template= "template"; |
||||
String Target_Text = "text"; |
||||
String Regular_Custom = "custom"; |
||||
String Regular_Auto_Height = "auto_height"; |
||||
|
||||
double Popup_Center_Default_Width = 95; |
||||
double Popup_Center_Default_Height = 95; |
||||
double Popup_Follow_Default_Width = 40; |
||||
double Popup_Follow_Default_Height = 10; |
||||
} |
@ -0,0 +1,81 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.design.beans.FurtherBasicBeanPane; |
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.js.MobilePopupHyperlink; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class MobilePopupPane extends FurtherBasicBeanPane<MobilePopupHyperlink> { |
||||
private ContentSettingPane contentSettingPane; |
||||
private StyleSettingPane styleSettingPane; |
||||
|
||||
public MobilePopupPane() { |
||||
this.initComponents(); |
||||
this.setDefaultBean(); |
||||
} |
||||
|
||||
protected void initComponents() { |
||||
this.setLayout(new BorderLayout()); |
||||
this.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); |
||||
|
||||
JPanel scrollContent = new JPanel(); |
||||
scrollContent.setLayout(new BorderLayout(10, 10)); |
||||
contentSettingPane = new ContentSettingPane(); |
||||
scrollContent.add(contentSettingPane, BorderLayout.NORTH); |
||||
styleSettingPane = new StyleSettingPane(); |
||||
scrollContent.add(styleSettingPane, BorderLayout.CENTER); |
||||
|
||||
contentSettingPane.addTargetRadioActionListener(radioActionListener); |
||||
|
||||
UIScrollPane scrollPane= new UIScrollPane(scrollContent); |
||||
scrollPane.setBorder(BorderFactory.createEmptyBorder()); |
||||
|
||||
JComponent scrollComponent = new JLayer<UIScrollPane>(scrollPane, new WheelScrollLayerUI()); |
||||
|
||||
this.add(scrollComponent, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void setDefaultBean() { |
||||
this.populateBean(new MobilePopupHyperlink()); |
||||
} |
||||
private ActionListener radioActionListener = new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
styleSettingPane.resetPane(contentSettingPane.getTargetType()); |
||||
} |
||||
}; |
||||
|
||||
@Override |
||||
public void populateBean(MobilePopupHyperlink mobilePopupHyperlink) { |
||||
contentSettingPane.populateBean(mobilePopupHyperlink); |
||||
styleSettingPane.populateBean(mobilePopupHyperlink); |
||||
} |
||||
|
||||
@Override |
||||
public MobilePopupHyperlink updateBean() { |
||||
MobilePopupHyperlink mobilePopupHyperlink = new MobilePopupHyperlink(); |
||||
contentSettingPane.updateBean(mobilePopupHyperlink); |
||||
styleSettingPane.updateBean(mobilePopupHyperlink); |
||||
return mobilePopupHyperlink; |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(Object ob) { |
||||
return ob instanceof MobilePopupHyperlink; |
||||
} |
||||
|
||||
@Override |
||||
public String title4PopupWindow() { |
||||
return Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup"); |
||||
} |
||||
|
||||
@Override |
||||
public void reset() { |
||||
this.setDefaultBean(); |
||||
} |
||||
} |
@ -0,0 +1,157 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.design.dialog.BasicPane; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.VerticalFlowLayout; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
|
||||
public class MobilePopupRegularPane extends BasicPane { |
||||
private String label; |
||||
|
||||
private JPanel radiosPane; |
||||
private UIRadioButton customRadio; |
||||
private UIRadioButton autoRadio; |
||||
private ButtonGroup radioButtons; |
||||
|
||||
private JPanel spinnerGroupPane; |
||||
private UISpinner widthSpinner; |
||||
private JPanel widthSpinnerPane; |
||||
private UISpinner heightSpinner; |
||||
private JPanel heightSpinnerPane; |
||||
|
||||
|
||||
public MobilePopupRegularPane(String label) { |
||||
this.label = label; |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
this.setLayout(new BorderLayout()); |
||||
this.add(this.createRadioButtonGroupPane(), BorderLayout.NORTH); |
||||
spinnerGroupPane = this.createSpinnerPane(); |
||||
this.add(spinnerGroupPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JPanel createRadioButtonGroupPane() { |
||||
radiosPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5)); |
||||
|
||||
customRadio = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Custom")); |
||||
customRadio.addActionListener(radioActionListener); |
||||
autoRadio = new UIRadioButton(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Height_Adaptive")); |
||||
autoRadio.addActionListener(radioActionListener); |
||||
|
||||
radioButtons = new ButtonGroup(); |
||||
radioButtons.add(customRadio); |
||||
radioButtons.add(autoRadio); |
||||
|
||||
radiosPane.add(customRadio); |
||||
radiosPane.add(autoRadio); |
||||
|
||||
return MobilePopupUIUtils.createLeftTileRightContentPanel(this.label, radiosPane); |
||||
} |
||||
|
||||
private ActionListener radioActionListener = new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
resetSpinnerGroupPane(customRadio.isSelected()); |
||||
} |
||||
}; |
||||
|
||||
private JPanel createSpinnerPane() { |
||||
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 15, 5)); |
||||
spinnerPane.setBorder(BorderFactory.createEmptyBorder(0, MobilePopupUIUtils.Left_Title_width, 0, 0)); |
||||
widthSpinner = new UISpinner(0, 100, 1, 95); |
||||
widthSpinnerPane = this.createSpinnerLabelPane(widthSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Width")); |
||||
heightSpinner = new UISpinner(0, 100, 1, 95); |
||||
heightSpinnerPane = this.createSpinnerLabelPane(heightSpinner, Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Height")); |
||||
|
||||
spinnerPane.add(widthSpinnerPane); |
||||
spinnerPane.add(heightSpinnerPane); |
||||
|
||||
return spinnerPane; |
||||
} |
||||
|
||||
private JPanel createSpinnerLabelPane(UISpinner spinner, String labelText) { |
||||
JPanel spinnerLabelPane = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 5)); |
||||
|
||||
JPanel spinnerPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 2,0)); |
||||
Dimension dimension = new Dimension(60, 20); |
||||
spinner.setPreferredSize(dimension); |
||||
UILabel percent = new UILabel("%"); |
||||
spinnerPane.add(spinner); |
||||
spinnerPane.add(percent); |
||||
|
||||
UILabel label = new UILabel(labelText); |
||||
label.setPreferredSize(dimension); |
||||
label.setHorizontalAlignment(SwingConstants.CENTER); |
||||
|
||||
spinnerLabelPane.add(spinnerPane); |
||||
spinnerLabelPane.add(label); |
||||
|
||||
return spinnerLabelPane; |
||||
} |
||||
|
||||
private void resetSpinnerGroupPane(boolean showHeightSpinnerPane) { |
||||
spinnerGroupPane.removeAll(); |
||||
spinnerGroupPane.add(widthSpinnerPane); |
||||
if(showHeightSpinnerPane) { |
||||
spinnerGroupPane.add(heightSpinnerPane); |
||||
} |
||||
spinnerGroupPane.revalidate(); |
||||
spinnerGroupPane.repaint(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
public void setRegularType(String regularType) { |
||||
if (StringUtils.equals(regularType, MobilePopupConstants.Regular_Auto_Height)) { |
||||
radioButtons.setSelected(autoRadio.getModel(), true); |
||||
} else { |
||||
radioButtons.setSelected(customRadio.getModel(), true); |
||||
} |
||||
resetSpinnerGroupPane(customRadio.isSelected()); |
||||
} |
||||
|
||||
public String getRegularType() { |
||||
if (autoRadio.isSelected()) { |
||||
return MobilePopupConstants.Regular_Auto_Height; |
||||
} else { |
||||
return MobilePopupConstants.Regular_Custom; |
||||
} |
||||
} |
||||
|
||||
public void setWidthSpinnerValue(double width) { |
||||
widthSpinner.setValue(width); |
||||
} |
||||
|
||||
public double getWidthSpinnerValue() { |
||||
return widthSpinner.getValue(); |
||||
} |
||||
|
||||
public void setHeightSpinnerValue(double height) { |
||||
heightSpinner.setValue(height); |
||||
} |
||||
|
||||
public double getHeightSpinnerValue() { |
||||
return heightSpinner.getValue(); |
||||
} |
||||
|
||||
public void resetPane(String regularType, double width, double height) { |
||||
this.setRegularType(regularType); |
||||
this.setWidthSpinnerValue(width); |
||||
this.setHeightSpinnerValue(height); |
||||
resetSpinnerGroupPane(StringUtils.equals(regularType, MobilePopupConstants.Regular_Custom)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.mainframe.widget.UITitleSplitLine; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class MobilePopupUIUtils { |
||||
static public int Line_Height = 20; |
||||
static public int SplitLineWidth = 520; |
||||
static public int Left_Title_width = 80; |
||||
|
||||
static public JPanel createLeftTileRightContentPanel(String title, JComponent contentPanel) { |
||||
JPanel jp = new JPanel(); |
||||
jp.setBorder(BorderFactory.createEmptyBorder(0,0,0, 30)); |
||||
jp.setLayout(new BorderLayout(10,0)); |
||||
UILabel titleLabel = new UILabel(title + ":"); |
||||
titleLabel.setPreferredSize(new Dimension(MobilePopupUIUtils.Left_Title_width, Line_Height)); |
||||
titleLabel.setHorizontalAlignment(SwingConstants.RIGHT); |
||||
jp.add(titleLabel, BorderLayout.WEST); |
||||
jp.add(contentPanel, BorderLayout.CENTER); |
||||
return jp; |
||||
} |
||||
|
||||
static public JPanel createTitleSplitLineContentPane(String title, JComponent contentPanel) { |
||||
JPanel jp = new JPanel(); |
||||
jp.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
||||
jp.setLayout(new BorderLayout(0, 10)); |
||||
UITitleSplitLine titleLine = new UITitleSplitLine(title, SplitLineWidth); |
||||
titleLine.setPreferredSize(new Dimension(SplitLineWidth, Line_Height)); |
||||
jp.add(titleLine, BorderLayout.NORTH); |
||||
jp.add(contentPanel, BorderLayout.CENTER); |
||||
return jp; |
||||
} |
||||
} |
@ -0,0 +1,205 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.frpane.UINumberDragPane; |
||||
import com.fr.design.gui.icombobox.LineComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.layout.VerticalFlowLayout; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.design.utils.gui.GUICoreUtils; |
||||
import com.fr.js.MobilePopupHyperlink; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class StyleSettingPane extends BasicBeanPane<MobilePopupHyperlink> { |
||||
private double maxNumber = 100; |
||||
private double maxBorderRadius = 24; |
||||
|
||||
JPanel typePane; |
||||
UILabel popupTypeLabel; |
||||
|
||||
JPanel stylePane; |
||||
LineComboBox borderType; |
||||
NewColorSelectBox borderColor; |
||||
UISpinner borderRadiusSpinner; |
||||
|
||||
NewColorSelectBox bgColor; |
||||
//透明度
|
||||
UINumberDragPane numberDragPane; |
||||
|
||||
MobilePopupRegularPane mobileRegularPane; |
||||
MobilePopupRegularPane padRegularPane; |
||||
|
||||
public StyleSettingPane() { |
||||
this.initComponent(); |
||||
} |
||||
|
||||
private void initComponent() { |
||||
this.setLayout(new BorderLayout(0, 10)); |
||||
this.setBorder(GUICoreUtils.createTitledBorder(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Style"))); |
||||
|
||||
typePane = this.createTypePane(); |
||||
this.add(typePane, BorderLayout.NORTH); |
||||
stylePane = this.createStylePane(); |
||||
this.add(stylePane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JPanel createTypePane() { |
||||
JPanel typePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
popupTypeLabel = new UILabel(""); |
||||
typePane.add(popupTypeLabel, BorderLayout.CENTER); |
||||
return MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Type"), typePane); |
||||
} |
||||
|
||||
private JPanel createStylePane() { |
||||
JPanel stylePane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
stylePane.add(this.createBorderSettingPane(), BorderLayout.NORTH); |
||||
stylePane.add(this.createBackgroundSettingPane(), BorderLayout.CENTER); |
||||
stylePane.add(this.createPopupSizePane(), BorderLayout.SOUTH); |
||||
return stylePane; |
||||
} |
||||
|
||||
private JPanel createBorderSettingPane() { |
||||
JPanel borderPane = new JPanel(); |
||||
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 10); |
||||
layout.setAlignLeft(true); |
||||
borderPane.setLayout(layout); |
||||
|
||||
borderType = new LineComboBox(MobilePopupConstants.BORDER_LINE_STYLE_ARRAY); |
||||
borderType.setPreferredSize(new Dimension(115, 20)); |
||||
borderPane.add(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Line"), borderType)); |
||||
borderColor = new NewColorSelectBox(100); |
||||
borderPane.add(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), borderColor)); |
||||
borderRadiusSpinner = new UISpinner(0, maxBorderRadius, 1, 20); |
||||
borderRadiusSpinner.setPreferredSize(new Dimension(120, 20)); |
||||
borderPane.add(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Radius"), borderRadiusSpinner)); |
||||
return MobilePopupUIUtils.createTitleSplitLineContentPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Border"), borderPane); |
||||
} |
||||
|
||||
private JPanel createBackgroundSettingPane() { |
||||
JPanel bgPane = new JPanel(); |
||||
VerticalFlowLayout layout = new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 10); |
||||
layout.setAlignLeft(true); |
||||
bgPane.setLayout(layout); |
||||
|
||||
JPanel colorPane = new JPanel(new FlowLayout(FlowLayout.LEFT, 0,0)); |
||||
bgColor = new NewColorSelectBox(100); |
||||
colorPane.add(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Colors"), bgColor)); |
||||
bgPane.add(colorPane); |
||||
|
||||
JPanel transparencyPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
this.numberDragPane = new UINumberDragPane(0,100); |
||||
this.numberDragPane.setPreferredSize(new Dimension(140, 20)); |
||||
transparencyPane.add(numberDragPane, BorderLayout.CENTER); |
||||
transparencyPane.add(new UILabel(" %"), BorderLayout.EAST); |
||||
bgPane.add(MobilePopupUIUtils.createLeftTileRightContentPanel(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Opacity"), transparencyPane)); |
||||
return MobilePopupUIUtils.createTitleSplitLineContentPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Background"), bgPane); |
||||
} |
||||
|
||||
private JPanel createPopupSizePane() { |
||||
JPanel sizePane = new JPanel(new BorderLayout()); |
||||
|
||||
mobileRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Mobile_Rules")); |
||||
padRegularPane = new MobilePopupRegularPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Pad_Rules")); |
||||
|
||||
sizePane.add(mobileRegularPane, BorderLayout.NORTH); |
||||
sizePane.add(padRegularPane, BorderLayout.CENTER); |
||||
|
||||
return MobilePopupUIUtils.createTitleSplitLineContentPane(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Size"), sizePane); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
public void resetPane(String popupTargetType) { |
||||
if (StringUtils.equals(popupTargetType, MobilePopupConstants.Target_Template)) { |
||||
popupTypeLabel.setText(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Center")); |
||||
mobileRegularPane.resetPane(MobilePopupConstants.Regular_Custom, MobilePopupConstants.Popup_Center_Default_Width, MobilePopupConstants.Popup_Center_Default_Height); |
||||
padRegularPane.resetPane(MobilePopupConstants.Regular_Custom, MobilePopupConstants.Popup_Center_Default_Width, MobilePopupConstants.Popup_Center_Default_Height); |
||||
} else { |
||||
popupTypeLabel.setText(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Follow")); |
||||
mobileRegularPane.resetPane(MobilePopupConstants.Regular_Custom, MobilePopupConstants.Popup_Follow_Default_Width, MobilePopupConstants.Popup_Follow_Default_Height); |
||||
padRegularPane.resetPane(MobilePopupConstants.Regular_Custom, MobilePopupConstants.Popup_Follow_Default_Width, MobilePopupConstants.Popup_Follow_Default_Height); |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobilePopupHyperlink link) { |
||||
this.populateTypeBean(link); |
||||
this.populateBorderSettingBean(link); |
||||
this.populateBackgroundSettingBean(link); |
||||
this.populatePopupSizeBean(link); |
||||
} |
||||
|
||||
@Override |
||||
public MobilePopupHyperlink updateBean() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
public void updateBean(MobilePopupHyperlink link) { |
||||
this.updateBorderSettingBean(link); |
||||
this.updateBackgroundSettingBean(link); |
||||
this.updatePopupSizeBean(link); |
||||
|
||||
} |
||||
|
||||
private void populateTypeBean(MobilePopupHyperlink link) { |
||||
if (StringUtils.equals(link.getPopupTarget(), MobilePopupConstants.Target_Text)) { |
||||
popupTypeLabel.setText(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Follow")); |
||||
} else { |
||||
popupTypeLabel.setText(Toolkit.i18nText("FR-Plugin-Designer_Mobile_Popup_Center")); |
||||
} |
||||
} |
||||
|
||||
private void populateBorderSettingBean(MobilePopupHyperlink link) { |
||||
borderType.setSelectedLineStyle(link.getBorderType()); |
||||
borderColor.setSelectObject(link.getBorderColor()); |
||||
borderRadiusSpinner.setValue(link.getBorderRadius()); |
||||
|
||||
} |
||||
|
||||
private void updateBorderSettingBean(MobilePopupHyperlink link) { |
||||
link.setBorderType(borderType.getSelectedLineStyle()); |
||||
link.setBorderColor(borderColor.getSelectObject()); |
||||
link.setBorderRadius(borderRadiusSpinner.getValue()); |
||||
|
||||
} |
||||
|
||||
private void populateBackgroundSettingBean(MobilePopupHyperlink link) { |
||||
bgColor.setSelectObject(link.getBgColor()); |
||||
numberDragPane.populateBean(link.getBgOpacity() * maxNumber); |
||||
} |
||||
|
||||
private void updateBackgroundSettingBean(MobilePopupHyperlink link) { |
||||
link.setBgColor(bgColor.getSelectObject()); |
||||
link.setBgOpacity((float)(numberDragPane.updateBean() / maxNumber)); |
||||
} |
||||
|
||||
private void populatePopupSizeBean(MobilePopupHyperlink link) { |
||||
mobileRegularPane.setRegularType(link.getMobileRegularType()); |
||||
mobileRegularPane.setWidthSpinnerValue(link.getMobileWidth()); |
||||
mobileRegularPane.setHeightSpinnerValue(link.getMobileHeight()); |
||||
padRegularPane.setRegularType(link.getPadRegularType()); |
||||
padRegularPane.setWidthSpinnerValue(link.getPadWidth()); |
||||
padRegularPane.setHeightSpinnerValue(link.getPadHeight()); |
||||
|
||||
} |
||||
|
||||
private void updatePopupSizeBean(MobilePopupHyperlink link) { |
||||
link.setMobileRegularType(mobileRegularPane.getRegularType()); |
||||
link.setMobileWidth(mobileRegularPane.getWidthSpinnerValue()); |
||||
link.setMobileHeight(mobileRegularPane.getHeightSpinnerValue()); |
||||
link.setPadRegularType(padRegularPane.getRegularType()); |
||||
link.setPadWidth(padRegularPane.getWidthSpinnerValue()); |
||||
link.setPadHeight(padRegularPane.getHeightSpinnerValue()); |
||||
} |
||||
} |
@ -0,0 +1,42 @@
|
||||
package com.fr.design.hyperlink.popup; |
||||
|
||||
import com.fr.design.gui.icontainer.UIScrollPane; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.plaf.LayerUI; |
||||
import java.awt.*; |
||||
import java.awt.event.MouseWheelEvent; |
||||
|
||||
class WheelScrollLayerUI extends LayerUI<UIScrollPane> { |
||||
@Override |
||||
public void installUI(JComponent c) { |
||||
super.installUI(c); |
||||
if (c instanceof JLayer) { |
||||
((JLayer) c).setLayerEventMask(AWTEvent.MOUSE_WHEEL_EVENT_MASK); |
||||
} |
||||
} |
||||
@Override |
||||
public void uninstallUI(JComponent c) { |
||||
if (c instanceof JLayer) { |
||||
((JLayer) c).setLayerEventMask(0); |
||||
} |
||||
super.uninstallUI(c); |
||||
} |
||||
@Override |
||||
protected void processMouseWheelEvent(MouseWheelEvent e, JLayer<? extends UIScrollPane> l) { |
||||
Component c = e.getComponent(); |
||||
int dir = e.getWheelRotation(); |
||||
JScrollPane main = l.getView(); |
||||
if (c instanceof JScrollPane && !c.equals(main)) { |
||||
JScrollPane child = (JScrollPane) c; |
||||
BoundedRangeModel m = child.getVerticalScrollBar().getModel(); |
||||
int extent = m.getExtent(); |
||||
int minimum = m.getMinimum(); |
||||
int maximum = m.getMaximum(); |
||||
int value = m.getValue(); |
||||
if (value + extent >= maximum && dir > 0 || value <= minimum && dir < 0) { |
||||
main.dispatchEvent(SwingUtilities.convertMouseEvent(c, e, main)); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,33 @@
|
||||
package com.fr.design.locale.impl; |
||||
|
||||
import com.fr.design.DesignerEnvManager; |
||||
import com.fr.general.locale.LocaleMark; |
||||
import java.util.HashMap; |
||||
import java.util.Locale; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author hades |
||||
* @version 10.0 |
||||
* Created by hades on 2021/9/2 |
||||
*/ |
||||
public class DoubleSplashMark implements LocaleMark<String> { |
||||
|
||||
private final Map<Locale, String> map = new HashMap<Locale, String>(); |
||||
private static final String SPLASH_PATH_X2 = "/com/fr/design/images/splash@2x.png"; |
||||
private static final String SPLASH_PATH_EN_X2 = "/com/fr/design/images/splash_en@2x.png"; |
||||
|
||||
public DoubleSplashMark() { |
||||
map.put(Locale.CHINA, SPLASH_PATH_X2); |
||||
map.put(Locale.KOREA, SPLASH_PATH_EN_X2); |
||||
map.put(Locale.JAPAN, SPLASH_PATH_EN_X2); |
||||
map.put(Locale.US, SPLASH_PATH_EN_X2); |
||||
map.put(Locale.TAIWAN, SPLASH_PATH_EN_X2); |
||||
} |
||||
|
||||
@Override |
||||
public String getValue() { |
||||
String result = map.get(DesignerEnvManager.getEnvManager().getLanguage()); |
||||
return result == null ? SPLASH_PATH_EN_X2 : result; |
||||
} |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.fr.design.mainframe.authority; |
||||
|
||||
import com.fr.report.cell.cellattr.core.group.DSColumn; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
public class DSColumnAuthorityChecker extends ElementAuthorityChecker<DSColumn> { |
||||
|
||||
@Override |
||||
@Nullable |
||||
Set<String> getNoAuthDatasetNames(DSColumn dsColumn, Set<String> authDatasetNames) { |
||||
if (!authDatasetNames.contains(dsColumn.getDSName())) { |
||||
return new HashSet<>(Arrays.asList(dsColumn.getDSName())); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.fr.design.mainframe.authority; |
||||
|
||||
import org.jetbrains.annotations.Nullable; |
||||
import sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl; |
||||
|
||||
import java.lang.reflect.Type; |
||||
import java.util.Set; |
||||
|
||||
|
||||
public abstract class ElementAuthorityChecker<T> { |
||||
|
||||
|
||||
/** |
||||
* @Description 获取越权的数据连接 |
||||
* @param: t 待检查的对象 |
||||
* @param: authConnectionNames 有权限的数据连接名 |
||||
* @return 如果有返回名称,没有返回null |
||||
*/ |
||||
@Nullable |
||||
Set<String> getNoAuthConnectionNames(T t, Set<String> authConnectionNames) { |
||||
return null; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* @Description 获取越权的服务器数据集 |
||||
* @param: t 待检查的对象 |
||||
* @param: authDatasetNames 有权限的服务器数据集名 |
||||
* @return 如果有返回名称,没有返回null |
||||
*/ |
||||
@Nullable |
||||
Set<String> getNoAuthDatasetNames(T t, Set<String> authDatasetNames) { |
||||
return null; |
||||
} |
||||
|
||||
/** |
||||
* @Description 要检查对象的className |
||||
* @return className |
||||
*/ |
||||
String getCheckClassName() { |
||||
ParameterizedTypeImpl parameterizedType = (ParameterizedTypeImpl) this.getClass().getGenericSuperclass(); |
||||
Type type = parameterizedType.getActualTypeArguments()[0]; |
||||
return type.getTypeName(); |
||||
} |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.fr.design.mainframe.authority; |
||||
|
||||
import com.fr.base.Formula; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
import java.util.regex.Matcher; |
||||
import java.util.regex.Pattern; |
||||
|
||||
public class FormulaAuthorityChecker extends ElementAuthorityChecker<Formula> { |
||||
private static final Pattern FORMULA_PATTERN = Pattern.compile("^=SQL\\(\"(.+?)\","); |
||||
|
||||
@Override |
||||
@Nullable |
||||
public Set<String> getNoAuthConnectionNames(Formula formula, Set<String> authConnectionNames) { |
||||
String content = formula.getContent(); |
||||
Matcher matcher = FORMULA_PATTERN.matcher(content); |
||||
if (matcher.find()) { |
||||
if (!authConnectionNames.contains(matcher.group(1))) { |
||||
return new HashSet<>(Arrays.asList(matcher.group(1))); |
||||
} |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,184 @@
|
||||
package com.fr.design.mainframe.authority; |
||||
|
||||
|
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
|
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.mainframe.JTemplate; |
||||
import com.fr.design.mod.ModClassFilter; |
||||
import com.fr.invoke.ClassHelper; |
||||
|
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.rpc.ExceptionHandler; |
||||
import com.fr.rpc.RPCInvokerExceptionInfo; |
||||
import com.fr.stable.Filter; |
||||
import com.fr.workspace.WorkContext; |
||||
import com.fr.workspace.server.authority.user.UserAuthority; |
||||
|
||||
import java.util.Collection; |
||||
import java.util.HashMap; |
||||
import java.util.HashSet; |
||||
import java.util.Iterator; |
||||
import java.util.Map; |
||||
import java.util.Set; |
||||
|
||||
|
||||
import static javax.swing.JOptionPane.WARNING_MESSAGE; |
||||
|
||||
|
||||
public class JTemplateAuthorityChecker { |
||||
JTemplate<?, ?> jTemplate; |
||||
Set<String> authConnectionNames; |
||||
Set<String> authDatasetNames; |
||||
Map<String, ElementAuthorityChecker> checkerMap = new HashMap<>(); |
||||
Set<String> authFailConnectionNames = new HashSet<>(); |
||||
Set<String> authFailDatasetNames = new HashSet<>(); |
||||
|
||||
|
||||
public JTemplateAuthorityChecker(JTemplate<?, ?> jTemplate) { |
||||
long s = System.currentTimeMillis(); |
||||
this.jTemplate = jTemplate; |
||||
this.initAuthNames(); |
||||
this.initChecker(); |
||||
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker init time consume:" + (System.currentTimeMillis() - s)); |
||||
} |
||||
|
||||
private void initAuthNames() { |
||||
UserAuthority templateAuthority = WorkContext.getCurrent().get(UserAuthority.class); |
||||
Map<String, Set<String>> authNamesMap = templateAuthority.getAuthServerDataSetAndConnectionNames(); |
||||
if (authNamesMap != null) { |
||||
//有权限的数据连接名称
|
||||
authConnectionNames = authNamesMap.get(UserAuthority.AUTH_CONNECTION_NAMES); |
||||
//有权限的数据集名称(模板数据集和服务器数据集)
|
||||
authDatasetNames = authNamesMap.get(UserAuthority.AUTH_SERVER_DATASET_NAMES); |
||||
Iterator<String> iterator = jTemplate.getTarget().getTableDataNameIterator(); |
||||
while (iterator.hasNext()) { |
||||
String datasetName = iterator.next(); |
||||
authDatasetNames.add(datasetName); |
||||
} |
||||
} |
||||
} |
||||
|
||||
private void initChecker() { |
||||
registerChecker(new NameDatabaseConnectionAuthorityChecker()); |
||||
registerChecker(new DSColumnAuthorityChecker()); |
||||
registerChecker(new FormulaAuthorityChecker()); |
||||
registerChecker(new NameTableDataAuthorityChecker()); |
||||
} |
||||
|
||||
private void registerChecker(ElementAuthorityChecker checker) { |
||||
checkerMap.put(checker.getCheckClassName(), checker); |
||||
} |
||||
|
||||
|
||||
public boolean isAuthority() { |
||||
long s = System.currentTimeMillis(); |
||||
//遍历模板对象,根据checkerMap.keySet()把感兴趣的对象找出来
|
||||
Map<String, Collection<Object>> targetObjects = ClassHelper.searchObject(jTemplate.getTarget(), checkerMap.keySet(), ClassFilter.getInstance()); |
||||
|
||||
//找到对应的checker,对对象进行检查
|
||||
for (String name : targetObjects.keySet()) { |
||||
ElementAuthorityChecker checker = checkerMap.get(name); |
||||
for (Object object : targetObjects.get(name)) { |
||||
if (authConnectionNames != null) { |
||||
Set<String> noAuthName = checker.getNoAuthConnectionNames(object, authConnectionNames); |
||||
if (noAuthName != null) { |
||||
authFailConnectionNames.addAll(noAuthName); |
||||
} |
||||
} |
||||
if (authDatasetNames != null) { |
||||
Set<String> noAuthName = checker.getNoAuthDatasetNames(object, authDatasetNames); |
||||
if (noAuthName != null) { |
||||
authFailDatasetNames.addAll(noAuthName); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
FineLoggerFactory.getLogger().info("JTemplateAuthorityChecker check time consume:" + (System.currentTimeMillis() - s)); |
||||
return authFailConnectionNames.size() == 0 && authFailDatasetNames.size() == 0; |
||||
} |
||||
|
||||
public void showAuthorityFailPromptDialog() { |
||||
StringBuffer stringBuffer = new StringBuffer(); |
||||
stringBuffer.append(Toolkit.i18nText("Fine-Design-Basic_Save_Failure")); |
||||
stringBuffer.append("\n"); |
||||
stringBuffer.append(getPromptInfo(authFailDatasetNames, |
||||
Toolkit.i18nText("Fine-Design_Template_Authority_Check_Server_Dataset_Authority"))); |
||||
stringBuffer.append(getPromptInfo(authFailConnectionNames, |
||||
Toolkit.i18nText("Fine-Design_Template_Authority_Check_Data_Connection_Authority"))); |
||||
FineJOptionPane.showMessageDialog( |
||||
DesignerContext.getDesignerFrame(), |
||||
stringBuffer.toString(), |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
WARNING_MESSAGE); |
||||
} |
||||
|
||||
private String getPromptInfo(Set<String> authFailNames, String message) { |
||||
StringBuffer stringBuffer = new StringBuffer(); |
||||
if (authFailNames.size() > 0) { |
||||
stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Current_Operator_Miss")); |
||||
stringBuffer.append(authFailNames.size()); |
||||
stringBuffer.append(Toolkit.i18nText("Fine-Design_Report_Ge")); |
||||
stringBuffer.append(message); |
||||
stringBuffer.append("\n"); |
||||
stringBuffer.append(getNoAuthNameSequence(authFailNames)); |
||||
} |
||||
return stringBuffer.toString(); |
||||
} |
||||
|
||||
private String getNoAuthNameSequence(Set<String> names) { |
||||
StringBuffer stringBuffer = new StringBuffer(); |
||||
int showMaxCount = 3; |
||||
int count = 0; |
||||
for (String name : names) { |
||||
if (count == showMaxCount) { |
||||
stringBuffer.append(Toolkit.i18nText("Fine-Design_Template_Authority_Check_Etc")); |
||||
break; |
||||
} |
||||
stringBuffer.append(name); |
||||
if (count != names.size() - 1 && count != showMaxCount - 1) { |
||||
stringBuffer.append(";"); |
||||
} |
||||
count++; |
||||
} |
||||
stringBuffer.append("\n"); |
||||
return stringBuffer.toString(); |
||||
} |
||||
|
||||
static class ClassFilter implements Filter<String> { |
||||
|
||||
private static final Set<String> FILTER_SET = new HashSet<>(); |
||||
private static final Set<String> START_WITH_SET = new HashSet<>(); |
||||
private static final Filter<String> INSTANCE = new ModClassFilter(); |
||||
|
||||
public static Filter<String> getInstance() { |
||||
return INSTANCE; |
||||
} |
||||
|
||||
static { |
||||
FILTER_SET.add("java.awt.image.BufferedImage"); |
||||
FILTER_SET.add("sun.awt.AppContext"); |
||||
FILTER_SET.add("com.fr.poly.creator.ECBlockCreator"); |
||||
FILTER_SET.add("io.netty.channel.nio.SelectedSelectionKeySet"); |
||||
FILTER_SET.add("com.fr.form.ui.ElementCaseImage"); |
||||
FILTER_SET.add("this$0"); |
||||
START_WITH_SET.add("com.fr.design"); |
||||
} |
||||
|
||||
@Override |
||||
public boolean accept(String s) { |
||||
if (FILTER_SET.contains(s)) { |
||||
return true; |
||||
} |
||||
for (String start : START_WITH_SET) { |
||||
if (s.startsWith(start)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,22 @@
|
||||
package com.fr.design.mainframe.authority; |
||||
|
||||
import com.fr.data.impl.NameDatabaseConnection; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
import java.util.stream.Collectors; |
||||
|
||||
public class NameDatabaseConnectionAuthorityChecker extends ElementAuthorityChecker<NameDatabaseConnection> { |
||||
@Override |
||||
@Nullable |
||||
Set<String> getNoAuthConnectionNames(NameDatabaseConnection nameDatabaseConnection, Set<String> authConnectionNames) { |
||||
String name = nameDatabaseConnection.getName(); |
||||
if (!authConnectionNames.contains(name)) { |
||||
return new HashSet<>(Arrays.asList(name)); |
||||
} |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,19 @@
|
||||
package com.fr.design.mainframe.authority; |
||||
|
||||
import com.fr.data.impl.NameTableData; |
||||
import org.jetbrains.annotations.Nullable; |
||||
|
||||
import java.util.Arrays; |
||||
import java.util.HashSet; |
||||
import java.util.Set; |
||||
|
||||
public class NameTableDataAuthorityChecker extends ElementAuthorityChecker<NameTableData> { |
||||
@Override |
||||
@Nullable |
||||
Set<String> getNoAuthDatasetNames(NameTableData nameTableData, Set<String> authDatasetNames) { |
||||
if (!authDatasetNames.contains(nameTableData.getName())) { |
||||
return new HashSet<>(Arrays.asList(nameTableData.getName())); |
||||
} |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.combo; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.combo.SimpleComboPane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.combo.SimpleComboStyle; |
||||
|
||||
public class SimpleComboCheckBoxStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return SimpleComboStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return SimpleComboPane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "tagcombocheckbox"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-SimpleCombo_SimpleComboStyle"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.combo; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.combo.SimpleComboPane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.combo.SimpleComboStyle; |
||||
|
||||
public class SimpleComboStyleProvider extends AbstractMobileWidgetStyleProvider{ |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return SimpleComboStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return SimpleComboPane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "combo"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-SimpleCombo_SimpleComboStyle"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.date; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.date.NavigationCustomDefinePane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.date.NavigationMobileStyle; |
||||
|
||||
public class NavigationStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return NavigationMobileStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return NavigationCustomDefinePane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "datetime"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-Date_Navigation_Calendar"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.date; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.date.SimpleDateCustomDefinePane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.date.SimpleDateMobileStyle; |
||||
|
||||
public class SimpleDateStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return SimpleDateMobileStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return SimpleDateCustomDefinePane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "datetime"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-SimpleDate_Style"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.date; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.date.SimpleCustomDefinePane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.date.SimpleMobileStyle; |
||||
|
||||
public class SimpleStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return SimpleMobileStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return SimpleCustomDefinePane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "datetime"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-Date_Simple_Calendar"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.radiogroup; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.radiogroup.CapsuleCustomDefinePane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.radiogroup.CapsuleMobileStyle; |
||||
|
||||
public class CapsuleRadioGroupStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return CapsuleMobileStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return CapsuleCustomDefinePane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "radiogroup"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Capsule_Button"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.radiogroup; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.radiogroup.ImageCustomDefinePane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle; |
||||
|
||||
public class ImageRadioGroupStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return ImageMobileStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return ImageCustomDefinePane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "radiogroup"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Graphic_Button"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,35 @@
|
||||
package com.fr.design.mainframe.mobile.provider.radiogroup; |
||||
|
||||
import com.fr.design.fun.impl.AbstractMobileWidgetStyleProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.ui.radiogroup.UnitedCustomDefinePane; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.radiogroup.UnitedMobileStyle; |
||||
|
||||
public class UnitedRadioGroupStyleProvider extends AbstractMobileWidgetStyleProvider { |
||||
@Override |
||||
public Class<? extends MobileStyle> classForMobileStyle() { |
||||
return UnitedMobileStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends MobileStyleCustomDefinePane> classForWidgetAppearance() { |
||||
return UnitedCustomDefinePane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String xTypeForWidget() { |
||||
return "radiogroup"; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-RadioGroup_Linkage_Button"); |
||||
} |
||||
|
||||
@Override |
||||
public int currentAPILevel() { |
||||
return CURRENT_LEVEL; |
||||
} |
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.fr.design.mainframe.mobile.provider.topparam; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.fun.impl.AbstractMobileParamUIProvider; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.mainframe.mobile.ui.topparam.MobileTopParamPane; |
||||
import com.fr.form.ui.mobile.MobileParamStyle; |
||||
import com.fr.form.ui.mobile.impl.MobileTopParamStyle; |
||||
|
||||
public class MobileTopParamStyleProvider extends AbstractMobileParamUIProvider { |
||||
@Override |
||||
public Class<? extends MobileParamStyle> classForMobileParamStyle() { |
||||
return MobileTopParamStyle.class; |
||||
} |
||||
|
||||
@Override |
||||
public Class<? extends BasicBeanPane<? extends MobileParamStyle>> classForMobileParamAppearance() { |
||||
return MobileTopParamPane.class; |
||||
} |
||||
|
||||
@Override |
||||
public String displayName() { |
||||
return Toolkit.i18nText("Fine-Plugin-TopParam_Name"); |
||||
} |
||||
} |
@ -0,0 +1,304 @@
|
||||
package com.fr.design.mainframe.mobile.ui.combo; |
||||
|
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
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.UISpinner; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.mainframe.mobile.utils.FontConfigPane; |
||||
import com.fr.design.mainframe.mobile.utils.IconConfigPane; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.combo.SimpleComboStyle; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public class SimpleComboPane extends MobileStyleCustomDefinePane { |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
private FontConfigPane labelFontPane; |
||||
private FontConfigPane valueFontPane; |
||||
private IconConfigPane expandIconPane; |
||||
private IconConfigPane unexpandIconPane; |
||||
private NewColorSelectBox background; |
||||
private LineComboBox borderType; |
||||
private NewColorSelectBox borderColor; |
||||
private UISpinner borderRadius; |
||||
private UIRadioButton fillButton; |
||||
private UIRadioButton customButton; |
||||
private UISpinner widthSpinner; |
||||
|
||||
private UIRadioButton floatFillButton; |
||||
private UIRadioButton floatSameWidthButton; |
||||
|
||||
public SimpleComboPane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}; |
||||
this.add(basicScrollPane); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Control_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-SimpleCombo_Style_Default"), Toolkit.i18nText("Fine-Plugin-SimpleCombo_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
|
||||
} |
||||
}); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
||||
JPanel stylePanel = DesignerUtils.createLeftRightComponentsPane(buttonStyleLabel, custom); |
||||
panel.add(stylePanel); |
||||
scrollPanel.add(panel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = createCenterPane(); |
||||
centerPane.setVisible(false); |
||||
addLabelNamePane(); |
||||
addValuePane(); |
||||
addIconPane(); |
||||
addWidgetSettingPane(); |
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
} |
||||
|
||||
private void addLabelNamePane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Label_Name"))); |
||||
labelFontPane = new FontConfigPane(); |
||||
JPanel fontPanel = createFontPane(labelFontPane); |
||||
centerPane.add(fontPanel); |
||||
} |
||||
|
||||
private void addValuePane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Control_Value"))); |
||||
valueFontPane = new FontConfigPane(); |
||||
JPanel fontPanel = createFontPane(valueFontPane); |
||||
valueFontPane.setFontColor(new Color(153, 153, 153)); |
||||
centerPane.add(fontPanel); |
||||
} |
||||
|
||||
private JPanel createFontPane(FontConfigPane fontConfigPane) { |
||||
UILabel fontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Character")); |
||||
JPanel fontPanel = DesignerUtils.createLeftRightComponentsPane(fontLabel, fontConfigPane); |
||||
return fontPanel; |
||||
} |
||||
|
||||
private void addIconPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Arrow"))); |
||||
UILabel tipLabel = new UILabel(); |
||||
tipLabel.setFont(new Font(tipLabel.getName(), Font.PLAIN, 10)); |
||||
tipLabel.setSize(470, 40); |
||||
tipLabel.setText(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Tips")); |
||||
tipLabel.setForeground(Color.decode("#9B9B9B")); |
||||
centerPane.add(tipLabel); |
||||
|
||||
|
||||
UILabel expandLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Expand_Icon")); |
||||
UILabel unexpandLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Collapse_Icon")); |
||||
|
||||
expandIconPane = new IconConfigPane(); |
||||
unexpandIconPane = new IconConfigPane(); |
||||
|
||||
JPanel expandPane = DesignerUtils.createLeftRightComponentsPane(expandLabel, expandIconPane); |
||||
centerPane.add(expandPane); |
||||
|
||||
JPanel unexpandPane = DesignerUtils.createLeftRightComponentsPane(unexpandLabel, unexpandIconPane); |
||||
centerPane.add(unexpandPane); |
||||
} |
||||
|
||||
private void addWidgetSettingPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Control_Region"))); |
||||
background = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
borderType = new LineComboBox(DesignerUtils.BORDER_LINE_STYLE_ARRAY); |
||||
borderType.setSelectedLineStyle(Constants.LINE_THIN); |
||||
borderType.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
borderColor = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
borderRadius = new UISpinner(0, Integer.MAX_VALUE, 1, 2); |
||||
borderRadius.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
|
||||
JComponent[] controlComponents = new JComponent[]{background, borderType, borderColor, borderRadius}; |
||||
String[] comboBoxNames = new String[]{ |
||||
Toolkit.i18nText("Fine-Plugin-SimpleCombo_Control_Background"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleCombo_Control_Border"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleCombo_Border_Color"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleCombo_Radius"), |
||||
}; |
||||
|
||||
Component[][] components = new Component[4][]; |
||||
|
||||
for (int i = 0; i < 4; i++) { |
||||
UILabel label = DesignerUtils.createConfigLabel(comboBoxNames[i]); |
||||
components[i] = new Component[]{label, controlComponents[i]}; |
||||
} |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p, }; |
||||
double[] columnSize = {p, p}; |
||||
JPanel controlPanel = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 10); |
||||
centerPane.add(controlPanel); |
||||
|
||||
fillButton = new UIRadioButton(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Horizontal_Fill")); |
||||
fillButton.setSelected(true); |
||||
customButton = new UIRadioButton(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Custom_Width")); |
||||
ActionListener listener = new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
widthSpinner.setVisible(customButton.isSelected()); |
||||
} |
||||
}; |
||||
fillButton.addActionListener(listener); |
||||
customButton.addActionListener(listener); |
||||
ButtonGroup buttonGroup = new ButtonGroup(); |
||||
buttonGroup.add(fillButton); |
||||
buttonGroup.add(customButton); |
||||
widthSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 200); |
||||
widthSpinner.setPreferredSize(new Dimension(78, 20)); |
||||
widthSpinner.setVisible(false); |
||||
UILabel widthLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Width")); |
||||
JPanel buttonsPane = createButtonPane(); |
||||
buttonsPane.add(fillButton); |
||||
buttonsPane.add(customButton); |
||||
JPanel widthSetting = DesignerUtils.createLeftRightComponentsPane(widthLabel, buttonsPane, widthSpinner); |
||||
centerPane.add(widthSetting); |
||||
|
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Floating_Layer"))); |
||||
UILabel floatLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Width")); |
||||
floatFillButton = new UIRadioButton(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Horizontal_Fill")); |
||||
floatFillButton.setSelected(true); |
||||
floatSameWidthButton = new UIRadioButton(Toolkit.i18nText("Fine-Plugin-SimpleCombo_Follow_Control")); |
||||
ButtonGroup floatButtonGroup = new ButtonGroup(); |
||||
floatButtonGroup.add(floatFillButton); |
||||
floatButtonGroup.add(floatSameWidthButton); |
||||
JPanel floatButtonPane = createButtonPane(); |
||||
floatButtonPane.add(floatFillButton); |
||||
floatButtonPane.add(floatSameWidthButton); |
||||
JPanel floatSetting = DesignerUtils.createLeftRightComponentsPane(floatLabel, floatFillButton, floatSameWidthButton); |
||||
centerPane.add(floatSetting); |
||||
} |
||||
|
||||
private JPanel createButtonPane() { |
||||
JPanel buttonPane = new JPanel(); |
||||
buttonPane.setLayout(new GridLayout(0, 2, 14, 0)); |
||||
buttonPane.setPreferredSize(new Dimension(220, 20)); |
||||
return buttonPane; |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle ob) { |
||||
SimpleComboStyle mobileStyle = (SimpleComboStyle) ob; |
||||
custom.setSelectedIndex(mobileStyle.isCustom() ? 1 : 0); |
||||
expandIconPane.populate(mobileStyle.getExpandIcon()); |
||||
unexpandIconPane.populate(mobileStyle.getUnexpandIcon()); |
||||
if (mobileStyle.getLabelFont() != null) { |
||||
labelFontPane.populate(mobileStyle.getLabelFont()); |
||||
} |
||||
if (mobileStyle.getValueFont() != null) { |
||||
valueFontPane.populate(mobileStyle.getValueFont()); |
||||
} |
||||
if (mobileStyle.getBackgroundColor() != null) { |
||||
background.setSelectObject(mobileStyle.getBackgroundColor()); |
||||
} |
||||
if (mobileStyle.getBorderColor() != null) { |
||||
borderColor.setSelectObject(mobileStyle.getBorderColor()); |
||||
} |
||||
borderType.setSelectedLineStyle(mobileStyle.getBorderType()); |
||||
borderRadius.setValue(mobileStyle.getBorderRadius()); |
||||
if (mobileStyle.isCustomWidth()) { |
||||
fillButton.setSelected(false); |
||||
customButton.setSelected(true); |
||||
widthSpinner.setVisible(true); |
||||
widthSpinner.setValue(mobileStyle.getWidth()); |
||||
} else { |
||||
fillButton.setSelected(true); |
||||
customButton.setSelected(false); |
||||
widthSpinner.setVisible(false); |
||||
} |
||||
if (mobileStyle.isFloatWidthFollow()) { |
||||
floatFillButton.setSelected(false); |
||||
floatSameWidthButton.setSelected(true); |
||||
} else { |
||||
floatFillButton.setSelected(true); |
||||
floatSameWidthButton.setSelected(false); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
SimpleComboStyle mobileStyle = (SimpleComboStyle) this.widget.getMobileStyle(); |
||||
mobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
mobileStyle.setExpandIcon(expandIconPane.update()); |
||||
mobileStyle.setUnexpandIcon(unexpandIconPane.update()); |
||||
mobileStyle.setLabelFont(labelFontPane.update()); |
||||
mobileStyle.setValueFont(valueFontPane.update()); |
||||
mobileStyle.setBackgroundColor(background.getSelectObject()); |
||||
mobileStyle.setBorderColor(borderColor.getSelectObject()); |
||||
mobileStyle.setBorderType(borderType.getSelectedLineStyle()); |
||||
mobileStyle.setBorderRadius(borderRadius.getValue()); |
||||
mobileStyle.setCustomWidth(customButton.isSelected()); |
||||
mobileStyle.setWidth(widthSpinner.getValue()); |
||||
mobileStyle.setFloatWidthFollow(floatSameWidthButton.isSelected()); |
||||
return mobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,272 @@
|
||||
package com.fr.design.mainframe.mobile.ui.date; |
||||
|
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.event.UIObserverListener; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.date.NavigationMobileStyle; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public class NavigationCustomDefinePane extends MobileStyleCustomDefinePane { |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
|
||||
private UIComboBox expand; |
||||
private UIComboBox dateFontSize; |
||||
private NewColorSelectBox buttonColorSelectBox; |
||||
private NewColorSelectBox titleSplitLineColorSelectBox; |
||||
private UICheckBox showTitleEditor; |
||||
private NewColorSelectBox arrowColorSelectBox; |
||||
private UIColorButton mainFontColor; |
||||
private UIColorButton specialFontColor; |
||||
|
||||
private Color titleSplitLineDisableColor = new Color(234, 234, 234); |
||||
private Color titleSplitLineColor; |
||||
|
||||
public NavigationCustomDefinePane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}; |
||||
this.add(basicScrollPane); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
JPanel stylePanel = new JPanel(); |
||||
stylePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-Date_Style_Default"), Toolkit.i18nText("Fine-Plugin-Date_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
|
||||
} |
||||
}); |
||||
stylePanel.add(buttonStyleLabel); |
||||
stylePanel.add(custom); |
||||
scrollPanel.add(stylePanel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = createCenterPane(); |
||||
centerPane.setVisible(false); |
||||
addExpandPane(); |
||||
addHeaderLinePane(); |
||||
addButtonColorPane(); |
||||
addFontColorPane(); |
||||
addArrowPane(); |
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
custom.setSelectedIndex(1); |
||||
} |
||||
|
||||
private void addExpandPane() { |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Status")); |
||||
expand = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-Date_Status_Collapse"), Toolkit.i18nText("Fine-Plugin-Date_Status_Expand")}); |
||||
expand.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(expand); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private void addButtonColorPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Button"))); |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Button_Color")); |
||||
buttonColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
buttonColorSelectBox.setSelectObject(new Color(31, 173, 229)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(buttonColorSelectBox); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private void addHeaderLinePane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Title_Line"))); |
||||
|
||||
UILabel titleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_SubTitle_Line")); |
||||
showTitleEditor = DesignerUtils.createCheckBox(Toolkit.i18nText("Fine-Plugin-Date_Show_Title_Line"), true); |
||||
JPanel headerPanel = new JPanel(); |
||||
headerPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
headerPanel.add(titleLabel); |
||||
headerPanel.add(showTitleEditor); |
||||
centerPane.add(headerPanel); |
||||
|
||||
final UILabel splitLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Title_Split_Line_Color")); |
||||
titleSplitLineColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
if(showTitleEditor.isSelected()) { |
||||
titleSplitLineColor = titleSplitLineColorSelectBox.getSelectObject(); |
||||
} |
||||
} |
||||
}); |
||||
titleSplitLineColorSelectBox.setSelectObject(new Color(234, 234, 234)); |
||||
final JPanel splitLineColorPanel = new JPanel(); |
||||
splitLineColorPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
splitLineColorPanel.add(splitLabel); |
||||
splitLineColorPanel.add(titleSplitLineColorSelectBox); |
||||
|
||||
|
||||
showTitleEditor.registerChangeListener(new UIObserverListener() { |
||||
@Override |
||||
public void doChange() { |
||||
if(showTitleEditor.isSelected()) { |
||||
titleSplitLineColorSelectBox.setSelectObject(titleSplitLineColor); |
||||
} else { |
||||
titleSplitLineColorSelectBox.setSelectObject(titleSplitLineDisableColor); |
||||
} |
||||
|
||||
titleSplitLineColorSelectBox.setEnabled(showTitleEditor.isSelected()); |
||||
splitLabel.setEnabled(showTitleEditor.isSelected()); |
||||
} |
||||
}); |
||||
centerPane.add(splitLineColorPanel); |
||||
} |
||||
|
||||
private void addFontColorPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Font"))); |
||||
UILabel mainLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Font_Main")); |
||||
mainFontColor = new UIColorButton(); |
||||
mainFontColor.setColor(new Color(51, 51, 51)); |
||||
mainFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
|
||||
UILabel specialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Font_Special")); |
||||
specialFontColor = new UIColorButton(); |
||||
specialFontColor.setColor(new Color(255, 148, 84)); |
||||
specialFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel panel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][] { |
||||
{mainLabel, mainFontColor}, |
||||
{specialLabel, specialFontColor} |
||||
}, rowSize, columnSize, 10); |
||||
|
||||
centerPane.add(panel); |
||||
|
||||
|
||||
UILabel fontSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Font_Size")); |
||||
dateFontSize = new UIComboBox(new Integer[]{12, 13, 14, 15, 16, 17, 18}); |
||||
dateFontSize.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
dateFontSize.setSelectedItem(14); |
||||
JPanel fontPanel = new JPanel(); |
||||
fontPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
fontPanel.add(fontSizeLabel); |
||||
fontPanel.add(dateFontSize); |
||||
centerPane.add(fontPanel); |
||||
} |
||||
|
||||
private void addArrowPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Arrow"))); |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Arrow_Color")); |
||||
arrowColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
arrowColorSelectBox.setSelectObject(new Color(234, 234, 234)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(arrowColorSelectBox ); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle ob) { |
||||
NavigationMobileStyle mobileStyle = (NavigationMobileStyle) ob; |
||||
custom.setSelectedIndex(mobileStyle.isCustom() ? 1 : 0); |
||||
expand.setSelectedIndex(mobileStyle.isExpand() ? 1 : 0); |
||||
buttonColorSelectBox.setSelectObject(mobileStyle.getButtonBackgroundColor()); |
||||
mainFontColor.setColor(mobileStyle.getMainFontColor()); |
||||
specialFontColor.setColor(mobileStyle.getSpecialFontColor()); |
||||
showTitleEditor.setSelected(mobileStyle.isShowTitleLine()); |
||||
if(mobileStyle.isShowTitleLine()) { |
||||
titleSplitLineColorSelectBox.setSelectObject(mobileStyle.getTitleSplitLineColor()); |
||||
} else { |
||||
titleSplitLineColorSelectBox.setSelectObject(titleSplitLineDisableColor); |
||||
titleSplitLineColor = mobileStyle.getTitleSplitLineColor(); |
||||
} |
||||
dateFontSize.setSelectedItem(mobileStyle.getDateFontSize()); |
||||
arrowColorSelectBox.setSelectObject(mobileStyle.getArrowColor()); |
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
NavigationMobileStyle mobileStyle = (NavigationMobileStyle)this.widget.getMobileStyle(); |
||||
|
||||
mobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
mobileStyle.setExpand(expand.getSelectedIndex() == 1); |
||||
mobileStyle.setButtonBackgroundColor(buttonColorSelectBox.getSelectObject()); |
||||
mobileStyle.setMainFontColor(mainFontColor.getColor()); |
||||
mobileStyle.setSpecialFontColor(specialFontColor.getColor()); |
||||
mobileStyle.setShowTitleLine(showTitleEditor.isSelected()); |
||||
if(showTitleEditor.isSelected()) { |
||||
mobileStyle.setTitleSplitLineColor(titleSplitLineColorSelectBox.getSelectObject()); |
||||
} else { |
||||
mobileStyle.setTitleSplitLineColor(titleSplitLineColor); |
||||
} |
||||
mobileStyle.setDateFontSize(Integer.parseInt(dateFontSize.getSelectedItem().toString())); |
||||
mobileStyle.setArrowColor(arrowColorSelectBox.getSelectObject()); |
||||
return mobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,230 @@
|
||||
package com.fr.design.mainframe.mobile.ui.date; |
||||
|
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.date.SimpleMobileStyle; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public class SimpleCustomDefinePane extends MobileStyleCustomDefinePane { |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
|
||||
private UIComboBox expand; |
||||
private UIComboBox dateFontSize; |
||||
private NewColorSelectBox buttonColorSelectBox; |
||||
private NewColorSelectBox titleSplitLineColorSelectBox; |
||||
private NewColorSelectBox arrowColorSelectBox; |
||||
private UIColorButton mainFontColor; |
||||
private UIColorButton specialFontColor; |
||||
|
||||
public SimpleCustomDefinePane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
|
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
|
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}; |
||||
this.add(basicScrollPane); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
JPanel stylePanel = new JPanel(); |
||||
stylePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-Date_Style_Default"), |
||||
Toolkit.i18nText("Fine-Plugin-Date_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
|
||||
} |
||||
}); |
||||
stylePanel.add(buttonStyleLabel); |
||||
stylePanel.add(custom); |
||||
scrollPanel.add(stylePanel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = createCenterPane(); |
||||
centerPane.setVisible(false); |
||||
addExpandPane(); |
||||
addHeaderLinePane(); |
||||
addButtonColorPane(); |
||||
addFontColorPane(); |
||||
addArrowPane(); |
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
custom.setSelectedIndex(1); |
||||
} |
||||
|
||||
private void addExpandPane() { |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Status")); |
||||
expand = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-Date_Status_Collapse"), Toolkit.i18nText("Fine-Plugin-Date_Status_Expand")}); |
||||
expand.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(expand); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private void addHeaderLinePane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Title_Line"))); |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Title_Split_Line_Color")); |
||||
titleSplitLineColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
titleSplitLineColorSelectBox.setSelectObject(new Color(234, 234, 234)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(titleSplitLineColorSelectBox); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private void addButtonColorPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Button"))); |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Button_Color")); |
||||
buttonColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
buttonColorSelectBox.setSelectObject(new Color(31, 173, 229)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(buttonColorSelectBox); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private void addFontColorPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Font"))); |
||||
UILabel mainLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Font_Main")); |
||||
mainFontColor = new UIColorButton(); |
||||
mainFontColor.setColor(new Color(51, 51, 51)); |
||||
mainFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
|
||||
UILabel specialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Font_Special")); |
||||
specialFontColor = new UIColorButton(); |
||||
specialFontColor.setColor(new Color(255, 148, 84)); |
||||
specialFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel panel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][] { |
||||
{mainLabel, mainFontColor}, |
||||
{specialLabel, specialFontColor} |
||||
}, rowSize, columnSize, 10); |
||||
|
||||
centerPane.add(panel); |
||||
|
||||
UILabel fontSizeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Font_Size")); |
||||
dateFontSize = new UIComboBox(new Integer[]{12, 13, 14, 15, 16, 17, 18}); |
||||
dateFontSize.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
dateFontSize.setSelectedItem(14); |
||||
JPanel fontPanel = new JPanel(); |
||||
fontPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
fontPanel.add(fontSizeLabel); |
||||
fontPanel.add(dateFontSize); |
||||
centerPane.add(fontPanel); |
||||
} |
||||
|
||||
private void addArrowPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-Date_Arrow"))); |
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-Date_Arrow_Color")); |
||||
arrowColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
arrowColorSelectBox.setSelectObject(new Color(234, 234, 234)); |
||||
JPanel panel = new JPanel(); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
panel.add(label); |
||||
panel.add(arrowColorSelectBox ); |
||||
centerPane.add(panel); |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle ob) { |
||||
SimpleMobileStyle mobileStyle = (SimpleMobileStyle) ob; |
||||
custom.setSelectedIndex(mobileStyle.isCustom() ? 1 : 0); |
||||
expand.setSelectedIndex(mobileStyle.isExpand() ? 1 : 0); |
||||
buttonColorSelectBox.setSelectObject(mobileStyle.getButtonBackgroundColor()); |
||||
mainFontColor.setColor(mobileStyle.getMainFontColor()); |
||||
specialFontColor.setColor(mobileStyle.getSpecialFontColor()); |
||||
titleSplitLineColorSelectBox.setSelectObject(mobileStyle.getTitleSplitLineColor()); |
||||
dateFontSize.setSelectedItem(mobileStyle.getDateFontSize()); |
||||
arrowColorSelectBox.setSelectObject(mobileStyle.getArrowColor()); |
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
SimpleMobileStyle mobileStyle = (SimpleMobileStyle)this.widget.getMobileStyle(); |
||||
|
||||
mobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
mobileStyle.setExpand(expand.getSelectedIndex() == 1); |
||||
mobileStyle.setButtonBackgroundColor(buttonColorSelectBox.getSelectObject()); |
||||
mobileStyle.setMainFontColor(mainFontColor.getColor()); |
||||
mobileStyle.setSpecialFontColor(specialFontColor.getColor()); |
||||
mobileStyle.setTitleSplitLineColor(titleSplitLineColorSelectBox.getSelectObject()); |
||||
mobileStyle.setDateFontSize(Integer.parseInt(dateFontSize.getSelectedItem().toString())); |
||||
mobileStyle.setArrowColor(arrowColorSelectBox.getSelectObject()); |
||||
return mobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,267 @@
|
||||
package com.fr.design.mainframe.mobile.ui.date; |
||||
|
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.gui.ibutton.UIRadioButton; |
||||
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.UISpinner; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.mainframe.mobile.utils.FontConfigPane; |
||||
import com.fr.design.mainframe.mobile.utils.IconConfigPane; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.date.ControlStyle; |
||||
import com.fr.form.ui.mobile.date.SimpleDateMobileStyle; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public class SimpleDateCustomDefinePane extends MobileStyleCustomDefinePane { |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
private FontConfigPane labelFontConfigPane; |
||||
private FontConfigPane controlValueConfigPane; |
||||
private NewColorSelectBox controlBackground; |
||||
private LineComboBox controlBorder; |
||||
private NewColorSelectBox controlBorderColor; |
||||
private UISpinner controlWidgetRadius; |
||||
private UISpinner widthSpinner; |
||||
private UIRadioButton fillButton; |
||||
private UIRadioButton customButton; |
||||
private IconConfigPane iconConfigPane; |
||||
|
||||
public SimpleDateCustomDefinePane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
this.add(new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
JPanel stylePanel = new JPanel(); |
||||
stylePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleDate_Control_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-SimpleDate_Style_Default"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
|
||||
} |
||||
}); |
||||
stylePanel.add(buttonStyleLabel); |
||||
stylePanel.add(custom); |
||||
scrollPanel.add(stylePanel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
centerPane.setVisible(false); |
||||
|
||||
addFontConfigPane(); |
||||
addIconConfigPane(); |
||||
addControlConfigPane(); |
||||
|
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
} |
||||
|
||||
private void addControlConfigPane() { |
||||
|
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleDate_Control_Region"))); |
||||
controlBackground = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
controlBorder = new LineComboBox(DesignerUtils.BORDER_LINE_STYLE_ARRAY); |
||||
controlBorder.setSelectedLineStyle(Constants.LINE_THIN); |
||||
controlBorder.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
controlBorderColor = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
controlWidgetRadius = new UISpinner(0, Integer.MAX_VALUE, 1, 2); |
||||
controlWidgetRadius.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
|
||||
JComponent[] controlComponents = new JComponent[]{controlBackground, controlBorder, controlBorderColor, controlWidgetRadius}; |
||||
String[] comboBoxNames = new String[]{ |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Control_Background"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Control_Border"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Border_Color"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Radius") |
||||
}; |
||||
|
||||
Component[][] components = new Component[4][]; |
||||
|
||||
for (int i = 0; i < 4; i++) { |
||||
UILabel label = DesignerUtils.createConfigLabel(comboBoxNames[i]); |
||||
components[i] = new Component[]{label, controlComponents[i]}; |
||||
} |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel controlPanel = TableLayoutHelper.createCommonTableLayoutPane(components, rowSize, columnSize, 10); |
||||
centerPane.add(controlPanel); |
||||
|
||||
this.fillButton = new UIRadioButton(Toolkit.i18nText("Fine-Plugin-SimpleDate_Horizontal_Fill")); |
||||
this.customButton = new UIRadioButton(Toolkit.i18nText("Fine-Plugin-SimpleDate_Width_Custom")); |
||||
|
||||
ButtonGroup buttonGroup = new ButtonGroup(); |
||||
buttonGroup.add(fillButton); |
||||
buttonGroup.add(customButton); |
||||
|
||||
JPanel panel = new JPanel(); |
||||
panel.add(fillButton); |
||||
panel.add(customButton); |
||||
panel.setLayout(new GridLayout(0, 2, 14, 0)); |
||||
panel.setPreferredSize(new Dimension(174, 20)); |
||||
fillButton.setSelected(true); |
||||
|
||||
ActionListener listener = new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
widthSpinner.setVisible(customButton.isSelected()); |
||||
} |
||||
}; |
||||
|
||||
fillButton.addActionListener(listener); |
||||
customButton.addActionListener(listener); |
||||
|
||||
UILabel label = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleDate_Width")); |
||||
widthSpinner = new UISpinner(1, Integer.MAX_VALUE, 1, 200); |
||||
widthSpinner.setPreferredSize(new Dimension(78, 20)); |
||||
widthSpinner.setVisible(false); |
||||
centerPane.add(DesignerUtils.createLeftRightComponentsPane(label, panel, widthSpinner)); |
||||
|
||||
} |
||||
|
||||
private void addFontConfigPane() { |
||||
|
||||
String[] titleSplitLineNames = new String[]{ |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Label_Name"), |
||||
Toolkit.i18nText("Fine-Plugin-SimpleDate_Control_Value") |
||||
}; |
||||
labelFontConfigPane = new FontConfigPane(); |
||||
controlValueConfigPane = new FontConfigPane(); |
||||
FontConfigPane[] fontConfigPanes = new FontConfigPane[]{labelFontConfigPane, controlValueConfigPane}; |
||||
for (int i = 0; i < 2; i++) { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(titleSplitLineNames[i])); |
||||
UILabel fontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-SimpleDate_Character")); |
||||
JPanel fontPanel = DesignerUtils.createLeftRightComponentsPane(fontLabel, fontConfigPanes[i]); |
||||
centerPane.add(fontPanel); |
||||
} |
||||
} |
||||
|
||||
private void addIconConfigPane() { |
||||
|
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-SimpleDate_Icon"))); |
||||
UILabel tipLabel = new UILabel(); |
||||
tipLabel.setFont(new Font(tipLabel.getName(), Font.PLAIN, 10)); |
||||
tipLabel.setSize(470, 40); |
||||
tipLabel.setText(Toolkit.i18nText("Fine-Plugin-SimpleDate_Tip")); |
||||
tipLabel.setForeground(Color.decode("#9B9B9B")); |
||||
centerPane.add(tipLabel); |
||||
|
||||
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
|
||||
|
||||
iconConfigPane = new IconConfigPane(); |
||||
centerPane.add(iconConfigPane); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle mobileStyle) { |
||||
SimpleDateMobileStyle simpleDateMobileStyle = (SimpleDateMobileStyle) mobileStyle; |
||||
custom.setSelectedIndex(simpleDateMobileStyle.isCustom() ? 1 : 0); |
||||
iconConfigPane.populate(simpleDateMobileStyle.getIconValue()); |
||||
labelFontConfigPane.populate(simpleDateMobileStyle.getLabelFontStyle()); |
||||
controlValueConfigPane.populate(simpleDateMobileStyle.getValueFontStyle()); |
||||
|
||||
ControlStyle controlStyle = simpleDateMobileStyle.getControlStyle(); |
||||
|
||||
if (controlStyle != null) { |
||||
controlBackground.setSelectObject(controlStyle.getBackground()); |
||||
controlBorderColor.setSelectObject(controlStyle.getBorderColor()); |
||||
controlBorder.setSelectedLineStyle(controlStyle.getBorderType()); |
||||
controlWidgetRadius.setValue(controlStyle.getBorderRadius()); |
||||
if (controlStyle.isCustomWidth()) { |
||||
widthSpinner.setVisible(true); |
||||
widthSpinner.setValue(controlStyle.getWidth()); |
||||
customButton.setSelected(true); |
||||
fillButton.setSelected(false); |
||||
} else { |
||||
widthSpinner.setVisible(false); |
||||
customButton.setSelected(false); |
||||
fillButton.setSelected(true); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
SimpleDateMobileStyle simpleDateMobileStyle = (SimpleDateMobileStyle) this.widget.getMobileStyle(); |
||||
simpleDateMobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
simpleDateMobileStyle.setIconValue(iconConfigPane.update()); |
||||
simpleDateMobileStyle.setLabelFontStyle(labelFontConfigPane.update()); |
||||
simpleDateMobileStyle.setValueFontStyle(controlValueConfigPane.update()); |
||||
ControlStyle controlStyle = new ControlStyle(); |
||||
controlStyle.setBackground(controlBackground.getSelectObject()); |
||||
controlStyle.setBorderColor(controlBorderColor.getSelectObject()); |
||||
controlStyle.setBorderType(controlBorder.getSelectedLineStyle()); |
||||
controlStyle.setBorderRadius(controlWidgetRadius.getValue()); |
||||
controlStyle.setCustomWidth(customButton.isSelected()); |
||||
controlStyle.setWidth(widthSpinner.getValue()); |
||||
simpleDateMobileStyle.setControlStyle(controlStyle); |
||||
return simpleDateMobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,310 @@
|
||||
package com.fr.design.mainframe.mobile.ui.radiogroup; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
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.UISpinner; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.mainframe.mobile.utils.FontConfigPane; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.radiogroup.CapsuleMobileStyle; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public class CapsuleCustomDefinePane extends MobileStyleCustomDefinePane { |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
|
||||
private UISpinner leftSpinner; |
||||
private UISpinner rightSpinner; |
||||
private UISpinner topSpinner; |
||||
private UISpinner bottomSpinner; |
||||
|
||||
private JRadioButton leftAlignRadioButton; |
||||
private JRadioButton centerAlignRadioButton; |
||||
|
||||
private NewColorSelectBox initialColorSelectBox; |
||||
private NewColorSelectBox selectedColorSelectBox; |
||||
|
||||
private LineComboBox borderLineCombo; |
||||
private NewColorSelectBox initialBorderColor; |
||||
private NewColorSelectBox selectedBorderColor; |
||||
private UISpinner borderRadiusSpinner; |
||||
|
||||
private FontConfigPane initialFontConfPane; |
||||
private UIColorButton selectedFontColor; |
||||
|
||||
|
||||
public CapsuleCustomDefinePane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}; |
||||
this.add(basicScrollPane); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
JPanel stylePanel = new JPanel(); |
||||
stylePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-RadioGroup_Style_Default"), |
||||
Toolkit.i18nText("Fine-Plugin-RadioGroup_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
|
||||
} |
||||
}); |
||||
stylePanel.add(buttonStyleLabel); |
||||
stylePanel.add(custom); |
||||
scrollPanel.add(stylePanel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = createCenterPane(); |
||||
centerPane.setVisible(false); |
||||
|
||||
addPaddingPane(); |
||||
addBackgroundPane(); |
||||
addBorderPane(); |
||||
addFontPane(); |
||||
|
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
custom.setSelectedIndex(1); |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
} |
||||
|
||||
private void addPaddingPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); |
||||
|
||||
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); |
||||
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); |
||||
UILabel buttonAlignHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment")); |
||||
|
||||
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); |
||||
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); |
||||
|
||||
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); |
||||
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); |
||||
|
||||
UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); |
||||
topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); |
||||
|
||||
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); |
||||
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); |
||||
|
||||
leftAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Left"), true); |
||||
centerAlignRadioButton = new JRadioButton(Toolkit.i18nText("Fine-Plugin-RadioGroup_Alignment_Center"), false); |
||||
|
||||
JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
JPanel layoutPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftAlignRadioButton, centerAlignRadioButton}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
ButtonGroup layoutRadioButtonGroup = new ButtonGroup(); |
||||
layoutRadioButtonGroup.add(leftAlignRadioButton); |
||||
layoutRadioButtonGroup.add(centerAlignRadioButton); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ |
||||
{paddingHintLabel, vPaddingSpinnerPanel}, |
||||
{emptyHintLabel, hPaddingSpinnerPanel}, |
||||
{buttonAlignHintLabel, layoutPanel}, |
||||
}, rowSize, columnSize, 10); |
||||
centerPane.add(paddingPanel); |
||||
} |
||||
|
||||
private void addBackgroundPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Background"))); |
||||
|
||||
UILabel initialColorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Background_Init")); |
||||
initialColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
initialColorSelectBox.setSelectObject(new Color(244, 244, 244)); |
||||
JPanel initialColorSelectPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialColorLabel, initialColorSelectBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(initialColorSelectPane); |
||||
|
||||
UILabel selectedColorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Background_Select")); |
||||
selectedColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
|
||||
} |
||||
}); |
||||
selectedColorSelectBox.setSelectObject(new Color(31, 173, 229)); |
||||
JPanel selectedColorSelectPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectedColorLabel, selectedColorSelectBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(selectedColorSelectPane); |
||||
} |
||||
|
||||
private void addBorderPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border"))); |
||||
|
||||
UILabel borderTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Line")); |
||||
borderLineCombo = new LineComboBox(DesignerUtils.BORDER_LINE_STYLE_ARRAY); |
||||
borderLineCombo.setSelectedLineStyle(Constants.LINE_THIN); |
||||
|
||||
UILabel initialColorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Init_Color")); |
||||
initialBorderColor = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
initialBorderColor.setSelectObject(new Color(244, 244, 244)); |
||||
|
||||
UILabel selectedColorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Select_Color")); |
||||
selectedBorderColor = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
selectedBorderColor.setSelectObject(new Color(31, 173, 229)); |
||||
|
||||
UILabel radiusLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Radius")); |
||||
borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 20); |
||||
borderRadiusSpinner.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel borderPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ |
||||
{borderTypeLabel, borderLineCombo}, |
||||
{initialColorLabel, initialBorderColor}, |
||||
{selectedColorLabel, selectedBorderColor}, |
||||
{radiusLabel, borderRadiusSpinner} |
||||
}, rowSize, columnSize, 10); |
||||
|
||||
centerPane.add(borderPanel); |
||||
|
||||
} |
||||
|
||||
private void addFontPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font"))); |
||||
|
||||
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); |
||||
initialFontConfPane = new FontConfigPane(); |
||||
initialFontConfPane.setFontColor(new Color(204, 204, 204)); |
||||
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(fontPanel); |
||||
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); |
||||
selectedFontColor = new UIColorButton(); |
||||
selectedFontColor.setColor(Color.WHITE); |
||||
selectedFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
JPanel selectFontColorPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectedFontLabel, selectedFontColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(selectFontColorPanel); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle ob) { |
||||
CapsuleMobileStyle mobileStyle = (CapsuleMobileStyle) ob; |
||||
custom.setSelectedIndex(mobileStyle.isCustom() ? 1 : 0); |
||||
leftSpinner.setValue(mobileStyle.getLeftPadding()); |
||||
rightSpinner.setValue(mobileStyle.getRightPadding()); |
||||
topSpinner.setValue(mobileStyle.getTopPadding()); |
||||
bottomSpinner.setValue(mobileStyle.getBottomPadding()); |
||||
leftAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignLeft); |
||||
centerAlignRadioButton.setSelected(mobileStyle.getButtonAlign() == DesignerUtils.kAlignCenter); |
||||
initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor()); |
||||
selectedColorSelectBox.setSelectObject(mobileStyle.getSelectedBackgroundColor()); |
||||
borderLineCombo.setSelectedLineStyle(mobileStyle.getBorderType()); |
||||
initialBorderColor.setSelectObject(mobileStyle.getInitialBorderColor()); |
||||
selectedBorderColor.setSelectObject(mobileStyle.getSelectedBorderColor()); |
||||
borderRadiusSpinner.setValue(mobileStyle.getBorderRadius()); |
||||
if (mobileStyle.getInitialFont() != null) { |
||||
initialFontConfPane.populate(mobileStyle.getInitialFont()); |
||||
} |
||||
if (mobileStyle.getSelectedFont() != null) { |
||||
selectedFontColor.setColor(mobileStyle.getSelectedFont().getForeground()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
CapsuleMobileStyle mobileStyle = (CapsuleMobileStyle) this.widget.getMobileStyle(); |
||||
|
||||
mobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
mobileStyle.setLeftPadding(leftSpinner.getValue()); |
||||
mobileStyle.setRightPadding(rightSpinner.getValue()); |
||||
mobileStyle.setTopPadding(topSpinner.getValue()); |
||||
mobileStyle.setBottomPadding(bottomSpinner.getValue()); |
||||
mobileStyle.setButtonAlign(leftAlignRadioButton.isSelected() ? DesignerUtils.kAlignLeft : DesignerUtils.kAlignCenter); |
||||
mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject()); |
||||
mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject()); |
||||
mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle()); |
||||
mobileStyle.setInitialBorderColor(initialBorderColor.getSelectObject()); |
||||
mobileStyle.setSelectedBorderColor(selectedBorderColor.getSelectObject()); |
||||
mobileStyle.setBorderRadius(borderRadiusSpinner.getValue()); |
||||
|
||||
FRFont initialFont = initialFontConfPane.updateFont(null, null, null); |
||||
FRFont selectedFont = initialFontConfPane.updateFont(selectedFontColor.getColor(), null, null); |
||||
|
||||
mobileStyle.setInitialFont(initialFont); |
||||
mobileStyle.setSelectedFont(selectedFont); |
||||
|
||||
return mobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,195 @@
|
||||
package com.fr.design.mainframe.mobile.ui.radiogroup; |
||||
|
||||
import com.fr.base.IconManager; |
||||
import com.fr.design.dialog.BasicDialog; |
||||
import com.fr.design.dialog.DialogActionAdapter; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.DesignerContext; |
||||
import com.fr.design.utils.DrawRoutines; |
||||
import com.fr.design.web.CustomIconPane; |
||||
import com.fr.form.ui.WidgetInfoConfig; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import javax.swing.plaf.basic.BasicButtonUI; |
||||
import java.awt.*; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.util.ArrayList; |
||||
|
||||
public class IconConfigPane extends JPanel { |
||||
private UIButton editIconButton; |
||||
private UIButton deleteIconButton; |
||||
private String curIconName; |
||||
private IconButton selectIconButton; |
||||
private ArrayList<IconButton> iconButtons = new ArrayList<IconButton>(); |
||||
|
||||
public IconConfigPane(int count) { |
||||
initComp(count); |
||||
} |
||||
|
||||
public void initComp(int count) { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel panel = FRGUIPaneFactory.createNormalFlowInnerContainer_M_Pane(); |
||||
panel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); |
||||
editIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Edit")); |
||||
editIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); |
||||
editIconButton.setPreferredSize(new Dimension(62, 20)); |
||||
panel.add(editIconButton); |
||||
editIconButton.addActionListener(new ActionListener() { |
||||
public void actionPerformed(ActionEvent e) { |
||||
final CustomIconPane cip = new CustomIconPane(){ |
||||
protected String createDescriptionText(){ |
||||
return Toolkit.i18nText("Fine-Design_Mobile_Custom_Icon_Message"); |
||||
} |
||||
}; |
||||
BasicDialog editDialog = cip.showWindow(DesignerContext.getDesignerFrame()); |
||||
editDialog.addDialogActionListener(new DialogActionAdapter() { |
||||
@Override |
||||
public void doOk() { |
||||
curIconName = cip.update(); |
||||
setShowIconImage(); |
||||
IconConfigPane.this.repaint(); |
||||
} |
||||
}); |
||||
editDialog.setVisible(true); |
||||
} |
||||
}); |
||||
editIconButton.setEnabled(false); |
||||
|
||||
deleteIconButton = new UIButton(Toolkit.i18nText("Fine-Design_Basic_Delete")); |
||||
deleteIconButton.setFont(FRFont.getInstance("Helvetica", Font.PLAIN, 12, Color.decode("#3A383A"))); |
||||
deleteIconButton.setPreferredSize(new Dimension(62, 20)); |
||||
panel.add(deleteIconButton); |
||||
deleteIconButton.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
selectIconButton.setIconName(StringUtils.EMPTY); |
||||
IconConfigPane.this.repaint(); |
||||
} |
||||
}); |
||||
deleteIconButton.setEnabled(false); |
||||
|
||||
|
||||
this.add(panel, BorderLayout.CENTER); |
||||
|
||||
JPanel northPane = new JPanel(); |
||||
northPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
for (int i = 0; i < count; i++) { |
||||
IconButton iconButton = new IconButton(""); |
||||
northPane.add(iconButton); |
||||
iconButtons.add(iconButton); |
||||
} |
||||
this.add(northPane, BorderLayout.NORTH); |
||||
} |
||||
|
||||
public void setShowIconImage() { |
||||
selectIconButton.setIconName(curIconName); |
||||
} |
||||
|
||||
public void populate(ArrayList<String> iconArr) { |
||||
for (int i = 0; i < iconButtons.size(); i++) { |
||||
iconButtons.get(i).setIconName(iconArr.get(i)); |
||||
} |
||||
} |
||||
|
||||
public ArrayList<String> update() { |
||||
ArrayList<String> iconNames = new ArrayList<String>(); |
||||
for (int i = 0; i < iconButtons.size(); i++) { |
||||
iconNames.add(iconButtons.get(i).getIconName()); |
||||
} |
||||
return iconNames; |
||||
} |
||||
|
||||
|
||||
private class IconButton extends JToggleButton implements ActionListener { |
||||
private String iconName; |
||||
private Image iconImage = null; |
||||
private static final int ICON_BUTTON_SIZE = 20; |
||||
private static final int ICON_X = 2; |
||||
private static final int ICON_Y = 2; |
||||
|
||||
public IconButton(String name) { |
||||
this.iconName = name; |
||||
this.addActionListener(this); |
||||
this.setBackground(Color.WHITE); |
||||
this.setCursor(new Cursor(Cursor.HAND_CURSOR)); |
||||
this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(name); |
||||
} |
||||
|
||||
@Override |
||||
public void updateUI() { |
||||
setUI(new BasicButtonUI() { |
||||
public void paint(Graphics g, JComponent c) { |
||||
super.paint(g, c); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
protected void paintBorder(Graphics g) { |
||||
super.paintBorder(g); |
||||
if (ComparatorUtils.equals(this, selectIconButton)) { |
||||
DrawRoutines.drawRoundedBorder( |
||||
g, Color.decode("#419BF9"), 0, 0, 20, 20); |
||||
} else { |
||||
DrawRoutines.drawRoundedBorder( |
||||
g, Color.decode("#D9DADD"), 0, 0, 20, 20); |
||||
} |
||||
|
||||
} |
||||
|
||||
public String getIconName() { |
||||
return iconName; |
||||
} |
||||
|
||||
public void setIconName(String iconName) { |
||||
this.iconName = iconName; |
||||
this.iconImage = WidgetInfoConfig.getInstance().getIconManager().getIconImage(iconName); |
||||
} |
||||
|
||||
@Override |
||||
public void paintComponent(Graphics g) { |
||||
super.paintComponent(g); |
||||
Graphics2D g2d = (Graphics2D) g; |
||||
// carl:这里缩放显示 16 × 16
|
||||
if (iconImage != null) { |
||||
g2d.drawImage(iconImage, ICON_X, ICON_Y, IconManager.DEFAULT_ICONWIDTH, IconManager.DEFAULT_ICONHEIGHT, null); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public Dimension getPreferredSize() { |
||||
return new Dimension(ICON_BUTTON_SIZE, ICON_BUTTON_SIZE); |
||||
} |
||||
|
||||
public void actionPerformed(ActionEvent evt) { |
||||
selectIconButton = this; |
||||
editIconButton.setEnabled(true); |
||||
if(StringUtils.isNotEmpty(this.iconName)) { |
||||
deleteIconButton.setEnabled(true); |
||||
} else { |
||||
deleteIconButton.setEnabled(false); |
||||
} |
||||
IconConfigPane.this.repaint();// repaint
|
||||
} |
||||
|
||||
@Override |
||||
public void addChangeListener(ChangeListener changeListener) { |
||||
this.changeListener = changeListener; |
||||
} |
||||
|
||||
private void fireChagneListener() { |
||||
if (this.changeListener != null) { |
||||
ChangeEvent evt = new ChangeEvent(this); |
||||
this.changeListener.stateChanged(evt); |
||||
} |
||||
} |
||||
|
||||
} |
||||
} |
@ -0,0 +1,242 @@
|
||||
package com.fr.design.mainframe.mobile.ui.radiogroup; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
import com.fr.design.gui.ibutton.UIToggleButton; |
||||
import com.fr.design.gui.icombobox.UIComboBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.gui.ispinner.UISpinner; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.mainframe.mobile.utils.FontConfigPane; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.radiogroup.ImageMobileStyle; |
||||
import com.fr.general.FRFont; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
|
||||
public class ImageCustomDefinePane extends MobileStyleCustomDefinePane { |
||||
|
||||
private static final Icon[] BOLD_ICONS = {BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold.png"), BaseUtils.readIcon("/com/fr/design/images/m_format/cellstyle/bold_white.png")}; |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
|
||||
private UISpinner leftSpinner; |
||||
private UISpinner rightSpinner; |
||||
private UISpinner topSpinner; |
||||
private UISpinner bottomSpinner; |
||||
|
||||
private IconConfigPane initialIconConfigPane; |
||||
private IconConfigPane selectedIconConfigPane; |
||||
|
||||
private FontConfigPane initialFontConfPane; |
||||
private UIColorButton selectedFontColor; |
||||
private UIToggleButton selectedFontBold; |
||||
|
||||
public ImageCustomDefinePane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}; |
||||
this.add(basicScrollPane); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
JPanel stylePanel = new JPanel(); |
||||
stylePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-RadioGroup_Style_Default"), |
||||
Toolkit.i18nText("Fine-Plugin-RadioGroup_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
|
||||
} |
||||
}); |
||||
stylePanel.add(buttonStyleLabel); |
||||
stylePanel.add(custom); |
||||
scrollPanel.add(stylePanel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = createCenterPane(); |
||||
centerPane.setVisible(false); |
||||
|
||||
addPaddingPane(); |
||||
|
||||
addIconPane(); |
||||
|
||||
addFontPane(); |
||||
|
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
custom.setSelectedIndex(1); |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
} |
||||
|
||||
private void addPaddingPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); |
||||
|
||||
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); |
||||
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); |
||||
|
||||
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); |
||||
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); |
||||
|
||||
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); |
||||
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); |
||||
|
||||
UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); |
||||
topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); |
||||
|
||||
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); |
||||
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); |
||||
|
||||
JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ |
||||
{paddingHintLabel, vPaddingSpinnerPanel}, |
||||
{emptyHintLabel, hPaddingSpinnerPanel}, |
||||
}, rowSize, columnSize, 10); |
||||
|
||||
centerPane.add(paddingPanel); |
||||
} |
||||
|
||||
private void addIconPane() { |
||||
|
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon"))); |
||||
|
||||
UILabel initialLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Init")); |
||||
UILabel selectedLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Icon_Select")); |
||||
|
||||
initialIconConfigPane = new IconConfigPane(8); |
||||
selectedIconConfigPane = new IconConfigPane(8); |
||||
|
||||
JPanel container = FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 5); |
||||
|
||||
JPanel initialPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
initialPane.add(initialLabel); |
||||
initialPane.add(initialIconConfigPane); |
||||
container.add(initialPane); |
||||
|
||||
JPanel selectedPane = FRGUIPaneFactory.createNormalFlowInnerContainer_S_Pane(); |
||||
selectedPane.add(selectedLabel); |
||||
selectedPane.add(selectedIconConfigPane); |
||||
container.add(selectedPane); |
||||
|
||||
centerPane.add(container); |
||||
|
||||
} |
||||
|
||||
private void addFontPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font"))); |
||||
|
||||
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); |
||||
initialFontConfPane = new FontConfigPane(); |
||||
initialFontConfPane.setFontColor(new Color(204, 204, 204)); |
||||
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(fontPanel); |
||||
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); |
||||
selectedFontColor = new UIColorButton(); |
||||
selectedFontColor.setColor(new Color(31, 173, 229)); |
||||
selectedFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
selectedFontBold = new UIToggleButton(BOLD_ICONS, true); |
||||
selectedFontBold.setPreferredSize(new Dimension(20, 20)); |
||||
JPanel selectFontColorPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectedFontLabel, selectedFontColor, selectedFontBold}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(selectFontColorPanel); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle ob) { |
||||
ImageMobileStyle mobileStyle = (ImageMobileStyle) ob; |
||||
custom.setSelectedIndex(mobileStyle.isCustom() ? 1 : 0); |
||||
leftSpinner.setValue(mobileStyle.getLeftPadding()); |
||||
rightSpinner.setValue(mobileStyle.getRightPadding()); |
||||
topSpinner.setValue(mobileStyle.getTopPadding()); |
||||
bottomSpinner.setValue(mobileStyle.getBottomPadding()); |
||||
initialIconConfigPane.populate(new ArrayList<>(Arrays.asList(mobileStyle.getInitialIconNames()))); |
||||
selectedIconConfigPane.populate(new ArrayList<>(Arrays.asList(mobileStyle.getSelectedIconNames()))); |
||||
if(mobileStyle.getInitialFont() != null) { |
||||
initialFontConfPane.populate(mobileStyle.getInitialFont()); |
||||
} |
||||
if(mobileStyle.getSelectedFont() != null) { |
||||
selectedFontColor.setColor(mobileStyle.getSelectedFont().getForeground()); |
||||
selectedFontBold.setSelected(mobileStyle.getSelectedFont().isBold()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
ImageMobileStyle mobileStyle = (ImageMobileStyle)this.widget.getMobileStyle(); |
||||
mobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
mobileStyle.setLeftPadding(leftSpinner.getValue()); |
||||
mobileStyle.setRightPadding(rightSpinner.getValue()); |
||||
mobileStyle.setTopPadding(topSpinner.getValue()); |
||||
mobileStyle.setBottomPadding(bottomSpinner.getValue()); |
||||
ArrayList<String> initialIconNamesList = initialIconConfigPane.update(); |
||||
ArrayList<String> selectedIconNamesList = selectedIconConfigPane.update(); |
||||
mobileStyle.setInitialIconNames(initialIconNamesList.toArray(new String[initialIconNamesList.size()])); |
||||
mobileStyle.setSelectedIconNames(selectedIconNamesList.toArray(new String[selectedIconNamesList.size()])); |
||||
FRFont initialFont = initialFontConfPane.updateFont(null, null, null); |
||||
FRFont selectedFont = initialFontConfPane.updateFont(selectedFontColor.getColor(), selectedFontBold.isSelected(), null); |
||||
mobileStyle.setInitialFont(initialFont); |
||||
mobileStyle.setSelectedFont(selectedFont); |
||||
return mobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,279 @@
|
||||
package com.fr.design.mainframe.mobile.ui.radiogroup; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.dialog.AttrScrollPane; |
||||
import com.fr.design.dialog.BasicScrollPane; |
||||
import com.fr.design.gui.ibutton.UIColorButton; |
||||
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.UISpinner; |
||||
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.mainframe.mobile.ui.MobileStyleCustomDefinePane; |
||||
import com.fr.design.mainframe.mobile.utils.DesignerUtils; |
||||
import com.fr.design.mainframe.mobile.utils.FontConfigPane; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.form.ui.Widget; |
||||
import com.fr.form.ui.mobile.MobileStyle; |
||||
import com.fr.form.ui.mobile.radiogroup.UnitedMobileStyle; |
||||
import com.fr.general.FRFont; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
import java.awt.event.ItemEvent; |
||||
import java.awt.event.ItemListener; |
||||
|
||||
public class UnitedCustomDefinePane extends MobileStyleCustomDefinePane { |
||||
|
||||
private JPanel scrollPanel; |
||||
private UIComboBox custom; |
||||
private JPanel centerPane; |
||||
|
||||
private UISpinner leftSpinner; |
||||
private UISpinner rightSpinner; |
||||
private UISpinner topSpinner; |
||||
private UISpinner bottomSpinner; |
||||
|
||||
private NewColorSelectBox initialColorSelectBox; |
||||
private NewColorSelectBox selectedColorSelectBox; |
||||
|
||||
private LineComboBox borderLineCombo; |
||||
private NewColorSelectBox borderColor; |
||||
private UISpinner borderRadiusSpinner; |
||||
|
||||
private FontConfigPane initialFontConfPane; |
||||
private UIColorButton selectedFontColor; |
||||
|
||||
public UnitedCustomDefinePane(Widget widget) { |
||||
super(widget); |
||||
} |
||||
|
||||
@Override |
||||
protected JPanel createPreviewPane() { |
||||
return null; |
||||
} |
||||
|
||||
@Override |
||||
protected void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.addScrollPane(); |
||||
this.addStyleSelectPane(); |
||||
this.addConfigPane(); |
||||
} |
||||
|
||||
private void addScrollPane() { |
||||
scrollPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
BasicScrollPane basicScrollPane = new AttrScrollPane() { |
||||
@Override |
||||
protected JPanel createContentPane() { |
||||
return scrollPanel; |
||||
} |
||||
}; |
||||
this.add(basicScrollPane); |
||||
} |
||||
|
||||
private void addStyleSelectPane() { |
||||
JPanel stylePanel = new JPanel(); |
||||
stylePanel.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); |
||||
UILabel buttonStyleLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Style")); |
||||
custom = new UIComboBox(new String[]{Toolkit.i18nText("Fine-Plugin-RadioGroup_Style_Default"), |
||||
Toolkit.i18nText("Fine-Plugin-RadioGroup_Style_Custom")}); |
||||
custom.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
custom.addItemListener(new ItemListener() { |
||||
@Override |
||||
public void itemStateChanged(ItemEvent e) { |
||||
boolean isCustom = custom.getSelectedIndex() == 1; |
||||
centerPane.setVisible(isCustom); |
||||
} |
||||
}); |
||||
stylePanel.add(buttonStyleLabel); |
||||
stylePanel.add(custom); |
||||
scrollPanel.add(stylePanel, BorderLayout.NORTH); |
||||
} |
||||
|
||||
private void addConfigPane() { |
||||
centerPane = createCenterPane(); |
||||
centerPane.setVisible(false); |
||||
|
||||
addPaddingPane(); |
||||
addBackgroundPane(); |
||||
addBorderPane(); |
||||
addFontPane(); |
||||
|
||||
scrollPanel.add(centerPane, BorderLayout.CENTER); |
||||
custom.setSelectedIndex(1); |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
return FRGUIPaneFactory.createVerticalFlowLayout_Pane(true, FlowLayout.LEADING, 0, 10); |
||||
} |
||||
|
||||
private void addPaddingPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Layout"))); |
||||
|
||||
UILabel paddingHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Button_Padding")); |
||||
UILabel emptyHintLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("")); |
||||
|
||||
UILabel leftLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Left")); |
||||
leftSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); |
||||
|
||||
UILabel rightLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Right")); |
||||
rightSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultHorizontalPadding); |
||||
|
||||
UILabel topLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Top")); |
||||
topSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); |
||||
|
||||
UILabel bottomLabel = new UILabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Padding_Bottom")); |
||||
bottomSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, DesignerUtils.kDefaultVerticalPadding); |
||||
|
||||
JPanel leftSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftLabel, leftSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel rightSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{rightLabel, rightSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel topSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topLabel, topSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
JPanel bottomSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{bottomLabel, bottomSpinner}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
JPanel vPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{topSpinnerPanel, bottomSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
JPanel hPaddingSpinnerPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{leftSpinnerPanel, rightSpinnerPanel}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_W1, LayoutConstants.VGAP_SMALL); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel paddingPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][]{ |
||||
{paddingHintLabel, vPaddingSpinnerPanel}, |
||||
{emptyHintLabel, hPaddingSpinnerPanel}, |
||||
}, rowSize, columnSize, 10); |
||||
|
||||
centerPane.add(paddingPanel); |
||||
} |
||||
|
||||
private void addBackgroundPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Background"))); |
||||
|
||||
UILabel initialColorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Background_Init")); |
||||
initialColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
initialColorSelectBox.setSelectObject(Color.WHITE); |
||||
JPanel initialColorSelectPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialColorLabel, initialColorSelectBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(initialColorSelectPane); |
||||
|
||||
UILabel selectedColorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Background_Select")); |
||||
selectedColorSelectBox = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
|
||||
} |
||||
}); |
||||
selectedColorSelectBox.setSelectObject(new Color(31, 173, 229)); |
||||
JPanel selectedColorSelectPane = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectedColorLabel, selectedColorSelectBox}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(selectedColorSelectPane); |
||||
} |
||||
|
||||
private void addBorderPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border"))); |
||||
|
||||
UILabel borderTypeLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Line")); |
||||
borderLineCombo = new LineComboBox(DesignerUtils.BORDER_LINE_STYLE_ARRAY); |
||||
borderLineCombo.setSelectedLineStyle(Constants.LINE_THIN); |
||||
|
||||
UILabel colorLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Color")); |
||||
borderColor = DesignerUtils.createNormalColorSelectBox(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
} |
||||
}); |
||||
borderColor.setSelectObject(new Color(31, 173, 229) ); |
||||
|
||||
UILabel radiusLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Border_Radius")); |
||||
borderRadiusSpinner = new UISpinner(0, Integer.MAX_VALUE, 1, 2); |
||||
borderRadiusSpinner.setPreferredSize(new Dimension(DesignerUtils.NORMAL_COMBO_WIDTH, 20)); |
||||
|
||||
double p = TableLayout.PREFERRED; |
||||
double[] rowSize = {p, p, p}; |
||||
double[] columnSize = {p, p}; |
||||
JPanel borderPanel = TableLayoutHelper.createCommonTableLayoutPane(new Component[][] { |
||||
{borderTypeLabel, borderLineCombo}, |
||||
{colorLabel, borderColor}, |
||||
{radiusLabel, borderRadiusSpinner} |
||||
}, rowSize, columnSize, 10); |
||||
|
||||
centerPane.add(borderPanel); |
||||
|
||||
} |
||||
|
||||
private void addFontPane() { |
||||
centerPane.add(DesignerUtils.createTitleSplitLine(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font"))); |
||||
|
||||
UILabel initialFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_init")); |
||||
initialFontConfPane = new FontConfigPane(); |
||||
initialFontConfPane.setFontColor(new Color(31, 173, 229)); |
||||
JPanel fontPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{initialFontLabel, initialFontConfPane}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(fontPanel); |
||||
UILabel selectedFontLabel = DesignerUtils.createConfigLabel(Toolkit.i18nText("Fine-Plugin-RadioGroup_Font_Select")); |
||||
selectedFontColor = new UIColorButton(); |
||||
selectedFontColor.setPreferredSize(new Dimension(20, 20)); |
||||
selectedFontColor.setColor(Color.WHITE); |
||||
JPanel selectFontColorPanel = TableLayoutHelper.createGapTableLayoutPane(new Component[][]{new Component[]{selectedFontLabel, selectedFontColor}}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
centerPane.add(selectFontColorPanel); |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileStyle ob) { |
||||
UnitedMobileStyle mobileStyle = (UnitedMobileStyle) ob; |
||||
custom.setSelectedIndex(mobileStyle.isCustom() ? 1 : 0); |
||||
leftSpinner.setValue(mobileStyle.getLeftPadding()); |
||||
rightSpinner.setValue(mobileStyle.getRightPadding()); |
||||
topSpinner.setValue(mobileStyle.getTopPadding()); |
||||
bottomSpinner.setValue(mobileStyle.getBottomPadding()); |
||||
initialColorSelectBox.setSelectObject(mobileStyle.getInitialBackgroundColor()); |
||||
selectedColorSelectBox.setSelectObject(mobileStyle.getSelectedBackgroundColor()); |
||||
borderLineCombo.setSelectedLineStyle(mobileStyle.getBorderType()); |
||||
borderColor.setSelectObject(mobileStyle.getBorderColor()); |
||||
borderRadiusSpinner.setValue(mobileStyle.getBorderRadius()); |
||||
if(mobileStyle.getInitialFont() != null) { |
||||
initialFontConfPane.populate(mobileStyle.getInitialFont()); |
||||
} |
||||
if(mobileStyle.getSelectedFont() != null) { |
||||
selectedFontColor.setColor(mobileStyle.getSelectedFont().getForeground()); |
||||
} |
||||
} |
||||
|
||||
@Override |
||||
public MobileStyle updateBean() { |
||||
UnitedMobileStyle mobileStyle = (UnitedMobileStyle)this.widget.getMobileStyle(); |
||||
|
||||
mobileStyle.setCustom(custom.getSelectedIndex() == 1); |
||||
mobileStyle.setLeftPadding(leftSpinner.getValue()); |
||||
mobileStyle.setRightPadding(rightSpinner.getValue()); |
||||
mobileStyle.setTopPadding(topSpinner.getValue()); |
||||
mobileStyle.setBottomPadding(bottomSpinner.getValue()); |
||||
mobileStyle.setInitialBackgroundColor(initialColorSelectBox.getSelectObject()); |
||||
mobileStyle.setSelectedBackgroundColor(selectedColorSelectBox.getSelectObject()); |
||||
mobileStyle.setBorderType(borderLineCombo.getSelectedLineStyle()); |
||||
mobileStyle.setBorderColor(borderColor.getSelectObject()); |
||||
mobileStyle.setBorderRadius(borderRadiusSpinner.getValue()); |
||||
|
||||
FRFont initialFont = initialFontConfPane.updateFont(null, null, null); |
||||
FRFont selectedFont = initialFontConfPane.updateFont(selectedFontColor.getColor(), null, null); |
||||
selectedFont.setForeground(selectedFontColor.getColor()); |
||||
|
||||
mobileStyle.setInitialFont(initialFont); |
||||
mobileStyle.setSelectedFont(selectedFont); |
||||
|
||||
return mobileStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,44 @@
|
||||
package com.fr.design.mainframe.mobile.ui.topparam; |
||||
|
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.form.ui.mobile.impl.MobileTopParamStyle; |
||||
|
||||
import javax.swing.*; |
||||
import java.awt.*; |
||||
|
||||
public class MobileTopParamPane extends BasicBeanPane<MobileTopParamStyle> { |
||||
private UICheckBox autoCommitCheckBox; |
||||
|
||||
public MobileTopParamPane() { |
||||
this.init(); |
||||
} |
||||
|
||||
private void init() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
JPanel panel = FRGUIPaneFactory.createTitledBorderPane(Toolkit.i18nText("Fine-Plugin-TopParam_Setting")); |
||||
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); |
||||
autoCommitCheckBox = new UICheckBox(Toolkit.i18nText("Fine-Plugin-TopParam_AutoCommit"), true); |
||||
panel.add(autoCommitCheckBox); |
||||
this.add(panel, BorderLayout.CENTER); |
||||
} |
||||
|
||||
@Override |
||||
public void populateBean(MobileTopParamStyle topParamStyle) { |
||||
autoCommitCheckBox.setSelected(topParamStyle.isAutoCommit()); |
||||
} |
||||
|
||||
@Override |
||||
public MobileTopParamStyle updateBean() { |
||||
MobileTopParamStyle topParamStyle = new MobileTopParamStyle(); |
||||
topParamStyle.setAutoCommit(autoCommitCheckBox.isSelected()); |
||||
return topParamStyle; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
} |
@ -0,0 +1,57 @@
|
||||
package com.fr.design.mainframe.mobile.utils; |
||||
|
||||
import com.fr.design.constants.LayoutConstants; |
||||
import com.fr.design.designer.IntervalConstants; |
||||
import com.fr.design.gui.icheckbox.UICheckBox; |
||||
import com.fr.design.gui.ilable.UILabel; |
||||
import com.fr.design.layout.TableLayoutHelper; |
||||
import com.fr.design.mainframe.widget.UITitleSplitLine; |
||||
import com.fr.design.style.color.NewColorSelectBox; |
||||
import com.fr.stable.Constants; |
||||
|
||||
import javax.swing.*; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.*; |
||||
|
||||
public class DesignerUtils { |
||||
|
||||
public static final int NORMAL_COMBO_WIDTH = 152; |
||||
public static final int kDefaultHorizontalPadding = 0; |
||||
public static final int kDefaultVerticalPadding = 15; |
||||
public static final int kAlignLeft = 0; |
||||
public static final int kAlignCenter = 1; |
||||
public static final int[] BORDER_LINE_STYLE_ARRAY = new int[]{ |
||||
Constants.LINE_NONE, |
||||
Constants.LINE_THIN, |
||||
Constants.LINE_MEDIUM, |
||||
Constants.LINE_THICK, |
||||
}; |
||||
|
||||
public static UITitleSplitLine createTitleSplitLine(String title) { |
||||
UITitleSplitLine splitLine = new UITitleSplitLine(title, 520); |
||||
splitLine.setPreferredSize(new Dimension(520, 20)); |
||||
return splitLine; |
||||
} |
||||
|
||||
public static UILabel createConfigLabel(String title) { |
||||
UILabel label = new UILabel(title, UILabel.RIGHT); |
||||
label.setPreferredSize(new Dimension(100, 20)); |
||||
return label; |
||||
} |
||||
|
||||
public static NewColorSelectBox createNormalColorSelectBox(ChangeListener changeListener) { |
||||
NewColorSelectBox colorSelectBox = new NewColorSelectBox(NORMAL_COMBO_WIDTH); |
||||
colorSelectBox.addSelectChangeListener(changeListener); |
||||
return colorSelectBox; |
||||
} |
||||
|
||||
public static UICheckBox createCheckBox(String text, boolean selected) { |
||||
UICheckBox uiCheckBox = new UICheckBox(text, selected); |
||||
return uiCheckBox; |
||||
} |
||||
|
||||
public static JPanel createLeftRightComponentsPane(Component... components) { |
||||
return TableLayoutHelper.createGapTableLayoutPane(new Component[][]{components}, TableLayoutHelper.FILL_LASTCOLUMN, IntervalConstants.INTERVAL_L1, LayoutConstants.VGAP_MEDIUM); |
||||
} |
||||
|
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue