/** Method called when the "Sea of gates" technology has changed. */ private void sogTechChanged() { String techName = (String) sogRouteTechnology.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech == null) return; sogArcList = new JPanel(); sogRouteArcOptions.setViewportView(sogArcList); sogArcList.setLayout(new GridBagLayout()); int i = 0; for (Iterator<ArcProto> it = tech.getArcs(); it.hasNext(); ) { ArcProto ap = it.next(); if (!ap.getFunction().isMetal()) continue; JLabel arcName = new JLabel(ap.getName()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = i; gbc.anchor = GridBagConstraints.WEST; gbc.weightx = 1; gbc.insets = new Insets(0, 2, 0, 2); sogArcList.add(arcName, gbc); JCheckBox favorArc = sogFavorChecks.get(ap); if (favorArc == null) { favorArc = new JCheckBox("Favor"); sogFavorChecks.put(ap, favorArc); if (Routing.isSeaOfGatesFavor(ap)) favorArc.setSelected(true); } gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = i; sogArcList.add(favorArc, gbc); JCheckBox prohibitArc = sogProhibitChecks.get(ap); if (prohibitArc == null) { prohibitArc = new JCheckBox("Prohibit"); sogProhibitChecks.put(ap, prohibitArc); if (Routing.isSeaOfGatesPrevent(ap)) prohibitArc.setSelected(true); } gbc = new GridBagConstraints(); gbc.gridx = 2; gbc.gridy = i; sogArcList.add(prohibitArc, gbc); i++; } }
/** * Method called at the start of the dialog. Caches current values and displays them in the * Routing tab. */ public void init() { // initilze for the stitcher that is running boolean initRoutMimicOn = Routing.isMimicStitchOn(); boolean initRoutAutoOn = Routing.isAutoStitchOn(); if (!initRoutMimicOn && !initRoutAutoOn) routNoStitcher.setSelected(true); else { if (initRoutMimicOn) routMimicStitcher.setSelected(true); else routAutoStitcher.setSelected(true); } // initialize the "default arc" setting for (Iterator<Technology> tIt = Technology.getTechnologies(); tIt.hasNext(); ) { Technology tech = tIt.next(); routTechnology.addItem(tech.getTechName()); sogRouteTechnology.addItem(tech.getTechName()); } routTechnology.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { techChanged(); } }); // the sea-of-gates section sogFavorChecks = new HashMap<ArcProto, JCheckBox>(); sogProhibitChecks = new HashMap<ArcProto, JCheckBox>(); sogArcList = new JPanel(); sogRouteArcOptions.setViewportView(sogArcList); sogRouteTechnology.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { sogTechChanged(); } }); sogRouteTechnology.setSelectedItem(Technology.getCurrent().getTechName()); sogMaxArcWidth.setText(TextUtils.formatDistance(Routing.getSeaOfGatesMaxWidth())); sogComplexityLimit.setText(Integer.toString(Routing.getSeaOfGatesComplexityLimit())); sogParallel.setSelected(Routing.isSeaOfGatesUseParallelRoutes()); sogParallel.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { sogParallelChanged(); } }); sogParallelDij.setSelected(Routing.isSeaOfGatesUseParallelFromToRoutes()); sogParallelDij.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { sogParallelChanged(); } }); routTechnology.setSelectedItem(Technology.getCurrent().getTechName()); routOverrideArc.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent evt) { overrideChanged(); } }); String prefArcName = Routing.getPreferredRoutingArc(); initRoutDefArc = null; if (prefArcName.length() > 0) { initRoutDefArc = ArcProto.findArcProto(prefArcName); routOverrideArc.setSelected(true); } else { routOverrideArc.setSelected(false); } overrideChanged(); if (initRoutDefArc != null) { routTechnology.setSelectedItem(initRoutDefArc.getTechnology().getTechName()); routDefaultArc.setSelectedItem(initRoutDefArc.getName()); } // auot routing section routAutoCreateExports.setSelected(Routing.isAutoStitchCreateExports()); // mimic routing section routMimicPortsMustMatch.setSelected(Routing.isMimicStitchMatchPorts()); routMimicPortsWidthMustMatch.setSelected(Routing.isMimicStitchMatchPortWidth()); routMimicNumArcsMustMatch.setSelected(Routing.isMimicStitchMatchNumArcs()); routMimicNodeSizesMustMatch.setSelected(Routing.isMimicStitchMatchNodeSize()); routMimicNodeTypesMustMatch.setSelected(Routing.isMimicStitchMatchNodeType()); routMimicNoOtherArcs.setSelected(Routing.isMimicStitchNoOtherArcsSameDir()); routMimicOnlyNewTopology.setSelected(Routing.isMimicStitchOnlyNewTopology()); routMimicInteractive.setSelected(Routing.isMimicStitchInteractive()); routMimicKeepPins.setSelected(Routing.isMimicStitchPinsKept()); }
/** Method called when the factory reset is requested. */ public void reset() { if (Routing.isFactoryMimicStitchOn() != Routing.isMimicStitchOn()) Routing.setMimicStitchOn(Routing.isFactoryMimicStitchOn()); if (Routing.isFactoryAutoStitchOn() != Routing.isAutoStitchOn()) Routing.setAutoStitchOn(Routing.isFactoryAutoStitchOn()); if (!Routing.getFactoryPreferredRoutingArc().equals(Routing.getPreferredRoutingArc())) Routing.setPreferredRoutingArc(Routing.getFactoryPreferredRoutingArc()); for (Iterator<Technology> it = Technology.getTechnologies(); it.hasNext(); ) { Technology tech = it.next(); for (Iterator<ArcProto> aIt = tech.getArcs(); aIt.hasNext(); ) { ArcProto ap = aIt.next(); if (Routing.isFactorySeaOfGatesFavor(ap) != Routing.isSeaOfGatesFavor(ap)) Routing.setSeaOfGatesFavor(ap, Routing.isFactorySeaOfGatesFavor(ap)); if (Routing.isFactorySeaOfGatesPrevent(ap) != Routing.isSeaOfGatesPrevent(ap)) Routing.setSeaOfGatesPrevent(ap, Routing.isFactorySeaOfGatesPrevent(ap)); } } if (Routing.getFactorySeaOfGatesMaxWidth() != Routing.getSeaOfGatesMaxWidth()) Routing.setSeaOfGatesMaxWidth(Routing.getFactorySeaOfGatesMaxWidth()); if (Routing.getFactorySeaOfGatesComplexityLimit() != Routing.getSeaOfGatesComplexityLimit()) Routing.setSeaOfGatesComplexityLimit(Routing.getFactorySeaOfGatesComplexityLimit()); if (Routing.isFactorySeaOfGatesUseParallelRoutes() != Routing.isSeaOfGatesUseParallelRoutes()) Routing.setSeaOfGatesUseParallelRoutes(Routing.isFactorySeaOfGatesUseParallelRoutes()); if (Routing.isFactorySeaOfGatesUseParallelFromToRoutes() != Routing.isSeaOfGatesUseParallelFromToRoutes()) Routing.setSeaOfGatesUseParallelFromToRoutes( Routing.isFactorySeaOfGatesUseParallelFromToRoutes()); if (Routing.isFactoryMimicStitchInteractive() != Routing.isMimicStitchInteractive()) Routing.setMimicStitchInteractive(Routing.isFactoryMimicStitchInteractive()); if (Routing.isFactoryMimicStitchPinsKept() != Routing.isMimicStitchPinsKept()) Routing.setMimicStitchPinsKept(Routing.isFactoryMimicStitchPinsKept()); if (Routing.isFactoryMimicStitchMatchPorts() != Routing.isMimicStitchMatchPorts()) Routing.setMimicStitchMatchPorts(Routing.isFactoryMimicStitchMatchPorts()); if (Routing.isFactoryMimicStitchMatchPortWidth() != Routing.isMimicStitchMatchPortWidth()) Routing.setMimicStitchMatchPortWidth(Routing.isFactoryMimicStitchMatchPortWidth()); if (Routing.isFactoryMimicStitchMatchNumArcs() != Routing.isMimicStitchMatchNumArcs()) Routing.setMimicStitchMatchNumArcs(Routing.isFactoryMimicStitchMatchNumArcs()); if (Routing.isFactoryMimicStitchMatchNodeSize() != Routing.isMimicStitchMatchNodeSize()) Routing.setMimicStitchMatchNodeSize(Routing.isFactoryMimicStitchMatchNodeSize()); if (Routing.isFactoryMimicStitchMatchNodeType() != Routing.isMimicStitchMatchNodeType()) Routing.setMimicStitchMatchNodeType(Routing.isFactoryMimicStitchMatchNodeType()); if (Routing.isFactoryMimicStitchNoOtherArcsSameDir() != Routing.isMimicStitchNoOtherArcsSameDir()) Routing.setMimicStitchNoOtherArcsSameDir(Routing.isFactoryMimicStitchNoOtherArcsSameDir()); if (Routing.isFactoryMimicStitchOnlyNewTopology() != Routing.isMimicStitchOnlyNewTopology()) Routing.setMimicStitchOnlyNewTopology(Routing.isFactoryMimicStitchOnlyNewTopology()); if (Routing.isFactoryAutoStitchCreateExports() != Routing.isAutoStitchCreateExports()) Routing.setAutoStitchCreateExports(Routing.isFactoryAutoStitchCreateExports()); }
/** Method called when the "OK" panel is hit. Updates any changed fields in the Routing tab. */ public void term() { boolean curMimic = routMimicStitcher.isSelected(); if (curMimic != Routing.isMimicStitchOn()) { Routing.setMimicStitchOn(curMimic); MenuCommands.menuBar().updateAllButtons(); } boolean curAuto = routAutoStitcher.isSelected(); if (curAuto != Routing.isAutoStitchOn()) { Routing.setAutoStitchOn(curAuto); MenuCommands.menuBar().updateAllButtons(); } // pick up sea-of-gates preferences for (Iterator<ArcProto> it = sogFavorChecks.keySet().iterator(); it.hasNext(); ) { ArcProto ap = it.next(); JCheckBox check = sogFavorChecks.get(ap); if (check.isSelected() != Routing.isSeaOfGatesFavor(ap)) Routing.setSeaOfGatesFavor(ap, check.isSelected()); } for (Iterator<ArcProto> it = sogProhibitChecks.keySet().iterator(); it.hasNext(); ) { ArcProto ap = it.next(); JCheckBox check = sogProhibitChecks.get(ap); if (check.isSelected() != Routing.isSeaOfGatesPrevent(ap)) Routing.setSeaOfGatesPrevent(ap, check.isSelected()); } double curSOGMaxWid = TextUtils.atofDistance(sogMaxArcWidth.getText()); if (curSOGMaxWid != Routing.getSeaOfGatesMaxWidth()) Routing.setSeaOfGatesMaxWidth(curSOGMaxWid); int curSOGComplexity = TextUtils.atoi(sogComplexityLimit.getText()); if (curSOGComplexity != Routing.getSeaOfGatesComplexityLimit()) Routing.setSeaOfGatesComplexityLimit(curSOGComplexity); boolean curSOGParallel = sogParallel.isSelected(); if (curSOGParallel != Routing.isSeaOfGatesUseParallelRoutes()) Routing.setSeaOfGatesUseParallelRoutes(curSOGParallel); curSOGParallel = sogParallelDij.isSelected(); if (curSOGParallel != Routing.isSeaOfGatesUseParallelFromToRoutes()) Routing.setSeaOfGatesUseParallelFromToRoutes(curSOGParallel); ArcProto ap = null; if (routOverrideArc.isSelected()) { String techName = (String) routTechnology.getSelectedItem(); Technology tech = Technology.findTechnology(techName); if (tech != null) { String curArcName = (String) routDefaultArc.getSelectedItem(); ap = tech.findArcProto(curArcName); } } if (ap != initRoutDefArc) { String newArcName = ""; if (ap != null) newArcName = ap.getTechnology().getTechName() + ":" + ap.getName(); Routing.setPreferredRoutingArc(newArcName); } boolean cur = routMimicPortsMustMatch.isSelected(); if (cur != Routing.isMimicStitchMatchPorts()) Routing.setMimicStitchMatchPorts(cur); cur = routMimicPortsWidthMustMatch.isSelected(); if (cur != Routing.isMimicStitchMatchPortWidth()) Routing.setMimicStitchMatchPortWidth(cur); cur = routMimicNumArcsMustMatch.isSelected(); if (cur != Routing.isMimicStitchMatchNumArcs()) Routing.setMimicStitchMatchNumArcs(cur); cur = routMimicNodeSizesMustMatch.isSelected(); if (cur != Routing.isMimicStitchMatchNodeSize()) Routing.setMimicStitchMatchNodeSize(cur); cur = routMimicNodeTypesMustMatch.isSelected(); if (cur != Routing.isMimicStitchMatchNodeType()) Routing.setMimicStitchMatchNodeType(cur); cur = routMimicNoOtherArcs.isSelected(); if (cur != Routing.isMimicStitchNoOtherArcsSameDir()) Routing.setMimicStitchNoOtherArcsSameDir(cur); cur = routMimicOnlyNewTopology.isSelected(); if (cur != Routing.isMimicStitchOnlyNewTopology()) Routing.setMimicStitchOnlyNewTopology(cur); cur = routMimicInteractive.isSelected(); if (cur != Routing.isMimicStitchInteractive()) Routing.setMimicStitchInteractive(cur); cur = routMimicKeepPins.isSelected(); if (cur != Routing.isMimicStitchPinsKept()) Routing.setMimicStitchPinsKept(cur); cur = routAutoCreateExports.isSelected(); if (cur != Routing.isAutoStitchCreateExports()) Routing.setAutoStitchCreateExports(cur); }