use of com.cburch.logisim.gui.generic.AttrTableModel in project logisim-evolution by reds-heig.
the class ToolboxManip method selectionChanged.
public void selectionChanged(ProjectExplorerEvent event) {
Object selected = event.getTarget();
if (selected instanceof ProjectExplorerToolNode) {
Tool tool = ((ProjectExplorerToolNode) selected).getValue();
if (selected instanceof AddTool) {
AddTool addTool = (AddTool) tool;
ComponentFactory source = addTool.getFactory();
if (source instanceof SubcircuitFactory) {
SubcircuitFactory circFact = (SubcircuitFactory) source;
Circuit circ = circFact.getSubcircuit();
if (proj.getCurrentCircuit() == circ) {
AttrTableModel m = new AttrTableCircuitModel(proj, circ);
proj.getFrame().setAttrTableModel(m);
return;
}
}
}
// This was causing the selection to lag behind double-clicks,
// commented-out
// lastSelected = proj.getTool();
proj.setTool(tool);
proj.getFrame().viewAttributes(tool);
}
}
use of com.cburch.logisim.gui.generic.AttrTableModel in project logisim-evolution by reds-heig.
the class Frame method viewAttributes.
private void viewAttributes(Tool oldTool, Tool newTool, boolean force) {
AttributeSet newAttrs;
if (newTool == null) {
newAttrs = null;
if (!force) {
return;
}
} else {
newAttrs = newTool.getAttributeSet(layoutCanvas);
}
if (newAttrs == null) {
AttrTableModel oldModel = attrTable.getAttrTableModel();
boolean same = oldModel instanceof AttrTableToolModel && ((AttrTableToolModel) oldModel).getTool() == oldTool;
if (!force && !same && !(oldModel instanceof AttrTableCircuitModel)) {
return;
}
}
if (newAttrs == null) {
Circuit circ = proj.getCurrentCircuit();
if (circ != null) {
setAttrTableModel(new AttrTableCircuitModel(proj, circ));
} else if (force) {
setAttrTableModel(null);
}
} else if (newAttrs instanceof SelectionAttributes) {
setAttrTableModel(attrTableSelectionModel);
} else {
setAttrTableModel(new AttrTableToolModel(proj, newTool));
}
}
Aggregations