mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
moved utility method
This commit is contained in:
Binary file not shown.
+7
-37
@@ -36,6 +36,7 @@ import org.diylc.presenter.Presenter;
|
|||||||
import com.diyfever.gui.MemoryBar;
|
import com.diyfever.gui.MemoryBar;
|
||||||
import com.diyfever.gui.miscutils.ConfigurationManager;
|
import com.diyfever.gui.miscutils.ConfigurationManager;
|
||||||
import com.diyfever.gui.miscutils.PercentageListCellRenderer;
|
import com.diyfever.gui.miscutils.PercentageListCellRenderer;
|
||||||
|
import com.diyfever.gui.miscutils.Utils;
|
||||||
import com.diyfever.gui.update.UpdateLabel;
|
import com.diyfever.gui.update.UpdateLabel;
|
||||||
|
|
||||||
public class StatusBar extends JPanel implements IPlugIn {
|
public class StatusBar extends JPanel implements IPlugIn {
|
||||||
@@ -207,8 +208,8 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
break;
|
break;
|
||||||
case SELECTION_SIZE_CHANGED:
|
case SELECTION_SIZE_CHANGED:
|
||||||
Point2D size = (Point2D) params[0];
|
Point2D size = (Point2D) params[0];
|
||||||
boolean metric = ConfigurationManager.getInstance().readBoolean(
|
boolean metric = ConfigurationManager.getInstance().readBoolean(Presenter.METRIC_KEY,
|
||||||
Presenter.METRIC_KEY, true);
|
true);
|
||||||
if (size == null) {
|
if (size == null) {
|
||||||
getSizeLabel().setText("N/A");
|
getSizeLabel().setText("N/A");
|
||||||
} else {
|
} else {
|
||||||
@@ -234,45 +235,14 @@ public class StatusBar extends JPanel implements IPlugIn {
|
|||||||
private void refreshStatusText() {
|
private void refreshStatusText() {
|
||||||
if (componentSlot == null) {
|
if (componentSlot == null) {
|
||||||
if (componentsUnderCursor != null && !componentsUnderCursor.isEmpty()) {
|
if (componentsUnderCursor != null && !componentsUnderCursor.isEmpty()) {
|
||||||
String formattedNames = "";
|
String formattedNames = Utils.toCommaString(componentsUnderCursor);
|
||||||
int n = 1;
|
getStatusLabel().setText("Drag control points of " + formattedNames);
|
||||||
for (IDIYComponent<?> component : componentsUnderCursor) {
|
|
||||||
if (n > 1) {
|
|
||||||
formattedNames += ", ";
|
|
||||||
}
|
|
||||||
formattedNames += component.getName();//
|
|
||||||
// +
|
|
||||||
// " (<b><font color=\"blue\">"
|
|
||||||
// +
|
|
||||||
n++;
|
|
||||||
// +
|
|
||||||
// "</font></b>)";
|
|
||||||
}
|
|
||||||
getStatusLabel().setText("Drag " + formattedNames);
|
|
||||||
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
|
} else if (selectedComponentNames != null && !selectedComponentNames.isEmpty()) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (int i = 0; i < selectedComponentNames.size(); i++) {
|
builder.append(Utils.toCommaString(selectedComponentNames));
|
||||||
if (i > 0) {
|
|
||||||
if (i == selectedComponentNames.size() - 1) {
|
|
||||||
builder.append(" and ");
|
|
||||||
} else {
|
|
||||||
builder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
builder.append(selectedComponentNames.get(i));
|
|
||||||
}
|
|
||||||
if (!stuckComponentNames.isEmpty()) {
|
if (!stuckComponentNames.isEmpty()) {
|
||||||
builder.append(" (");
|
builder.append(" (");
|
||||||
for (int i = 0; i < stuckComponentNames.size(); i++) {
|
builder.append(Utils.toCommaString(stuckComponentNames));
|
||||||
if (i > 0) {
|
|
||||||
if (i == stuckComponentNames.size() - 1) {
|
|
||||||
builder.append(" and ");
|
|
||||||
} else {
|
|
||||||
builder.append(", ");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
builder.append(stuckComponentNames.get(i));
|
|
||||||
}
|
|
||||||
builder.append(" would be affected by dragging as well)");
|
builder.append(" would be affected by dragging as well)");
|
||||||
}
|
}
|
||||||
getStatusLabel().setText("Selection: " + builder.toString());
|
getStatusLabel().setText("Selection: " + builder.toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user