Browse Source
Merge in DESIGN/design from ~KERRY/design_10.0:feature/10.0 to feature/10.0 * commit 'a605e33b6b5df940e9946eb0992ca4b9de882ab6': 代码修改 REPORT-35149 预定义样式优化及与图表统一research/11.0
kerry
4 years ago
31 changed files with 520 additions and 446 deletions
@ -0,0 +1,225 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.config.predefined.PredefinedCellStyle; |
||||
import com.fr.config.predefined.PredefinedCellStyleConfig; |
||||
import com.fr.design.actions.UpdateAction; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.gui.NameInspector; |
||||
import com.fr.design.gui.controlpane.JListControlPane; |
||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||
import com.fr.design.gui.controlpane.NameableCreator; |
||||
import com.fr.design.gui.controlpane.ShortCut4JControlPane; |
||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.design.gui.ilist.ModNameActionListener; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.predefined.ui.detail.cell.CustomPredefinedStylePane; |
||||
import com.fr.design.menu.ShortCut; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.log.FineLoggerFactory; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.BorderFactory; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.JSeparator; |
||||
import javax.swing.SwingConstants; |
||||
import javax.swing.SwingUtilities; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.event.ActionEvent; |
||||
import java.lang.reflect.Constructor; |
||||
import java.lang.reflect.InvocationTargetException; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-09-27 |
||||
*/ |
||||
public class CellStyleListControlPane extends JListControlPane { |
||||
private boolean namePermitted = true; |
||||
|
||||
public CellStyleListControlPane() { |
||||
super(); |
||||
this.addModNameActionListener(new ModNameActionListener() { |
||||
public void nameModed(int index, String oldName, String newName) { |
||||
if (ComparatorUtils.equals(oldName, newName) || ComparatorUtils.equals(newName, NameInspector.ILLEGAL_NAME_HOLDER)) { |
||||
return; |
||||
} |
||||
namePermitted = true; |
||||
String[] allNames = nameableList.getAllNames(); |
||||
allNames[index] = StringUtils.EMPTY; |
||||
if (StringUtils.isEmpty(newName)) { |
||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index); |
||||
return; |
||||
} |
||||
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) { |
||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index); |
||||
return; |
||||
} |
||||
populateSelectedValue(); |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private void showTipDialogAndReset(String content, int index) { |
||||
nameableList.stopEditing(); |
||||
|
||||
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(CellStyleListControlPane.this), |
||||
content, |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
JOptionPane.WARNING_MESSAGE); |
||||
setIllegalIndex(index); |
||||
namePermitted = false; |
||||
} |
||||
|
||||
@Override |
||||
public NameableCreator[] createNameableCreators() { |
||||
return new NameableCreator[]{new CellStyleNameObjectCreator(Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), |
||||
PredefinedCellStyle.class, CustomPredefinedStylePane.class)}; |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return StringUtils.EMPTY; |
||||
} |
||||
|
||||
protected void initComponentPane() { |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.setCreators(this.createNameableCreators()); |
||||
initCardPane(); |
||||
JPanel leftPane = getLeftPane(); |
||||
JSeparator jSeparator = new JSeparator(SwingConstants.VERTICAL); |
||||
leftPane.setPreferredSize(new Dimension(70, 0)); |
||||
jSeparator.setPreferredSize(new Dimension(2, 0)); |
||||
cardPane.setPreferredSize(new Dimension(238, 0)); |
||||
cardPane.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); |
||||
JPanel mainSplitPane = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
mainSplitPane.add(leftPane, BorderLayout.WEST); |
||||
mainSplitPane.add(jSeparator, BorderLayout.CENTER); |
||||
mainSplitPane.add(cardPane, BorderLayout.EAST); |
||||
|
||||
this.add(mainSplitPane, BorderLayout.CENTER); |
||||
this.checkButtonEnabled(); |
||||
} |
||||
|
||||
protected ShortCut4JControlPane[] createShortcuts() { |
||||
return new ShortCut4JControlPane[]{ |
||||
shortCutFactory.addItemShortCut(), |
||||
new RemoveItemShortCut4JControlPane(new RemoveItemAction()) |
||||
}; |
||||
} |
||||
|
||||
|
||||
public class RemoveItemShortCut4JControlPane extends ShortCut4JControlPane { |
||||
RemoveItemShortCut4JControlPane(ShortCut shortCut) { |
||||
this.shortCut = shortCut; |
||||
} |
||||
|
||||
@Override |
||||
public void checkEnable() { |
||||
ListModelElement selectModel = CellStyleListControlPane.this.getSelectedValue(); |
||||
if (selectModel != null) { |
||||
NameObject selectNameObject = (NameObject) selectModel.wrapper; |
||||
PredefinedCellStyle cellStyle = (PredefinedCellStyle) (selectNameObject.getObject()); |
||||
this.shortCut.setEnabled(!cellStyle.isBuiltIn() && !cellStyle.isDefaultStyle()); |
||||
} else { |
||||
this.shortCut.setEnabled(false); |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
|
||||
private class RemoveItemAction extends UpdateAction { |
||||
RemoveItemAction() { |
||||
this.setName(com.fr.design.i18n.Toolkit.i18nText(("Fine-Design_Basic_Action_Remove"))); |
||||
this.setMnemonic('R'); |
||||
this.setSmallIcon(BaseUtils |
||||
.readIcon("/com/fr/base/images/cell/control/remove.png")); |
||||
} |
||||
|
||||
@Override |
||||
public void actionPerformed(ActionEvent evt) { |
||||
CellStyleListControlPane.this.onRemoveItem(); |
||||
} |
||||
} |
||||
|
||||
|
||||
class CellStyleNameObjectCreator extends NameObjectCreator { |
||||
public CellStyleNameObjectCreator(String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||
super(menuName, clazz, updatePane); |
||||
} |
||||
|
||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||
Constructor<? extends PredefinedCellStyle> constructor = null; |
||||
try { |
||||
constructor = clazzOfInitCase.getConstructor(); |
||||
PredefinedCellStyle cellStyle = constructor.newInstance(); |
||||
|
||||
cellStyle.setName(menuName); |
||||
cellStyle.setStyle(Style.getInstance()); |
||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), cellStyle); |
||||
|
||||
} catch (NoSuchMethodException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} catch (IllegalAccessException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} catch (InstantiationException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} catch (InvocationTargetException e) { |
||||
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
||||
} |
||||
return null; |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Populate |
||||
*/ |
||||
public void populateBean(PredefinedCellStyleConfig ob) { |
||||
if (ob == null) { |
||||
return; |
||||
} |
||||
|
||||
List nameStyleList = new ArrayList(); |
||||
|
||||
Iterator styleNameIterator = ob.getStyleNameIterator(); |
||||
while (styleNameIterator.hasNext()) { |
||||
String name = (String) styleNameIterator.next(); |
||||
PredefinedCellStyle tmpStyle = ob.getStyle(name); |
||||
|
||||
if (tmpStyle != null) { |
||||
nameStyleList.add(new NameObject(name, tmpStyle)); |
||||
} |
||||
} |
||||
|
||||
NameObject[] nameObjects = new NameObject[nameStyleList.size()]; |
||||
nameStyleList.toArray(nameObjects); |
||||
|
||||
populate(nameObjects); |
||||
} |
||||
|
||||
|
||||
public PredefinedCellStyleConfig updateBean() { |
||||
Nameable[] nameables = this.update(); |
||||
PredefinedCellStyleConfig styleConfig = new PredefinedCellStyleConfig(); |
||||
for (int i = 0; i < nameables.length; i++) { |
||||
PredefinedCellStyle tmpStyle = (PredefinedCellStyle) ((NameObject) nameables[i]).getObject(); |
||||
tmpStyle.setName(nameables[i].getName()); |
||||
styleConfig.addStyle(tmpStyle); |
||||
} |
||||
return styleConfig; |
||||
} |
||||
|
||||
|
||||
} |
@ -1,332 +0,0 @@
|
||||
package com.fr.design.mainframe.predefined.ui.detail; |
||||
|
||||
import com.fr.base.BaseUtils; |
||||
import com.fr.base.Style; |
||||
import com.fr.config.predefined.PredefinedCellStyle; |
||||
import com.fr.config.predefined.PredefinedCellStyleConfig; |
||||
import com.fr.design.beans.BasicBeanPane; |
||||
import com.fr.design.dialog.FineJOptionPane; |
||||
import com.fr.design.gui.NameInspector; |
||||
import com.fr.design.gui.ibutton.UIButton; |
||||
import com.fr.design.gui.ilist.JNameEdList; |
||||
import com.fr.design.gui.ilist.ListModelElement; |
||||
import com.fr.design.gui.ilist.ModNameActionListener; |
||||
import com.fr.design.i18n.Toolkit; |
||||
import com.fr.design.icon.IconPathConstants; |
||||
import com.fr.design.layout.FRGUIPaneFactory; |
||||
import com.fr.design.mainframe.predefined.ui.PredefinedStyleEditPane; |
||||
import com.fr.design.mainframe.predefined.ui.detail.cell.CustomPredefinedStylePane; |
||||
import com.fr.general.ComparatorUtils; |
||||
import com.fr.general.NameObject; |
||||
import com.fr.report.cell.DefaultTemplateCellElement; |
||||
import com.fr.report.cell.TemplateCellElement; |
||||
import com.fr.report.core.PaintUtils; |
||||
import com.fr.stable.Constants; |
||||
import com.fr.stable.Nameable; |
||||
import com.fr.stable.StringUtils; |
||||
|
||||
import javax.swing.DefaultListModel; |
||||
import javax.swing.JOptionPane; |
||||
import javax.swing.JPanel; |
||||
import javax.swing.SwingUtilities; |
||||
import javax.swing.event.ChangeEvent; |
||||
import javax.swing.event.ChangeListener; |
||||
import java.awt.BorderLayout; |
||||
import java.awt.CardLayout; |
||||
import java.awt.Dimension; |
||||
import java.awt.FlowLayout; |
||||
import java.awt.Graphics; |
||||
import java.awt.Graphics2D; |
||||
import java.awt.Rectangle; |
||||
import java.awt.event.ActionEvent; |
||||
import java.awt.event.ActionListener; |
||||
import java.awt.event.MouseAdapter; |
||||
import java.awt.event.MouseEvent; |
||||
import java.util.ArrayList; |
||||
import java.util.Arrays; |
||||
import java.util.Iterator; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* Created by kerry on 2020-09-01 |
||||
*/ |
||||
public class CellStyleSettingPane extends BasicBeanPane<PredefinedCellStyleConfig> { |
||||
|
||||
private StyleListPane styleListPane; |
||||
private List<CustomPredefinedStylePane> customStylePaneList = new ArrayList<>(); |
||||
private CardLayout cardLayout; |
||||
private JPanel centerPane; |
||||
private PredefinedStyleEditPane editPane; |
||||
private CellStylePreviewPane previewPane; |
||||
private UIButton removeBtn; |
||||
|
||||
public CellStyleSettingPane(PredefinedStyleEditPane editPane) { |
||||
this.editPane = editPane; |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.add(createLeftPane(), BorderLayout.WEST); |
||||
this.add(createCenterPane(), BorderLayout.CENTER); |
||||
} |
||||
|
||||
private JPanel createLeftPane() { |
||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
panel.setPreferredSize(new Dimension(80, 267)); |
||||
panel.add(createToolPane(), BorderLayout.NORTH); |
||||
panel.add(createStyleListPane(), BorderLayout.CENTER); |
||||
return panel; |
||||
} |
||||
|
||||
private JPanel createToolPane() { |
||||
JPanel panel = FRGUIPaneFactory.createLeftFlowZeroGapBorderPane(); |
||||
UIButton addBtn = new UIButton(BaseUtils.readIcon(IconPathConstants.ADD_POPMENU_ICON_PATH)); |
||||
addBtn.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
styleListPane.addNewStyle(); |
||||
} |
||||
}); |
||||
addBtn.setBorderPainted(false); |
||||
panel.add(addBtn); |
||||
removeBtn = new UIButton(BaseUtils.readIcon(IconPathConstants.TD_REMOVE_ICON_PATH)); |
||||
removeBtn.setBorderPainted(false); |
||||
removeBtn.addActionListener(new ActionListener() { |
||||
@Override |
||||
public void actionPerformed(ActionEvent e) { |
||||
styleListPane.removeStyle(); |
||||
} |
||||
}); |
||||
panel.add(removeBtn); |
||||
return panel; |
||||
} |
||||
|
||||
private JPanel createStyleListPane() { |
||||
JPanel jPanel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
jPanel.setPreferredSize(new Dimension(80, 249)); |
||||
styleListPane = new StyleListPane(); |
||||
jPanel.add(styleListPane); |
||||
return jPanel; |
||||
} |
||||
|
||||
private JPanel createCenterPane() { |
||||
JPanel panel = FRGUIPaneFactory.createBorderLayout_S_Pane(); |
||||
JPanel titlePreviewPane = FRGUIPaneFactory.createTitledBorderPane(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Basic_Preview")); |
||||
titlePreviewPane.setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0)); |
||||
previewPane = new CellStylePreviewPane(); |
||||
previewPane.setPreferredSize(new Dimension(100, 20)); |
||||
titlePreviewPane.setPreferredSize(new Dimension(230, 45)); |
||||
titlePreviewPane.add(previewPane); |
||||
panel.add(titlePreviewPane, BorderLayout.NORTH); |
||||
cardLayout = new CardLayout(); |
||||
centerPane = new JPanel(cardLayout); |
||||
panel.add(centerPane, BorderLayout.CENTER); |
||||
|
||||
return panel; |
||||
} |
||||
|
||||
|
||||
@Override |
||||
public void populateBean(PredefinedCellStyleConfig ob) { |
||||
styleListPane.populate(ob); |
||||
} |
||||
|
||||
@Override |
||||
public PredefinedCellStyleConfig updateBean() { |
||||
return styleListPane.update(); |
||||
} |
||||
|
||||
@Override |
||||
protected String title4PopupWindow() { |
||||
return null; |
||||
} |
||||
|
||||
class StyleListPane extends JPanel { |
||||
private DefaultListModel defaultListModel; |
||||
private JNameEdList styleList; |
||||
|
||||
public StyleListPane() { |
||||
defaultListModel = new DefaultListModel(); |
||||
styleList = new JNameEdList(defaultListModel) { |
||||
public Rectangle createRect(Rectangle rect, int iconWidth) { |
||||
return new Rectangle(rect.x, rect.y, rect.width, rect.height); |
||||
} |
||||
|
||||
}; |
||||
styleList.setEditable(true); |
||||
styleList.addModNameActionListener(new ModNameActionListener() { |
||||
public void nameModed(int index, String oldName, String newName) { |
||||
if (ComparatorUtils.equals(oldName, newName) || ComparatorUtils.equals(newName, NameInspector.ILLEGAL_NAME_HOLDER)) { |
||||
return; |
||||
} |
||||
String[] allNames = styleList.getAllNames(); |
||||
allNames[index] = StringUtils.EMPTY; |
||||
if (StringUtils.isEmpty(newName)) { |
||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Empty_Name"), index); |
||||
return; |
||||
} |
||||
if (isNameRepeated(new List[]{Arrays.asList(allNames)}, newName)) { |
||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newName), index); |
||||
styleList.setNameAt("请重新命名", index); |
||||
return; |
||||
} |
||||
styleList.repaint(); |
||||
|
||||
} |
||||
}); |
||||
this.setLayout(FRGUIPaneFactory.createBorderLayout()); |
||||
this.add(styleList, BorderLayout.CENTER); |
||||
|
||||
styleList.addMouseListener(new MouseAdapter() { |
||||
@Override |
||||
public void mouseClicked(MouseEvent e) { |
||||
int selectIndex = styleList.getSelectedIndex(); |
||||
Object nameable = styleList.getType(selectIndex); |
||||
if (nameable == null) { |
||||
return; |
||||
} |
||||
PredefinedCellStyle cellStyle = ((PredefinedCellStyle) nameable); |
||||
cardLayout.show(centerPane, styleList.getNameAt(selectIndex)); |
||||
styleList.stopEditing(); |
||||
removeBtn.setEnabled(!cellStyle.isBuiltIn()); |
||||
if (!validateCouldRename(cellStyle)) { |
||||
return; |
||||
} |
||||
if (e.getClickCount() >= 2 |
||||
&& SwingUtilities.isLeftMouseButton(e)) { |
||||
styleList.editItemAt(styleList.getSelectedIndex()); |
||||
} |
||||
} |
||||
}); |
||||
} |
||||
|
||||
private boolean validateCouldRename(PredefinedCellStyle cellStyle) { |
||||
return !cellStyle.isBuiltIn(); |
||||
} |
||||
|
||||
|
||||
private void showTipDialogAndReset(String content, int index) { |
||||
styleList.stopEditing(); |
||||
|
||||
FineJOptionPane.showMessageDialog(SwingUtilities.getWindowAncestor(StyleListPane.this), |
||||
content, |
||||
Toolkit.i18nText("Fine-Design_Basic_Alert"), |
||||
JOptionPane.WARNING_MESSAGE); |
||||
} |
||||
|
||||
protected boolean isNameRepeated(java.util.List[] list, String name) { |
||||
for (int i = 0; i < list.length; i++) { |
||||
if (list[i].contains(name)) { |
||||
return true; |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
|
||||
public void populate(PredefinedCellStyleConfig ob) { |
||||
Iterator<PredefinedCellStyle> iterator = ob.getAllStyles().values().iterator(); |
||||
while (iterator.hasNext()) { |
||||
PredefinedCellStyle entry = iterator.next(); |
||||
addStyle(entry); |
||||
|
||||
} |
||||
reset(); |
||||
|
||||
} |
||||
|
||||
private void reset() { |
||||
if (defaultListModel.getSize() > 0) { |
||||
styleList.setSelectedIndex(0); |
||||
removeBtn.setEnabled(false); |
||||
cardLayout.show(centerPane, styleList.getNameAt(0)); |
||||
centerPane.validate(); |
||||
Object nameable = styleList.getType(0); |
||||
if (nameable == null) { |
||||
return; |
||||
} |
||||
PredefinedCellStyle cellStyle = ((PredefinedCellStyle) nameable); |
||||
previewPane.refresh(cellStyle.getStyle()); |
||||
} |
||||
} |
||||
|
||||
public PredefinedCellStyleConfig update() { |
||||
PredefinedCellStyleConfig config = new PredefinedCellStyleConfig(); |
||||
for (int i = 0; i < defaultListModel.getSize(); i++) { |
||||
String name = styleList.getNameAt(i); |
||||
Style style = customStylePaneList.get(i).updateBean(); |
||||
config.addStyle(new PredefinedCellStyle(name, style)); |
||||
} |
||||
return config; |
||||
} |
||||
|
||||
public void addNewStyle() { |
||||
String newStyleName = com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"); |
||||
if (isNameRepeated(new List[]{Arrays.asList(styleList.getAllNames())}, |
||||
newStyleName)) { |
||||
showTipDialogAndReset(Toolkit.i18nText("Fine-Design_Basic_Predefined_Style_Duplicate_Name", newStyleName), 0); |
||||
return; |
||||
} |
||||
PredefinedCellStyle cellStyle = new PredefinedCellStyle(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_New_Style"), Style.getInstance()); |
||||
addStyle(cellStyle); |
||||
} |
||||
|
||||
public void addStyle(PredefinedCellStyle cellStyle) { |
||||
ListModelElement el = new ListCellStyleModelElement(new NameObject(cellStyle.getName(), cellStyle)); |
||||
defaultListModel.addElement(el); |
||||
CustomPredefinedStylePane customPredefinedStylePane = new CustomPredefinedStylePane(); |
||||
customPredefinedStylePane.populateBean(cellStyle.getStyle()); |
||||
customPredefinedStylePane.addChangeListener(new ChangeListener() { |
||||
@Override |
||||
public void stateChanged(ChangeEvent e) { |
||||
previewPane.refresh(customPredefinedStylePane.updateBean()); |
||||
editPane.valueChangeAction(); |
||||
} |
||||
}); |
||||
centerPane.add(customPredefinedStylePane, cellStyle.getName()); |
||||
customStylePaneList.add(customPredefinedStylePane); |
||||
} |
||||
|
||||
public void removeStyle() { |
||||
int selectIndex = styleList.getSelectedIndex(); |
||||
defaultListModel.remove(selectIndex); |
||||
centerPane.remove(customStylePaneList.get(selectIndex)); |
||||
customStylePaneList.remove(selectIndex); |
||||
reset(); |
||||
} |
||||
} |
||||
|
||||
class ListCellStyleModelElement extends com.fr.design.gui.ilist.ListModelElement { |
||||
private Nameable nameable; |
||||
|
||||
public ListCellStyleModelElement(Nameable nameable) { |
||||
super(nameable); |
||||
this.nameable = nameable; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return this.nameable.getName(); |
||||
} |
||||
} |
||||
|
||||
class CellStylePreviewPane extends JPanel { |
||||
private TemplateCellElement ce; |
||||
|
||||
public CellStylePreviewPane() { |
||||
ce = new DefaultTemplateCellElement(); |
||||
ce.setValue(com.fr.design.i18n.Toolkit.i18nText("Fine-Design_Predefined_Cell_Test_Word")); |
||||
} |
||||
|
||||
public void refresh(Style style) { |
||||
this.ce.setStyle(style); |
||||
this.repaint(); |
||||
} |
||||
|
||||
@Override |
||||
public void paint(Graphics g) { |
||||
Style.paintBackground((Graphics2D) g, ce.getStyle(), this.getWidth(), this.getHeight()); |
||||
Style.paintBorder((Graphics2D) g, ce.getStyle(), this.getWidth(), this.getHeight()); |
||||
PaintUtils.paintGridCellContent((Graphics2D) g, ce, this.getWidth(), this.getHeight(), Constants.FR_PAINT_RESOLUTION); |
||||
} |
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue