Java 类java.util.EventObject 实例源码

项目:incubator-netbeans    文件:DragOperation.java   
void end(EventObject e, boolean clear) {
    Point pt = (e instanceof MouseEvent) ? ((MouseEvent)e).getPoint() : ((DropTargetDropEvent)e).getLocation();
    started = false;
    currentItem = null;
    if(dragComponent == null) return;
    if ((e instanceof DropTargetDropEvent)
            || ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
        menuEditLayer.layers.remove(dragComponent);
        menuEditLayer.dropTargetLayer.clearDropTarget();
    }

    switch (op) {
    case PICK_AND_PLOP_FROM_PALETTE: completePickAndPlopFromPalette(pt, clear); break;
    case INTER_MENU_DRAG: completeInterMenuDrag(pt); break ;
    case NO_MENUBAR: /* do nothing */ break;
    }

    menuEditLayer.glassLayer.requestFocusInWindow();
    if ((e instanceof DropTargetDropEvent)
            || ((e instanceof MouseEvent) && !((MouseEvent) e).isShiftDown())) {// #195795: Do not deselect the dropTarget when Shift is pressed
        payloadComponent = null;
        targetComponent = null;
    }
    menuEditLayer.repaint();

}
项目:jsf-sdk    文件:StandardBeanInfo.java   
private static Method[] introspectListenerMethods(Class<?> listenerType) {
    Method[] methods = listenerType.getDeclaredMethods();
    ArrayList<Method> list = new ArrayList<Method>();
    for (int i = 0; i < methods.length; i++) {
        Class<?>[] paramTypes = methods[i].getParameterTypes();
        if (paramTypes.length != 1) {
            continue;
        }

        if (EventObject.class.isAssignableFrom(paramTypes[0])) {
            list.add(methods[i]);
        }
    }
    Method[] matchedMethods = new Method[list.size()];
    list.toArray(matchedMethods);
    return matchedMethods;
}
项目:incubator-netbeans    文件:SheetTable.java   
/** Toggle the expanded state of a property set if either the event
 *  was a double click in the title area, a single click in the spinner
 *  area, or a keyboard event. */
private void maybeToggleExpanded(int row, EventObject e) {
    boolean doExpand = true;

    //If it's a mouse event, we need to check if it's a double click.
    if (e instanceof MouseEvent) {
        MouseEvent me = (MouseEvent) e;
        doExpand = me.getClickCount() > 1;

        //If not a double click, allow single click in the spinner margin
        if (!doExpand) {
            //marginWidth will definitely be initialized, you can't
            //click something that isn't on the screen
            doExpand = me.getPoint().x <= PropUtils.getMarginWidth();
        }
    }

    if (doExpand) {
        toggleExpanded(row);
    }
}
项目:jaffa-framework    文件:PrinterOutputTypeViewerComponent.java   
private IUpdateListener getUpdateListener() {
    if (m_updateListener == null) {
        m_updateListener = new IUpdateListener() {
            public void updateDone(EventObject source) {
                try {
                    // .//GEN-END:_updateObject_2_be
                    // Add custom code //GEN-FIRST:_updateObject_1


                    // .//GEN-LAST:_updateObject_1
                    // .//GEN-BEGIN:_updateObject_3_be
                    doInquiry();
                } catch (Exception e) {
                    log.warn("Error in refreshing the Results screen after the Update", e);
                }
            }
        };
    }
    return m_updateListener;
}
项目:incubator-netbeans    文件:ConfigurationsComboModel.java   
public void confirm(EventObject fe) {
    JTextField tf = (JTextField) fe.getSource();
    JComboBox combo = (JComboBox) tf.getParent();
    if (combo==null)
        return;
    if (fe instanceof FocusEvent) {
        combo.getEditor().getEditorComponent().removeFocusListener(this);
    } else {
        combo.getEditor().getEditorComponent().removeKeyListener(this);
    }
    Configuration config = lastSelected;
    config.setDisplayName(tf.getText());
    combo.setSelectedItem(config);
    combo.setEditable(false);
    currentActiveItem = null;
}
项目:incubator-netbeans    文件:DataModelTest.java   
public void doTestSetIcon () {
    System.err.println("testSetIcon");
    TabData td = mdl.getTab (20);
    noEvent = true;
    mdl.setIcon(20, td.getIcon());
    noEvent = false;

    mdl.setIcon(20, sameSizeIcon);
    assertEventIndices(20,20);
    assertListenerCall("contentsChanged");
    assertPravda (td.getIcon() == sameSizeIcon, "Icon was changed but same old still returned from TabData");
    assertWidthNotChanged();
    EventObject last = lastEvent;

    mdl.setIcon(20, biggerIcon);
    assertWidthChanged();
    assertPravda (last != lastEvent,  "Icon changed but no event fired");

    //restore the state
    mdl.setIcon(20,ic);
}
项目:hy.common.ui    文件:JDatePanel.java   
public boolean shouldSelectCell(EventObject anEvent) 
{
    if ( this.cellObject == null || Help.isNull(this.cellObject.getText()) )
    {
        this.fireEditingCanceled();
        return false;
    }

    //this.cellObject.setBackground($COLOR_DAY_SELECT);
    //this.cellObject.setFont($FONT_SELECT);

    // 这条语句是关键中的关键(提示:重绘)
    setDay(Integer.parseInt(this.cellObject.getText().trim()));

    return true;
}
项目:myfaces-trinidad    文件:JavaIntrospector.java   
private boolean _isEventHandler(
  Method m
  ) throws IntrospectionException
{
  // We assume that a method is an event handler if it has a single
  // argument, whose type inherit from java.util.Event.
  try
  {
    Class argTypes[] = m.getParameterTypes();

    if (argTypes.length != 1)
    {
      return false;
    }

    return (_isSubclass(argTypes[0], EventObject.class));
  }
  catch (Exception ex)
  {
    throw new IntrospectionException("Unexpected reflection exception: " + ex);
  }
}
项目:jaffa-framework    文件:MessageViewerComponent.java   
/** Invokes the processDone() method of the registered IMessageViewerListener objects in the same thread.
 */
