public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    KeyPromoterSettings that = (KeyPromoterSettings) o;

    if (allButtonsEnabled != that.allButtonsEnabled) return false;
    if (displayTime != that.displayTime) return false;
    if (fixedTipPosistion != that.fixedTipPosistion) return false;
    if (flashAnimationDelay != that.flashAnimationDelay) return false;
    if (menusEnabled != that.menusEnabled) return false;
    if (proposeToCreateShortcutCount != that.proposeToCreateShortcutCount) return false;
    if (toolWindowButtonsEnabled != that.toolWindowButtonsEnabled) return false;
    if (toolbarButtonsEnabled != that.toolbarButtonsEnabled) return false;
    if (backgroundColor != null
        ? !backgroundColor.equals(that.backgroundColor)
        : that.backgroundColor != null) return false;
    if (borderColor != null ? !borderColor.equals(that.borderColor) : that.borderColor != null)
      return false;
    if (popupTemplate != null
        ? !popupTemplate.equals(that.popupTemplate)
        : that.popupTemplate != null) return false;
    if (textColor != null ? !textColor.equals(that.textColor) : that.textColor != null)
      return false;

    return true;
  }
Exemplo n.º 2
0
 /**
  * Compares the argument to the receiver, and returns true if they represent the <em>same</em>
  * object using a class specific comparison.
  *
  * @param object the object to compare with this object
  * @return <code>true</code> if the object is the same as this object and <code>false</code>
  *     otherwise
  * @see #hashCode()
  */
 public boolean equals(Object object) {
   if (object == this) return true;
   if (object == null) return false;
   if (!(object instanceof TextStyle)) return false;
   TextStyle style = (TextStyle) object;
   if (foreground != null) {
     if (!foreground.equals(style.foreground)) return false;
   } else if (style.foreground != null) return false;
   if (background != null) {
     if (!background.equals(style.background)) return false;
   } else if (style.background != null) return false;
   if (font != null) {
     if (!font.equals(style.font)) return false;
   } else if (style.font != null) return false;
   if (metrics != null || style.metrics != null) return false;
   if (underline != style.underline) return false;
   if (underlineStyle != style.underlineStyle) return false;
   if (borderStyle != style.borderStyle) return false;
   if (strikeout != style.strikeout) return false;
   if (rise != style.rise) return false;
   if (underlineColor != null) {
     if (!underlineColor.equals(style.underlineColor)) return false;
   } else if (style.underlineColor != null) return false;
   if (strikeoutColor != null) {
     if (!strikeoutColor.equals(style.strikeoutColor)) return false;
   } else if (style.strikeoutColor != null) return false;
   if (underlineStyle != style.underlineStyle) return false;
   if (borderColor != null) {
     if (!borderColor.equals(style.borderColor)) return false;
   } else if (style.borderColor != null) return false;
   if (data != null) {
     if (!data.equals(style.data)) return false;
   } else if (style.data != null) return false;
   return true;
 }
 private void paintBackground(Graphics2D g, Color color, float x, int y, float width) {
   if (width <= 0
       || color == null
       || color.equals(myEditor.getColorsScheme().getDefaultBackground())
       || color.equals(myEditor.getBackgroundColor())) return;
   g.setColor(color);
   g.fillRect((int) x, y, (int) width, myView.getLineHeight());
 }
 private void merge(TextAttributes attributes) {
   Color myBackground = myMergedAttributes.getBackgroundColor();
   if (myBackground == null || myDefaultBackground.equals(myBackground)) {
     myMergedAttributes.setBackgroundColor(attributes.getBackgroundColor());
   }
   Color myForeground = myMergedAttributes.getForegroundColor();
   if (myForeground == null || myDefaultForeground.equals(myForeground)) {
     myMergedAttributes.setForegroundColor(attributes.getForegroundColor());
   }
   if (myMergedAttributes.getFontType() == Font.PLAIN) {
     myMergedAttributes.setFontType(attributes.getFontType());
   }
 }
