/** * Builds the syntactic type depending on the current depth. * <p> * For instance, a current depth of 3 would return: * * <pre> * l(l(l(''))) * </pre> * * Note that the processor ignore the 'real' mime-type (the data is just * passed on), and thus uses '' as the innermost type. * * @return */ private String getSyntacticType() { String syntacticType = "''"; for (int i = 0; i < getDepth(); i++) { syntacticType = "l(" + syntacticType + ")"; } return syntacticType; }
/** * Export depth as <extensions><flattenlist depth="X" * /></extensions> */ public Element provideXML() { Element extensions = new Element(EXTENSIONS, XScufl.XScuflNS); Element flattenList = new Element(FLATTENLIST, XScufl.XScuflNS); flattenList.setAttribute(DEPTH, Integer.toString(getDepth()), XScufl.XScuflNS); extensions.addContent(flattenList); return extensions; }
new SpinnerNumberModel(flattener.getDepth(), 2, 100, 1); final JSpinner spinner = new JSpinner(range); panel.add(spinner, c);
public void testDefaultDepth() { assertEquals("Default value should be 2", 2, getLocalWorker().getDepth()); }
public void testSettingDepth() { FlattenList l = getLocalWorker(); l.setDepth(3); assertEquals(3, l.getDepth()); l.setDepth(1337); assertEquals(1337, l.getDepth()); // Below 2 should not work, should limit to 2 l.setDepth(1); assertEquals(2, l.getDepth()); l.setDepth(0); assertEquals(2, l.getDepth()); l.setDepth(-1); assertEquals(2, l.getDepth()); l.setDepth(-20); assertEquals(2, l.getDepth()); // But setting to 2 should work l.setDepth(3); l.setDepth(2); assertEquals(2, l.getDepth()); }
public void testXMLImport() { FlattenList flattener = getLocalWorker(); flattener.setDepth(1337); Element e = flattener.provideXML(); FlattenList flattener2 = getLocalWorker(); flattener2.consumeXML(e); assertEquals("Did not consume XML correctly", 1337, flattener2.getDepth()); }