예제 #1
0
    public void mouseMoved(MouseEvent ev) {
      JRootPane root = getRootPane();

      if (root.getWindowDecorationStyle() == JRootPane.NONE) {
        return;
      }

      Window w = (Window) ev.getSource();

      Frame f = null;
      Dialog d = null;

      if (w instanceof Frame) {
        f = (Frame) w;
      } else if (w instanceof Dialog) {
        d = (Dialog) w;
      }

      // Update the cursor
      int cursor = getCursor(calculateCorner(w, ev.getX(), ev.getY()));

      if (cursor != 0
          && ((f != null && (f.isResizable() && (f.getExtendedState() & Frame.MAXIMIZED_BOTH) == 0))
              || (d != null && d.isResizable()))) {
        w.setCursor(Cursor.getPredefinedCursor(cursor));
      } else {
        w.setCursor(lastCursor);
      }
    }
예제 #2
0
  public void actionPerformed(ActionEvent evt) {
    if (model.names().isEmpty() || model.files().isEmpty()) {
      return;
    }

    BackgroundMatcher backgroundMatcher =
        new BackgroundMatcher(model, EpisodeMetrics.defaultSequence(true));
    backgroundMatcher.execute();

    Window window = getWindow(evt.getSource());
    window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

    try {
      // wait a for little while (matcher might finish in less than a second)
      backgroundMatcher.get(2, TimeUnit.SECONDS);
    } catch (TimeoutException ex) {
      // matcher will probably take a while
      ProgressDialog dialog = createProgressDialog(window, backgroundMatcher);
      dialog.setLocation(getOffsetLocation(dialog.getOwner()));

      // display progress dialog and stop blocking EDT
      dialog.setVisible(true);
    } catch (Exception e) {
      Logger.getLogger(getClass().getName()).log(Level.SEVERE, e.toString(), e);
    } finally {
      window.setCursor(Cursor.getDefaultCursor());
    }
  }
 @Override
 public void actionPerformed(final ActionEvent e) {
   final Window window = (Window) Application.get().getMainPane();
   try {
     window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
     actionInvoked(e);
   } finally {
     window.setCursor(Cursor.getDefaultCursor());
   }
 }
예제 #4
0
 /**
  * Uninstalls any state that <code>installClientDecorations</code> has installed.
  *
  * <p>NOTE: This may be called if you haven't installed client decorations yet (ie before <code>
  * installClientDecorations</code> has been invoked).
  */
 private void uninstallClientDecorations(JRootPane root) {
   uninstallBorder(root);
   uninstallWindowListeners(root);
   setTitlePane(root, null);
   uninstallLayout(root);
   // We have to revalidate/repaint root if the style is JRootPane.NONE
   // only. When we needs to call revalidate/repaint with other styles
   // the installClientDecorations is always called after this method
   // imediatly and it will cause the revalidate/repaint at the proper
   // time.
   int style = root.getWindowDecorationStyle();
   if (style == JRootPane.NONE) {
     root.repaint();
     root.revalidate();
   }
   // Reset the cursor, as we may have changed it to a resize cursor
   if (window != null) {
     window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   }
   window = null;
 }
예제 #5
0
 public void mouseExited(MouseEvent ev) {
   Window w = (Window) ev.getSource();
   w.setCursor(lastCursor);
 }
예제 #6
0
  public void performEdit(final DataFactory dataFactory, final String queryName)
      throws ReportDataFactoryException {
    final DataFactoryMetaData metadata = dataFactory.getMetaData();
    if (metadata.isEditable() == false) {
      return;
    }

    final DataSourcePlugin dataSourcePlugin = metadata.createEditor();
    final DataFactory storedFactory = dataFactory.derive();
    if (dataSourcePlugin.canHandle(dataFactory)) {
      final ReportRenderContext activeContext = getActiveContext();
      final AbstractReportDefinition report = activeContext.getReportDefinition();
      final boolean editingActiveQuery = contains(report.getQuery(), dataFactory.getQueryNames());

      final ReportDesignerDesignTimeContext designTimeContext =
          new ReportDesignerDesignTimeContext(getReportDesignerContext());
      editedDataFactory =
          dataSourcePlugin.performEdit(designTimeContext, dataFactory, queryName, null);
      if (editedDataFactory == null) {
        return;
      }

      final Window parentWindow = designTimeContext.getParentWindow();
      parentWindow.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

      final CompoundDataFactory collection = (CompoundDataFactory) report.getDataFactory();
      final int dataFactoryCount = collection.size();
      for (int j = 0; j < dataFactoryCount; j++) {
        final DataFactory originalDataFactory = collection.getReference(j);
        if (originalDataFactory == dataFactory) {
          collection.remove(j);

          final DataFactory editedClone = editedDataFactory.derive();
          collection.add(j, editedDataFactory);
          activeContext
              .getUndo()
              .addChange(
                  ActionMessages.getString("EditQueryAction.Text"),
                  new DataSourceEditUndoEntry(j, storedFactory, editedClone));

          report.notifyNodeChildRemoved(originalDataFactory);
          report.notifyNodeChildAdded(editedDataFactory);

          parentWindow.setCursor(Cursor.getDefaultCursor());
          if (editingActiveQuery == false) {
            // if we are editing a query that is not the one the current report uses, do not mess
            // around with it.
            return;
          }

          final String[] editedQueries = editedDataFactory.getQueryNames();
          if (contains(report.getQuery(), editedQueries) == false) {
            report.setQuery(null);
          }
          return;
        }
      }

      throw new IllegalStateException();
    }
  }
예제 #7
0
 protected void setWaitCursor(boolean wait) {
   window.setCursor(Cursor.getPredefinedCursor(wait ? Cursor.WAIT_CURSOR : Cursor.DEFAULT_CURSOR));
 }
예제 #8
0
 public void invisibleCursor() {
   Image curs;
   curs = new ImageIcon("Textures\\Cross.png").getImage();
   Window w = s.getFullScreenWindow();
   w.setCursor(w.getToolkit().createCustomCursor(curs, new Point(0, 0), "null"));
 }
 public static void setDefaultCursor(JComponent content) {
   final Window wnd = SwingUtilities.getWindowAncestor(content);
   if (wnd != null) {
     wnd.setCursor(Cursor.getDefaultCursor());
   }
 }