Exemplo n.º 5
0
 boolean isAdherentStrikeout(TextStyle style) {
   if (this == style) return true;
   if (style == null) return false;
   if (strikeout != style.strikeout) return false;
   if (strikeoutColor != null) {
     if (!strikeoutColor.equals(style.strikeoutColor)) return false;
   } else {
     if (style.strikeoutColor != null) return false;
     if (foreground != null) {
       if (!foreground.equals(style.foreground)) return false;
     } else if (style.foreground != null) return false;
   }
   return true;
 }
Exemplo n.º 6
0
 boolean isAdherentBorder(TextStyle style) {
   if (this == style) return true;
   if (style == null) return false;
   if (borderStyle != style.borderStyle) return false;
   if (borderColor != null) {
     if (!borderColor.equals(style.borderColor)) return false;
   } else {
     if (style.borderColor != null) return false;
     if (foreground != null) {
       if (!foreground.equals(style.foreground)) return false;
     } else if (style.foreground != null) return false;
   }
   return true;
 }
 private void processBackground(int startOffset, Color background) {
   if (myBackground == null && background != null && !myDefaultBackground.equals(background)) {
     addTextIfPossible(startOffset);
     myBackground = background;
     builder.addBackground(background);
   } else if (myBackground != null) {
     Color c = background == null ? myDefaultBackground : background;
     if (!myBackground.equals(c)) {
       addTextIfPossible(startOffset);
       builder.addBackground(c);
       myBackground = c;
     }
   }
 }
Exemplo n.º 8
0
 boolean isAdherentUnderline(TextStyle style) {
   if (this == style) return true;
   if (style == null) return false;
   if (underline != style.underline) return false;
   if (underlineStyle != style.underlineStyle) return false;
   if (underlineColor != null) {
     if (!underlineColor.equals(style.underlineColor)) return false;
   } else {
     if (style.underlineColor != null) return false;
     if (foreground != null) {
       if (!foreground.equals(style.foreground)) return false;
     } else if (style.foreground != null) return false;
   }
   return true;
 }
 /**
  * Set the default contour label color <br>
  * <B>Property Change:</B> <code>labelColor</code>.
  */
 public void setLabelColor(Color color) {
   if (!labelColor_.equals(color)) {
     Color tempOld = labelColor_;
     labelColor_ = color;
     changes_.firePropertyChange("labelColor", tempOld, labelColor_);
   }
 }
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!(o instanceof ColorSampleLookupValue)) {
      return false;
    }

    ColorSampleLookupValue value = (ColorSampleLookupValue) o;

    if (myIsStandard != value.myIsStandard) {
      return false;
    }
    if (myColor != null ? !myColor.equals(value.myColor) : value.myColor != null) {
      return false;
    }
    if (myName != null ? !myName.equals(value.myName) : value.myName != null) {
      return false;
    }
    if (myValue != null ? !myValue.equals(value.myValue) : value.myValue != null) {
      return false;
    }

    return true;
  }
Exemplo n.º 11
0
  private static Component createDescription(Example example, ExampleGroup group) {
    Color foreground = group.getPreferredForeground();

    WebLabel titleLabel = new WebLabel(example.getTitle(), JLabel.TRAILING);
    titleLabel.setDrawShade(true);
    titleLabel.setForeground(foreground);
    if (foreground.equals(Color.WHITE)) {
      titleLabel.setShadeColor(Color.BLACK);
    }

    if (example.getDescription() == null) {
      return titleLabel;
    } else {
      WebLabel descriptionLabel = new WebLabel(example.getDescription(), WebLabel.TRAILING);
      descriptionLabel.setForeground(Color.GRAY);
      SwingUtils.changeFontSize(descriptionLabel, -1);

      WebPanel vertical =
          new WebPanel(new VerticalFlowLayout(VerticalFlowLayout.MIDDLE, 0, 0, true, false));
      vertical.setOpaque(false);
      vertical.add(titleLabel);
      vertical.add(descriptionLabel);

      return vertical;
    }
  }
Exemplo n.º 12
0
  public void paintText(Graphics g, int x, int y, String title) {
    x += paintIcon(g, x, y);
    Graphics2D g2D = (Graphics2D) g;
    Shape savedClip = g2D.getClip();
    Color fc = AbstractLookAndFeel.getWindowTitleForegroundColor();
    if (fc.equals(Color.white)) {
      Color bc = AbstractLookAndFeel.getWindowTitleColorDark();
      g2D.setColor(bc);
      JTattooUtilities.drawString(rootPane, g, title, x - 1, y - 1);
      g2D.setColor(ColorHelper.darker(bc, 30));
      JTattooUtilities.drawString(rootPane, g, title, x + 1, y + 1);
    }
    g.setColor(fc);

    Area clipArea = new Area(new Rectangle2D.Double(x, 0, getWidth(), getHeight() / 2));
    clipArea.intersect(new Area(savedClip));
    g2D.setClip(clipArea);
    JTattooUtilities.drawString(rootPane, g, title, x, y);

    clipArea = new Area(new Rectangle2D.Double(x, (getHeight() / 2), getWidth(), getHeight()));
    clipArea.intersect(new Area(savedClip));
    g2D.setClip(clipArea);
    g.setColor(ColorHelper.darker(fc, 20));
    JTattooUtilities.drawString(rootPane, g, title, x, y);

    g2D.setClip(savedClip);
  }
Exemplo n.º 13
0
 private void remove(int x, int y, Color c) {
   if (c.equals(Color.RED)) {
     numRedCheckers--;
   } else {
     numBlackCheckers--;
   }
 }
Exemplo n.º 14
0
 public boolean equals(Color c, int px, int py, int px2, int py2) {
   if (!bValid) return false;
   if (!c.equals(fgColor)) return false;
   if (x == px && x2 == px2) {
     if (y == py && y2 == py2) return true;
   }
   return false;
 }
 private void findNextSuitableRange() {
   myNextAttributes = null;
   while (myIterator.hasNext()) {
     RangeHighlighterEx highlighter = myIterator.next();
     if (highlighter == null
         || !highlighter.isValid()
         || !isInterestedInLayer(highlighter.getLayer())) {
       continue;
     }
     // LINES_IN_RANGE highlighters are not supported currently
     myNextStart = Math.max(highlighter.getStartOffset(), myStartOffset);
     myNextEnd = Math.min(highlighter.getEndOffset(), myEndOffset);
     if (myNextStart >= myEndOffset) {
       break;
     }
     if (myNextStart < myCurrentEnd) {
       continue; // overlapping ranges withing document markup model are not supported currently
     }
     TextAttributes attributes = null;
     Object tooltip = highlighter.getErrorStripeTooltip();
     if (tooltip instanceof HighlightInfo) {
       HighlightInfo info = (HighlightInfo) tooltip;
       TextAttributesKey key = info.forcedTextAttributesKey;
       if (key == null) {
         HighlightInfoType type = info.type;
         key = type.getAttributesKey();
       }
       if (key != null) {
         attributes = myColorsScheme.getAttributes(key);
       }
     }
     if (attributes == null) {
       continue;
     }
     Color foreground = attributes.getForegroundColor();
     Color background = attributes.getBackgroundColor();
     if ((foreground == null || myDefaultForeground.equals(foreground))
         && (background == null || myDefaultBackground.equals(background))
         && attributes.getFontType() == Font.PLAIN) {
       continue;
     }
     myNextAttributes = attributes;
     break;
   }
 }
Exemplo n.º 16
0
 @Override
 public boolean equals(final TextAttributes attributes1, final TextAttributes attributes2) {
   Color effectColor = attributes1.getEffectColor();
   EffectType effectType = attributes1.getEffectType();
   return effectColor != null
       && effectColor.equals(attributes2.getEffectColor())
       && (EffectType.BOXED == effectType || EffectType.ROUNDED_BOX == effectType)
       && effectType == attributes2.getEffectType();
 }
