Browse Source

Merge branch 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~xiaoxia/design into release/10.0

* 'release/10.0' of http://cloud.finedevelop.com:2015/scm/~xiaoxia/design:
  update
  update
  update
  REPORT-16711 【10.0.3回归】权限设置无法从参数面板控件切换到a1单元格  && REPORT-16847【概率出现】 按钮图标错乱
bugfix/10.0
XiaXiang 6 years ago
parent
commit
2a8e68ec3b
  1. 44
      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

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

@ -25,10 +25,13 @@ import com.fr.stable.StringUtils;
* @since 2012-5-11下午4:28:24
*/
public class UIToggleButton extends UIButton implements GlobalNameObserver{
private static final int ICON_COUNT = 2;
private boolean isSelected;
private boolean isEventBannded = false;
private String toggleButtonName = "";
private GlobalNameListener globalNameListener = null;
private Icon[] icons;
public UIToggleButton() {
this(StringUtils.EMPTY);
@ -53,9 +56,9 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* @param icons
*/
public UIToggleButton(Icon[] icons) {
super(icons[0], null, icons[1]);
setSelectedIcon(icons[1]);
super(icons[0], null, null);
setExtraPainted(true);
this.icons = icons;
addActionListener(new AbstractAction() {
@Override
public void actionPerformed(ActionEvent e) {
@ -73,10 +76,10 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
* @param icons
*/
public UIToggleButton(Icon[] icons, boolean needRelease) {
super(icons[0], null, icons[1]);
super(icons[0], null, null);
setBorderPainted(true);
setSelectedIcon(icons[1]);
setExtraPainted(true);
this.icons = icons;
if (!needRelease) {
addActionListener(new AbstractAction() {
@Override
@ -92,6 +95,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
addMouseListener(getMouseListener());
}
@Override
public void setGlobalName(String name){
toggleButtonName = name ;
}
@ -100,6 +104,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
*
* @return
*/
@Override
public boolean isSelected() {
return isSelected;
}
@ -115,12 +120,15 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
super.setSelected(isSelected);
if (this.isSelected != isSelected) {
this.isSelected = isSelected;
repaint();
refresh(isSelected);
}
}
@Override
protected void initListener(){
if(shouldResponseChangeListener()){
this.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
if (uiObserverListener == null) {
return;
@ -138,10 +146,30 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
if (this.isSelected != isSelected) {
this.isSelected = isSelected;
fireSelectedChanged();
repaint();
refresh(isSelected);
}
}
private void refresh(final boolean isSelected) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
Icon[] icons = UIToggleButton.this.icons;
if (icons != null && icons.length == ICON_COUNT) {
if (isSelected) {
UIToggleButton.this.setIcon(icons[1]);
} else {
UIToggleButton.this.setIcon(icons[0]);
}
}
UIToggleButton.this.repaint();
}
});
}
protected MouseListener getMouseListener() {
return new MouseAdapter() {
@Override
@ -157,6 +185,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
this.isEventBannded = ban;
}
@Override
protected void fireStateChanged() {
}
@ -187,6 +216,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
}
}
@Override
protected void paintOtherBorder(Graphics g) {
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(UIConstants.BS);
@ -200,6 +230,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
*
* @return 如果需要响应观察者事件则返回true否则返回false
*/
@Override
public boolean shouldResponseChangeListener() {
return true;
}
@ -208,6 +239,7 @@ public class UIToggleButton extends UIButton implements GlobalNameObserver{
*
* @param listener 观察者监听事件
*/
@Override
public void registerNameListener(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 FormatBrushAction formatBrushAction;
private ActionListener keyListener = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
if (!formatBrush.isSelected()) {
DesignerContext.setFormatState(DesignerContext.FORMAT_STATE_ONCE);
@ -188,6 +189,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
}
};
private ActionListener escKey = new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
cancelFormatBrush();
}
@ -212,6 +214,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/**
* 取消格式化
*/
@Override
public void cancelFormat() {
return;
}
@ -240,7 +243,6 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
verScrollBar = new DynamicScrollBar(Adjustable.VERTICAL, this, this.resolution);
horScrollBar = new DynamicScrollBar(Adjustable.HORIZONTAL, this, this.resolution);
this.add(RGridLayout.VerticalBar, this.verScrollBar);
// this.add(RGridLayout.HorizontalBar, this.horScrollBar);
// Init input/action map defaultly.
initInputActionMap();
@ -253,7 +255,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
initFormatBrush();
}
@Override
public int getMenuState() {
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.removeActionListener(formatBrushAction);
formatBrush.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
//如果没有格式刷,点击时就是想使用格式刷
if (e.getClickCount() == 1) {
@ -528,8 +531,8 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
FineLoggerFactory.getLogger().info("Nothing to release");
}
this.selection = selection;
fireSelectionChanged();
}
fireSelectionChanged();
}
@ -1210,6 +1213,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
/**
* 请求焦点
*/
@Override
public void requestFocus() {
super.requestFocus();
this.getGrid().requestFocus();
@ -1338,6 +1342,7 @@ public abstract class ElementCasePane<T extends TemplateElementCase> extends Tar
*
* @return 返回正在编辑的状态.
*/
@Override
public EditingState createEditingState() {
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.getHorizontalScrollBar().setValue(this.horizontalValue);
// ElementCasePane.this.setResolution(this.resolution);
HistoryTemplateListPane.getInstance().getCurrentEditingTemplate().setScale(this.resolution);
// 重绘.
ElementCasePane.this.repaint();

Loading…
Cancel
Save