protected void invokeMessageViewerListeners() throws ApplicationExceptions, FrameworkException{
    if (m_messageViewerListeners != null) {
        EventObject eventObject = new EventObject(this);
        for (Iterator i = m_messageViewerListeners.iterator(); i.hasNext(); )
            ( (IMessageViewerListener) i.next() ).processDone(eventObject);
    }
}
项目:incubator-netbeans    文件:TreeTable.java   
private boolean shouldStartEditingTimer(EventObject event) {
    if ((event instanceof MouseEvent) && SwingUtilities.isLeftMouseButton((MouseEvent) event)) {
        MouseEvent me = (MouseEvent) event;

        return ((me.getID() == MouseEvent.MOUSE_PRESSED) && (me.getClickCount() == 1) && inHitRegion(me));
    }

    return false;
}
项目:incubator-netbeans    文件:TreeTable.java   
private boolean shouldStopEditingTimer(EventObject event) {
    if (timer == null) {
        return false;
    }

    if (event instanceof MouseEvent) {
        MouseEvent me = (MouseEvent) event;

        return (!SwingUtilities.isLeftMouseButton(me) || (me.getClickCount() > 1));
    }

    return false;
}
项目:QN-ACTR-Release    文件:ServiceTimesPanel.java   
/**
 * If the request is to edit ld times in a system with zero customers, shows a warning messages and returns false.
 * Otherwise passes request to superclass method
 */
