public void testNodeListenersDetachedAtFinalizeIssue58065() throws Exception { CookieNode node = new CookieNode(); SimpleCookieAction2 sca = new SimpleCookieAction2(); Action action = sca.createContextAwareInstance(node.getLookup()); class NodeListenerMemoryFilter implements MemoryFilter { public int numofnodelisteners = 0; public boolean reject(Object obj) { numofnodelisteners += (obj instanceof NodeListener)?1:0; return !((obj instanceof EventListenerList) | (obj instanceof Object[])); } } NodeListenerMemoryFilter filter = new NodeListenerMemoryFilter(); assertSize("",Arrays.asList( new Object[] {node} ),1000000,filter); assertTrue("Node is expected to have a NodeListener attached", filter.numofnodelisteners > 0); Reference actionref = new WeakReference(sca); sca = null; action = null; assertGC("CookieAction is supposed to be GCed", actionref); NodeListenerMemoryFilter filter2 = new NodeListenerMemoryFilter(); assertSize("",Arrays.asList( new Object[] {node} ),1000000,filter2); assertEquals("Node is expected to have no NodeListener attached", 0, filter2.numofnodelisteners); }
/** * Creates a new {@link MetaDataStatisticsModel} instance. * * @param exampleSet * the {@link ExampleSet} for which the meta data statistics should be created. No * reference to it is stored to prevent memory leaks. */ public MetaDataStatisticsModel(final ExampleSet exampleSet) { this.weakExampleSet = new WeakReference<>(exampleSet); this.eventListener = new EventListenerList(); visibleCount = -1; currentPageIndex = 0; mapOfStatModelVisibility = new HashMap<>(); mapOfSortingSettings = new HashMap<>(); mapOfValueTypeVisibility = new HashMap<>(); for (String valueTypeString : Ontology.VALUE_TYPE_NAMES) { int valueType = Ontology.ATTRIBUTE_VALUE_TYPE.mapName(valueTypeString); mapOfValueTypeVisibility.put(valueType, Boolean.TRUE); } allowSortingAndFiltering = false; orderedModelList = new ArrayList<>(); // has to be ArrayList because we access the index // from 1-n on filtering showSpecialAttributes = true; showRegularAttributes = true; showOnlyMissingsAttributes = false; filterNameString = ""; }
@Override public HttpConnector clone() throws CloneNotSupportedException { HttpConnector clonedObject = (HttpConnector) super.clone(); clonedObject.httpStateListeners = new EventListenerList(); clonedObject.sUrl = ""; clonedObject.handleCookie = true; clonedObject.httpParameters = new XMLVector<XMLVector<String>>(); clonedObject.postQuery = ""; clonedObject.certificateManager = new CertificateManager(); clonedObject.hostConfiguration = new HostConfiguration(); clonedObject.givenAuthPassword = null; clonedObject.givenAuthUser = null; return clonedObject; }
public TargetChooser(SchemaModel m, String tb) { this.model = m; this.targetBase = tb; if( targetBase == null || targetBase.length() == 0 || targetBase.equals("/") ) //$NON-NLS-1$ { targetBase = null; } if( targetBase != null ) { SchemaNode newRoot = model.getNode(targetBase); model = new SchemaModel(newRoot); } listeners = new EventListenerList(); }
/** * Constructor. * * @param dict The dictionary to use. */ public SpellingParser(SpellDictionary dict) { result = new DefaultParseResult(this); sc = new SpellChecker(dict); sc.addSpellCheckListener(this); setSquiggleUnderlineColor(Color.BLUE); setHyperlinkListener(this); setMaxErrorCount(DEFAULT_MAX_ERROR_COUNT); setAllowAdd(true); setAllowIgnore(true); setSpellCheckableTokenIdentifier( new DefaultSpellCheckableTokenIdentifier()); // Since the spelling callback can possibly be called many times // per parsing, we're extremely cheap here and pre-split our message // format instead of using MessageFormat. //String temp = msg.getString("IncorrectSpelling"); //int offs = temp.indexOf("{0}"); //noticePrefix = temp.substring(0, offs); //noticeSuffix = temp.substring(offs+3); listenerList = new EventListenerList(); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.paint = SerialUtilities.readPaint(stream); this.basePaint = SerialUtilities.readPaint(stream); this.outlinePaint = SerialUtilities.readPaint(stream); this.baseOutlinePaint = SerialUtilities.readPaint(stream); this.stroke = SerialUtilities.readStroke(stream); this.baseStroke = SerialUtilities.readStroke(stream); this.outlineStroke = SerialUtilities.readStroke(stream); this.baseOutlineStroke = SerialUtilities.readStroke(stream); this.shape = SerialUtilities.readShape(stream); this.baseShape = SerialUtilities.readShape(stream); this.itemLabelPaint = SerialUtilities.readPaint(stream); this.baseItemLabelPaint = SerialUtilities.readPaint(stream); // listeners are not restored automatically, but storage must be provided... this.listenerList = new EventListenerList(); }
/** * Creates a new plot. */ protected Plot() { this.parent = null; // make sure, that no one modifies the global default insets. this.insets = new Insets (DEFAULT_INSETS.top, DEFAULT_INSETS.left, DEFAULT_INSETS.bottom, DEFAULT_INSETS.right); this.backgroundPaint = DEFAULT_BACKGROUND_PAINT; this.backgroundAlpha = DEFAULT_BACKGROUND_ALPHA; this.backgroundImage = null; this.outlineStroke = DEFAULT_OUTLINE_STROKE; this.outlinePaint = DEFAULT_OUTLINE_PAINT; this.foregroundAlpha = DEFAULT_FOREGROUND_ALPHA; this.noDataMessage = null; this.noDataMessageFont = new Font("SansSerif", Font.PLAIN, 12); this.noDataMessagePaint = Color.black; this.drawingSupplier = new DefaultDrawingSupplier(); this.listenerList = new EventListenerList(); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.paint = SerialUtilities.readPaint(stream); this.basePaint = SerialUtilities.readPaint(stream); this.fillPaint = SerialUtilities.readPaint(stream); this.baseFillPaint = SerialUtilities.readPaint(stream); this.outlinePaint = SerialUtilities.readPaint(stream); this.baseOutlinePaint = SerialUtilities.readPaint(stream); this.stroke = SerialUtilities.readStroke(stream); this.baseStroke = SerialUtilities.readStroke(stream); this.outlineStroke = SerialUtilities.readStroke(stream); this.baseOutlineStroke = SerialUtilities.readStroke(stream); this.shape = SerialUtilities.readShape(stream); this.baseShape = SerialUtilities.readShape(stream); this.itemLabelPaint = SerialUtilities.readPaint(stream); this.baseItemLabelPaint = SerialUtilities.readPaint(stream); // listeners are not restored automatically, but storage must be // provided... this.listenerList = new EventListenerList(); }
/** * Creates a new plot. */ protected Plot() { this.parent = null; this.insets = DEFAULT_INSETS; this.backgroundPaint = DEFAULT_BACKGROUND_PAINT; this.backgroundAlpha = DEFAULT_BACKGROUND_ALPHA; this.backgroundImage = null; this.outlineStroke = DEFAULT_OUTLINE_STROKE; this.outlinePaint = DEFAULT_OUTLINE_PAINT; this.foregroundAlpha = DEFAULT_FOREGROUND_ALPHA; this.noDataMessage = null; this.noDataMessageFont = new Font("SansSerif", Font.PLAIN, 12); this.noDataMessagePaint = Color.black; this.drawingSupplier = new DefaultDrawingSupplier(); this.listenerList = new EventListenerList(); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.borderStroke = SerialUtilities.readStroke(stream); this.borderPaint = SerialUtilities.readPaint(stream); this.backgroundPaint = SerialUtilities.readPaint(stream); this.progressListeners = new EventListenerList(); this.changeListeners = new EventListenerList(); this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); // register as a listener with sub-components... if (this.title != null) { this.title.addChangeListener(this); } for (int i = 0; i < getSubtitleCount(); i++) { getSubtitle(i).addChangeListener(this); } this.plot.addChangeListener(this); }
private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { this.acc = AccessController.getContext(); ObjectInputStream.GetField f = in.readFields(); EventListenerList newListenerList = (EventListenerList) f.get("listenerList", null); if (newListenerList == null) { throw new InvalidObjectException("Null listenerList"); } listenerList = newListenerList; int newInitialDelay = f.get("initialDelay", 0); checkDelay(newInitialDelay, "Invalid initial delay: "); initialDelay = newInitialDelay; int newDelay = f.get("delay", 0); checkDelay(newDelay, "Invalid delay: "); delay = newDelay; repeats = f.get("repeats", false); coalesce = f.get("coalesce", false); actionCommand = (String) f.get("actionCommand", null); }
/** * Creates a new title. * * @param position the position of the title (<code>null</code> not * permitted). * @param horizontalAlignment the horizontal alignment of the title (LEFT, * CENTER or RIGHT, <code>null</code> not * permitted). * @param verticalAlignment the vertical alignment of the title (TOP, * MIDDLE or BOTTOM, <code>null</code> not * permitted). * @param padding the amount of space to leave around the outside of the * title (<code>null</code> not permitted). */ protected Title(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, RectangleInsets padding) { ParamChecks.nullNotPermitted(position, "position"); ParamChecks.nullNotPermitted(horizontalAlignment, "horizontalAlignment"); ParamChecks.nullNotPermitted(verticalAlignment, "verticalAlignment"); ParamChecks.nullNotPermitted(padding, "padding"); this.visible = true; this.position = position; this.horizontalAlignment = horizontalAlignment; this.verticalAlignment = verticalAlignment; setPadding(padding); this.listenerList = new EventListenerList(); this.notify = true; }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.zoomFillPaint = SerialUtilities.readPaint(stream); this.zoomOutlinePaint = SerialUtilities.readPaint(stream); // we create a new but empty chartMouseListeners list this.chartMouseListeners = new EventListenerList(); // register as a listener with sub-components... if (this.chart != null) { this.chart.addChangeListener(this); } }
/** * Creates a new plot. */ protected Plot() { this.parent = null; this.insets = DEFAULT_INSETS; this.backgroundPaint = DEFAULT_BACKGROUND_PAINT; this.backgroundAlpha = DEFAULT_BACKGROUND_ALPHA; this.backgroundImage = null; this.outlineVisible = true; this.outlineStroke = DEFAULT_OUTLINE_STROKE; this.outlinePaint = DEFAULT_OUTLINE_PAINT; this.foregroundAlpha = DEFAULT_FOREGROUND_ALPHA; this.noDataMessage = null; this.noDataMessageFont = new Font("SansSerif", Font.PLAIN, 12); this.noDataMessagePaint = Color.black; this.drawingSupplier = new DefaultDrawingSupplier(); this.notify = true; this.listenerList = new EventListenerList(); }
/** * Creates a new title. * * @param position the position of the title ({@code null} not * permitted). * @param horizontalAlignment the horizontal alignment of the title (LEFT, * CENTER or RIGHT, {@code null} not * permitted). * @param verticalAlignment the vertical alignment of the title (TOP, * MIDDLE or BOTTOM, {@code null} not * permitted). * @param padding the amount of space to leave around the outside of the * title ({@code null} not permitted). */ protected Title(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, RectangleInsets padding) { Args.nullNotPermitted(position, "position"); Args.nullNotPermitted(horizontalAlignment, "horizontalAlignment"); Args.nullNotPermitted(verticalAlignment, "verticalAlignment"); Args.nullNotPermitted(padding, "padding"); this.visible = true; this.position = position; this.horizontalAlignment = horizontalAlignment; this.verticalAlignment = verticalAlignment; setPadding(padding); this.listenerList = new EventListenerList(); this.notify = true; }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.zoomFillPaint = SerialUtils.readPaint(stream); this.zoomOutlinePaint = SerialUtils.readPaint(stream); // we create a new but empty chartMouseListeners list this.chartMouseListeners = new EventListenerList(); // register as a listener with sub-components... if (this.chart != null) { this.chart.addChangeListener(this); } }
/** * Creates a new plot. */ protected Plot() { this.chart = null; this.parent = null; this.insets = DEFAULT_INSETS; this.backgroundPaint = DEFAULT_BACKGROUND_PAINT; this.backgroundAlpha = DEFAULT_BACKGROUND_ALPHA; this.backgroundImage = null; this.outlineVisible = true; this.outlineStroke = DEFAULT_OUTLINE_STROKE; this.outlinePaint = DEFAULT_OUTLINE_PAINT; this.foregroundAlpha = DEFAULT_FOREGROUND_ALPHA; this.noDataMessage = null; this.noDataMessageFont = new Font("SansSerif", Font.PLAIN, 12); this.noDataMessagePaint = Color.BLACK; this.drawingSupplier = new DefaultDrawingSupplier(); this.notify = true; this.listenerList = new EventListenerList(); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.borderStroke = SerialUtils.readStroke(stream); this.borderPaint = SerialUtils.readPaint(stream); this.backgroundPaint = SerialUtils.readPaint(stream); this.progressListeners = new EventListenerList(); this.changeListeners = new EventListenerList(); this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); // register as a listener with sub-components... if (this.title != null) { this.title.addChangeListener(this); } for (int i = 0; i < getSubtitleCount(); i++) { getSubtitle(i).addChangeListener(this); } this.plot.addChangeListener(this); }
/** * Create a new image-wrapper icon. * * @param inputStream The input stream to read the image from. * @param w The width of the icon. * @param h The height of the icon. */ public ImageWrapperIcon(InputStream inputStream, int w, int h) { this.imageInputStream = inputStream; this.width = w; this.height = h; this.listenerList = new EventListenerList(); this.cachedImages = new LinkedHashMap<String, BufferedImage>() { @Override protected boolean removeEldestEntry( Map.Entry<String, BufferedImage> eldest) { return size() > 5; } ; }; this.renderImage(this.width, this.height); }
/** * Create a new image-wrapper icon. * * @param image The original image. * @param w The width of the icon. * @param h The height of the icon. */ public ImageWrapperIcon(Image image, int w, int h) { this.imageInputStream = null; this.image = image; this.width = w; this.height = h; this.listenerList = new EventListenerList(); this.cachedImages = new LinkedHashMap<String, BufferedImage>() { @Override protected boolean removeEldestEntry( Map.Entry<String, BufferedImage> eldest) { return size() > 5; } ; }; this.renderImage(this.width, this.height); }
/** * Creates a slider with no user interface. * Use setKnob, setTrack and setBackground to build its user interface. * * @param component the parent Component */ public GraphicSlider( Component component ) { super( component ); // Initialize instance data. _knob = _knobHighlight = _track = _background = null; _knobHighlight = null; _dragBounds = new Rectangle(); _minimum = 0; _maximum = 100; _value = ( _maximum - _minimum ) / 2; _tickSize = new Dimension( 1, 12 ); _listenerList = new EventListenerList(); _knobListener = new KnobListener(); // Enable anti-aliasing. RenderingHints hints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); setRenderingHints( hints ); }
/** * Sole constructor. * * @param format format of the label used to display the value */ public AbstractFourierSlider( String format ) { super(); assert( format != null ); setBorder( BorderFactory.createEtchedBorder() ); _format = format; _listenerList = new EventListenerList(); // UI components _slider = new JSlider(); _slider.setValue( 0 ); _slider.addChangeListener( this ); _label = new JLabel(); // Layout EasyGridBagLayout layout = new EasyGridBagLayout( this ); layout.setInsets( FourierAbstractControlPanel.DEFAULT_INSETS ); setLayout( layout ); layout.addAnchoredComponent( _label, 0, 0, GridBagConstraints.WEST ); layout.addAnchoredComponent( _slider, 1, 0, GridBagConstraints.WEST ); updateLabel(); }
private HarmonicColors() { // Colors for harmonics _harmonicColors = new Color[] { new Color( 1f, 0f, 0f ), new Color( 1f, 0.5f, 0f ), new Color( 1f, 1f, 0f ), new Color( 0f, 1f, 0f ), new Color( 0f, 0.790002f, 0.340007f ), new Color( 0.392193f, 0.584307f, 0.929395f ), new Color( 0f, 0f, 1f ), new Color( 0f, 0f, 0.501999f ), new Color( 0.569994f, 0.129994f, 0.61999f ), new Color( 0.729408f, 0.333293f, 0.827494f ), new Color( 1f, 0.411802f, 0.705893f ) }; _listenerList = new EventListenerList(); }
/** * Constructor. * * @param component * @param harmonic * @param chart */ public AbstractHarmonicMeasurementTool( Component component, Harmonic harmonic, Chart chart ) { super( component ); _harmonic = harmonic; _chart = chart; _chart.addListener( this ); // Label setLabelColor( LABEL_COLOR ); setLabelFont( LABEL_FONT ); // Bar setBorderColor( BAR_BORDER_COLOR ); setStroke( BAR_STROKE ); // Interactivity addMouseInputListener( new MouseFocusListener() ); _listenerList = new EventListenerList(); // Interested in color changes. HarmonicColors.getInstance().addHarmonicColorChangeListener( this ); updateTool(); }
/** * Sole constructor. * * @param component the parent Component * @param onImageName the resource name of the "on" image * @param offImageName the resource name of the "off" image */ public ToggleSwitch( Component component, String onImageName, String offImageName ) { super( component, offImageName ); _onImageName = onImageName; _offImageName = offImageName; _listenerList = new EventListenerList(); // Set up interactivity. super.setCursorHand(); super.addMouseInputListener( new ToggleSwitchMouseInputListener() ); _on = true; // force an update setOn( false ); }
/** * Provides serialization support. * * @param stream the input stream. * * @throws IOException if there is an I/O error. * @throws ClassNotFoundException if there is a classpath problem. */ private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.borderStroke = SerialUtilities.readStroke(stream); this.borderPaint = SerialUtilities.readPaint(stream); this.backgroundPaint = SerialUtilities.readPaint(stream); this.progressListeners = new EventListenerList(); this.changeListeners = new EventListenerList(); this.renderingHints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); this.renderingHints.put(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); // register as a listener with sub-components... if (this.title != null) { this.title.addChangeListener(this); } for (int i = 0; i < getSubtitleCount(); i++) { getSubtitle(i).addChangeListener(this); } this.plot.addChangeListener(this); }
public SolutionRepresentation( AqueousSolution solution, Point2D location, boolean visible ) { this.solution = solution; this.location = new Point2D.Double( location.getX(), location.getY() ); this.visible = visible; this.listeners = new EventListenerList(); this.solutionChangeListener = new AqueousSolutionChangeListener() { public void concentrationChanged() { fireConcentrationChanged(); } public void strengthChanged() { fireStrengthChanged(); } }; solution.addAqueousSolutionChangeListener( solutionChangeListener ); }
/** * Creates a slider with no user interface. * Use setKnob, setTrack and setBackground to build its user interface. * * @param component the parent Component */ public GraphicSlider( IUserComponent userComponent, Component component ) { super( component ); // Initialize instance data. _userComponent = userComponent; _knob = _knobHighlight = _track = _background = null; _knobHighlight = null; _dragBounds = new Rectangle(); _minimum = 0; _maximum = 100; _value = ( _maximum - _minimum ) / 2; _tickSize = new Dimension( 1, 12 ); _listenerList = new EventListenerList(); _knobListener = new KnobListener(); // Enable anti-aliasing. RenderingHints hints = new RenderingHints( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON ); setRenderingHints( hints ); }
public IntegerSpinnerNode( IUserComponent userComponent, IntegerRange range ) { super(); addInputEventListener( new CursorHandler() ); listeners = new EventListenerList(); spinner = new IntegerSpinner( userComponent, range ); addChild( new PSwing( spinner ) ); // addChild *after* making changes to the spinner or there will be problems, see #1824 // propagate change events spinner.addChangeListener( new ChangeListener() { public void stateChanged( ChangeEvent e ) { fireStateChange(); } } ); }
/** * Sole constructor. Creates a sound player that responds to changes * in a specified Fourier series. Sound I/O is handled in a separate * thread, which is running only when sound is "on". * <p/> * // * @param fourierSeries * * @throws LineUnavailableException if there is an error configuring the audio system */ public FourierSoundPlayer() throws LineUnavailableException { _soundEnabled = false; _listenerList = new EventListenerList(); // Set up the source data line. AudioFormat audioFormat = new AudioFormat( ENCODING, SAMPLE_RATE, SAMPLE_SIZE, CHANNELS, FRAME_SIZE, FRAME_RATE, false ); _oscillator = new FourierOscillator( DEFAULT_VOLUME, audioFormat, STREAM_LENGTH ); DataLine.Info info = new DataLine.Info( SourceDataLine.class, audioFormat ); try { _sourceDataLine = (SourceDataLine) AudioSystem.getLine( info ); _sourceDataLine.open( audioFormat, DEVICE_BUFFER_SIZE ); } catch( IllegalArgumentException e ) { throw new LineUnavailableException(); } }
/** * Creates a new output node */ public OutputNode() { this.connector = new NodeConnector(this); propertyChangeSupport = new PropertyChangeSupport(this); listenerList = new EventListenerList(); img = null; }
/** * Creates a new process node * * @param process */ public ProcessNode(Class process) { this.input = new HashMap<>(); this.processType = process; this.processInput = buildProcessInput(); this.processOutput = buildProcessOutput(); this.connector = new NodeConnector(this); this.inputChangeSupport = new PropertyChangeSupport(this); this.outputChangeSupport = new PropertyChangeSupport(this); this.listenerList = new EventListenerList(); this.invalidated = true; VISNode.get().getModel().getUserPreferences().getLocaleSubject().subscribe((locale) -> { metadata = ProcessMetadata.fromClass(process, locale); }); }
/** Implements {@link Object#clone} to behave correctly if cloning is desired. * But {@link Cloneable} is <em>not</em> declared by default. * <P> * The default implementation checks whether the child list implements * <code>Cloneable</code>, and if so, it clones the children. * If the child list does not support cloning, {@link Children#LEAF} is used * instead for the children. The parent of this node is set to <code>null</code> and an empty set * of listeners is attached to the node. * * @return the cloned version of the node * @exception CloneNotSupportedException if the children cannot be cloned * in spite of implementing <code>Cloneable</code> */ @Override protected Object clone() throws CloneNotSupportedException { Node n = (Node) super.clone(); Children hier2; if (hierarchy instanceof Cloneable) { hier2 = (Children) hierarchy.cloneHierarchy(); } else { hier2 = Children.LEAF; } // attach the hierarchy n.hierarchy = hier2; hier2.attachTo(n); // no parent n.parent = null; // empty set of listeners if (listeners instanceof LookupEventList) { n.listeners = new LookupEventList(internalLookup(false)); } else { n.listeners = new EventListenerList(); } return n; }
public AbstractModel(ModelSource source) { this.source = source; pcs = new PropertyChangeSupport(this); ues = new ModelUndoableEditSupport(); componentListeners = new EventListenerList(); status = State.VALID; }
private void init() { assert (tokenHierarchy == null); tokenHierarchy = LexerApiPackageAccessor.get().createTokenHierarchy(this); // Create listener list even for non-mutable hierarchies as there may be // custom embeddings created that need to be notified listenerList = new EventListenerList(); rootChildrenLanguages = null; }
/** * Creates a new {@link ConfigurableModel} instance including all available {@link Configurable} * s. */ public ConfigurableModel() { this.eventListener = new EventListenerList(); // creates the model with all available configurables for all sources initModel(true, null); }
public ProcessRendererModel() { this.eventListener = new EventListenerList(); this.processes = Collections.unmodifiableList(Collections.<ExecutionUnit> emptyList()); this.selectedOperators = Collections.unmodifiableList(Collections.<Operator> emptyList()); this.draggedOperators = Collections.unmodifiableList(Collections.<Operator> emptyList()); this.processSizes = new WeakHashMap<>(); this.portNumbers = new WeakHashMap<>(); this.snapToGrid = Boolean.parseBoolean(ParameterService .getParameterValue(RapidMinerGUI.PROPERTY_RAPIDMINER_GUI_SNAP_TO_GRID)); this.hoveringProcessIndex = -1; // listen for snapToGrid changes ParameterService.registerParameterChangeListener(new ParameterChangeListener() { @Override public void informParameterSaved() { // ignore } @Override public void informParameterChanged(String key, String value) { if (RapidMinerGUI.PROPERTY_RAPIDMINER_GUI_SNAP_TO_GRID.equals(key)) { setSnapToGrid(Boolean.parseBoolean(value)); } } }); }
/** * Inits the * * @param exampleSet * @param attribute */ protected AbstractAttributeStatisticsModel(final ExampleSet exampleSet, final Attribute attribute) { this.attribute = attribute; this.weakExampleSet = new WeakReference<>(exampleSet); this.specialAttName = exampleSet.getAttributes().findRoleByName(attribute.getName()).getSpecialName(); this.construction = attribute.getConstruction(); this.eventListener = new EventListenerList(); }