protected final void showProgress(String message) {
   myProgressMessage.setText(message);
   if (myProgressPanel.getParent() == null) {
     myGlassLayer.setEnabled(false);
     myProgressIcon.resume();
     myLayeredPane.add(myProgressPanel, LAYER_PROGRESS);
     myLayeredPane.repaint();
   }
 }
  ParameterInfoComponent(
      Object[] objects,
      Editor editor,
      @NotNull ParameterInfoHandler handler,
      boolean requestFocus) {
    super(new BorderLayout());
    myRequestFocus = requestFocus;

    if (!ApplicationManager.getApplication().isUnitTestMode()) {
      JComponent editorComponent = editor.getComponent();
      JLayeredPane layeredPane = editorComponent.getRootPane().getLayeredPane();
      myWidthLimit = layeredPane.getWidth();
    }

    NORMAL_FONT = UIUtil.getLabelFont();
    BOLD_FONT = NORMAL_FONT.deriveFont(Font.BOLD);

    myObjects = objects;

    setBackground(BACKGROUND_COLOR);

    myHandler = handler;
    myPanels = new OneElementComponent[myObjects.length];
    final JPanel panel = new JPanel(new GridBagLayout());
    for (int i = 0; i < myObjects.length; i++) {
      myPanels[i] = new OneElementComponent();
      panel.add(
          myPanels[i],
          new GridBagConstraints(
              0,
              i,
              1,
              1,
              1,
              0,
              GridBagConstraints.WEST,
              GridBagConstraints.HORIZONTAL,
              new Insets(0, 0, 0, 0),
              0,
              0));
    }
    if (myRequestFocus) {
      AccessibleContextUtil.setName(
          this, "Parameter Info. Press TAB to navigate through each element. Press ESC to close.");
    }

    final JScrollPane pane = ScrollPaneFactory.createScrollPane(panel);
    pane.setBorder(null);
    pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    add(pane, BorderLayout.CENTER);

    myCurrentParameterIndex = -1;
  }
 private static boolean hasMnemonicInBalloons(Container container, int code) {
   final Component parent = UIUtil.findUltimateParent(container);
   if (parent instanceof RootPaneContainer) {
     final JLayeredPane pane = ((RootPaneContainer) parent).getLayeredPane();
     for (Component component : pane.getComponents()) {
       if (component instanceof ComponentWithMnemonics
           && component instanceof Container
           && hasMnemonic((Container) component, code)) {
         return true;
       }
     }
   }
   return false;
 }
 protected final void showDesignerCard() {
   myErrorMessages.removeAll();
   myErrorStack.setText(null);
   myLayeredPane.revalidate();
   myHorizontalCaption.update();
   myVerticalCaption.update();
   myLayout.show(this, DESIGNER_CARD);
 }
 protected final void hideProgress() {
   myGlassLayer.setEnabled(true);
   myProgressIcon.suspend();
   myLayeredPane.remove(myProgressPanel);
 }
  private void createDesignerCard() {
    myLayeredPane = new MyLayeredPane();

    mySurfaceArea =
        new ComponentEditableArea(myLayeredPane) {
          @Override
          protected void fireSelectionChanged() {
            super.fireSelectionChanged();
            myLayeredPane.revalidate();
            myLayeredPane.repaint();
          }

          @Override
          public RadComponent findTarget(int x, int y, @Nullable ComponentTargetFilter filter) {
            if (myRootComponent != null) {
              FindComponentVisitor visitor = new FindComponentVisitor(myLayeredPane, filter, x, y);
              myRootComponent.accept(visitor, false);
              return visitor.getResult();
            }
            return null;
          }

          @Override
          public InputTool findTargetTool(int x, int y) {
            return myDecorationLayer.findTargetTool(x, y);
          }

          @Override
          public void showSelection(boolean value) {
            myDecorationLayer.showSelection(value);
          }

          @Override
          public ComponentDecorator getRootSelectionDecorator() {
            return DesignerEditorPanel.this.getRootSelectionDecorator();
          }

          @Nullable
          public EditOperation processRootOperation(OperationContext context) {
            return DesignerEditorPanel.this.processRootOperation(context);
          }

          @Override
          public FeedbackLayer getFeedbackLayer() {
            return myFeedbackLayer;
          }

          @Override
          public RadComponent getRootComponent() {
            return myRootComponent;
          }
        };

    myPaletteListener =
        new ListSelectionListener() {
          @Override
          public void valueChanged(ListSelectionEvent e) {
            if (DesignerToolWindowManager.getInstance(getProject()).getActiveDesigner()
                == DesignerEditorPanel.this) {
              Item paletteItem = (Item) PaletteManager.getInstance(getProject()).getActiveItem();
              if (paletteItem != null) {
                myToolProvider.setActiveTool(
                    new CreationTool(true, createCreationFactory(paletteItem)));
              } else if (myToolProvider.getActiveTool() instanceof CreationTool) {
                myToolProvider.loadDefaultTool();
              }
            }
          }
        };

    myToolProvider =
        new ToolProvider() {
          @Override
          public void loadDefaultTool() {
            setActiveTool(new SelectionTool());
          }

          @Override
          public void setActiveTool(InputTool tool) {
            if (getActiveTool() instanceof CreationTool && !(tool instanceof CreationTool)) {
              PaletteManager.getInstance(getProject()).clearActiveItem();
            }
            super.setActiveTool(tool);
          }

          @Override
          public boolean execute(
              final ThrowableRunnable<Exception> operation,
              String command,
              final boolean updateProperties) {
            final boolean[] is = {true};
            CommandProcessor.getInstance()
                .executeCommand(
                    getProject(),
                    new Runnable() {
                      public void run() {
                        is[0] = DesignerEditorPanel.this.execute(operation, updateProperties);
                      }
                    },
                    command,
                    null);
            return is[0];
          }

          @Override
          public void execute(final List<EditOperation> operations, String command) {
            CommandProcessor.getInstance()
                .executeCommand(
                    getProject(),
                    new Runnable() {
                      public void run() {
                        DesignerEditorPanel.this.execute(operations);
                      }
                    },
                    command,
                    null);
          }

          @Override
          public void showError(@NonNls String message, Throwable e) {
            DesignerEditorPanel.this.showError(message, e);
          }
        };

    myGlassLayer = new GlassLayer(myToolProvider, mySurfaceArea);
    myLayeredPane.add(myGlassLayer, LAYER_GLASS);

    myDecorationLayer = new DecorationLayer(mySurfaceArea);
    myLayeredPane.add(myDecorationLayer, LAYER_DECORATION);

    myFeedbackLayer = new FeedbackLayer();
    myLayeredPane.add(myFeedbackLayer, LAYER_FEEDBACK);

    JPanel content = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.VERTICAL;

    myVerticalCaption = new CaptionPanel(this, false);
    content.add(myVerticalCaption, gbc);

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    myHorizontalCaption = new CaptionPanel(this, true);
    content.add(myHorizontalCaption, gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;

    myScrollPane = ScrollPaneFactory.createScrollPane(myLayeredPane);
    myScrollPane.setBackground(Color.WHITE);
    content.add(myScrollPane, gbc);

    myHorizontalCaption.attachToScrollPane(myScrollPane);
    myVerticalCaption.attachToScrollPane(myScrollPane);

    myActionPanel = new DesignerActionPanel(this, myGlassLayer);

    myDesignerCard = new JPanel(new FillLayout());
    myDesignerCard.add(myActionPanel.getToolbarComponent());
    myDesignerCard.add(content);
    add(myDesignerCard, DESIGNER_CARD);

    PaletteManager.getInstance(getProject()).addSelectionListener(myPaletteListener);

    mySourceSelectionListener =
        new ComponentSelectionListener() {
          @Override
          public void selectionChanged(EditableArea area) {
            storeSourceSelectionState();
          }
        };
    mySurfaceArea.addSelectionListener(mySourceSelectionListener);
  }
  /** Initializes the layout and the ribbon. */
  private void initRibbon() {
    this.setLayout(new RibbonFrameLayout());
    this.ribbon = new JRibbon(this);
    this.add(this.ribbon, BorderLayout.NORTH);

    // this.keyTipManager = new KeyTipManager(this);
    Toolkit.getDefaultToolkit()
        .addAWTEventListener(
            new AWTEventListener() {
              private boolean prevAltModif = false;

              @Override
              public void eventDispatched(AWTEvent event) {
                Object src = event.getSource();
                if (src instanceof Component) {
                  Component c = (Component) src;
                  if ((c == JRibbonFrame.this)
                      || (SwingUtilities.getWindowAncestor(c) == JRibbonFrame.this)) {
                    if (event instanceof KeyEvent) {
                      KeyEvent keyEvent = (KeyEvent) event;
                      // System.out.println(keyEvent.getID() + ":"
                      // + keyEvent.getKeyCode());
                      switch (keyEvent.getID()) {
                        case KeyEvent.KEY_PRESSED:
                          // if (keyEvent.getKeyCode() ==
                          // KeyEvent.VK_ESCAPE) {
                          // keyTipManager.showPreviousChain();
                          // }

                          break;
                        case KeyEvent.KEY_RELEASED:
                          boolean wasAltModif = prevAltModif;
                          prevAltModif = keyEvent.getModifiersEx() == InputEvent.ALT_DOWN_MASK;
                          if (wasAltModif && keyEvent.getKeyCode() == KeyEvent.VK_ALT) break;
                          char keyChar = keyEvent.getKeyChar();
                          if (Character.isLetter(keyChar) || Character.isDigit(keyChar)) {
                            // System.out.println("Will handle key press "
                            // + keyChar);
                            KeyTipManager.defaultManager().handleKeyPress(keyChar);
                          }
                          if ((keyEvent.getKeyCode() == KeyEvent.VK_ALT)
                              || (keyEvent.getKeyCode() == KeyEvent.VK_F10)) {
                            if (keyEvent.getModifiers() != 0 || keyEvent.getModifiersEx() != 0)
                              break;
                            boolean hadPopups =
                                !PopupPanelManager.defaultManager().getShownPath().isEmpty();
                            PopupPanelManager.defaultManager().hidePopups(null);
                            if (hadPopups || KeyTipManager.defaultManager().isShowingKeyTips()) {
                              KeyTipManager.defaultManager().hideAllKeyTips();
                            } else {
                              KeyTipManager.defaultManager().showRootKeyTipChain(JRibbonFrame.this);
                            }
                          }
                          if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE) {
                            // System.out.println("In KTM");
                            KeyTipManager.defaultManager().showPreviousChain();
                          }
                          break;
                      }
                    }
                    if (event instanceof MouseEvent) {
                      MouseEvent mouseEvent = (MouseEvent) event;
                      switch (mouseEvent.getID()) {
                        case MouseEvent.MOUSE_CLICKED:
                        case MouseEvent.MOUSE_DRAGGED:
                        case MouseEvent.MOUSE_PRESSED:
                        case MouseEvent.MOUSE_RELEASED:
                          KeyTipManager.defaultManager().hideAllKeyTips();
                      }
                    }
                  }
                }
              }
            },
            AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK);

    final KeyTipLayer keyTipLayer = new KeyTipLayer();
    JRootPane rootPane = this.getRootPane();
    JLayeredPane layeredPane = rootPane.getLayeredPane();
    final LayoutManager currLM = rootPane.getLayout();
    rootPane.setLayout(
        new LayoutManager() {
          @Override
          public void addLayoutComponent(String name, Component comp) {
            currLM.addLayoutComponent(name, comp);
          }

          @Override
          public void layoutContainer(Container parent) {
            currLM.layoutContainer(parent);
            JRibbonFrame ribbonFrame = JRibbonFrame.this;
            if (ribbonFrame.getRootPane().getWindowDecorationStyle() != JRootPane.NONE)
              keyTipLayer.setBounds(ribbonFrame.getRootPane().getBounds());
            else keyTipLayer.setBounds(ribbonFrame.getRootPane().getContentPane().getBounds());
          }

          @Override
          public Dimension minimumLayoutSize(Container parent) {
            return currLM.minimumLayoutSize(parent);
          }

          @Override
          public Dimension preferredLayoutSize(Container parent) {
            return currLM.preferredLayoutSize(parent);
          }

          @Override
          public void removeLayoutComponent(Component comp) {
            currLM.removeLayoutComponent(comp);
          }
        });
    // layeredPane.setLayout(new OverlayLayout(layeredPane));
    layeredPane.add(keyTipLayer, (Integer) (JLayeredPane.DEFAULT_LAYER + 60));

    this.addWindowListener(
        new WindowAdapter() {
          @Override
          public void windowDeactivated(WindowEvent e) {
            // hide all key tips on window deactivation
            KeyTipManager keyTipManager = KeyTipManager.defaultManager();
            if (keyTipManager.isShowingKeyTips()) {
              keyTipManager.hideAllKeyTips();
            }
          }
        });

    KeyTipManager.defaultManager()
        .addKeyTipListener(
            new KeyTipManager.KeyTipListener() {
              @Override
              public void keyTipsHidden(KeyTipEvent event) {
                if (event.getSource() == JRibbonFrame.this) keyTipLayer.setVisible(false);
              }

              @Override
              public void keyTipsShown(KeyTipEvent event) {
                if (event.getSource() == JRibbonFrame.this) keyTipLayer.setVisible(true);
              }
            });

    ToolTipManager.sharedInstance().setLightWeightPopupEnabled(false);
    JPopupMenu.setDefaultLightWeightPopupEnabled(false);

    super.setIconImages(Arrays.asList(FlamingoUtilities.getBlankImage(16, 16)));
  }
  private void jbInit() throws Exception {
    setIconImage(nu.fw.jeti.images.StatusIcons.getImageIcon("jeti").getImage());
    // btnRegister.setMnemonic('R');
    // btnRegister.setText(I18N.gettext("main.manageservices.Register"));
    I18N.setTextAndMnemonic("main.manageservices.Register", btnRegister);
    btnRegister.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            btnRegister_actionPerformed(e);
          }
        });
    btnCancel.setAlignmentX(0.5f);
    Action cancelAction =
        new AbstractAction(I18N.gettext("Cancel")) {
          public void actionPerformed(ActionEvent e) {
            btnCancel_actionPerformed(e);
          }
        };
    btnCancel.setAction(cancelAction);

    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    JLayeredPane layeredPane = getLayeredPane();
    layeredPane.getActionMap().put("cancel", cancelAction);
    layeredPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(stroke, "cancel");

    addWindowListener(
        new java.awt.event.WindowAdapter() {
          public void windowClosing(WindowEvent e) {
            backend.removeListener(RegisterListener.class, RegisterServices.this);
            dispose();
          }
        });
    this.setTitle(I18N.gettext("main.manageservices.Manage_Services"));
    // DefaultListModel listModel = new DefaultListModel();
    /*
    for(Iterator i = services.listIterator();i.hasNext();)
    {
    	listModel.addElement((String)((Object[])i.next())[0]);
    }
    */
    jList1 = new JList(new DefaultListModel());
    jList1.addListSelectionListener(
        new javax.swing.event.ListSelectionListener() {
          public void valueChanged(ListSelectionEvent e) {
            jList1_valueChanged(e);
          }
        });
    jList1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    btnChangeServer.setAlignmentX(0.5f);
    // btnChangeServer.setMnemonic('S');
    // btnChangeServer.setText(I18N.gettext("main.manageservices.Change_Server"));
    I18N.setTextAndMnemonic("main.manageservices.Change_Server", btnChangeServer);
    btnChangeServer.addActionListener(
        new java.awt.event.ActionListener() {
          public void actionPerformed(ActionEvent e) {
            btnChangeServer_actionPerformed(e);
          }
        });
    JLabel label = new JLabel();
    label.setAlignmentX(0.5f);
    // jLabel1.setText(I18N.gettext("main.manageservices.Server"));
    I18N.setTextAndMnemonic("main.manageservices.Server", label);
    label.setLabelFor(txtServer);
    this.getContentPane().add(jList1, BorderLayout.CENTER);
    this.getContentPane().add(jPanel1, BorderLayout.SOUTH);
    // jPanel1.add(btnRegister, null);
    jPanel1.setLayout(new BoxLayout(jPanel1, BoxLayout.Y_AXIS));
    jPanel1.add(label);
    jPanel1.add(txtServer);
    jPanel1.add(btnChangeServer);
    jPanel1.add(btnCancel);
    pack();
  }