/** * Initialize the GUI components and layout for this component. */ private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final) // The Loop Controller panel can be displayed standalone or inside // another panel. For standalone, we want to display the TITLE, NAME, // etc. (everything). However, if we want to display it within another // panel, we just display the Loop Count fields (not the TITLE and // NAME). // Standalone if (displayName) { setLayout(new BorderLayout(0, 5)); setBorder(makeBorder()); add(makeTitlePanel(), BorderLayout.NORTH); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(createLoopCountPanel(), BorderLayout.NORTH); add(mainPanel, BorderLayout.CENTER); } else { // Embedded setLayout(new BorderLayout()); add(createLoopCountPanel(), BorderLayout.NORTH); } }
/** * Create a new LoopControlPanel as either a standalone or an embedded * component. * * @param displayName * indicates whether or not this component should display its * name. If true, this is a standalone component. If false, this * component is intended to be used as a subpanel for another * component. */ public ForeachControlPanel(boolean displayName) { this.displayName = displayName; init(); }
@Override public TestElement createTestElement() { ForeachController lc = new ForeachController(); modifyTestElement(lc); return lc; }
@Override public void modifyTestElement(TestElement lc) { configureTestElement(lc); if (lc instanceof ForeachController) { ForeachController fec = (ForeachController) lc; fec.setInputVal(inputVal.getText()); fec.setStartIndex(startIndex.getText()); fec.setEndIndex(endIndex.getText()); fec.setReturnVal(returnVal.getText()); fec.setUseSeparator(useSeparator.isSelected()); } }