@Override
public boolean editCellAt(int row, int col, EventObject e) {
    if (zeroLD && (stationTypes[row] == STATION_LD)) {
        JOptionPane.showMessageDialog(ServiceTimesPanel.this,
                "<html><center>Cannot edit LD service times in a system with zero customers</center></html>", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return false;
    }
    return super.editCellAt(row, col, e);
}
项目:incubator-netbeans    文件:TreeViewCellEditor.java   
@Override
public boolean isCellEditable(EventObject event) {
    if ((event != null) && (event instanceof MouseEvent)) {
        if (!SwingUtilities.isLeftMouseButton((MouseEvent) event) || ((MouseEvent) event).isPopupTrigger()) {
            abortTimer();
            return false;
        }
        if (!wasFocusOwner) {
            wasFocusOwner = true;
            return false;
        }
    }

    if (lastPath != null) {
        Node n = Visualizer.findNode(lastPath.getLastPathComponent());

        if ((n == null) || !n.canRename()) {
            return false;
        }
    } else {
        // Disallow rename when multiple nodes are selected
        return false;
    }

    // disallow editing if we are in DnD operation
    if (dndActive) {
        return false;
    }

    return super.isCellEditable(event);
}
项目:OpenJSharp    文件:DefaultTreeCellEditor.java   
/**
 * Returns true if <code>event</code> is <code>null</code>,
 * or it is a <code>MouseEvent</code> with a click count &gt; 2
 * and <code>inHitRegion</code> returns true.
 * @param event the event being studied
 */
protected boolean canEditImmediately(EventObject event) {
    if((event instanceof MouseEvent) &&
       SwingUtilities.isLeftMouseButton((MouseEvent)event)) {
        MouseEvent       me = (MouseEvent)event;

        return ((me.getClickCount() > 2) &&
                inHitRegion(me.getX(), me.getY()));
    }
    return (event == null);
}
项目:jdk8u-jdk    文件:DefaultCellEditor.java   
/**
 * Constructs a <code>DefaultCellEditor</code> object that uses a
 * combo box.
 *
 * @param comboBox  a <code>JComboBox</code> object
 */
public DefaultCellEditor(final JComboBox comboBox) {
    editorComponent = comboBox;
    comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
    delegate = new EditorDelegate() {
        public void setValue(Object value) {
            comboBox.setSelectedItem(value);
        }

        public Object getCellEditorValue() {
            return comboBox.getSelectedItem();
        }

        public boolean shouldSelectCell(EventObject anEvent) {
            if (anEvent instanceof MouseEvent) {
                MouseEvent e = (MouseEvent)anEvent;
                return e.getID() != MouseEvent.MOUSE_DRAGGED;
            }
            return true;
        }
        public boolean stopCellEditing() {
            if (comboBox.isEditable()) {
                // Commit edited value.
                comboBox.actionPerformed(new ActionEvent(
                                 DefaultCellEditor.this, 0, ""));
            }
            return super.stopCellEditing();
        }
    };
    comboBox.addActionListener(delegate);
}
项目:incubator-netbeans    文件:EditablePropertyDisplayer.java   
private void trySendEnterToDialog() {
    //        System.err.println("SendEnterToDialog");
    EventObject ev = EventQueue.getCurrentEvent();

    if (ev instanceof KeyEvent && (((KeyEvent) ev).getKeyCode() == KeyEvent.VK_ENTER)) {
        if (ev.getSource() instanceof JComboBox && ((JComboBox) ev.getSource()).isPopupVisible()) {
            return;
        }

        if (
            ev.getSource() instanceof JTextComponent &&
                ((JTextComponent) ev.getSource()).getParent() instanceof JComboBox &&
                ((JComboBox) ((JTextComponent) ev.getSource()).getParent()).isPopupVisible()
        ) {
            return;
        }

        JRootPane jrp = getRootPane();

        if (jrp != null) {
            JButton b = jrp.getDefaultButton();

            if ((b != null) && b.isEnabled()) {
                b.doClick();
            }
        }
    }
}
项目:openjdk-jdk10    文件:JTreeTable.java   
/**
 * Overriden to invoke repaint for the particular location if
 * the column contains the tree. This is done as the tree editor does
 * not fill the bounds of the cell, we need the renderer to paint
 * the tree in the background, and then draw the editor over it.
 */
public boolean editCellAt(int row, int column, EventObject e){
    boolean retValue = super.editCellAt(row, column, e);
    if (retValue && getColumnClass(column) == TreeTableModel.class) {
        repaint(getCellRect(row, column, false));
    }
    return retValue;
}
项目:jdk8u-jdk    文件:DefaultTreeCellEditor.java   
/**
 * This is invoked if a <code>TreeCellEditor</code>
 * is not supplied in the constructor.
 * It returns a <code>TextField</code> editor.
 * @return a new <code>TextField</code> editor
 */
protected TreeCellEditor createTreeCellEditor() {
    Border              aBorder = UIManager.getBorder("Tree.editorBorder");
    DefaultCellEditor   editor = new DefaultCellEditor
        (new DefaultTextField(aBorder)) {
        public boolean shouldSelectCell(EventObject event) {
            boolean retValue = super.shouldSelectCell(event);
            return retValue;
        }
    };

    // One click to edit.
    editor.setClickCountToStart(1);
    return editor;
}
项目:Equella    文件:I18nCellEditor.java   
@Override
public boolean isCellEditable(EventObject anEvent)
{
    if( anEvent instanceof MouseEvent )
    {
        return ((MouseEvent) anEvent).getClickCount() >= 2;
    }
    return false;
}
项目:openjdk-jdk10    文件:Introspector.java   
private boolean isEventHandler(Method m) {
    // We assume that a method is an event handler if it has a single
    // argument, whose type inherit from java.util.Event.
    Type argTypes[] = m.getGenericParameterTypes();
    if (argTypes.length != 1) {
        return false;
    }
    return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
}
项目:OpenJSharp    文件:Introspector.java   
private boolean isEventHandler(Method m) {
    // We assume that a method is an event handler if it has a single
    // argument, whose type inherit from java.util.Event.
    Type argTypes[] = m.getGenericParameterTypes();
    if (argTypes.length != 1) {
        return false;
    }
    return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
}
项目:convertigo-engine    文件:AbstractSequenceCompositeWrap.java   
protected boolean checkEventSource(EventObject event) {
    boolean isSourceFromSequence = false;
    Object source = event.getSource();
    if (event instanceof SequenceEvent) {
        if ((source instanceof Sequence) || (source instanceof Step)) {
            Sequence sequence = null;
            if (source instanceof Sequence) sequence = (Sequence)source;
            if (source instanceof Step) sequence = ((Step)source).getParentSequence();
            if ((sequence != null) && (sequence.equals(this.sequence) || sequence.getOriginal().equals(this.sequence)))
                isSourceFromSequence = true;
        }
    }
    return isSourceFromSequence;
}
项目:jdk8u-jdk    文件:DefaultTreeCellEditor.java   
/**
 * Returns true if <code>event</code> is a <code>MouseEvent</code>
 * and the click count is 1.
 * @param event  the event being studied
 */
protected boolean shouldStartEditingTimer(EventObject event) {
    if((event instanceof MouseEvent) &&
        SwingUtilities.isLeftMouseButton((MouseEvent)event)) {
        MouseEvent        me = (MouseEvent)event;

        return (me.getClickCount() == 1 &&
                inHitRegion(me.getX(), me.getY()));
    }
    return false;
}
项目:ramus    文件:RowTreeTable.java   
@Override
public boolean editCellAt(int row, int column, EventObject e) {
    if ((e != null) && (!isEditIfNullEvent())) {
        return false;
    }
    boolean res = super.editCellAt(row, column, e);
    if ((res) && (cellEditor instanceof DefaultCellEditor)) {
        ((DefaultCellEditor) cellEditor).getComponent().requestFocus();
    }
    return res;
}
项目:OpenJSharp    文件:DefaultTreeCellEditor.java   
/**
 * If the <code>realEditor</code> returns true to this
 * message, <code>prepareForEditing</code>
 * is messaged and true is returned.
 */
public boolean isCellEditable(EventObject event) {
    boolean            retValue = false;
    boolean            editable = false;

    if (event != null) {
        if (event.getSource() instanceof JTree) {
            setTree((JTree)event.getSource());
            if (event instanceof MouseEvent) {
                TreePath path = tree.getPathForLocation(
                                     ((MouseEvent)event).getX(),
                                     ((MouseEvent)event).getY());
                editable = (lastPath != null && path != null &&
                           lastPath.equals(path));
                if (path!=null) {
                    lastRow = tree.getRowForPath(path);
                    Object value = path.getLastPathComponent();
                    boolean isSelected = tree.isRowSelected(lastRow);
                    boolean expanded = tree.isExpanded(path);
                    TreeModel treeModel = tree.getModel();
                    boolean leaf = treeModel.isLeaf(value);
                    determineOffset(tree, value, isSelected,
                                    expanded, leaf, lastRow);
                }
            }
        }
    }
    if(!realEditor.isCellEditable(event))
        return false;
    if(canEditImmediately(event))
        retValue = true;
    else if(editable && shouldStartEditingTimer(event)) {
        startEditingTimer();
    }
    else if(timer != null && timer.isRunning())
        timer.stop();
    if(retValue)
        prepareForEditing();
    return retValue;
}
项目:jaffa-framework    文件:QueueListComponent.java   
public FormKey viewMessages(String queue, MessageModeEnum messageMode) throws ApplicationExceptions, FrameworkException {
    QueueViewerComponent viewComponent = (QueueViewerComponent) run("Jaffa.Messaging.QueueViewer");
    viewComponent.setReturnToFormKey(getResultsFormKey());
    viewComponent.setQueue(queue);
    viewComponent.setMessageMode(messageMode);
    viewComponent.addQueueViewerListener(new IQueueViewerListener() {
        public void processDone(EventObject source) throws ApplicationExceptions, FrameworkException{
            displayResults();
        }
    });

    return viewComponent.display();
}
项目:QN-ACTR-Release    文件:LDEditor.java   
/**
 * borrowed from <code>DefaultCellEditor</code>
 */
@Override
public boolean isCellEditable(EventObject e) {
    if (e instanceof MouseEvent) {
        return ((MouseEvent) e).getClickCount() >= clicksToEdit;
    }
    return true;
}
项目:convertigo-engine    文件:AbstractConnectorCompositeWrap.java   
protected boolean checkEventSource(EventObject event) {
    boolean isSourceFromConnector = false;
    Object source = event.getSource();
    if (event instanceof ConnectorEvent) {
        if (source instanceof DatabaseObject) {
            Connector connector = ((DatabaseObject)source).getConnector();
            if ((connector != null) && (connector.equals(this.connector)))
                isSourceFromConnector = true;
        }
    }
    return isSourceFromConnector;
}
项目:jmt    文件:ServiceDemandsPanel.java   
/**
 * If the request is to edit ld times in a system with zero customers, shows a warning messages and returns false.
 * Otherwise passes request to superclass method
 */
@Override
public boolean editCellAt(int row, int col, EventObject e) {
    if (zeroLD && (stationTypes[row] == STATION_LD)) {
        JOptionPane.showMessageDialog(ServiceDemandsPanel.this,
                "<html><center>Cannot edit LD service times in a system with zero customers</center></html>", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return false;
    }
    return super.editCellAt(row, col, e);
}
项目:jmt    文件:ServiceTimesPanel.java   
/**
 * If the request is to edit ld times in a system with zero customers, shows a warning messages and returns false.
 * Otherwise passes request to superclass method
 */
@Override
public boolean editCellAt(int row, int col, EventObject e) {
    if (zeroLD && (stationTypes[row] == STATION_LD)) {
        JOptionPane.showMessageDialog(ServiceTimesPanel.this,
                "<html><center>Cannot edit LD service times in a system with zero customers</center></html>", "Warning",
                JOptionPane.WARNING_MESSAGE);
        return false;
    }
    return super.editCellAt(row, col, e);
}
项目:hy.common.ui    文件:JDatePanel.java   
public boolean isCellEditable(EventObject anEvent) 
{
    return true;
}
项目:openjdk-jdk10    文件:bug8023474.java   
public boolean shouldSelectCell(EventObject anEvent) {
    return true;
}
项目:incubator-netbeans    文件:ComponentsSelectionPanel.java   
public boolean isCellEditable(final EventObject event) {
    return true;
}
项目:LightSIP    文件:ReInviteTest.java   
private SipListener getSipListener(EventObject sipEvent) {
    SipProvider source = (SipProvider) sipEvent.getSource();
    SipListener listener = (SipListener) providerTable.get(source);
    assertTrue(listener != null);
    return listener;
}
项目:jdk8u-jdk    文件:EventQueue.java   
QueueElement(EventObject event, Vector<NamingListener> vector) {
    this.event = event;
    this.vector = vector;
}
项目:incubator-netbeans    文件:TableSheetCell.java   
/** Cell should not be selected
 * @param ev event
 * @return <code>false</code>
 */
@Override
public boolean shouldSelectCell(EventObject ev) {
    return true;
}
项目:incubator-netbeans    文件:TableSheetCell.java   
/** Return true.
 * @param e event
 * @return <code>true</code>
 */
@Override
public boolean isCellEditable(EventObject e) {
    return true;
}
项目:jdk8u-jdk    文件:bug8023474.java   
public boolean shouldSelectCell(EventObject anEvent) {
    return true;
}
项目:LightSIP    文件:RFC5626KeepAliveTest.java   
private SipListenerExt getSipListener(EventObject sipEvent) {
    SipProvider source = (SipProvider) sipEvent.getSource();
    SipListenerExt listener = (SipListenerExt) providerTable.get(source);
    assertTrue(listener != null);
    return listener;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:CompImplEditor.java   
@Override
public void commandStackChanged(EventObject event) {
    firePropertyChange(PROP_DIRTY);
    super.commandStackChanged(event);
}