consolidate case for property labels

This commit is contained in:
Branislav Stojkovic
2019-01-12 10:46:50 +01:00
parent facf816458
commit 5ce3d6d4b3
8 changed files with 44 additions and 8 deletions
@@ -70,7 +70,7 @@ public abstract class AbstractSchematicLeadedSymbol<T> extends AbstractLeadedCom
} }
} }
@EditableProperty(name = "Label position") @EditableProperty(name = "Label Position")
public LabelPosition getLabelPosition() { public LabelPosition getLabelPosition() {
return labelPosition; return labelPosition;
} }
Binary file not shown.
@@ -405,7 +405,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
body = null; body = null;
} }
@EditableProperty(name = "Lug size") @EditableProperty(name = "Lug Size")
public Size getLugDiameter() { public Size getLugDiameter() {
return lugDiameter; return lugDiameter;
} }
@@ -433,7 +433,7 @@ public class PotentiometerPanel extends AbstractPotentiometer {
this.borderColor = borderColor; this.borderColor = borderColor;
} }
@EditableProperty(name = "Show shaft") @EditableProperty(name = "Show Shaft")
public boolean getShowShaft() { public boolean getShowShaft() {
return showShaft; return showShaft;
} }
@@ -97,7 +97,7 @@ public class Resistor extends AbstractLeadedComponent<Resistance> {
this.power = power; this.power = power;
} }
@EditableProperty(name = "Power rating") @EditableProperty(name = "Power Rating")
public org.diylc.core.measures.Power getPowerNew() { public org.diylc.core.measures.Power getPowerNew() {
return powerNew; return powerNew;
} }
@@ -77,7 +77,7 @@ public class ResistorSymbol extends AbstractSchematicLeadedSymbol<Resistance> {
this.power = power; this.power = power;
} }
@EditableProperty(name = "Power rating") @EditableProperty(name = "Power Rating")
public org.diylc.core.measures.Power getPowerNew() { public org.diylc.core.measures.Power getPowerNew() {
// Backward compatibility // Backward compatibility
if (powerNew == null) { if (powerNew == null) {
Binary file not shown.
Binary file not shown.
@@ -65,12 +65,14 @@ class ComponentTabbedPane extends JTabbedPane {
private final IPlugInPort plugInPort; private final IPlugInPort plugInPort;
private Container recentToolbar; private Container recentToolbar;
private Container buildingBlocksToolbar;
private List<String> pendingRecentComponents = null; private List<String> pendingRecentComponents = null;
public ComponentTabbedPane(IPlugInPort plugInPort) { public ComponentTabbedPane(IPlugInPort plugInPort) {
super(); super();
this.plugInPort = plugInPort; this.plugInPort = plugInPort;
addTab("Recently Used", createRecentComponentsPanel()); addTab("Recently Used", createRecentComponentsPanel());
// addTab("Building Blocks", createBuildingBlocksPanel());
Map<String, List<ComponentType>> componentTypes = plugInPort.getComponentTypes(); Map<String, List<ComponentType>> componentTypes = plugInPort.getComponentTypes();
List<String> categories = new ArrayList<String>(componentTypes.keySet()); List<String> categories = new ArrayList<String>(componentTypes.keySet());
Collections.sort(categories); Collections.sort(categories);
@@ -154,6 +156,14 @@ class ComponentTabbedPane extends JTabbedPane {
return recentToolbar; return recentToolbar;
} }
public Container getBuildingBlocksToolbar() {
if (buildingBlocksToolbar == null) {
buildingBlocksToolbar = new Container();
buildingBlocksToolbar.setLayout(new BoxLayout(buildingBlocksToolbar, BoxLayout.X_AXIS));
}
return buildingBlocksToolbar;
}
private Component createComponentPanel(List<ComponentType> componentTypes) { private Component createComponentPanel(List<ComponentType> componentTypes) {
Container toolbar = new Container(); Container toolbar = new Container();
Collections.sort(componentTypes, ComparatorFactory.getInstance().getComponentTypeComparator()); Collections.sort(componentTypes, ComparatorFactory.getInstance().getComponentTypeComparator());
@@ -195,6 +205,32 @@ class ComponentTabbedPane extends JTabbedPane {
return panel; return panel;
} }
@SuppressWarnings("unchecked")
private Component createBuildingBlocksPanel() {
JPanel panel = new JPanel(new BorderLayout());
panel.setOpaque(false);
final Container toolbar = getBuildingBlocksToolbar();
// refreshRecentComponentsToolbar(
// toolbar,
// (List<String>) ConfigurationManager.getInstance().readObject(IPlugInPort.RECENT_COMPONENTS_KEY,
// new ArrayList<String>()));
// ConfigurationManager.getInstance().addConfigListener(IPlugInPort.RECENT_COMPONENTS_KEY, new IConfigListener() {
//
// @Override
// public void valueChanged(String key, Object value) {
// // Cache the new list, we'll refresh when there's a
// // chance
// pendingRecentComponents = (List<String>) value;
// }
// });
panel.add(toolbar, BorderLayout.CENTER);
return panel;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void refreshRecentComponentsToolbar(Container toolbar, List<String> recentComponentClassList) { private void refreshRecentComponentsToolbar(Container toolbar, List<String> recentComponentClassList) {
toolbar.removeAll(); toolbar.removeAll();