/** * 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 = LocalWorker.UNTYPED; 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 sliceList = new Element(SLICELIST, XScufl.XScuflNS); sliceList.setAttribute(DEPTH, Integer.toString(getDepth()), XScufl.XScuflNS); extensions.addContent(sliceList); return extensions; }
new SpinnerNumberModel(slicer.getDepth(), 1, 100, 1); final JSpinner spinner = new JSpinner(range); panel.add(spinner, c);
public void testDefaultDepth() { assertEquals("Default value should be 1", 1, getLocalWorker().getDepth()); }
public void testSettingDepth() { SliceList l = getLocalWorker(); l.setDepth(3); assertEquals(3, l.getDepth()); l.setDepth(1337); assertEquals(1337, l.getDepth()); // Below 1 should not work, should limit to 1 l.setDepth(0); assertEquals(1, l.getDepth()); l.setDepth(-1); assertEquals(1, l.getDepth()); l.setDepth(-20); assertEquals(1, l.getDepth()); l.setDepth(3); l.setDepth(2); assertEquals(2, l.getDepth()); }
public void testXMLImport() { SliceList slicer = getLocalWorker(); slicer.setDepth(1337); Element e = slicer.provideXML(); SliceList slicer2 = getLocalWorker(); slicer2.consumeXML(e); assertEquals("Did not consume XML correctly", 1337, slicer2.getDepth()); }