/** * Create new component properties panel. */ public ComponentProperties() { super(" Component Properties "); createTextField("Name"); addFullLineComponent("Addresses_label", new JLabel("Addresses")); addFullLineComponent("Addresses", SGUI.createReadOnlyTable()); createTextField("Type"); createTextField("Model name"); createTextField("Creator"); createTextField("Resource Identifier"); createTextField("(global / local)"); createTextField("Ownership"); createTextField("State"); createTextField("Processing state"); createCheckBox("Master"); createCheckBox("Daemon"); createCheckBox("Auto shutdown"); }
/** * Set the component description. */ public void setDescription(IComponentDescription desc) { this.desc = desc; if(propcomp!=null) { propcomp.setDescription(desc); propcomp.repaint(); } }
/** * Set the description. */ public void setDescription(IComponentDescription desc) { getTextField("Name").setText(desc.getName().getName()); getTextField("Type").setText(desc.getType()); getTextField("Model name").setText(desc.getModelName()); getTextField("Creator").setText(desc.getCreator()!=null? desc.getCreator().getName(): "n/a"); getTextField("Ownership").setText(desc.getOwnership()); getTextField("State").setText(desc.getState()); String gid = desc.getResourceIdentifier().getGlobalIdentifier()!=null? desc.getResourceIdentifier().getGlobalIdentifier().getResourceId(): "n/a"; ILocalResourceIdentifier lid = desc.getResourceIdentifier().getLocalIdentifier(); getTextField("Resource Identifier").setText(gid==null? "n/a": gid); getTextField("(global / local)").setText(lid==null? "n/a": lid.toString()); // getTextField("Processing state").setText(desc.getProcessingState()); getCheckBox("Master").setSelected(desc.getMaster()==null? false: desc.getMaster().booleanValue()); getCheckBox("Daemon").setSelected(desc.getDaemon()==null? false: desc.getDaemon().booleanValue()); getCheckBox("Auto shutdown").setSelected(desc.getAutoShutdown()==null? false: desc.getAutoShutdown().booleanValue()); JTable list = (JTable)getComponent("Addresses"); String[] addresses = desc.getName().getAddresses(); DefaultTableModel dtm = new DefaultTableModel(); dtm.addColumn("Addresses", addresses!=null?addresses:SUtil.EMPTY_STRING_ARRAY); list.setModel(dtm); } }
/** * Get or create a component displaying the node properties. * Only to be called if hasProperties() is true; */ public JComponent getPropertiesComponent() { // Refresh to update cid addresses later. refresh(false); if(propcomp==null) { propcomp = new ComponentProperties(); } propcomp.setDescription(desc); return propcomp; }