Exemplo n.º 17
0
  /**
   * Sets the color used to draw the dial.
   *
   * @param c color in which to paint the dial.
   */
  public synchronized void setColor(Color c) {
    // Ignores calls that don't actually change anything.
    if (!color.equals(c)) {
      color = c;

      // Resets stored images to make sure they get repainted
      // with the right color.
      for (int i = 0; i < frames.length; i++) frames[i] = null;
    }
  }
Exemplo n.º 18
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    Project project = (Project) o;

    if (!name.equals(project.name)) return false;
    if (color != null ? !color.equals(project.color) : project.color != null) return false;
    return !(tasks != null ? !tasks.equals(project.tasks) : project.tasks != null);
  }
Exemplo n.º 19
0
 /**
  * selectClickable -- a recursive function which searches the game board for game balls of the
  * same color as the one selected, and 'selects' them as well.
  */
 public void selectClickable(int m, int n) {
   Color home = balls[m][n].getColor();
   balls[m][n].select();
   scount += 1;
   if ((n - 1) >= 0) {
     Color north = balls[m][n - 1].getColor();
     if ((home.equals(north)) && !(balls[m][n - 1].isSelected())) selectClickable(m, (n - 1));
   }
   if ((m - 1) >= 0) {
     Color west = balls[m - 1][n].getColor();
     if ((home.equals(west)) && !(balls[m - 1][n].isSelected())) selectClickable((m - 1), n);
   }
   if ((n + 1) < B_HEIGHT) {
     Color south = balls[m][n + 1].getColor();
     if ((home.equals(south)) && !(balls[m][n + 1].isSelected())) selectClickable(m, (n + 1));
   }
   if ((m + 1) < B_WIDTH) {
     Color east = balls[m + 1][n].getColor();
     if ((home.equals(east)) && !(balls[m + 1][n].isSelected())) selectClickable((m + 1), n);
   }
 }
Exemplo n.º 20
0
  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    AttributesFlyweight that = (AttributesFlyweight) o;

    if (myFontType != that.myFontType) return false;
    if (myBackground != null ? !myBackground.equals(that.myBackground) : that.myBackground != null)
      return false;
    if (myEffectColor != null
        ? !myEffectColor.equals(that.myEffectColor)
        : that.myEffectColor != null) return false;
    if (myEffectType != that.myEffectType) return false;
    if (myErrorStripeColor != null
        ? !myErrorStripeColor.equals(that.myErrorStripeColor)
        : that.myErrorStripeColor != null) return false;
    if (myForeground != null ? !myForeground.equals(that.myForeground) : that.myForeground != null)
      return false;

    return true;
  }
Exemplo n.º 21
0
  public boolean equals(final ColorScale cs) {
    if (min == null && cs.min != null || min != null && cs.min == null) {
      return false;
    }
    if ((min != null && cs.min != null) && Double.compare(min, cs.min) != 0) {
      return false;
    }
    if (max == null && cs.max != null || max != null && cs.max == null) {
      return false;
    }
    if ((max != null && cs.max != null) && Double.compare(max, cs.max) != 0) {
      return false;
    }
    if (!scaling.equals(cs.scaling)) {
      return false;
    }
    if (interpolate != cs.interpolate) {
      return false;
    }
    if (forceValuesIntoRange != cs.forceValuesIntoRange) {
      return false;
    }
    if (reliefShading != cs.reliefShading) {
      return false;
    }
    if (nullColor.length != cs.nullColor.length) {
      return false;
    }
    for (int i = 0; i < nullColor.length; i++) {
      if (nullColor[i] != cs.nullColor[i]) {
        return false;
      }
    }
    if (size() != cs.size()) {
      return false;
    }
    final Iterator<Double> iterator1 = cs.keySet().iterator();
    for (final Double d1 : this.keySet()) {
      final Double d2 = iterator1.next();
      if (d1.compareTo(d2) != 0) {
        return false;
      }

      final Color value1 = get(d1);
      final Color value2 = get(d2);
      if (!value1.equals(value2)) {
        return false;
      }
    }
    return true;
  }
