Browse Source

Merge pull request #739 in BA/design from ~ZHENG/design:dev to dev

* commit '269d6a97ec3980666b68568420361de71bbf4118':
  editlabel not append origin label
master
superman 8 years ago
parent
commit
500b23e418
  1. 44
      designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java

44
designer_chart/src/com/fr/design/mainframe/chart/gui/UIEditLabel.java

@ -161,35 +161,47 @@ public class UIEditLabel extends JPanel implements UIObserver{
return text; return text;
} }
protected boolean appendOriginalLabel() {
return true;
}
private void stopEditing(){ private void stopEditing(){
isEditingStopped = true; isEditingStopped = true;
this.removeAll(); this.removeAll();
String text =this.showLabel.getText(); if(appendOriginalLabel()) {
text = StringUtils.cutStringEndWith(text,":"); String text = this.showLabel.getText();
text = !ComparatorUtils.equals(text, this.originalLabel) ? text = StringUtils.cutStringEndWith(text, ":");
StringUtils.perfectEnd(text, "(" + this.originalLabel + ")"): this.originalLabel; text = !ComparatorUtils.equals(text, this.originalLabel) ?
showLabel.setText(StringUtils.perfectEnd(text,":")); StringUtils.perfectEnd(text, "(" + this.originalLabel + ")") : this.originalLabel;
showLabel.setText(StringUtils.perfectEnd(text, ":"));
}
this.add(showLabel, BorderLayout.CENTER); this.add(showLabel, BorderLayout.CENTER);
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();
} }
public String getText(){ public String getText(){
String text =this.showLabel.getText(); if(appendOriginalLabel()) {
text = StringUtils.cutStringEndWith(text,":"); String text = this.showLabel.getText();
return StringUtils.cutStringEndWith(text,"("+this.originalLabel+")"); text = StringUtils.cutStringEndWith(text, ":");
return StringUtils.cutStringEndWith(text, "(" + this.originalLabel + ")");
} else {
return this.showLabel.getText();
}
} }
public void setText(String text){ public void setText(String text){
if(text == null || StringUtils.isEmpty(text)){ if(appendOriginalLabel()) {
this.showLabel.setText(this.originalLabel); if (text == null || StringUtils.isEmpty(text)) {
return; this.showLabel.setText(this.originalLabel);
} return;
if(!ComparatorUtils.equals(text,originalLabel)){ }
text = StringUtils.cutStringEndWith(text, ":"); if (!ComparatorUtils.equals(text, originalLabel)) {
text = StringUtils.perfectEnd(text,"("+originalLabel+")"); text = StringUtils.cutStringEndWith(text, ":");
text = StringUtils.perfectEnd(text, "(" + originalLabel + ")");
}
text = StringUtils.perfectEnd(text, ":");
} }
text = StringUtils.perfectEnd(text,":");
this.showLabel.setText(text); this.showLabel.setText(text);
} }

Loading…
Cancel
Save