Browse Source

REPORT-16711 【10.0.3回归】权限设置无法从参数面板控件切换到a1单元格 && REPORT-16847【概率出现】 按钮图标错乱

bugfix/10.0
Hades 6 years ago
parent
commit
a4c3e17d91
  1. 40
      designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java
  2. 12
      designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

40
designer-base/src/main/java/com/fr/design/gui/ibutton/UIToggleButton.java

@ -29,6 +29,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
private boolean isEventBannded = false; private boolean isEventBannded = false;
private String toggleButtonName = ""; private String toggleButtonName = "";
private GlobalNameListener globalNameListener = null; private GlobalNameListener globalNameListener = null;
private Icon[] icons;
public UIToggleButton() { public UIToggleButton() {
this(StringUtils.EMPTY); this(StringUtils.EMPTY);
@ -53,9 +54,9 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* @param icons * @param icons
*/ */
public UIToggleButton(Icon[] icons) { public UIToggleButton(Icon[] icons) {
super(icons[0], null, icons[1]); super(icons[0], null, null);
setSelectedIcon(icons[1]);
setExtraPainted(true); setExtraPainted(true);
this.icons = icons;
addActionListener(new AbstractAction() { addActionListener(new AbstractAction() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
@ -73,10 +74,10 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* @param icons * @param icons
*/ */
public UIToggleButton(Icon[] icons, boolean needRelease) { public UIToggleButton(Icon[] icons, boolean needRelease) {
super(icons[0], null, icons[1]); super(icons[0], null, null);
setBorderPainted(true); setBorderPainted(true);
setSelectedIcon(icons[1]);
setExtraPainted(true); setExtraPainted(true);
this.icons = icons;
if (!needRelease) { if (!needRelease) {
addActionListener(new AbstractAction() { addActionListener(new AbstractAction() {
@Override @Override
@ -92,6 +93,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
addMouseListener(getMouseListener()); addMouseListener(getMouseListener());
} }
@Override
public void setGlobalName(String name){ public void setGlobalName(String name){
toggleButtonName = name ; toggleButtonName = name ;
} }
@ -100,6 +102,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* *
* @return * @return
*/ */
@Override
public boolean isSelected() { public boolean isSelected() {
return isSelected; return isSelected;
} }
@ -115,9 +118,11 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
super.setSelected(isSelected); super.setSelected(isSelected);
if (this.isSelected != isSelected) { if (this.isSelected != isSelected) {
this.isSelected = isSelected; this.isSelected = isSelected;
repaint(); refresh(isSelected);
} }
} }
@Override
protected void initListener(){ protected void initListener(){
if(shouldResponseChangeListener()){ if(shouldResponseChangeListener()){
this.addChangeListener(new ChangeListener() { this.addChangeListener(new ChangeListener() {
@ -138,10 +143,29 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
if (this.isSelected != isSelected) { if (this.isSelected != isSelected) {
this.isSelected = isSelected; this.isSelected = isSelected;
fireSelectedChanged(); fireSelectedChanged();
repaint(); refresh(isSelected);
} }
} }
private void refresh(final boolean isSelected) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
if (icons != null) {
if (isSelected) {
UIToggleButton.this.setIcon(icons[1]);
} else {
UIToggleButton.this.setIcon(icons[0]);
}
}
UIToggleButton.this.repaint();
}
});
}
protected MouseListener getMouseListener() { protected MouseListener getMouseListener() {
return new MouseAdapter() { return new MouseAdapter() {
@Override @Override
@ -157,6 +181,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
this.isEventBannded = ban; this.isEventBannded = ban;
} }
@Override
protected void fireStateChanged() { protected void fireStateChanged() {
} }
@ -187,6 +212,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
} }
} }
@Override
protected void paintOtherBorder(Graphics g) { protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g; Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(UIConstants.BS); g2d.setStroke(UIConstants.BS);
@ -200,6 +226,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* *
* @return 如果需要响应观察者事件则返回true否则返回false * @return 如果需要响应观察者事件则返回true否则返回false
*/ */
@Override
public boolean shouldResponseChangeListener() { public boolean shouldResponseChangeListener() {
return true; return true;
} }
@ -208,6 +235,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* *
* @param listener 观察者监听事件 * @param listener 观察者监听事件
*/ */
@Override
public void registerNameListener(GlobalNameListener listener) { public void registerNameListener(GlobalNameListener listener) {
globalNameListener = listener; globalNameListener = listener;
} }

12
designer-realize/src/main/java/com/fr/design/mainframe/ElementCasePane.java

@ -174,6 +174,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
private CellSelection cellNeedTOFormat = null; private CellSelection cellNeedTOFormat = null;
private FormatBrushAction formatBrushAction; private FormatBrushAction formatBrushAction;
private ActionListener keyListener = new ActionListener() { private ActionListener keyListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
if (!formatBrush.isSelected()) { if (!formatBrush.isSelected()) {
DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE); DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE);
@ -188,6 +189,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
} }
}; };
private ActionListener escKey = new ActionListener() { private ActionListener escKey = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
cancelFormatBrush(); cancelFormatBrush();
} }
@ -212,6 +214,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/** /**
* 取消格式化 * 取消格式化
*/ */
@Override
public void cancelFormat() { public void cancelFormat() {
return; return;
} }
@ -240,7 +243,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution); verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution);
horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution); horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution);
this.add(RGridLayout.VerticalBar, this.verScrollBar); this.add(RGridLayout.VerticalBar, this.verScrollBar);
// this.add(RGridLayout.HorizontalBar, this.horScrollBar);
// Init input/action map defaultly. // Init input/action map defaultly.
initInputActionMap(); initInputActionMap();
@ -253,7 +255,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
initFormatBrush(); initFormatBrush();
} }
@Override
public int getMenuState() { public int getMenuState() {
return DesignState.WORK_SHEET; return DesignState.WORK_SHEET;
} }
@ -265,6 +267,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
formatBrush.setSelected(DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL); formatBrush.setSelected(DesignerContext.getFormatState() != DesignerContext.FORMAT_STATE_NULL);
formatBrush.removeActionListener(formatBrushAction); formatBrush.removeActionListener(formatBrushAction);
formatBrush.addMouseListener(new MouseAdapter() { formatBrush.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) { public void mouseClicked(MouseEvent e) {
//如果没有格式刷,点击时就是想使用格式刷 //如果没有格式刷,点击时就是想使用格式刷
if (e.getClickCount() == 1) { if (e.getClickCount() == 1) {
@ -528,8 +531,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
FineLoggerFactory.getLogger().info("Nothing to release"); FineLoggerFactory.getLogger().info("Nothing to release");
} }
this.selection = selection; this.selection = selection;
fireSelectionChanged();
} }
fireSelectionChanged();
} }
@ -1210,6 +1213,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/** /**
* 请求焦点 * 请求焦点
*/ */
@Override
public void requestFocus() { public void requestFocus() {
super.requestFocus(); super.requestFocus();
this.getGrid().requestFocus(); this.getGrid().requestFocus();
@ -1338,6 +1342,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
* *
* @return 返回正在编辑的状态. * @return 返回正在编辑的状态.
*/ */
@Override
public EditingState createEditingState() { public EditingState createEditingState() {
return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue(), this.resolution); return new ElementCaseEditingState(this.selection, this.verScrollBar.getValue(), this.horScrollBar.getValue(), this.resolution);
} }
@ -1380,7 +1385,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue); ElementCasePane.this.getVerticalScrollBar().setValue(this.verticalValue);
ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue); ElementCasePane.this.getHorizontalScrollBar().setValue(this.horizontalValue);
// ElementCasePane.this.setResolution(this.resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution); HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
// 重绘. // 重绘.
ElementCasePane.this.repaint(); ElementCasePane.this.repaint();

Loading…
Cancel
Save