Example usage for javax.swing.event EventListenerList EventListenerList

List of usage examples for javax.swing.event EventListenerList EventListenerList

Introduction

In this page you can find the example usage for javax.swing.event EventListenerList EventListenerList.

Prototype

EventListenerList

Source Link

Usage

From source file:com.projity.pm.task.Project.java

private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
    s.defaultReadObject();/*from  w w  w  .ja  v a  2  s .  c  om*/
    hasKey = HasKeyImpl.deserialize(s, this);
    //initUndo();
    tasks = new LinkedList();
    objectEventManager = new ObjectEventManager();
    objectSelectionEventManager = new ObjectSelectionEventManager();
    scheduleEventManager = new ScheduleEventManager();
    multipleTransactionManager = new MultipleTransactionManager();
    projectListenerList = new EventListenerList();
    taskOutlines = new OutlineCollectionImpl(Settings.numHierarchies(), this);
    barClosureInstance = new BarClosure();

}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * Provides serialization support./*www .  ja va  2s  . c  om*/
 *
 * @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();

    // 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);
    }

}

From source file:KIDLYAbstractRenderer.java

/**
 * Returns an independent copy of the renderer.
 *
 * @return A clone./*from  w  w w .  jav  a2 s  .  c  o m*/
 *
 * @throws CloneNotSupportedException if some component of the renderer
 *         does not support cloning.
 */
protected Object clone() throws CloneNotSupportedException {
    KIDLYAbstractRenderer clone = (KIDLYAbstractRenderer) super.clone();

    if (this.seriesVisibleList != null) {
        clone.seriesVisibleList = (BooleanList) this.seriesVisibleList.clone();
    }

    if (this.seriesVisibleInLegendList != null) {
        clone.seriesVisibleInLegendList = (BooleanList) this.seriesVisibleInLegendList.clone();
    }

    // 'paint' : immutable, no need to clone reference
    if (this.paintList != null) {
        clone.paintList = (PaintList) this.paintList.clone();
    }
    // 'basePaint' : immutable, no need to clone reference

    if (this.fillPaintList != null) {
        clone.fillPaintList = (PaintList) this.fillPaintList.clone();
    }
    // 'outlinePaint' : immutable, no need to clone reference
    if (this.outlinePaintList != null) {
        clone.outlinePaintList = (PaintList) this.outlinePaintList.clone();
    }
    // 'baseOutlinePaint' : immutable, no need to clone reference

    // 'stroke' : immutable, no need to clone reference
    if (this.strokeList != null) {
        clone.strokeList = (StrokeList) this.strokeList.clone();
    }
    // 'baseStroke' : immutable, no need to clone reference

    // 'outlineStroke' : immutable, no need to clone reference
    if (this.outlineStrokeList != null) {
        clone.outlineStrokeList = (StrokeList) this.outlineStrokeList.clone();
    }
    // 'baseOutlineStroke' : immutable, no need to clone reference

    if (this.shape != null) {
        clone.shape = ShapeUtilities.clone(this.shape);
    }
    if (this.shapeList != null) {
        clone.shapeList = (ShapeList) this.shapeList.clone();
    }
    if (this.baseShape != null) {
        clone.baseShape = ShapeUtilities.clone(this.baseShape);
    }

    // 'itemLabelsVisible' : immutable, no need to clone reference
    if (this.itemLabelsVisibleList != null) {
        clone.itemLabelsVisibleList = (BooleanList) this.itemLabelsVisibleList.clone();
    }
    // 'basePaint' : immutable, no need to clone reference

    // 'itemLabelFont' : immutable, no need to clone reference
    if (this.itemLabelFontList != null) {
        clone.itemLabelFontList = (ObjectList) this.itemLabelFontList.clone();
    }
    // 'baseItemLabelFont' : immutable, no need to clone reference

    // 'itemLabelPaint' : immutable, no need to clone reference
    if (this.itemLabelPaintList != null) {
        clone.itemLabelPaintList = (PaintList) this.itemLabelPaintList.clone();
    }
    // 'baseItemLabelPaint' : immutable, no need to clone reference

    // 'postiveItemLabelAnchor' : immutable, no need to clone reference
    if (this.positiveItemLabelPositionList != null) {
        clone.positiveItemLabelPositionList = (ObjectList) this.positiveItemLabelPositionList.clone();
    }
    // 'baseItemLabelAnchor' : immutable, no need to clone reference

    // 'negativeItemLabelAnchor' : immutable, no need to clone reference
    if (this.negativeItemLabelPositionList != null) {
        clone.negativeItemLabelPositionList = (ObjectList) this.negativeItemLabelPositionList.clone();
    }
    // 'baseNegativeItemLabelAnchor' : immutable, no need to clone reference

    if (this.createEntitiesList != null) {
        clone.createEntitiesList = (BooleanList) this.createEntitiesList.clone();
    }

    if (this.legendShapeList != null) {
        clone.legendShapeList = (ShapeList) this.legendShapeList.clone();
    }
    if (this.legendTextFont != null) {
        clone.legendTextFont = (ObjectList) this.legendTextFont.clone();
    }
    if (this.legendTextPaint != null) {
        clone.legendTextPaint = (PaintList) this.legendTextPaint.clone();
    }
    clone.listenerList = new EventListenerList();
    clone.event = null;
    return clone;
}

