Browse Source
* commit '2a1d33292d1d8f0a700deb4066425ab127a7e2f9': (30 commits) 填报重构访问方式改为op=write_plus PFC-607 插件安装删除更新不重启支持 放弃动态代理,用javassist实现相同功能: 1、动态代理不能作用到没接口的class上 2、动态代理改变了class的类型,开发和调试都不太方便 3、动态代理影响性能 旧模板参数模板时候加ID 无JIRA任务,改代码规范改出bug了 PMD 数组字典无法保存 代码规范 fix fix REPORT-2897 9.0设计器修改 ->修改缩放条按钮交互、修改扩展控件之间的间距 REPORT-3986 [9.0一轮回归]将设计器宽度调整到屏幕一半后连续添加10个sheet,设计器最大化后缩放滑块显示异常 bugfix:单元格元素插入内容,对话框取消之后回到原内容 REPORT-3952 [9.0一轮回归]插入悬浮元素选择插入图表点击取消时会触发保存按钮 SonarQube bugfix:单元格元素插入内容下拉菜单后变为选中第一个而不是上次选中项 SonarQube format tmp fix REPORT-3789 [9.0一轮回归]下拉树、视图树控件无构建树设置 REPORT-4115 参数面板各控件属性面板添加标签属性 ...master
xiaoxia
7 years ago
83 changed files with 1813 additions and 1102 deletions
@ -1 +1,62 @@ |
|||||||
package com.fr.design.actions;
import com.fr.base.BaseUtils;
import com.fr.design.data.datapane.TableDataTreePane;
import com.fr.design.DesignModelAdapter;
import com.fr.design.designer.TargetComponent;
import com.fr.design.file.HistoryTemplateListPane;
import com.fr.design.mainframe.*;
import com.fr.general.Inter;
/**
* Author : daisy
* Date: 13-9-2
* Time: 下午3:36
*/
public class ExitAuthorityEditAction extends TemplateComponentAction {
public ExitAuthorityEditAction(TargetComponent t) {
super(t);
this.setName(Inter.getLocText(new String[]{"Exit", "DashBoard-Potence", "Edit"}));
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit.png"));
}
public void prepare4Undo() {
}
public boolean executeActionReturnUndoRecordNeeded() {
TargetComponent tc = getEditingComponent();
if (tc == null) {
return false;
}
if (BaseUtils.isAuthorityEditing()) {
BaseUtils.setAuthorityEditing(false);
WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter()));
EastRegionContainerPane.getInstance().replaceDownPane(tc.getEastDownPane());
EastRegionContainerPane.getInstance().replaceUpPane(tc.getEastUpPane());
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus());
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint();
DesignerContext.getDesignerFrame().refreshDottedLine();
fireAuthorityStateToNomal();
}
return true;
}
/**
* 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体
*/
private void fireAuthorityStateToNomal() {
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList();
for (int i = 0; i < opendedTemplate.size(); i++) {
//如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
if (opendedTemplate.get(i).isDoSomethingInAuthority()) {
opendedTemplate.get(i).fireAuthorityStateToNomal();
}
}
}
} |
package com.fr.design.actions; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.data.datapane.TableDataTreePane; |
||||||
|
import com.fr.design.DesignModelAdapter; |
||||||
|
import com.fr.design.designer.TargetComponent; |
||||||
|
import com.fr.design.file.HistoryTemplateListPane; |
||||||
|
import com.fr.design.mainframe.*; |
||||||
|
import com.fr.general.Inter; |
||||||
|
|
||||||
|
/** |
||||||
|
* Author : daisy |
||||||
|
* Date: 13-9-2 |
||||||
|
* Time: 下午3:36 |
||||||
|
*/ |
||||||
|
public class ExitAuthorityEditAction extends TemplateComponentAction { |
||||||
|
|
||||||
|
public ExitAuthorityEditAction(TargetComponent t) { |
||||||
|
super(t); |
||||||
|
this.setName(Inter.getLocText(new String[]{"Exit", "DashBoard-Potence", "Edit"})); |
||||||
|
this.setSmallIcon(BaseUtils.readIcon("/com/fr/design/images/m_report/exit_authority_edit.png")); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void prepare4Undo() { |
||||||
|
// 遗留代码
|
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public boolean executeActionReturnUndoRecordNeeded() { |
||||||
|
TargetComponent tc = getEditingComponent(); |
||||||
|
if (tc == null) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
if (BaseUtils.isAuthorityEditing()) { |
||||||
|
BaseUtils.setAuthorityEditing(false); |
||||||
|
WestRegionContainerPane.getInstance().replaceDownPane(TableDataTreePane.getInstance(DesignModelAdapter.getCurrentModelAdapter())); |
||||||
|
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().refreshEastPropertiesPane(); |
||||||
|
DesignerContext.getDesignerFrame().resetToolkitByPlus(tc.getToolBarMenuDockPlus()); |
||||||
|
DesignerContext.getDesignerFrame().needToAddAuhtorityPaint(); |
||||||
|
DesignerContext.getDesignerFrame().refreshDottedLine(); |
||||||
|
|
||||||
|
fireAuthorityStateToNomal(); |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 退出权限编辑时,将所有的做过权限编辑的状态,作为一个状态赋给报、报表主体 |
||||||
|
*/ |
||||||
|
private void fireAuthorityStateToNomal() { |
||||||
|
java.util.List<JTemplate<?, ?>> opendedTemplate = HistoryTemplateListPane.getInstance().getHistoryList(); |
||||||
|
for (int i = 0; i < opendedTemplate.size(); i++) { |
||||||
|
//如果在权限编辑时做过操作,则将做过的操作作为一个整体状态赋给正在报表
|
||||||
|
if (opendedTemplate.get(i).isDoSomethingInAuthority()) { |
||||||
|
opendedTemplate.get(i).fireAuthorityStateToNomal(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,373 @@ |
|||||||
|
package com.fr.design.gui.ibutton; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.base.CellBorderStyle; |
||||||
|
import com.fr.base.GraphHelper; |
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
|
import com.fr.design.event.UIObserver; |
||||||
|
import com.fr.design.event.UIObserverListener; |
||||||
|
import com.fr.design.utils.gui.GUICoreUtils; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
|
import javax.swing.*; |
||||||
|
import javax.swing.plaf.ButtonUI; |
||||||
|
import java.awt.*; |
||||||
|
import java.awt.event.ActionEvent; |
||||||
|
import java.awt.event.ActionListener; |
||||||
|
import java.awt.event.MouseEvent; |
||||||
|
import java.awt.geom.RoundRectangle2D; |
||||||
|
|
||||||
|
public class UISliderButton extends JButton implements UIObserver { |
||||||
|
|
||||||
|
public static final int OTHER_BORDER = 1; |
||||||
|
public static final int NORMAL_BORDER = 2; |
||||||
|
private static final int HEIGH = 20; |
||||||
|
private static final int TOOLTIP_Y = 30; |
||||||
|
private boolean isExtraPainted = true; |
||||||
|
private boolean isRoundBorder = true; |
||||||
|
private int rectDirection = Constants.NULL; |
||||||
|
private Stroke borderStroke = UIConstants.BS; |
||||||
|
private Color borderColor = UIConstants.LINE_COLOR; |
||||||
|
|
||||||
|
private boolean isPressedPainted = true; |
||||||
|
private boolean isNormalPainted = true; |
||||||
|
protected boolean isBorderPaintedOnlyWhenPressed = false; |
||||||
|
|
||||||
|
private int borderType = NORMAL_BORDER; |
||||||
|
private CellBorderStyle border = null; |
||||||
|
|
||||||
|
protected UIObserverListener uiObserverListener; |
||||||
|
|
||||||
|
public UISliderButton() { |
||||||
|
this(StringUtils.EMPTY); |
||||||
|
} |
||||||
|
|
||||||
|
public UISliderButton(String string) { |
||||||
|
this(string, null); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public UISliderButton(Icon icon) { |
||||||
|
this(null, icon); |
||||||
|
} |
||||||
|
|
||||||
|
public UISliderButton(Action action) { |
||||||
|
super(action); |
||||||
|
init(); |
||||||
|
} |
||||||
|
|
||||||
|
public UISliderButton(String text, Icon icon) { |
||||||
|
super(text, icon); |
||||||
|
init(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否进行过权限编辑 |
||||||
|
* |
||||||
|
* @param role 角色 |
||||||
|
* @return 否 |
||||||
|
*/ |
||||||
|
public boolean isDoneAuthorityEdited(String role) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
public UISliderButton(Icon normal, Icon rollOver, Icon pressed) { |
||||||
|
super(normal); |
||||||
|
setBorderPainted(false); |
||||||
|
setRolloverIcon(rollOver); |
||||||
|
setPressedIcon(pressed); |
||||||
|
setExtraPainted(false); |
||||||
|
setBackground(null); |
||||||
|
setOpaque(false); |
||||||
|
initListener(); |
||||||
|
} |
||||||
|
|
||||||
|
protected void initListener() { |
||||||
|
if (shouldResponseChangeListener()) { |
||||||
|
this.addActionListener(new ActionListener() { |
||||||
|
public void actionPerformed(ActionEvent e) { |
||||||
|
if (uiObserverListener == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
uiObserverListener.doChange(); |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
//确定是正常的边框类型,还是其他的Border类型
|
||||||
|
//若是其他的border类型,则要setOtherType,即设置线型颜色等。若是其他类型,但是没有设置,则默认的是虚线型边框
|
||||||
|
public void setBorderType(int borderType) { |
||||||
|
this.borderType = borderType; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public void setBorderStyle(CellBorderStyle border) { |
||||||
|
this.border = border; |
||||||
|
} |
||||||
|
|
||||||
|
public void set4ToolbarButton() { |
||||||
|
setNormalPainted(false); |
||||||
|
Dimension dim = getPreferredSize(); |
||||||
|
dim.height = HEIGH; |
||||||
|
setBackground(null); |
||||||
|
setOpaque(false); |
||||||
|
setSize(dim); |
||||||
|
setBorderPaintedOnlyWhenPressed(true); |
||||||
|
} |
||||||
|
|
||||||
|
public void set4LargeToolbarButton() { |
||||||
|
setNormalPainted(false); |
||||||
|
setBackground(null); |
||||||
|
setOpaque(false); |
||||||
|
setSize(new Dimension(40, 40)); |
||||||
|
setBorderPaintedOnlyWhenPressed(true); |
||||||
|
} |
||||||
|
|
||||||
|
public void set4ChartLargeToolButton() { |
||||||
|
setNormalPainted(false); |
||||||
|
setBackground(null); |
||||||
|
setOpaque(false); |
||||||
|
setSize(new Dimension(34, 44)); |
||||||
|
setBorderPaintedOnlyWhenPressed(true); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
private void init() { |
||||||
|
setOpaque(false); |
||||||
|
setBackground(null); |
||||||
|
setRolloverEnabled(true); |
||||||
|
initListener(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public ButtonUI getUI() { |
||||||
|
return new UISliderButtonUI(); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新界面 |
||||||
|
*/ |
||||||
|
public void updateUI() { |
||||||
|
setUI(getUI()); |
||||||
|
} |
||||||
|
|
||||||
|
public CellBorderStyle getBorderStyle() { |
||||||
|
return this.border; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Insets getInsets() { |
||||||
|
if (getIcon() != null) { |
||||||
|
return new Insets(0, 3, 0, 3); |
||||||
|
} |
||||||
|
return new Insets(0, 0, 0, 0); |
||||||
|
} |
||||||
|
|
||||||
|
//@Override
|
||||||
|
public Dimension getPreferredSize() { |
||||||
|
return new Dimension(super.getPreferredSize().width, 20); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public int getBorderType() { |
||||||
|
return borderType; |
||||||
|
} |
||||||
|
|
||||||
|
public void setOtherBorder(Stroke s, Color c) { |
||||||
|
borderStroke = s; |
||||||
|
borderColor = c; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
protected void paintBorder(Graphics g) { |
||||||
|
|
||||||
|
if (!isBorderPainted()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
if (borderType == OTHER_BORDER) { |
||||||
|
paintOtherBorder(g); |
||||||
|
} else { |
||||||
|
boolean isPress = (isBorderPaintedOnlyWhenPressed && getModel().isPressed()); |
||||||
|
if (isPress || !isBorderPaintedOnlyWhenPressed) { |
||||||
|
if (ui instanceof UISliderButtonUI) { |
||||||
|
((UISliderButtonUI) ui).paintBorder(g, this); |
||||||
|
|
||||||
|
} else { |
||||||
|
super.paintBorder(g); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public void paintComponent(Graphics g) { |
||||||
|
super.paintComponent(g); |
||||||
|
Dimension size = this.getSize(); |
||||||
|
Graphics2D g2d = (Graphics2D) g; |
||||||
|
Stroke oldStroke = g2d.getStroke(); |
||||||
|
if (border != null) { |
||||||
|
g2d.setColor(border.getTopColor()); |
||||||
|
GraphHelper.drawLine(g2d, 3, 4, size.getWidth() - 4, 4, border.getTopStyle()); |
||||||
|
g2d.setColor(border.getLeftColor()); |
||||||
|
GraphHelper.drawLine(g2d, 3, 4, 3, size.getHeight() - 4, border.getLeftStyle()); |
||||||
|
g2d.setColor(border.getBottomColor()); |
||||||
|
GraphHelper.drawLine(g2d, 3, size.getHeight() - 4, size.getWidth() - 4, size.getHeight() - 4, border.getBottomStyle()); |
||||||
|
g2d.setColor(border.getRightColor()); |
||||||
|
GraphHelper.drawLine(g2d, size.getWidth() - 4, 4, size.getWidth() - 4, size.getHeight() - 4, border.getRightStyle()); |
||||||
|
} else { |
||||||
|
GraphHelper.drawLine(g2d, 2, 4, size.getWidth() - 4, 4, Constants.LINE_NONE); |
||||||
|
GraphHelper.drawLine(g2d, 2, 4, 2, size.getHeight() - 4, Constants.LINE_NONE); |
||||||
|
GraphHelper.drawLine(g2d, 2, size.getHeight() - 4, size.getWidth() - 4, size.getHeight() - 4, Constants.LINE_NONE); |
||||||
|
GraphHelper.drawLine(g2d, size.getWidth() - 4, 4, size.getWidth() - 4, size.getHeight() - 4, Constants.LINE_NONE); |
||||||
|
} |
||||||
|
g2d.setStroke(oldStroke); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
protected void paintOtherBorder(Graphics g) { |
||||||
|
Graphics2D g2d = (Graphics2D) g; |
||||||
|
g2d.setStroke(borderStroke); |
||||||
|
Shape shape = new RoundRectangle2D.Float(0.5f, 0.5f, getWidth() - 1, getHeight() - 1, UIConstants.ARC, UIConstants.ARC); |
||||||
|
g2d.setColor(borderColor); |
||||||
|
g2d.draw(shape); |
||||||
|
} |
||||||
|
|
||||||
|
public void setExtraPainted(boolean extra) { |
||||||
|
this.isExtraPainted = extra; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否额外画 |
||||||
|
* |
||||||
|
* @return 是则返回TRUE |
||||||
|
*/ |
||||||
|
public boolean isExtraPainted() { |
||||||
|
return this.isExtraPainted; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public int getRectDirection() { |
||||||
|
return rectDirection; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否圆边框 |
||||||
|
* |
||||||
|
* @return 是则返回true |
||||||
|
*/ |
||||||
|
public boolean isRoundBorder() { |
||||||
|
return isRoundBorder; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param isRoundBorder |
||||||
|
*/ |
||||||
|
public void setRoundBorder(boolean isRoundBorder) { |
||||||
|
setRoundBorder(isRoundBorder, Constants.NULL); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param isRound |
||||||
|
* @param rectDirection |
||||||
|
*/ |
||||||
|
public void setRoundBorder(boolean isRound, int rectDirection) { |
||||||
|
this.isRoundBorder = isRound; |
||||||
|
this.rectDirection = rectDirection; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否按压画 |
||||||
|
* |
||||||
|
* @return 是则返回TRUE |
||||||
|
*/ |
||||||
|
public boolean isPressedPainted() { |
||||||
|
return isPressedPainted; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param isPressedPainted |
||||||
|
*/ |
||||||
|
public void setPressedPainted(boolean isPressedPainted) { |
||||||
|
this.isPressedPainted = isPressedPainted; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 是否正常画 |
||||||
|
* |
||||||
|
* @return 是则返回TRUE |
||||||
|
*/ |
||||||
|
public boolean isNormalPainted() { |
||||||
|
return isNormalPainted; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param isNormalPressed |
||||||
|
*/ |
||||||
|
public void setNormalPainted(boolean isNormalPressed) { |
||||||
|
this.isNormalPainted = isNormalPressed; |
||||||
|
if (!isNormalPressed) { |
||||||
|
setBackground(null); |
||||||
|
setOpaque(false); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* @param value |
||||||
|
*/ |
||||||
|
public void setBorderPaintedOnlyWhenPressed(boolean value) { |
||||||
|
this.isBorderPaintedOnlyWhenPressed = value; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Point getToolTipLocation(MouseEvent event) { |
||||||
|
return new Point(event.getX(), event.getY() - TOOLTIP_Y); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 主函数 |
||||||
|
* |
||||||
|
* @param args 入口参数 |
||||||
|
*/ |
||||||
|
public static void main(String... args) { |
||||||
|
JFrame jf = new JFrame("test"); |
||||||
|
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); |
||||||
|
JPanel content = (JPanel) jf.getContentPane(); |
||||||
|
content.setLayout(null); |
||||||
|
|
||||||
|
UISliderButton bb = new UISliderButton(BaseUtils.readIcon("/com/fr/design/images/buttonicon/add.png")); |
||||||
|
bb.setEnabled(false); |
||||||
|
bb.setBorderType(OTHER_BORDER); |
||||||
|
// bb.setBounds(20, 20,content.getSize().width, bb.getPreferredSize().height);
|
||||||
|
bb.setPreferredSize(new Dimension(100, 30)); |
||||||
|
bb.setBounds(0, 0, bb.getPreferredSize().width, bb.getPreferredSize().height); |
||||||
|
content.add(bb); |
||||||
|
GUICoreUtils.centerWindow(jf); |
||||||
|
jf.setSize(400, 400); |
||||||
|
jf.setVisible(true); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 给组件登记一个观察者监听事件 |
||||||
|
* |
||||||
|
* @param listener 观察者监听事件 |
||||||
|
*/ |
||||||
|
public void registerChangeListener(UIObserverListener listener) { |
||||||
|
this.uiObserverListener = listener; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 组件是否需要响应添加的观察者事件 |
||||||
|
* |
||||||
|
* @return 如果需要响应观察者事件则返回true,否则返回false |
||||||
|
*/ |
||||||
|
public boolean shouldResponseChangeListener() { |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,227 @@ |
|||||||
|
package com.fr.design.gui.ibutton; |
||||||
|
|
||||||
|
import java.awt.*; |
||||||
|
import java.awt.geom.RoundRectangle2D; |
||||||
|
|
||||||
|
import javax.swing.AbstractButton; |
||||||
|
import javax.swing.ButtonModel; |
||||||
|
import javax.swing.Icon; |
||||||
|
import javax.swing.JComponent; |
||||||
|
import javax.swing.SwingUtilities; |
||||||
|
import javax.swing.plaf.basic.BasicButtonUI; |
||||||
|
import javax.swing.plaf.basic.BasicHTML; |
||||||
|
import javax.swing.text.View; |
||||||
|
|
||||||
|
import com.fr.base.BaseUtils; |
||||||
|
import com.fr.design.constants.UIConstants; |
||||||
|
import com.fr.design.roleAuthority.ReportAndFSManagePane; |
||||||
|
import com.fr.stable.Constants; |
||||||
|
import sun.swing.SwingUtilities2; |
||||||
|
|
||||||
|
import com.fr.stable.StringUtils; |
||||||
|
import com.fr.design.utils.gui.GUIPaintUtils; |
||||||
|
|
||||||
|
import static com.fr.design.utils.gui.GUIPaintUtils.fillPaint; |
||||||
|
|
||||||
|
public class UISliderButtonUI extends BasicButtonUI { |
||||||
|
|
||||||
|
private Rectangle viewRec = new Rectangle(); |
||||||
|
private Rectangle textRec = new Rectangle(); |
||||||
|
private Rectangle iconRec = new Rectangle(); |
||||||
|
|
||||||
|
@Override |
||||||
|
public void paint(Graphics g, JComponent c) { |
||||||
|
UISliderButton b = (UISliderButton) c; |
||||||
|
Graphics2D g2d = (Graphics2D) g; |
||||||
|
int w = b.getWidth(); |
||||||
|
int h = b.getHeight(); |
||||||
|
|
||||||
|
String text = initRecAndGetText(b, SwingUtilities2.getFontMetrics(b, g), b.getWidth(), b.getHeight()); |
||||||
|
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); |
||||||
|
clearTextShiftOffset(); |
||||||
|
|
||||||
|
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
||||||
|
if (b.isExtraPainted()) { |
||||||
|
if (isPressed(b) && b.isPressedPainted()) { |
||||||
|
fillPressed(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); |
||||||
|
} else if (isRollOver(b)) { |
||||||
|
fillRollOver(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); |
||||||
|
} else if (b.isNormalPainted()) { |
||||||
|
fillNormal(g2d, 0, 0, w, h, b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles), b.isPressedPainted()); |
||||||
|
} |
||||||
|
} |
||||||
|
((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); |
||||||
|
|
||||||
|
paintContent(g, b, text); |
||||||
|
} |
||||||
|
|
||||||
|
protected boolean isRollOver(AbstractButton b) { |
||||||
|
ButtonModel model = b.getModel(); |
||||||
|
return model.isRollover() && !b.isSelected(); |
||||||
|
} |
||||||
|
|
||||||
|
protected boolean isPressed(AbstractButton b) { |
||||||
|
ButtonModel model = b.getModel(); |
||||||
|
return (model.isArmed() && model.isPressed()) || b.isSelected(); |
||||||
|
} |
||||||
|
|
||||||
|
private void paintContent(Graphics g, AbstractButton b, String text) { |
||||||
|
if (b.getIcon() != null) { |
||||||
|
paintIcon(g, b); |
||||||
|
} |
||||||
|
if (!StringUtils.isEmpty(text)) { |
||||||
|
paintText(g, b, text); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void paintText(Graphics g, AbstractButton b, String text) { |
||||||
|
View v = (View) b.getClientProperty(BasicHTML.propertyKey); |
||||||
|
if (v != null) { |
||||||
|
v.paint(g, textRec); |
||||||
|
return; |
||||||
|
} |
||||||
|
FontMetrics fm = SwingUtilities2.getFontMetrics(b, g); |
||||||
|
int mnemonicIndex = b.getDisplayedMnemonicIndex(); |
||||||
|
if (b.isEnabled()) { |
||||||
|
g.setColor(UIConstants.FONT_COLOR); |
||||||
|
} else { |
||||||
|
g.setColor(UIConstants.LINE_COLOR); |
||||||
|
} |
||||||
|
|
||||||
|
SwingUtilities2.drawStringUnderlineCharAt(b, g, text, mnemonicIndex, textRec.x + getTextShiftOffset(), textRec.y + fm.getAscent() + getTextShiftOffset()); |
||||||
|
} |
||||||
|
|
||||||
|
private String initRecAndGetText(AbstractButton b, FontMetrics fm, int width, int height) { |
||||||
|
Insets i = b.getInsets(); |
||||||
|
viewRec.x = i.left; |
||||||
|
viewRec.y = i.top; |
||||||
|
viewRec.width = width - (i.right + viewRec.x); |
||||||
|
viewRec.height = height - (i.bottom + viewRec.y); |
||||||
|
textRec.x = textRec.y = textRec.width = textRec.height = 0; |
||||||
|
iconRec.x = iconRec.y = iconRec.width = iconRec.height = 0; |
||||||
|
// layout the text and icon
|
||||||
|
return SwingUtilities.layoutCompoundLabel( |
||||||
|
b, fm, b.getText(), b.getIcon(), |
||||||
|
b.getVerticalAlignment(), b.getHorizontalAlignment(), |
||||||
|
b.getVerticalTextPosition(), b.getHorizontalTextPosition(), |
||||||
|
viewRec, iconRec, textRec, |
||||||
|
b.getText() == null ? 0 : b.getIconTextGap()); |
||||||
|
} |
||||||
|
|
||||||
|
protected void paintBorder(Graphics g, UISliderButton b) { |
||||||
|
String selectedRoles = ReportAndFSManagePane.getInstance().getRoleTree().getSelectedRoleName(); |
||||||
|
GUIPaintUtils.drawBorder((Graphics2D) g, 0, 0, b.getWidth(), b.getHeight(), b.isRoundBorder(), b.getRectDirection(), b.isDoneAuthorityEdited(selectedRoles)); |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
protected void paintIcon(Graphics g, JComponent c) { |
||||||
|
AbstractButton b = (AbstractButton) c; |
||||||
|
ButtonModel model = b.getModel(); |
||||||
|
Icon icon = b.getIcon(); |
||||||
|
Icon tmpIcon = null; |
||||||
|
if (icon == null) { |
||||||
|
return; |
||||||
|
} |
||||||
|
Icon selectedIcon = null; |
||||||
|
/* the fallback icon should be based on the selected state */ |
||||||
|
if (model.isSelected()) { |
||||||
|
selectedIcon = (Icon) b.getSelectedIcon(); |
||||||
|
if (selectedIcon != null) { |
||||||
|
icon = selectedIcon; |
||||||
|
} |
||||||
|
} |
||||||
|
if (!model.isEnabled()) { |
||||||
|
if (model.isSelected()) { |
||||||
|
tmpIcon = (Icon) b.getDisabledSelectedIcon(); |
||||||
|
if (tmpIcon == null) { |
||||||
|
tmpIcon = selectedIcon; |
||||||
|
} |
||||||
|
} |
||||||
|
if (tmpIcon == null) { |
||||||
|
tmpIcon = (Icon) b.getDisabledIcon(); |
||||||
|
} |
||||||
|
} else if (model.isPressed() && model.isArmed()) { |
||||||
|
tmpIcon = (Icon) b.getPressedIcon(); |
||||||
|
if (tmpIcon != null) { |
||||||
|
// revert back to 0 offset
|
||||||
|
clearTextShiftOffset(); |
||||||
|
} |
||||||
|
} else if (b.isRolloverEnabled() && model.isRollover()) { |
||||||
|
if (model.isSelected()) { |
||||||
|
tmpIcon = (Icon) b.getRolloverSelectedIcon(); |
||||||
|
if (tmpIcon == null) { |
||||||
|
tmpIcon = selectedIcon; |
||||||
|
} |
||||||
|
} |
||||||
|
if (tmpIcon == null) { |
||||||
|
tmpIcon = (Icon) b.getRolloverIcon(); |
||||||
|
} |
||||||
|
} |
||||||
|
if (tmpIcon != null) { |
||||||
|
icon = tmpIcon; |
||||||
|
} |
||||||
|
paintModelIcon(model, icon, g, c); |
||||||
|
} |
||||||
|
|
||||||
|
private void paintModelIcon(ButtonModel model, Icon icon, Graphics g, JComponent c) { |
||||||
|
if (model.isPressed() && model.isArmed()) { |
||||||
|
icon.paintIcon(c, g, iconRec.x + getTextShiftOffset(), |
||||||
|
iconRec.y + getTextShiftOffset()); |
||||||
|
} else { |
||||||
|
icon.paintIcon(c, g, iconRec.x, iconRec.y); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
private void fillNormal(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { |
||||||
|
GradientPaint gp; |
||||||
|
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { |
||||||
|
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.AUTHORITY_DARK_BLUE); |
||||||
|
} else if (isPressedPainted) { |
||||||
|
gp = new GradientPaint(1, 1, UIConstants.SELECT_TAB, 1, height - 1, UIConstants.SELECT_TAB); |
||||||
|
}else{ |
||||||
|
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); |
||||||
|
} |
||||||
|
|
||||||
|
fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); |
||||||
|
} |
||||||
|
|
||||||
|
private void fillRollOver(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited, boolean isPressedPainted) { |
||||||
|
GradientPaint gp; |
||||||
|
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { |
||||||
|
gp = new GradientPaint(1, 1, UIConstants.AUTHORITY_BLUE, 1, height - 1, UIConstants.HOVER_BLUE); |
||||||
|
} else if (isPressedPainted) { |
||||||
|
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); |
||||||
|
}else { |
||||||
|
gp = new GradientPaint(1, 1, UIConstants.POP_DIALOG_BORDER, 1, height - 1, UIConstants.POP_DIALOG_BORDER); |
||||||
|
} |
||||||
|
fillPaint(g2d, x, y, width, height, isRound, rectDirection, gp, UIConstants.ARC); |
||||||
|
} |
||||||
|
|
||||||
|
private void fillPressed(Graphics2D g2d, int x, int y, int width, int height, boolean isRound, int rectDirection, boolean isAuthorityEdited) { |
||||||
|
Color oldColor = g2d.getColor(); |
||||||
|
if (BaseUtils.isAuthorityEditing() && isAuthorityEdited) { |
||||||
|
g2d.setColor(UIConstants.AUTHORITY_PRESS_BLUE); |
||||||
|
} else { |
||||||
|
g2d.setColor(UIConstants.POP_DIALOG_BORDER); |
||||||
|
} |
||||||
|
Shape oldClip = g2d.getClip(); |
||||||
|
if (isRound) { |
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
||||||
|
g2d.clip(new RoundRectangle2D.Double(x, y, width, height, UIConstants.ARC, UIConstants.ARC)); |
||||||
|
g2d.fillRoundRect(x, y, width, height, UIConstants.ARC, UIConstants.ARC); |
||||||
|
g2d.setClip(oldClip); |
||||||
|
if (rectDirection == Constants.RIGHT) { |
||||||
|
g2d.fillRect(width - 2, y, x + 2, height); |
||||||
|
} else if (rectDirection == Constants.LEFT) { |
||||||
|
g2d.fillRect(x, y, x + 2, height); |
||||||
|
} |
||||||
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); |
||||||
|
} else { |
||||||
|
g2d.clip(new Rectangle(x, y, width, height)); |
||||||
|
g2d.fillRect(0, 0, width, height); |
||||||
|
g2d.setClip(oldClip); |
||||||
|
} |
||||||
|
|
||||||
|
g2d.setColor(oldColor); |
||||||
|
} |
||||||
|
} |
@ -1,47 +0,0 @@ |
|||||||
package com.fr.design.gui.itextfield; |
|
||||||
|
|
||||||
import java.awt.event.FocusEvent; |
|
||||||
import java.awt.event.FocusListener; |
|
||||||
import javax.swing.text.Document; |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* Created by ibm on 2017/8/16. |
|
||||||
*/ |
|
||||||
public class UIPropertyTextField extends UITextField{ |
|
||||||
|
|
||||||
public UIPropertyTextField() { |
|
||||||
super(); |
|
||||||
} |
|
||||||
|
|
||||||
public UIPropertyTextField(int columns) { |
|
||||||
super(columns); |
|
||||||
} |
|
||||||
|
|
||||||
public UIPropertyTextField(String text, int columns) { |
|
||||||
super(text, columns); |
|
||||||
} |
|
||||||
|
|
||||||
public UIPropertyTextField(String text) { |
|
||||||
super(text); |
|
||||||
} |
|
||||||
|
|
||||||
public UIPropertyTextField(Document doc, String text, int columns) { |
|
||||||
super(doc, text, columns); |
|
||||||
} |
|
||||||
|
|
||||||
protected void initListener() { |
|
||||||
if (shouldResponseChangeListener()) { |
|
||||||
addFocusListener(new FocusListener() { |
|
||||||
@Override |
|
||||||
public void focusGained(FocusEvent e) { |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void focusLost(FocusEvent e) { |
|
||||||
attributeChange(); |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
Before Width: | Height: | Size: 389 B After Width: | Height: | Size: 942 B |
Before Width: | Height: | Size: 412 B After Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 214 B |
@ -1,41 +1,41 @@ |
|||||||
package com.fr.design.mainframe.widget.accessibles; |
package com.fr.design.mainframe.widget.accessibles; |
||||||
|
|
||||||
import javax.swing.SwingUtilities; |
import javax.swing.SwingUtilities; |
||||||
|
|
||||||
import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; |
import com.fr.design.mainframe.widget.wrappers.TreeModelWrapper; |
||||||
import com.fr.design.dialog.BasicDialog; |
import com.fr.design.dialog.BasicDialog; |
||||||
import com.fr.design.dialog.DialogActionAdapter; |
import com.fr.design.dialog.DialogActionAdapter; |
||||||
import com.fr.design.gui.frpane.TreeSettingPane; |
import com.fr.design.gui.frpane.TreeSettingPane; |
||||||
|
|
||||||
|
|
||||||
/** |
/** |
||||||
* 用于TreeEdito和TreeComboBox的数据格式设置 |
* 用于TreeEdito和TreeComboBox的数据格式设置 |
||||||
* @since 6.5.3 |
* @since 6.5.3 |
||||||
*/ |
*/ |
||||||
public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { |
public class AccessibleTreeModelEditor extends UneditableAccessibleEditor { |
||||||
|
|
||||||
private TreeSettingPane treeSettingPane; |
private TreeSettingPane treeSettingPane; |
||||||
|
|
||||||
public AccessibleTreeModelEditor() { |
public AccessibleTreeModelEditor() { |
||||||
super(new TreeModelWrapper()); |
super(new TreeModelWrapper()); |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
protected void showEditorPane() { |
protected void showEditorPane() { |
||||||
if (treeSettingPane == null) { |
if (treeSettingPane == null) { |
||||||
treeSettingPane = new TreeSettingPane(false); |
treeSettingPane = new TreeSettingPane(false); |
||||||
} |
} |
||||||
BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
BasicDialog dlg = treeSettingPane.showWindow(SwingUtilities.getWindowAncestor(this)); |
||||||
treeSettingPane.populate(getValue()); |
treeSettingPane.populate(getValue()); |
||||||
dlg.addDialogActionListener(new DialogActionAdapter() { |
dlg.addDialogActionListener(new DialogActionAdapter() { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void doOk() { |
public void doOk() { |
||||||
Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); |
Object nodeOrDict = treeSettingPane.updateTreeNodeAttrs(); |
||||||
setValue(nodeOrDict); |
setValue(nodeOrDict); |
||||||
fireStateChanged(); |
fireStateChanged(); |
||||||
} |
} |
||||||
}); |
}); |
||||||
dlg.setVisible(true); |
dlg.setVisible(true); |
||||||
} |
} |
||||||
} |
} |
@ -1,40 +1,40 @@ |
|||||||
package com.fr.design.mainframe.widget.wrappers; |
package com.fr.design.mainframe.widget.wrappers; |
||||||
|
|
||||||
import com.fr.base.TemplateUtils; |
import com.fr.base.TemplateUtils; |
||||||
import com.fr.data.impl.TreeNodeAttr; |
import com.fr.data.impl.TreeNodeAttr; |
||||||
import com.fr.data.impl.TreeNodeWrapper; |
import com.fr.data.impl.TreeNodeWrapper; |
||||||
import com.fr.design.Exception.ValidationException; |
import com.fr.design.Exception.ValidationException; |
||||||
import com.fr.design.designer.properties.Decoder; |
import com.fr.design.designer.properties.Decoder; |
||||||
import com.fr.design.designer.properties.Encoder; |
import com.fr.design.designer.properties.Encoder; |
||||||
import com.fr.general.Inter; |
import com.fr.general.Inter; |
||||||
import com.fr.general.NameObject; |
import com.fr.general.NameObject; |
||||||
import com.fr.stable.StringUtils; |
import com.fr.stable.StringUtils; |
||||||
|
|
||||||
public class TreeModelWrapper implements Encoder, Decoder { |
public class TreeModelWrapper implements Encoder, Decoder { |
||||||
|
|
||||||
@Override |
@Override |
||||||
public String encode(Object v) { |
public String encode(Object v) { |
||||||
if (v == null) { |
if (v == null) { |
||||||
return StringUtils.EMPTY; |
return StringUtils.EMPTY; |
||||||
} |
} |
||||||
if (v instanceof TreeNodeAttr[]) { |
if (v instanceof TreeNodeAttr[]) { |
||||||
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); |
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{((TreeNodeAttr[]) v).length + ""}); |
||||||
} else if (v instanceof TreeNodeWrapper) { |
} else if (v instanceof TreeNodeWrapper) { |
||||||
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); |
TreeNodeAttr[] treeNodeAttrs = ((TreeNodeWrapper) v).getTreeNodeAttrs(); |
||||||
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); |
return TemplateUtils.render(Inter.getLocText("FR-Designer_Total_N_Grade"), new String[]{"N"}, new String[]{treeNodeAttrs.length + ""}); |
||||||
} else if (v instanceof NameObject) { |
} else if (v instanceof NameObject) { |
||||||
return Inter.getLocText("FR-Designer_DataTable-Build"); |
return Inter.getLocText("FR-Designer_DataTable-Build"); |
||||||
} else { |
} else { |
||||||
return Inter.getLocText("FR-Designer_Auto-Build"); |
return Inter.getLocText("FR-Designer_Auto-Build"); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public Object decode(String txt) { |
public Object decode(String txt) { |
||||||
return null; |
return null; |
||||||
} |
} |
||||||
|
|
||||||
@Override |
@Override |
||||||
public void validate(String txt) throws ValidationException { |
public void validate(String txt) throws ValidationException { |
||||||
} |
} |
||||||
} |
} |
@ -1,84 +0,0 @@ |
|||||||
package com.fr.plugin.chart.designer.other; |
|
||||||
|
|
||||||
import com.fr.base.chart.BasePlot; |
|
||||||
import com.fr.chart.chartattr.Plot; |
|
||||||
import com.fr.chart.chartglyph.ConditionAttr; |
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
|
||||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
|
||||||
import com.fr.design.gui.ilist.ListModelElement; |
|
||||||
import com.fr.general.Inter; |
|
||||||
import com.fr.general.NameObject; |
|
||||||
import com.fr.plugin.chart.designer.component.ConditionUIMenuNameableCreator; |
|
||||||
import com.fr.stable.Nameable; |
|
||||||
|
|
||||||
import java.lang.reflect.Constructor; |
|
||||||
import java.lang.reflect.InvocationTargetException; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by mengao on 2017/8/18. |
|
||||||
*/ |
|
||||||
public class ChartConditionNameObjectCreator extends NameObjectCreator { |
|
||||||
private BasePlot plot; |
|
||||||
private ConditionUIMenuNameableCreator conditionUIMenuNameableCreator; |
|
||||||
|
|
||||||
public ChartConditionNameObjectCreator(BasePlot plot, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
|
||||||
super(menuName, clazz, updatePane); |
|
||||||
this.plot = plot; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* create Nameable |
|
||||||
* |
|
||||||
* @param helper |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
|
||||||
Constructor<? extends ConditionUIMenuNameableCreator> constructor = null; |
|
||||||
try { |
|
||||||
constructor = clazzOfInitCase.getConstructor(Plot.class, String.class, Object.class, Class.class); |
|
||||||
ConditionUIMenuNameableCreator conditionUIMenuNameableCreator = constructor.newInstance(plot, Inter.getLocText("Chart-Condition_Attributes"), new ConditionAttr(), getUpdatePane()); |
|
||||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), conditionUIMenuNameableCreator); |
|
||||||
|
|
||||||
} catch (NoSuchMethodException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} catch (IllegalAccessException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} catch (InstantiationException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} catch (InvocationTargetException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param ob |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public Object acceptObject2Populate(Object ob) { |
|
||||||
if (ob instanceof NameObject) { |
|
||||||
ob = ((NameObject) ob).getObject(); |
|
||||||
} |
|
||||||
if (clazzOfObject != null && clazzOfObject.isInstance(ob)) { |
|
||||||
doSthChanged4Icon(ob); |
|
||||||
conditionUIMenuNameableCreator = (ConditionUIMenuNameableCreator) ((ConditionUIMenuNameableCreator) ob).clone(); |
|
||||||
return ob; |
|
||||||
} |
|
||||||
|
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* save update bean |
|
||||||
* |
|
||||||
* @param wrapper |
|
||||||
* @param bean |
|
||||||
*/ |
|
||||||
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { |
|
||||||
conditionUIMenuNameableCreator.setObj(bean); |
|
||||||
((NameObject) wrapper.wrapper).setObject(conditionUIMenuNameableCreator); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,84 +0,0 @@ |
|||||||
package com.fr.plugin.chart.designer.other; |
|
||||||
|
|
||||||
import com.fr.design.beans.BasicBeanPane; |
|
||||||
import com.fr.design.gui.controlpane.NameObjectCreator; |
|
||||||
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
|
||||||
import com.fr.design.gui.ilist.ListModelElement; |
|
||||||
import com.fr.design.gui.imenutable.UIMenuNameableCreator; |
|
||||||
import com.fr.general.NameObject; |
|
||||||
import com.fr.stable.Nameable; |
|
||||||
|
|
||||||
import java.lang.reflect.Constructor; |
|
||||||
import java.lang.reflect.InvocationTargetException; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by mengao on 2017/8/21. |
|
||||||
*/ |
|
||||||
public class ChartHyperlinkNameObjectCreartor extends NameObjectCreator { |
|
||||||
private Object object; |
|
||||||
private UIMenuNameableCreator uIMenuNameableCreator; |
|
||||||
|
|
||||||
|
|
||||||
public ChartHyperlinkNameObjectCreartor(Object object, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
|
||||||
super(menuName, clazz, updatePane); |
|
||||||
this.object = object; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* create Nameable |
|
||||||
* |
|
||||||
* @param helper |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public Nameable createNameable(UnrepeatedNameHelper helper) { |
|
||||||
Constructor<? extends UIMenuNameableCreator> constructor = null; |
|
||||||
try { |
|
||||||
constructor = clazzOfInitCase.getConstructor(String.class, Object.class, Class.class); |
|
||||||
UIMenuNameableCreator uIMenuNameableCreator = constructor.newInstance(menuName, object, getUpdatePane()); |
|
||||||
return new NameObject(helper.createUnrepeatedName(this.menuName()), uIMenuNameableCreator); |
|
||||||
|
|
||||||
} catch (NoSuchMethodException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} catch (IllegalAccessException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} catch (InstantiationException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} catch (InvocationTargetException e) { |
|
||||||
e.printStackTrace(); |
|
||||||
} |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* @param ob |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public Object acceptObject2Populate(Object ob) { |
|
||||||
if (ob instanceof NameObject) { |
|
||||||
ob = ((NameObject) ob).getObject(); |
|
||||||
} |
|
||||||
if (clazzOfObject != null && clazzOfObject.isInstance(ob)) { |
|
||||||
doSthChanged4Icon(ob); |
|
||||||
uIMenuNameableCreator = ((UIMenuNameableCreator) ob).clone(); |
|
||||||
if (uIMenuNameableCreator.getObj() != null && object.getClass().isInstance(uIMenuNameableCreator.getObj())) { |
|
||||||
return ob; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* save update bean |
|
||||||
* |
|
||||||
* @param wrapper |
|
||||||
* @param bean |
|
||||||
*/ |
|
||||||
public void saveUpdatedBean(ListModelElement wrapper, Object bean) { |
|
||||||
uIMenuNameableCreator.setObj(bean); |
|
||||||
((NameObject) wrapper.wrapper).setObject(uIMenuNameableCreator); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,116 @@ |
|||||||
|
package com.fr.plugin.chart.designer.style.background; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.gui.controlpane.NameableCreator; |
||||||
|
import com.fr.design.gui.controlpane.UIListControlPane; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.general.NameObject; |
||||||
|
import com.fr.plugin.chart.attr.DefaultAxisHelper; |
||||||
|
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; |
||||||
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; |
||||||
|
import com.fr.stable.Nameable; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by mengao on 2017/8/22. |
||||||
|
*/ |
||||||
|
public class AlertLineListControlPane extends UIListControlPane { |
||||||
|
|
||||||
|
|
||||||
|
@Override |
||||||
|
public void saveSettings() { |
||||||
|
if (isPopulating) { |
||||||
|
return; |
||||||
|
} |
||||||
|
update((VanChartPlot) plot); |
||||||
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public NameableCreator[] createNameableCreators() { |
||||||
|
return new ChartNameObjectCreator[]{new ChartNameObjectCreator(new String[]{Inter.getLocText("ChartF-X_Axis"), Inter.getLocText("ChartF-Y_Axis")}, |
||||||
|
Inter.getLocText("Plugin-ChartF_AlertLine"), VanChartAlertValue.class, VanChartAlertValuePane.class)}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_AlertLine"); |
||||||
|
} |
||||||
|
|
||||||
|
protected String getAddItemText() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_AlertLine"); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(Plot plot) { |
||||||
|
this.plot = plot; |
||||||
|
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||||
|
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||||
|
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||||
|
String[] axisNames = DefaultAxisHelper.getAllAxisNames(xAxisList, yAxisList); |
||||||
|
|
||||||
|
ChartNameObjectCreator[] creators = {new ChartNameObjectCreator(axisNames, Inter.getLocText("Plugin-ChartF_AlertLine"), VanChartAlertValue.class, VanChartAlertValuePane.class)}; |
||||||
|
|
||||||
|
refreshNameableCreator(creators); |
||||||
|
|
||||||
|
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>(); |
||||||
|
|
||||||
|
for (VanChartAxis axis : xAxisList) { |
||||||
|
List<VanChartAlertValue> values = axis.getAlertValues(); |
||||||
|
for (VanChartAlertValue alertValue : values) { |
||||||
|
alertValue.setAxisNamesArray(axisNames); |
||||||
|
alertValue.setAxisName(axis.getAxisName()); |
||||||
|
nameObjects.add(new NameObject(alertValue.getAlertPaneSelectName(), alertValue)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
for (VanChartAxis axis : yAxisList) { |
||||||
|
List<VanChartAlertValue> values = axis.getAlertValues(); |
||||||
|
for (VanChartAlertValue alertValue : values) { |
||||||
|
alertValue.setAxisNamesArray(axisNames); |
||||||
|
alertValue.setAxisName(axis.getAxisName()); |
||||||
|
nameObjects.add(new NameObject(alertValue.getAlertPaneSelectName(), alertValue)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
populate(nameObjects.toArray(new NameObject[nameObjects.size()])); |
||||||
|
doLayout(); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(Plot plot) { |
||||||
|
|
||||||
|
Nameable[] nameables = this.update(); |
||||||
|
|
||||||
|
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||||
|
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||||
|
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||||
|
|
||||||
|
for (VanChartAxis axis : xAxisList) { |
||||||
|
List<VanChartAlertValue> axisAlerts = new ArrayList<VanChartAlertValue>(); |
||||||
|
for (int i = 0; i < nameables.length; i++) { |
||||||
|
VanChartAlertValue value = (VanChartAlertValue) ((NameObject) nameables[i]).getObject(); |
||||||
|
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||||
|
value.setAlertPaneSelectName(nameables[i].getName()); |
||||||
|
axisAlerts.add(value); |
||||||
|
} |
||||||
|
} |
||||||
|
axis.setAlertValues(axisAlerts); |
||||||
|
} |
||||||
|
for (VanChartAxis axis : yAxisList) { |
||||||
|
List<VanChartAlertValue> axisAlerts = new ArrayList<VanChartAlertValue>(); |
||||||
|
for (int i = 0; i < nameables.length; i++) { |
||||||
|
VanChartAlertValue value = (VanChartAlertValue) ((NameObject) nameables[i]).getObject(); |
||||||
|
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||||
|
value.setAlertPaneSelectName(nameables[i].getName()); |
||||||
|
axisAlerts.add(value); |
||||||
|
} |
||||||
|
} |
||||||
|
axis.setAlertValues(axisAlerts); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,121 @@ |
|||||||
|
package com.fr.plugin.chart.designer.style.background; |
||||||
|
|
||||||
|
import com.fr.chart.chartattr.Plot; |
||||||
|
import com.fr.design.gui.controlpane.NameableCreator; |
||||||
|
import com.fr.design.gui.controlpane.UIListControlPane; |
||||||
|
import com.fr.design.mainframe.DesignerContext; |
||||||
|
import com.fr.general.ComparatorUtils; |
||||||
|
import com.fr.general.Inter; |
||||||
|
import com.fr.general.NameObject; |
||||||
|
import com.fr.plugin.chart.attr.DefaultAxisHelper; |
||||||
|
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; |
||||||
|
import com.fr.plugin.chart.attr.axis.VanChartAxis; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartPlot; |
||||||
|
import com.fr.plugin.chart.attr.plot.VanChartRectanglePlot; |
||||||
|
import com.fr.plugin.chart.base.VanChartCustomIntervalBackground; |
||||||
|
import com.fr.stable.Nameable; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by mengao on 2017/8/22. |
||||||
|
*/ |
||||||
|
public class BackgroundListControlPane extends UIListControlPane { |
||||||
|
|
||||||
|
@Override |
||||||
|
public void saveSettings() { |
||||||
|
if (isPopulating) { |
||||||
|
return; |
||||||
|
} |
||||||
|
update((VanChartPlot) plot, false); |
||||||
|
DesignerContext.getDesignerFrame().getSelectedJTemplate().fireTargetModified(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public NameableCreator[] createNameableCreators() { |
||||||
|
return new BackgroundNameObjectCreator[]{new BackgroundNameObjectCreator(new String[]{Inter.getLocText("ChartF-X_Axis"), Inter.getLocText("ChartF-Y_Axis")}, |
||||||
|
Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"), VanChartAlertValue.class, VanChartAlertValuePane.class)}; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
protected String title4PopupWindow() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String getAddItemText() { |
||||||
|
return Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"); |
||||||
|
} |
||||||
|
|
||||||
|
public void populate(Plot plot) { |
||||||
|
this.plot = plot; |
||||||
|
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||||
|
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||||
|
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||||
|
String[] axisNames = DefaultAxisHelper.getAllAxisNames(xAxisList, yAxisList); |
||||||
|
|
||||||
|
BackgroundNameObjectCreator[] creators = {new BackgroundNameObjectCreator(axisNames, Inter.getLocText("Plugin-ChartF_CustomIntervalBackground"), VanChartCustomIntervalBackground.class, VanChartCustomIntervalBackgroundPane.class)}; |
||||||
|
|
||||||
|
refreshNameableCreator(creators); |
||||||
|
|
||||||
|
java.util.List<NameObject> nameObjects = new ArrayList<NameObject>(); |
||||||
|
|
||||||
|
|
||||||
|
for (VanChartAxis axis : xAxisList) { |
||||||
|
List<VanChartCustomIntervalBackground> customIntervalBackgrounds = axis.getCustomIntervalBackgroundArray(); |
||||||
|
for (VanChartCustomIntervalBackground background : customIntervalBackgrounds) { |
||||||
|
background.setAxisNamesArray(axisNames); |
||||||
|
background.setAxisName(axis.getAxisName()); |
||||||
|
nameObjects.add(new NameObject(background.getCustomIntervalBackgroundSelectName(), background)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
for (VanChartAxis axis : yAxisList) { |
||||||
|
List<VanChartCustomIntervalBackground> customIntervalBackgrounds = axis.getCustomIntervalBackgroundArray(); |
||||||
|
for (VanChartCustomIntervalBackground background : customIntervalBackgrounds) { |
||||||
|
background.setAxisNamesArray(axisNames); |
||||||
|
background.setAxisName(axis.getAxisName()); |
||||||
|
nameObjects.add(new NameObject(background.getCustomIntervalBackgroundSelectName(), background)); |
||||||
|
} |
||||||
|
} |
||||||
|
populate(nameObjects.toArray(new NameObject[nameObjects.size()])); |
||||||
|
doLayout(); |
||||||
|
} |
||||||
|
|
||||||
|
public void update(Plot plot, boolean isDefaultIntervalBackground) { |
||||||
|
|
||||||
|
Nameable[] nameables = this.update(); |
||||||
|
|
||||||
|
VanChartRectanglePlot rectanglePlot = (VanChartRectanglePlot) plot; |
||||||
|
List<VanChartAxis> xAxisList = rectanglePlot.getXAxisList(); |
||||||
|
List<VanChartAxis> yAxisList = rectanglePlot.getYAxisList(); |
||||||
|
|
||||||
|
for (VanChartAxis axis : xAxisList) { |
||||||
|
List<VanChartCustomIntervalBackground> axisCustomBackground = new ArrayList<VanChartCustomIntervalBackground>(); |
||||||
|
if (!isDefaultIntervalBackground) { |
||||||
|
for (int i = 0; i < nameables.length; i++) { |
||||||
|
VanChartCustomIntervalBackground value = (VanChartCustomIntervalBackground) ((NameObject) nameables[i]).getObject(); |
||||||
|
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||||
|
value.setCustomIntervalBackgroundSelectName(nameables[i].getName()); |
||||||
|
axisCustomBackground.add(value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
axis.setCustomIntervalBackgroundArray(axisCustomBackground); |
||||||
|
} |
||||||
|
for (VanChartAxis axis : yAxisList) { |
||||||
|
List<VanChartCustomIntervalBackground> axisCustomBackground = new ArrayList<VanChartCustomIntervalBackground>(); |
||||||
|
if (!isDefaultIntervalBackground) { |
||||||
|
for (int i = 0; i < nameables.length; i++) { |
||||||
|
VanChartCustomIntervalBackground value = (VanChartCustomIntervalBackground) ((NameObject) nameables[i]).getObject(); |
||||||
|
if (ComparatorUtils.equals(value.getAxisName(), axis.getAxisName())) { |
||||||
|
value.setCustomIntervalBackgroundSelectName(nameables[i].getName()); |
||||||
|
axisCustomBackground.add(value); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
axis.setCustomIntervalBackgroundArray(axisCustomBackground); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package com.fr.plugin.chart.designer.style.background; |
||||||
|
|
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.NameObject; |
||||||
|
import com.fr.plugin.chart.base.VanChartCustomIntervalBackground; |
||||||
|
import com.fr.stable.Nameable; |
||||||
|
|
||||||
|
import java.lang.reflect.Constructor; |
||||||
|
import java.lang.reflect.InvocationTargetException; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by mengao on 2017/8/23. |
||||||
|
*/ |
||||||
|
public class BackgroundNameObjectCreator extends ChartNameObjectCreator { |
||||||
|
public BackgroundNameObjectCreator(Object object, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||||
|
super(object, menuName, clazz, updatePane); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* create Nameable |
||||||
|
* |
||||||
|
* @param helper |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||||
|
Constructor<? extends VanChartCustomIntervalBackground> constructor = null; |
||||||
|
try { |
||||||
|
constructor = clazzOfInitCase.getConstructor(); |
||||||
|
VanChartCustomIntervalBackground vanChartCustomIntervalBackground = constructor.newInstance(); |
||||||
|
vanChartCustomIntervalBackground.setAxisNamesArray((String[]) object); |
||||||
|
vanChartCustomIntervalBackground.setAxisName(((String[]) object)[0]); |
||||||
|
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartCustomIntervalBackground); |
||||||
|
|
||||||
|
} catch (NoSuchMethodException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} catch (IllegalAccessException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} catch (InstantiationException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} catch (InvocationTargetException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
package com.fr.plugin.chart.designer.style.background; |
||||||
|
|
||||||
|
import com.fr.design.beans.BasicBeanPane; |
||||||
|
import com.fr.design.gui.controlpane.NameObjectCreator; |
||||||
|
import com.fr.design.gui.controlpane.UnrepeatedNameHelper; |
||||||
|
import com.fr.general.FRLogger; |
||||||
|
import com.fr.general.NameObject; |
||||||
|
import com.fr.plugin.chart.attr.axis.VanChartAlertValue; |
||||||
|
import com.fr.stable.Nameable; |
||||||
|
|
||||||
|
import java.lang.reflect.Constructor; |
||||||
|
import java.lang.reflect.InvocationTargetException; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by mengao on 2017/8/21. |
||||||
|
*/ |
||||||
|
public class ChartNameObjectCreator extends NameObjectCreator { |
||||||
|
protected Object object; |
||||||
|
|
||||||
|
|
||||||
|
public ChartNameObjectCreator(Object object, String menuName, Class clazz, Class<? extends BasicBeanPane> updatePane) { |
||||||
|
super(menuName, clazz, updatePane); |
||||||
|
this.object = object; |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* create Nameable |
||||||
|
* |
||||||
|
* @param helper |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public Nameable createNameable(UnrepeatedNameHelper helper) { |
||||||
|
Constructor<? extends VanChartAlertValue> constructor = null; |
||||||
|
try { |
||||||
|
constructor = clazzOfInitCase.getConstructor(); |
||||||
|
VanChartAlertValue vanChartAlertValue = constructor.newInstance(); |
||||||
|
vanChartAlertValue.setAxisNamesArray((String[]) object); |
||||||
|
vanChartAlertValue.setAxisName(((String[]) object)[0]); |
||||||
|
return new NameObject(helper.createUnrepeatedName(this.menuName()), vanChartAlertValue); |
||||||
|
|
||||||
|
} catch (NoSuchMethodException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} catch (IllegalAccessException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} catch (InstantiationException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} catch (InvocationTargetException e) { |
||||||
|
FRLogger.getLogger().error(e.getMessage(), e); |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue