Beispiel #1
0
  /** Initializes the call button. */
  private void initCallButton() {
    List<ProtocolProviderService> telephonyProviders = CallManager.getTelephonyProviders();

    if (telephonyProviders != null && telephonyProviders.size() > 0) {
      if (callButton.getParent() != null) return;

      callButton.setAlignmentX(JButton.CENTER_ALIGNMENT);

      callButton.setMnemonic(
          GuiActivator.getResources().getI18nMnemonic("service.gui.CALL_CONTACT"));

      buttonPanel.add(callButton);

      callButton.addActionListener(
          new ActionListener() {
            public void actionPerformed(ActionEvent e) {
              String searchText = parentWindow.getCurrentSearchText();

              if (searchText == null) return;

              CallManager.createCall(searchText, callButton);
            }
          });
    } else {
      buttonPanel.remove(callButton);
    }
  }
Beispiel #2
0
  /**
   * Updates the text area to take into account the new search text.
   *
   * @param searchText the search text to update
   */
  private void updateTextArea(String searchText) {
    if (callButton.getParent() != null) {
      textArea.setText(
          GuiActivator.getResources()
              .getI18NString(
                  "service.gui.NO_CONTACTS_FOUND", new String[] {'"' + searchText + '"'}));

      this.revalidate();
      this.repaint();
    }
  }
Beispiel #3
0
 public void actionPerformed(ActionEvent evt) {
   Component parent = extensionButton.getParent();
   while ((parent != null) && !(parent instanceof Frame)) parent = parent.getParent();
   String newExtensions =
       JOptionPane.showInputDialog(
           parent,
           "Edit the extension list.\nSeparate extensions by commas.\n\n",
           filter.getExtensionString());
   if ((newExtensions != null) && !newExtensions.trim().equals("")) {
     newExtensions = newExtensions.replaceAll("\\s", "");
     filter.setExtensions(newExtensions);
     extensionButton.setText(filter.getDescription());
     properties.setProperty("extensions", filter.getExtensionString());
     directoryPane.reloadTree();
   }
 }
Beispiel #4
0
  /**
   * Creates the <tt>UnknownContactPanel</tt> by specifying the parent window.
   *
   * @param window the parent window
   */
  public UnknownContactPanel(MainFrame window) {
    super(new BorderLayout());

    this.parentWindow = window;

    TransparentPanel mainPanel = new TransparentPanel(new BorderLayout());

    this.add(mainPanel, BorderLayout.NORTH);

    if (!ConfigurationUtils.isAddContactDisabled()) {
      initAddContactButton();
    }

    initCallButton();

    initSMSButton();

    initTextArea();
    mainPanel.add(textArea, BorderLayout.CENTER);

    if (callButton.getParent() != null) {
      textArea.setText(
          GuiActivator.getResources()
              .getI18NString(
                  "service.gui.NO_CONTACTS_FOUND",
                  new String[] {'"' + parentWindow.getCurrentSearchText() + '"'}));
    } else {
      textArea.setText(
          GuiActivator.getResources().getI18NString("service.gui.NO_CONTACTS_FOUND_SHORT"));
    }

    if (buttonPanel.getComponentCount() > 0) {
      TransparentPanel southPanel = new TransparentPanel(new FlowLayout(FlowLayout.CENTER));
      southPanel.add(buttonPanel);

      mainPanel.add(southPanel, BorderLayout.SOUTH);
    }

    loadSkin();
  }
  public void paintComponent(Graphics g) {
    if (getFrame() != null) {
      setState(getFrame().getExtendedState());
    }
    JRootPane rootPane = getRootPane();
    Window window = getWindow();
    boolean leftToRight =
        (window == null)
            ? rootPane.getComponentOrientation().isLeftToRight()
            : window.getComponentOrientation().isLeftToRight();
    boolean isSelected = (window == null) ? true : window.isActive();
    int width = getWidth();
    int height = getHeight();

    Color background;
    Color foreground;
    Color darkShadow;

    if (isSelected) {
      background = UIUtil.getPanelBackground(); // myActiveBackground;
      foreground = myActiveForeground;
      darkShadow = Gray._73; // myActiveShadow;
    } else {
      background = UIUtil.getPanelBackground(); // myInactiveBackground;
      foreground = myInactiveForeground;
      darkShadow = myInactiveShadow;
    }

    g.setColor(background);
    g.fillRect(0, 0, width, height);

    // g.setColor(darkShadow);
    // g.drawLine(0, height - 1, width, height - 1);
    // g.drawLine(0, 0, 0, 0);
    // g.drawLine(width - 1, 0, width - 1, 0);

    int xOffset = leftToRight ? 5 : width - 5;

    if (getWindowDecorationStyle() == JRootPane.FRAME) {
      xOffset += leftToRight ? IMAGE_WIDTH + 5 : -IMAGE_WIDTH - 5;
    }

    String theTitle = getTitle();
    if (theTitle != null) {
      FontMetrics fm = SwingUtilities2.getFontMetrics(rootPane, g);

      g.setColor(foreground);

      int yOffset = ((height - fm.getHeight()) / 2) + fm.getAscent();

      Rectangle rect = new Rectangle(0, 0, 0, 0);
      if (myIconifyButton != null && myIconifyButton.getParent() != null) {
        rect = myIconifyButton.getBounds();
      }
      int titleW;

      if (leftToRight) {
        if (rect.x == 0) {
          rect.x = window.getWidth() - window.getInsets().right - 2;
        }
        titleW = rect.x - xOffset - 4;
        theTitle = SwingUtilities2.clipStringIfNecessary(rootPane, fm, theTitle, titleW);
      } else {
        titleW = xOffset - rect.x - rect.width - 4;
        theTitle = SwingUtilities2.clipStringIfNecessary(rootPane, fm, theTitle, titleW);
        xOffset -= SwingUtilities2.stringWidth(rootPane, fm, theTitle);
      }
      int titleLength = SwingUtilities2.stringWidth(rootPane, fm, theTitle);
      if (myIdeMenu == null) {
        SwingUtilities2.drawString(rootPane, g, theTitle, xOffset, yOffset);
        xOffset += leftToRight ? titleLength + 5 : -5;
      }
    }

    int w = width;
    int h = height;
    h--;
    g.setColor(UIManager.getColor("MenuBar.darcula.borderColor"));
    g.drawLine(0, h, w, h);
    h--;
    g.setColor(UIManager.getColor("MenuBar.darcula.borderShadowColor"));
    g.drawLine(0, h, w, h);
  }
  private void setState(int state, boolean updateRegardless) {
    Window wnd = getWindow();

    if (wnd != null && getWindowDecorationStyle() == JRootPane.FRAME) {
      if (myState == state && !updateRegardless) {
        return;
      }
      Frame frame = getFrame();

      if (frame != null) {
        JRootPane rootPane = getRootPane();

        if (((state & Frame.MAXIMIZED_BOTH) != 0)
            && (rootPane.getBorder() == null || (rootPane.getBorder() instanceof UIResource))
            && frame.isShowing()) {
          rootPane.setBorder(null);
        } else if ((state & Frame.MAXIMIZED_BOTH) == 0) {
          // This is a croak, if state becomes bound, this can
          // be nuked.
          rootPaneUI.installBorder(rootPane);
        }
        if (frame.isResizable()) {
          if ((state & Frame.MAXIMIZED_BOTH) != 0) {
            updateToggleButton(myRestoreAction, myMinimizeIcon);
            myMaximizeAction.setEnabled(false);
            myRestoreAction.setEnabled(true);
          } else {
            updateToggleButton(myMaximizeAction, myMaximizeIcon);
            myMaximizeAction.setEnabled(true);
            myRestoreAction.setEnabled(false);
          }
          if (myToggleButton.getParent() == null || myIconifyButton.getParent() == null) {
            add(myToggleButton);
            add(myIconifyButton);
            revalidate();
            repaint();
          }
          myToggleButton.setText(null);
        } else {
          myMaximizeAction.setEnabled(false);
          myRestoreAction.setEnabled(false);
          if (myToggleButton.getParent() != null) {
            remove(myToggleButton);
            revalidate();
            repaint();
          }
        }
      } else {
        // Not contained in a Frame
        myMaximizeAction.setEnabled(false);
        myRestoreAction.setEnabled(false);
        myIconifyAction.setEnabled(false);
        remove(myToggleButton);
        remove(myIconifyButton);
        revalidate();
        repaint();
      }
      myCloseAction.setEnabled(true);
      myState = state;
    }
  }
Beispiel #7
0
 private boolean isStuck() {
   return (unstickButton.getParent() != null);
 }