From source file:KIDLYAbstractRenderer.java

/**
 * Provides serialization support./*from w w  w.java2s  .  c o  m*/
 *
 * @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);
    this.baseLegendShape = SerialUtilities.readShape(stream);
    this.baseLegendTextPaint = SerialUtilities.readPaint(stream);

    // listeners are not restored automatically, but storage must be
    // provided...
    this.listenerList = new EventListenerList();

}

From source file:org.apache.tapestry.AbstractPage.java

private void addListener(Class listenerClass, EventListener listener) {
    if (_listenerList == null)
        _listenerList = new EventListenerList();

    _listenerList.add(listenerClass, listener);
}

From source file:org.datavyu.controllers.component.MixerController.java

private void initView() {

    // Set default scale values
    minStart = 0;//from w  ww . ja v a2s  . c  om

    listenerList = new EventListenerList();

    // Set up the root panel
    tracksPanel = new JPanel();
    tracksPanel.setLayout(new MigLayout("ins 0", "[left|left|left|left]rel push[right|right]", ""));
    tracksPanel.setBackground(Color.WHITE);

    if (Platform.isMac()) {
        osxGestureListener.register(tracksPanel);
    }

    // Menu buttons
    lockToggle = new JToggleButton("Lock all");
    lockToggle.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            lockToggleHandler(e);
        }
    });
    lockToggle.setName("lockToggleButton");

    bookmarkButton = new JButton("Add Bookmark");
    bookmarkButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            addBookmarkHandler();
        }
    });
    bookmarkButton.setEnabled(false);
    bookmarkButton.setName("bookmarkButton");

    JButton snapRegion = new JButton("Snap Region");
    snapRegion.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            snapRegionHandler(e);
        }
    });
    snapRegion.setName("snapRegionButton");

    JButton clearRegion = new JButton("Clear Region");
    clearRegion.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            clearRegionHandler(e);
        }
    });
    clearRegion.setName("clearRegionButton");

    zoomSlide = new JSlider(JSlider.HORIZONTAL, 1, 1000, 1);
    zoomSlide.addChangeListener(new ChangeListener() {
        public void stateChanged(final ChangeEvent e) {

            if (!isUpdatingZoomSlide && zoomSlide.getValueIsAdjusting()) {

                try {
                    isUpdatingZoomSlide = true;
                    zoomSetting = (double) (zoomSlide.getValue() - zoomSlide.getMinimum())
                            / (zoomSlide.getMaximum() - zoomSlide.getMinimum() + 1);
                    viewportModel.setViewportZoom(zoomSetting,
                            needleController.getNeedleModel().getCurrentTime());
                } finally {
                    isUpdatingZoomSlide = false;
                }
            }
        }
    });
    zoomSlide.setName("zoomSlider");
    zoomSlide.setBackground(tracksPanel.getBackground());

    JButton zoomRegionButton = new JButton("", zoomIcon);
    zoomRegionButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            zoomToRegion(e);
        }
    });
    zoomRegionButton.setName("zoomRegionButton");

    tracksPanel.add(lockToggle);
    tracksPanel.add(bookmarkButton);
    tracksPanel.add(snapRegion);
    tracksPanel.add(clearRegion);
    tracksPanel.add(zoomRegionButton);
    tracksPanel.add(zoomSlide, "wrap");

    timescaleController = new TimescaleController(mixerModel);
    timescaleController.addTimescaleEventListener(this);
    needleController = new NeedleController(this, mixerModel);
    regionController = new RegionController(mixerModel);
    tracksEditorController = new TracksEditorController(this, mixerModel);

    needleController.setTimescaleTransitionHeight(
            timescaleController.getTimescaleModel().getZoomWindowToTrackTransitionHeight());
    needleController
            .setZoomIndicatorHeight(timescaleController.getTimescaleModel().getZoomWindowIndicatorHeight());

    // Set up the layered pane
    layeredPane = new JLayeredPane();
    layeredPane.setLayout(new MigLayout("fillx, ins 0"));

    final int layeredPaneHeight = 272;
    final int timescaleViewHeight = timescaleController.getTimescaleModel().getHeight();

    final int needleHeadHeight = (int) Math.ceil(NeedleConstants.NEEDLE_HEAD_HEIGHT);
    final int tracksScrollPaneY = needleHeadHeight + 1;
    final int timescaleViewY = layeredPaneHeight - MixerConstants.HSCROLL_HEIGHT - timescaleViewHeight;
    final int tracksScrollPaneHeight = timescaleViewY - tracksScrollPaneY;
    final int tracksScrollBarY = timescaleViewY + timescaleViewHeight;
    final int needleAndRegionMarkerHeight = (timescaleViewY + timescaleViewHeight
            - timescaleController.getTimescaleModel().getZoomWindowIndicatorHeight()
            - timescaleController.getTimescaleModel().getZoomWindowToTrackTransitionHeight() + 1);

    // Set up filler component responsible for horizontal resizing of the
    // layout.
    {

        // Null args; let layout manager handle sizes.
        Box.Filler filler = new Filler(null, null, null);
        filler.setName("Filler");
        filler.addComponentListener(new SizeHandler());

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("wmin", Integer.toString(MixerConstants.MIXER_MIN_WIDTH));

        // TODO Could probably use this same component to handle vertical
        // resizing...
        String template = "id filler, h 0!, grow 100 0, wmin ${wmin}, cell 0 0 ";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        layeredPane.setLayer(filler, MixerConstants.FILLER_ZORDER);
        layeredPane.add(filler, sub.replace(template), MixerConstants.FILLER_ZORDER);
    }

    // Set up the timescale layout
    {
        JComponent timescaleView = timescaleController.getView();

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("x", Integer.toString(TimescaleConstants.XPOS_ABS));
        constraints.put("y", Integer.toString(timescaleViewY));

        // Calculate padding from the right
        int rightPad = (int) (RegionConstants.RMARKER_WIDTH + MixerConstants.VSCROLL_WIDTH
                + MixerConstants.R_EDGE_PAD);
        constraints.put("x2", "(filler.w-" + rightPad + ")");
        constraints.put("y2", "(tscale.y+${height})");
        constraints.put("height", Integer.toString(timescaleViewHeight));

        String template = "id tscale, pos ${x} ${y} ${x2} ${y2}";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        // Must call setLayer first.
        layeredPane.setLayer(timescaleView, MixerConstants.TIMESCALE_ZORDER);
        layeredPane.add(timescaleView, sub.replace(template), MixerConstants.TIMESCALE_ZORDER);
    }

    // Set up the scroll pane's layout.
    {
        tracksScrollPane = new JScrollPane(tracksEditorController.getView());
        tracksScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
        tracksScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        tracksScrollPane.setBorder(BorderFactory.createEmptyBorder());
        tracksScrollPane.setName("jScrollPane");

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("x", "0");
        constraints.put("y", Integer.toString(tracksScrollPaneY));
        constraints.put("x2", "(filler.w-" + MixerConstants.R_EDGE_PAD + ")");
        constraints.put("height", Integer.toString(tracksScrollPaneHeight));

        String template = "pos ${x} ${y} ${x2} n, h ${height}!";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        layeredPane.setLayer(tracksScrollPane, MixerConstants.TRACKS_ZORDER);
        layeredPane.add(tracksScrollPane, sub.replace(template), MixerConstants.TRACKS_ZORDER);
    }

    // Create the region markers and set up the layout.
    {
        JComponent regionView = regionController.getView();

        Map<String, String> constraints = Maps.newHashMap();

        int x = (int) (TrackConstants.HEADER_WIDTH - RegionConstants.RMARKER_WIDTH);
        constraints.put("x", Integer.toString(x));
        constraints.put("y", "0");

        // Padding from the right
        int rightPad = MixerConstants.R_EDGE_PAD + MixerConstants.VSCROLL_WIDTH - 2;

        constraints.put("x2", "(filler.w-" + rightPad + ")");
        constraints.put("height", Integer.toString(needleAndRegionMarkerHeight));

        String template = "pos ${x} ${y} ${x2} n, h ${height}::";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        layeredPane.setLayer(regionView, MixerConstants.REGION_ZORDER);
        layeredPane.add(regionView, sub.replace(template), MixerConstants.REGION_ZORDER);
    }

    // Set up the timing needle's layout
    {
        JComponent needleView = needleController.getView();

        Map<String, String> constraints = Maps.newHashMap();

        int x = (int) (TrackConstants.HEADER_WIDTH - NeedleConstants.NEEDLE_HEAD_WIDTH
                + NeedleConstants.NEEDLE_WIDTH);
        constraints.put("x", Integer.toString(x));
        constraints.put("y", "0");

        // Padding from the right
        int rightPad = MixerConstants.R_EDGE_PAD + MixerConstants.VSCROLL_WIDTH - 1;

        constraints.put("x2", "(filler.w-" + rightPad + ")");
        constraints.put("height",
                Integer.toString(needleAndRegionMarkerHeight
                        + timescaleController.getTimescaleModel().getZoomWindowToTrackTransitionHeight()
                        + timescaleController.getTimescaleModel().getZoomWindowIndicatorHeight() - 1));

        String template = "pos ${x} ${y} ${x2} n, h ${height}::";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        layeredPane.setLayer(needleView, MixerConstants.NEEDLE_ZORDER);
        layeredPane.add(needleView, sub.replace(template), MixerConstants.NEEDLE_ZORDER);
    }

    // Set up the snap marker's layout
    {
        JComponent markerView = tracksEditorController.getMarkerView();

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("x", Integer.toString(TimescaleConstants.XPOS_ABS));
        constraints.put("y", Integer.toString(needleHeadHeight + 1));

        // Padding from the right
        int rightPad = MixerConstants.R_EDGE_PAD + MixerConstants.VSCROLL_WIDTH - 1;

        constraints.put("x2", "(filler.w-" + rightPad + ")");
        constraints.put("height", Integer.toString(needleAndRegionMarkerHeight - needleHeadHeight - 1));

        String template = "pos ${x} ${y} ${x2} n, h ${height}::";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        layeredPane.setLayer(markerView, MixerConstants.MARKER_ZORDER);
        layeredPane.add(markerView, sub.replace(template), MixerConstants.MARKER_ZORDER);
    }

    // Set up the tracks horizontal scroll bar
    {
        tracksScrollBar = new JScrollBar(Adjustable.HORIZONTAL);
        tracksScrollBar.setValues(0, TRACKS_SCROLL_BAR_RANGE, 0, TRACKS_SCROLL_BAR_RANGE);
        tracksScrollBar.setUnitIncrement(TRACKS_SCROLL_BAR_RANGE / 20);
        tracksScrollBar.setBlockIncrement(TRACKS_SCROLL_BAR_RANGE / 2);
        tracksScrollBar.addAdjustmentListener(this);
        tracksScrollBar.setValueIsAdjusting(false);
        tracksScrollBar.setVisible(false);
        tracksScrollBar.setName("horizontalScrollBar");

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("x", Integer.toString(TimescaleConstants.XPOS_ABS));
        constraints.put("y", Integer.toString(tracksScrollBarY));

        int rightPad = (int) (RegionConstants.RMARKER_WIDTH + MixerConstants.VSCROLL_WIDTH
                + MixerConstants.R_EDGE_PAD);
        constraints.put("x2", "(filler.w-" + rightPad + ")");
        constraints.put("height", Integer.toString(MixerConstants.HSCROLL_HEIGHT));

        String template = "pos ${x} ${y} ${x2} n, h ${height}::";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        layeredPane.setLayer(tracksScrollBar, MixerConstants.TRACKS_SB_ZORDER);
        layeredPane.add(tracksScrollBar, sub.replace(template), MixerConstants.TRACKS_SB_ZORDER);
    }

    {
        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("span", "6");
        constraints.put("width", Integer.toString(MixerConstants.MIXER_MIN_WIDTH));
        constraints.put("height", Integer.toString(layeredPaneHeight));

        String template = "growx, span ${span}, w ${width}::, h ${height}::, wrap";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        tracksPanel.add(layeredPane, sub.replace(template));
    }

    tracksPanel.validate();
}

