+ String countStr = "";
+ if (count > -1) {
+ countStr = "[" + count + "]";
+ }
+
+ if (width > 0) {
+ int padding = width - prefix.length() - title.length()
+ - countStr.length();
+ if (padding > 0) {
+ if (title.length() > 0)
+ title = StringUtils.padString(title, title.length()
+ + padding);
+ else
+ prefix = StringUtils.padString(prefix, prefix.length()
+ + padding);
+ }
+ }
+
+ String titleCache = prefix + title + count;
+ if (!titleCache.equals(this.titleCache)) {
+ super.setTitle(prefix);
+
+ Label lblPrefix = new Label(prefix);
+ UiColors.Element.TITLE_MAIN.themeLabel(lblPrefix);
+
+ Label lblTitle = null;
+ if (title.length() > 0) {
+ lblTitle = new Label(title);
+ UiColors.Element.TITLE_VARIABLE.themeLabel(lblTitle);
+ }
+
+ Label lblCount = null;
+ if (countStr != null) {
+ lblCount = new Label(countStr);
+ UiColors.Element.TITLE_COUNT.themeLabel(lblCount);
+ }
+
+ titlePanel.removeAllComponents();
+
+ titlePanel.addComponent(lblPrefix, BorderLayout.Location.LEFT);
+ if (lblTitle != null)
+ titlePanel.addComponent(lblTitle, BorderLayout.Location.CENTER);
+ if (lblCount != null)
+ titlePanel.addComponent(lblCount, BorderLayout.Location.RIGHT);