Exemplo n.º 22
0
 // Overridden for performance reasons. ---->
 @Override
 public boolean isOpaque() {
   Color back = getBackground();
   Component p = getParent();
   if (Objects.nonNull(p)) {
     p = p.getParent();
   } // p should now be the JTable.
   boolean colorMatch =
       Objects.nonNull(back)
           && Objects.nonNull(p)
           && back.equals(p.getBackground())
           && p.isOpaque();
   return !colorMatch && super.isOpaque();
 }
 private void processForeground(int startOffset, Color foreground) {
   if (myForeground == null && foreground != null) {
     addTextIfPossible(startOffset);
     myForeground = foreground;
     builder.addForeground(foreground);
   } else if (myForeground != null) {
     Color c = foreground == null ? myDefaultForeground : foreground;
     if (!myForeground.equals(c)) {
       addTextIfPossible(startOffset);
       builder.addForeground(c);
       myForeground = c;
     }
   }
 }
Exemplo n.º 24
0
 public void paintText(Graphics g, int x, int y, String title) {
   x += paintIcon(g, x, y);
   Graphics2D g2D = (Graphics2D) g;
   Color fc = AbstractLookAndFeel.getWindowTitleForegroundColor();
   if (fc.equals(Color.white)) {
     Color bc = AbstractLookAndFeel.getWindowTitleColorDark();
     g2D.setColor(bc);
     JTattooUtilities.drawString(rootPane, g, title, x - 1, y - 1);
     g2D.setColor(ColorHelper.darker(bc, 30));
     JTattooUtilities.drawString(rootPane, g, title, x + 1, y + 1);
   }
   g.setColor(fc);
   JTattooUtilities.drawString(rootPane, g, title, x, y);
 }
Exemplo n.º 25
0
  @Override
  public void colorChanged(Color color, Object source) {
    if (color != null && !color.equals(myColor)) {
      myColor = color;

      applyColor(color);

      if (source != myHex) {
        applyColorToHEX(color);
      }
      myPreviewComponent.setColor(color);
      fireColorChanged(color);
    }
  }
Exemplo n.º 26
0
  private void updatePreview(Color color, boolean fromHex) {
    if (color != null && !color.equals(myColor)) {
      myColor = color;
      myPreviewComponent.setColor(color);
      myColorWheelPanel.setColor(color, fromHex ? myHex : null);

      if (fromHex) {
        applyColor(color);
      } else {
        applyColorToHEX(color);
      }

      fireColorChanged(color);
    }
  }
  /** {@inheritDoc} */
  public void setBackgroundColor(Color color) {
    if (color == null) {
      String message = Logging.getMessage("nullValue.ColorIsNull");
      Logging.logger().severe(message);
      throw new IllegalArgumentException(message);
    }

    // Only set the color if it actually changed
    if (!color.equals(this.getBackgroundColor())) {
      this.backgroundColor = color;

      // Convert the color to an RGB hex triplet string that the WebBrowser will understand
      int rgb =
          (color.getRed() & 0xFF) << 16 | (color.getGreen() & 0xFF) << 8 | (color.getBlue() & 0xFF);
      String colorString = String.format("#%06X", rgb);

      WindowsWebViewJNI.setBackgroundColor(this.webViewWindowPtr, colorString);
    }
  }