From source file:org.datavyu.controllers.component.TrackController.java

/**
 * Creates a new TrackController./*w w  w  . j av a 2s.com*/
 *
 * @param trackPainter the track painter for this controller to manage.
 */
public TrackController(final MixerModel mixerModel, final TrackPainter trackPainter) {
    isMoveable = true;

    view = new JPanel();
    view.setLayout(new MigLayout("fillx, ins 0", "[]0[]"));
    view.setBorder(BorderFactory.createLineBorder(TrackConstants.BORDER_COLOR, 1));

    this.trackPainter = trackPainter;

    this.mixerModel = mixerModel;
    trackModel = new TrackModel();
    trackModel.setState(TrackState.NORMAL);
    trackModel.clearBookmarks();
    trackModel.setLocked(false);

    trackPainter.setMixerView(mixerModel);
    trackPainter.setTrackModel(trackModel);

    mixerModel.getViewportModel().addPropertyChangeListener(this);

    listenerList = new EventListenerList();

    final TrackPainterListener painterListener = new TrackPainterListener();
    trackPainter.addMouseListener(painterListener);
    trackPainter.addMouseMotionListener(painterListener);

    menu = new JPopupMenu();
    menu.setName("trackPopUpMenu");

    setBookmarkMenuItem = new JMenuItem("Set bookmark");
    setBookmarkMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            TrackController.this.setBookmarkAction();
        }
    });

    clearBookmarkMenuItem = new JMenuItem("Clear bookmarks");
    clearBookmarkMenuItem.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent e) {
            TrackController.this.clearBookmarkAction();
        }
    });
    menu.add(setBookmarkMenuItem);
    menu.add(clearBookmarkMenuItem);

    trackPainter.add(menu);

    // Create the Header panel and its components
    trackLabel = new JLabel("", SwingConstants.CENTER);
    trackLabel.setName("trackLabel");
    trackLabel.setHorizontalAlignment(SwingConstants.CENTER);
    trackLabel.setHorizontalTextPosition(SwingConstants.CENTER);
    iconLabel = new JLabel("", SwingConstants.CENTER);
    iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
    iconLabel.setHorizontalTextPosition(SwingConstants.CENTER);

    header = new JPanel(new MigLayout("ins 0, wrap 6"));
    header.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createMatteBorder(0, 0, 0, 1, TrackConstants.BORDER_COLOR),
            BorderFactory.createEmptyBorder(2, 2, 2, 2)));
    header.setBackground(Color.LIGHT_GRAY);

    // Normally I would use pushx instead of defining the width, but in this
    // case I defined the width because span combined with push makes the
    // first action icon cell push out as well. 136 was calculated from
    // 140 pixels minus 2 minus 2 (from the empty border defined above).
    header.add(trackLabel, "span 6, w 136!, center, growx");
    header.add(iconLabel, "span 6, w 136!, h 32!, center, growx");

    // Set up the button used for locking/unlocking track movement
    {
        lockUnlockButton = new JButton(TrackConstants.UNLOCK_ICON);
        lockUnlockButton.setName("lockUnlockButton");
        lockUnlockButton.setContentAreaFilled(false);
        lockUnlockButton.setBorderPainted(false);
        lockUnlockButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                handleLockUnlockButtonEvent(e);
            }
        });

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("width", Integer.toString(TrackConstants.ACTION_BUTTON_WIDTH));
        constraints.put("height", Integer.toString(TrackConstants.ACTION_BUTTON_HEIGHT));

        String template = "cell 0 2, w ${width}!, h ${height}!";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        header.add(lockUnlockButton, sub.replace(template));
    }

    // Set up the button used for hiding/showing a track's data viewer
    {
        visibleButton = new JButton(TrackConstants.VIEWER_HIDE_ICON);
        visibleButton.setName("visibleButton");
        visibleButton.setContentAreaFilled(false);
        visibleButton.setBorderPainted(false);
        visibleButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                handleVisibleButtonEvent(e);
            }
        });

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("width", Integer.toString(TrackConstants.ACTION_BUTTON_WIDTH));
        constraints.put("height", Integer.toString(TrackConstants.ACTION_BUTTON_HEIGHT));

        String template = "cell 1 2, w ${width}!, h ${height}!";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        header.add(visibleButton, sub.replace(template));
    }

    // Set up the button used for removing a track and its plugin
    {
        rubbishButton = new JButton(TrackConstants.DELETE_ICON);
        rubbishButton.setName("rubbishButton");
        rubbishButton.setContentAreaFilled(false);
        rubbishButton.setBorderPainted(false);
        rubbishButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(final ActionEvent e) {
                handleDeleteButtonEvent(e);
            }
        });

        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("width", Integer.toString(TrackConstants.ACTION_BUTTON_WIDTH));
        constraints.put("height", Integer.toString(TrackConstants.ACTION_BUTTON_HEIGHT));

        String template = "cell 5 2, w ${width}!, h ${height}!";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        header.add(rubbishButton, sub.replace(template));
    }

    // Add the header to our layout.
    {
        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("width", Integer.toString(TrackConstants.HEADER_WIDTH));
        constraints.put("height", Integer.toString(TrackConstants.CARRIAGE_HEIGHT));

        String template = "w ${width}!, h ${height}!";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        view.add(header, sub.replace(template));
    }

    // Add the track carriage to our layout.
    {
        Map<String, String> constraints = Maps.newHashMap();
        constraints.put("height", Integer.toString(TrackConstants.CARRIAGE_HEIGHT));

        String template = "pushx, growx, h ${height}!";
        StrSubstitutor sub = new StrSubstitutor(constraints);

        view.add(trackPainter, sub.replace(template));
    }

    view.validate();
}

