changed status text formatting

This commit is contained in:
bancika
2011-01-20 21:24:07 +00:00
parent a315bc06fa
commit 0c92d76d99
@@ -31,7 +31,6 @@ import org.diylc.common.EventType;
import org.diylc.common.IPlugIn; import org.diylc.common.IPlugIn;
import org.diylc.common.IPlugInPort; import org.diylc.common.IPlugInPort;
import org.diylc.core.IDIYComponent; import org.diylc.core.IDIYComponent;
import org.diylc.presenter.ComparatorFactory;
import org.diylc.presenter.Presenter; import org.diylc.presenter.Presenter;
import com.diyfever.gui.MemoryBar; import com.diyfever.gui.MemoryBar;
@@ -58,7 +57,7 @@ public class StatusBar extends JPanel implements IPlugIn {
// State variables // State variables
private ComponentType componentSlot; private ComponentType componentSlot;
private Point controlPointSlot; private Point controlPointSlot;
private List<IDIYComponent<?>> componentsUnderCursor; private List<String> componentNamesUnderCursor;
private List<String> selectedComponentNames; private List<String> selectedComponentNames;
private List<String> stuckComponentNames; private List<String> stuckComponentNames;
@@ -233,10 +232,12 @@ public class StatusBar extends JPanel implements IPlugIn {
refreshStatusText(); refreshStatusText();
break; break;
case AVAILABLE_CTRL_POINTS_CHANGED: case AVAILABLE_CTRL_POINTS_CHANGED:
componentsUnderCursor = new ArrayList<IDIYComponent<?>>( componentNamesUnderCursor = new ArrayList<String>();
((Map<IDIYComponent<?>, Integer>) params[0]).keySet()); for (IDIYComponent<?> component : ((Map<IDIYComponent<?>, Integer>) params[0]).keySet()) {
Collections.sort(componentsUnderCursor, ComparatorFactory.getInstance() componentNamesUnderCursor.add("<font color='blue'>" + component.getName()
.getComponentNameComparator()); + "</font>");
}
Collections.sort(componentNamesUnderCursor);
refreshStatusText(); refreshStatusText();
break; break;
} }
@@ -245,9 +246,9 @@ public class StatusBar extends JPanel implements IPlugIn {
private void refreshStatusText() { private void refreshStatusText() {
String statusText = ""; String statusText = "";
if (componentSlot == null) { if (componentSlot == null) {
if (componentsUnderCursor != null && !componentsUnderCursor.isEmpty()) { if (componentNamesUnderCursor != null && !componentNamesUnderCursor.isEmpty()) {
String formattedNames = Utils.toCommaString(componentsUnderCursor); String formattedNames = Utils.toCommaString(componentNamesUnderCursor);
statusText = "Drag control point(s) of " + formattedNames; statusText = "<html>Drag control point(s) of " + formattedNames + "</html>";
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) { } else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(Utils.toCommaString(selectedComponentNames)); builder.append(Utils.toCommaString(selectedComponentNames));