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