Exemplo n.º 28
0
 private boolean canDoubleJump(GameObj obj) {
   doubleJumpSpots = new ArrayList<Tuple<Integer, Integer>>();
   if (obj.isTile()) {
     return false;
   }
   int x = obj.getX();
   int y = obj.getY();
   if (obj.isQueen()) {
     return doubleJumpProcess(obj, x + 2, y + 2)
         || doubleJumpProcess(obj, x - 2, y + 2)
         || doubleJumpProcess(obj, x + 2, y - 2)
         || doubleJumpProcess(obj, x - 2, y - 2);
   } else {
     if (turn.equals(Color.RED)) {
       return doubleJumpProcess(obj, x + 2, y - 2) || doubleJumpProcess(obj, x - 2, y - 2);
     } else {
       return doubleJumpProcess(obj, x + 2, y + 2) || doubleJumpProcess(obj, x - 2, y + 2);
     }
   }
 }
  /**
   * Returns the default table cell renderer.
   *
   * @param table the JTable
   * @param value the value to assign to the cell at [row, column]
   * @param isSelected true if cell is selected
   * @param hasFocus true if cell has focus
   * @param row the row of the cell to render
   * @param column the column of the cell to render
   * @return the default table cell renderer
   */
  public Component getTableCellRendererComponent(
      JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    /* the following is the similar to DefaultTableCellRenderer */
    if (isSelected) {
      super.setForeground(UIHelper.BG_COLOR);
      super.setBackground(new Color(0, 104, 56, 175));
    } else {
      super.setForeground(table.getForeground());
      if (columnColors.get(column) == null) {
        super.setBackground(UIHelper.BG_COLOR);
      } else {
        super.setBackground(columnColors.get(column));
      }
    }

    setFont(UIHelper.VER_11_PLAIN);

    if (hasFocus) {
      setBorder(new DragBorder());
      if (table.isCellEditable(row, column)) {
        super.setForeground(UIHelper.BG_COLOR);
        super.setBackground(UIHelper.DARK_GREEN_COLOR);
      }
    } else {
      setBorder(noFocusBorder);
    }

    /* this method has been changed for formula feature */
    setValue(value);

    // DefaulTableCellRenderer code
    // begin optimization to avoid painting background
    Color back = getBackground();
    boolean colorMatch = (back != null) && (back.equals(table.getBackground())) && table.isOpaque();
    setOpaque(!colorMatch);

    // end optimization to aviod painting background
    return this;
  }
Exemplo n.º 30
0
    private void updatePipette() {
      Dialog pickerDialog = getPickerDialog();
      if (pickerDialog != null && pickerDialog.isShowing()) {
        Point mouseLoc = updateLocation();
        if (mouseLoc == null) return;
        final Color c = getPixelColor(mouseLoc);
        if (!c.equals(getColor()) || !mouseLoc.equals(myPreviousLocation)) {
          setColor(c);
          myPreviousLocation.setLocation(mouseLoc);
          myCaptureRect.setBounds(
              mouseLoc.x - HOT_SPOT.x + SIZE / 2 - 2, mouseLoc.y - HOT_SPOT.y + SIZE / 2 - 2, 5, 5);

          BufferedImage capture = myRobot.createScreenCapture(myCaptureRect);

          // Clear the cursor graphics
          myGraphics.setComposite(AlphaComposite.Src);
          myGraphics.setColor(UIUtil.TRANSPARENT_COLOR);
          myGraphics.fillRect(0, 0, myImage.getWidth(), myImage.getHeight());

          myGraphics.drawImage(
              capture, myZoomRect.x, myZoomRect.y, myZoomRect.width, myZoomRect.height, this);

          // cropping round image
          myGraphics.setComposite(AlphaComposite.getInstance(AlphaComposite.DST_OUT));
          myGraphics.drawImage(
              myMaskImage, myZoomRect.x, myZoomRect.y, myZoomRect.width, myZoomRect.height, this);

          // paint magnifier
          myGraphics.setComposite(AlphaComposite.SrcOver);

          UIUtil.drawImage(
              myGraphics, myPipetteImage, SIZE - AllIcons.Ide.Pipette.getIconWidth(), 0, this);

          pickerDialog.setCursor(
              myParent.getToolkit().createCustomCursor(myImage, HOT_SPOT, "ColorPicker"));
          notifyListener(c, 300);
        }
      }
    }