import java.awt.*; import java.applet.*; import java.io.*; import java.net.*; import java.util.*; public class NodeSetControls extends Panel { //PetaSIM tester; Choice myChoice; Panel tabs; Panel nodePanel; CardLayout nodeCards; Panel nodeCardPanels[]; Button nextButtons[]; Button prevButtons[]; GridBagLayout gbl; GridBagConstraints gbc; Panel nodeInterfacePanel; NodeSetInterfaces nodesetInt[]; int numNodes; public void add(Component c, GridBagLayout gbl, GridBagConstraints gbc, int x, int y, int w, int h) { gbc.gridx = x; gbc.gridy = y; gbc.gridwidth = w; gbc.gridheight = h; gbl.setConstraints(c,gbc); add(c); } public NodeSetControls() //(PetaSIM tester) //public void init() { //this.tester = tester; int i; String name; Panel nodeNextPrevPanel = new Panel(); nodeInterfacePanel = new Panel(); nodeCards = new CardLayout(); nodeInterfacePanel.setLayout(nodeCards); numNodes = 10; nodeCardPanels = new Panel[numNodes]; nodesetInt = new NodeSetInterfaces[numNodes]; //This loop creates the 8 panels. for(i=0; iNext Node")); setLayout(new BorderLayout()); add("North",nodeNextPrevPanel); add("Center", nodeInterfacePanel); } public Insets insets() { return new Insets(5,5,5,5); } public void paint(Graphics g) { Dimension d = size(); Insets in = insets(); Font f = new Font("TimesRoman", Font.BOLD, 14); FontMetrics fm = g.getFontMetrics(f); String s = "DISTRIBUTION"; g.setFont(f); //g.drawString(s, d.width/4+50, d.height/4-40); g.drawRect(0, 0, d.width-1, d.height-1); } public boolean action(Event evt, Object obj) { if(evt.target instanceof Button) { if(obj.equals(">Next Node")) //nodeCards.next(this); nodeCards.next(nodeInterfacePanel); else if(obj.equals("Previous Node<")) nodeCards.previous(nodeInterfacePanel); } //nodeCards.next(nodePanel); validate(); return true; } void updateNodeType(NodeSetInterfaces in) { //gbl = new GridBagLayout(); //gbc = new GridBagConstraints(); String c = in.nodeTypeChoice.getSelectedItem(); //System.out.println(c); if(c.equals("CPU")) { in.nodeGrainSizeLabel.enable(); in.nodeGrainSizeTxt.enable(); in.nodeFloatSpeedLabel.enable(); in.nodeFloatSpeedTxt.enable(); //in.nodeGrainSizeLabel.disable(); //in.nodeGrainSizeTxt.disable(); //in.nodeGrainSizeTxt.setText(""); /* in.remove(in.nodeFloatSpeedLabel); in.remove(in.nodeFloatSpeedTxt); Label nodeGrainSizeLabel = new Label("Grain Size :",Label.RIGHT); TextField nodeGrainSizeTxt = new TextField(); in.add(nodeGrainSizeLabel, in.gbl, in.gbc, 0, 4, 1, 1); in.add(nodeGrainSizeTxt, in.gbl, in.gbc, 1, 4, 1, 1); validate(); */ } else if( c.equals("Cache") || c.equals("Disk") || c.equals("Memory") ) { in.nodeGrainSizeLabel.enable(); in.nodeGrainSizeTxt.enable(); in.nodeFloatSpeedLabel.disable(); in.nodeFloatSpeedTxt.disable(); in.nodeFloatSpeedTxt.setText(""); } else { // pathway in.nodeFloatSpeedLabel.disable(); in.nodeFloatSpeedTxt.disable(); //in.nodeGrainSizeLabel.disable(); //in.nodeGrainSizeTxt.disable(); in.nodeFloatSpeedTxt.setText(""); //in.nodeGrainSizeTxt.setText(""); } } void updatePortCount(NodeSetInterfaces in) { String itm = in.portCountChoice.getSelectedItem(); int count = in.portCountChoice.countItems() - 1; for(int i=0; i