From source file:org.kineticsystem.commons.data.controller.DataNavigator.java

/**
 * Constructor./*from  w ww  . jav a 2s .  com*/
 * @param navigator The list navigator.
 * @param editor The object manager.
 */
public DataNavigator() {
    this.editor = null;
    navigator = new Navigator();
    navigator.addNavigatorListener(this);
    listenerList = new EventListenerList();
}

From source file:org.pentaho.reporting.designer.core.inspections.AutoInspectionRunner.java

public AutoInspectionRunner(final ReportDocumentContext reportRenderContext) {
    if (reportRenderContext == null) {
        throw new NullPointerException();
    }/* w w w. j a  va  2s.  c o  m*/
    this.reportRenderContext = reportRenderContext;
    this.timer = new Timer("Inspection-Manager", true);//NON-NLS
    this.eventListeners = new EventListenerList();

    this.lastTask = new InspectionTask(new InspectionRunnable());
    this.timer.schedule(lastTask, 1000);
}

From source file:org.pentaho.reporting.designer.core.util.dnd.ClipboardManager.java

private ClipboardManager() {
    this.listeners = new EventListenerList();
    try {/*from   ww w.  ja  v a  2  s .c  o  m*/
        this.clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
    } catch (final SecurityException se) {
        logger.error("Failed to create clipboard", se); // NON-NLS
        this.clipboard = new Clipboard("local-clipboard"); // NON-NLS
    }
}