public void addAction(final Action action) { action.addPropertyChangeListener(this); final LinkLabel label = new LinkLabel(null, null, new LinkListener() { @Override public void linkSelected(final LinkLabel aSource, final Object aLinkData) { action.actionPerformed(new ActionEvent(Banner.this, ActionEvent.ACTION_PERFORMED, Action.ACTION_COMMAND_KEY)); } }) { @Override protected Color getTextColor() { return PlatformColors.BLUE; } }; label.setFont(label.getFont().deriveFont(Font.BOLD)); myActions.put(action, label); myActionsPanel.add(label); updateAction(action); }
private JComponent createStrategyPanel() { final JPanel labelPanel = new JPanel(new BorderLayout()); labelPanel.setBackground(myTree.getBackground()); final LinkLabel<String> linkLabel = new LinkLabel<String>("Edit all targets", null); linkLabel.setBorder(new EmptyBorder(2, 2, 2, 2)); linkLabel.setListener(new LinkListener<String>() { @Override public void linkSelected(LinkLabel aSource, String aLinkData) { if (linkLabel.isEnabled()) { startSyncEditing(); } } }, null); myTree.addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { Boolean editMode = (Boolean)evt.getNewValue(); linkLabel.setEnabled(!editMode); linkLabel.setPaintUnderline(!editMode); linkLabel.repaint(); } }); labelPanel.add(linkLabel, BorderLayout.EAST); return labelPanel; }
@Nullable @Override public JComponent createComponent() { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(myCheckbox); panel.add(myComboBox); panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP)); panel.add(new LinkLabel("Manage Scopes", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { Settings settings = Settings.KEY.getData(DataManager.getInstance().getDataContext(panel)); if (settings != null) { settings.select(settings.find(ScopeChooserConfigurable.PROJECT_SCOPES)); } } })); return panel; }
public void addAction(final Action action) { action.addPropertyChangeListener(this); final LinkLabel label = new LinkLabel(null, null, new LinkListener() { public void linkSelected(final LinkLabel aSource, final Object aLinkData) { action.actionPerformed(new ActionEvent(Banner.this, ActionEvent.ACTION_PERFORMED, Action.ACTION_COMMAND_KEY)); } }) { @Override protected Color getTextColor() { return PlatformColors.BLUE; } }; label.setFont(label.getFont().deriveFont(Font.BOLD)); myActions.put(action, label); myActionsPanel.add(label); updateAction(action); }
@Nullable @Override public JComponent createComponent() { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(myCheckbox); panel.add(myComboBox); panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP)); panel.add(new LinkLabel("Edit scopes", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { final OptionsEditor optionsEditor = OptionsEditor.KEY.getData(DataManager.getInstance().getDataContext(panel)); if (optionsEditor != null) { SearchableConfigurable configurable = optionsEditor.findConfigurableById(new ScopeChooserConfigurable(myProject).getId()); if (configurable != null) { optionsEditor.select(configurable); } } } })); return panel; }
@Override public JComponent create(final Project project) { JPanel requirementToolbar = new JPanel(new FlowLayout(FlowLayout.LEFT, 2, 2)); LinkLabel gotoRequirement = new LinkLabel("", gotoIcon); requirementToolbar.add(gotoRequirement); final EntityContentPanel requirementPanel = new EntityContentPanel(project, "requirement", requirementToolbar); gotoRequirement.setListener(new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { HierarchicalChooser popupDialog = new HierarchicalChooser(project, "requirement", false, false, true, false, null); popupDialog.setVisible(true); String idStr = popupDialog.getSelectedValue(); if(!idStr.isEmpty()) { requirementPanel.goTo(idStr); } } }, null); return requirementPanel; }
public ColumnPanel(final EntityFilterPanel parent, String entityType, String property, T value, LinkListener listener) { this.entityType = entityType; this.property = property; nameLabel = new FieldNameLabel(entityType, property, parent.project.getComponent(MetadataService.class)) { @Override public Color getForeground() { return parent.isEnabled() ? SystemColor.textText : SystemColor.textInactiveText; } }; valueLabel = new JLabel() { @Override public Color getForeground() { return parent.isEnabled() ? SystemColor.textText : SystemColor.textInactiveText; } }; setValue(value); setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); add(nameLabel); add(valueLabel); if(parent.quickRemove) { add(new LinkLabel("", IconLoader.getIcon("/actions/clean.png"), listener, this)); } }
public EntityQueryPanel(final Project project, final EntityFilterModel<EntityQuery> model, final String entityType, final Set<String> hiddenFields, String delimiter, boolean showEmptyLabel, boolean showSection, boolean showIcon, boolean quickRemove) { super(project, model, entityType, delimiter, showEmptyLabel, showSection, quickRemove, false); crossLabel = makeLabel("Cross-Filter:"); crossLabel.setVisible(false); add(crossLabel); orderLabel = makeLabel("Order By:"); orderLabel.setVisible(false); add(orderLabel); if(showIcon) { LinkLabel modifyFilterLink = new LinkLabel("", modifyFilterIcon, new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { EntityQuery updatedQuery = new EntityQueryDialog(project, entityType, model.getFilter(), "Filter:", hiddenFields).chooseQuery(); if(updatedQuery != null) { model.getFilter().copyFrom(updatedQuery); model.fireFilterUpdated(true); } } }); add(modifyFilterLink, 0); } loadMetadata(); }
public WarningPanel(JComponent comp, Color background, boolean canClose, boolean visible) { super(new FlowLayout(FlowLayout.LEFT, 2, 2)); this.component = comp; comp.setBackground(Color.YELLOW); setBackground(Color.YELLOW); setBorder(BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(2, 0, 2, 0, background), BorderFactory.createEtchedBorder())); add(new JLabel(IconLoader.getIcon("/general/balloonInformation.png"))); add(comp); if(canClose) { LinkLabel warningCloseLink = new LinkLabel("", IconLoader.getIcon("/actions/closeNew.png")); warningCloseLink.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel linkLabel, Object o) { setVisible(false); } }, null); add(warningCloseLink); } setVisible(visible); }
public DropDownAction(String text, @Nullable LinkListener<Void> listener) { super(text, null, listener); setHorizontalTextPosition(SwingConstants.LEADING); setIconTextGap(0); setIcon(new Icon() { @Override public void paintIcon(Component c, Graphics g, int x, int y) { int lineY = getUI().getBaseline(DropDownAction.this, getWidth(), getHeight()) - getIconHeight(); IconUtil.colorize(myIcon, getTextColor()).paintIcon(c, g, x - 1, lineY); } @Override public int getIconWidth() { return myIcon.getIconWidth(); } @Override public int getIconHeight() { return myIcon.getIconHeight(); } }); }
private JComponent createStrategyPanel() { final JPanel labelPanel = new JPanel(new BorderLayout()); labelPanel.setBackground(myTree.getBackground()); final LinkLabel<String> linkLabel = new LinkLabel<>("Edit all targets", null); linkLabel.setBorder(new EmptyBorder(2, 2, 2, 2)); linkLabel.setListener(new LinkListener<String>() { @Override public void linkSelected(LinkLabel aSource, String aLinkData) { if (linkLabel.isEnabled()) { startSyncEditing(); } } }, null); myTree.addPropertyChangeListener(PushLogTreeUtil.EDIT_MODE_PROP, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { Boolean editMode = (Boolean)evt.getNewValue(); linkLabel.setEnabled(!editMode); linkLabel.setPaintUnderline(!editMode); linkLabel.repaint(); } }); labelPanel.add(linkLabel, BorderLayout.EAST); return labelPanel; }
@Nullable @Override public JComponent createComponent() { final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.add(myCheckbox); panel.add(myComboBox); panel.add(Box.createHorizontalStrut(UIUtil.DEFAULT_HGAP)); panel.add(new LinkLabel("Edit scopes", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { final OptionsEditor optionsEditor = DataManager.getInstance().getDataContext(panel).getData(OptionsEditor.KEY); if (optionsEditor != null) { SearchableConfigurable configurable = optionsEditor.findConfigurableById(new ScopeChooserConfigurable(myProject).getId()); if (configurable != null) { optionsEditor.select(configurable); } } } })); return panel; }
private static void updateLabel(@NotNull final JLabel label, @NotNull final Color bgColor, @Nullable final LinkListener listener, @Nullable Object linkData) { label.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); label.setOpaque(true); label.setBackground(bgColor); if (label instanceof LinkLabel) { ((LinkLabel)label).setListener(listener, linkData); } }
private static JPanel createFooterPanel() { JLabel versionLabel = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName() + " " + ApplicationInfo.getInstance().getFullVersion() + " Build " + ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode()); makeSmallFont(versionLabel); versionLabel.setForeground(WelcomeScreenColors.FOOTER_FOREGROUND); JPanel footerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); footerPanel.setBackground(WelcomeScreenColors.FOOTER_BACKGROUND); footerPanel.setBorder(new EmptyBorder(2, 5, 2, 5) { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor(WelcomeScreenColors.BORDER_COLOR); g.drawLine(x, y, x + width, y); } }); footerPanel.add(versionLabel); footerPanel.add(makeSmallFont(new JLabel(". "))); footerPanel.add(makeSmallFont(new LinkLabel("Check", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { UpdateChecker.updateAndShowResult(null, null); } }))); footerPanel.add(makeSmallFont(new JLabel(" for updates now."))); return footerPanel; }
private void buildInProcessCount() { removeAll(); setLayout(new BorderLayout()); final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0)); progressCountPanel.setOpaque(false); String processWord = myOriginals.size() == 1 ? " process" : " processes"; final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() { @Override public void linkSelected(final LinkLabel aSource, final Object aLinkData) { triggerPopupShowing(); } }); if (SystemInfo.isMac) label.setFont(JBUI.Fonts.label(11)); label.setOpaque(false); final Wrapper labelComp = new Wrapper(label); labelComp.setOpaque(false); progressCountPanel.add(labelComp, BorderLayout.CENTER); //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder()); progressCountPanel.add(myProgressIcon, BorderLayout.WEST); add(myRefreshAndInfoPanel, BorderLayout.CENTER); progressCountPanel.setBorder(JBUI.Borders.emptyRight(4)); add(progressCountPanel, BorderLayout.EAST); revalidate(); repaint(); }
private void createUIComponents() { AnAction action = ActionManager.getInstance().getAction(XDebuggerActions.VIEW_BREAKPOINTS); String shortcutText = action != null ? KeymapUtil.getFirstKeyboardShortcutText(action) : null; String text = shortcutText != null ? "More (" + shortcutText + ")" : "More"; myShowMoreOptionsLink = new LinkLabel(text, null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { if (myDelegate != null) { myDelegate.more(); } } }); }
@NotNull public static LinkLabel createRegExLink(@NotNull String title, @Nullable final Component owner, @Nullable final Logger logger) { final Runnable action = createRegExLinkRunnable(owner, logger); return new LinkLabel<Object>(title, null, new LinkListener<Object>() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { action.run(); } }); }
private static void updateLabel(@NotNull JLabel label, @NotNull Color bgColor, @Nullable LinkListener listener, @Nullable Object linkData) { label.setBorder(BorderFactory.createEmptyBorder(3, 5, 3, 5)); label.setOpaque(true); label.setBackground(bgColor); if (label instanceof LinkLabel) { //noinspection ConstantConditions ((LinkLabel)label).setListener(listener, linkData); } }
@Override protected JComponent createCenterPanel() { JLabel description = new JBLabel( "<html>You are about to commit CRLF line separators to the Git repository.<br/>" + "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE + "</code> to avoid line separator issues.</html>"); JLabel additionalDescription = new JBLabel( "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" + "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL); JLabel readMore = new LinkLabel("Read more", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { BrowserUtil.browse("https://help.github.com/articles/dealing-with-line-endings"); } }); JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT); myDontWarn = new JBCheckBox("Don't warn again"); myDontWarn.setMnemonic('w'); JPanel rootPanel = new JPanel(new GridBagLayout()); GridBag g = new GridBag() .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)) .setDefaultAnchor(GridBagConstraints.LINE_START) .setDefaultFill(GridBagConstraints.HORIZONTAL); rootPanel.add(icon, g.nextLine().next().coverColumn(4)); rootPanel.add(description, g.next()); rootPanel.add(readMore, g.nextLine().next().next()); rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP)); rootPanel.add(myDontWarn, g.nextLine().next().next().insets(0, 0, 0, 0)); return rootPanel; }
public Hyperlink() { super("Hyperlink", null); super.setListener(new LinkListener<Object>() { @Override public void linkSelected(final LinkLabel aSource, final Object aLinkData) { notifyActionListeners(); } }, null); // Make our link focusable via the keyboard (Tab key) super.setFocusable(true); }
private void createUIComponents() { linkLabel = new LinkLabel("Visit the Apple iOS Developer Center", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { try { Desktop.getDesktop().browse(new URI("https://developer.apple.com/devcenter/ios/index.action")); } catch (URISyntaxException | IOException ex) { //It looks like there's a problem } } }); }
@NotNull private LinkLabel createLinkLabel() { final LinkLabel showMoreLink = new LinkLabel("Powered by Yandex.Translator", null); LinkListener showMoreListener = new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { BrowserUtil.browse("http://translate.yandex.com/"); } }; showMoreLink.setListener(showMoreListener, null); return showMoreLink; }
private static JPanel createFooterPanel() { JLabel versionLabel = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName() + " " + ApplicationInfo.getInstance().getFullVersion() + " Build " + ApplicationInfo.getInstance().getBuild().asStringWithoutProductCode()); makeSmallFont(versionLabel); versionLabel.setForeground(WelcomeScreenColors.FOOTER_FOREGROUND); JPanel footerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); footerPanel.setBackground(WelcomeScreenColors.FOOTER_BACKGROUND); footerPanel.setBorder(new EmptyBorder(2, 5, 2, 5) { @Override public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { g.setColor(WelcomeScreenColors.BORDER_COLOR); g.drawLine(x, y, x + width, y); } }); footerPanel.add(versionLabel); footerPanel.add(makeSmallFont(new JLabel(". "))); footerPanel.add(makeSmallFont(new LinkLabel("Check", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { CheckForUpdateAction.actionPerformed(null, true, null, UpdateSettings.getInstance()); } }))); footerPanel.add(makeSmallFont(new JLabel(" for updates now."))); return footerPanel; }
private void buildInProcessCount() { removeAll(); setLayout(new BorderLayout()); final JPanel progressCountPanel = new JPanel(new BorderLayout(0, 0)); progressCountPanel.setOpaque(false); String processWord = myOriginals.size() == 1 ? " process" : " processes"; final LinkLabel label = new LinkLabel(myOriginals.size() + processWord + " running...", null, new LinkListener() { @Override public void linkSelected(final LinkLabel aSource, final Object aLinkData) { triggerPopupShowing(); } }); if (SystemInfo.isMac) label.setFont(UIUtil.getLabelFont().deriveFont(11.0f)); label.setOpaque(false); final Wrapper labelComp = new Wrapper(label); labelComp.setOpaque(false); progressCountPanel.add(labelComp, BorderLayout.CENTER); //myProgressIcon.setBorder(new IdeStatusBarImpl.MacStatusBarWidgetBorder()); progressCountPanel.add(myProgressIcon, BorderLayout.WEST); add(myRefreshAndInfoPanel, BorderLayout.CENTER); progressCountPanel.setBorder(new EmptyBorder(0, 0, 0, 4)); add(progressCountPanel, BorderLayout.EAST); revalidate(); repaint(); }
void setAddRootLinkHandler(final Runnable handler) { myAddLabel.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { handler.run(); } }, null); }
@Override protected JComponent createCenterPanel() { JLabel description = new JBLabel( "<html>You are about to commit CRLF line separators to the Git repository.<br/>" + "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE + "</code> to avoid line separator issues.</html>"); JLabel additionalDescription = new JBLabel( "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" + "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL); JLabel readMore = new LinkLabel("Read more", null, new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { BrowserUtil.launchBrowser("https://help.github.com/articles/dealing-with-line-endings"); } }); JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT); myDontWarn = new JBCheckBox("Don't warn again"); myDontWarn.setMnemonic('w'); JPanel rootPanel = new JPanel(new GridBagLayout()); GridBag g = new GridBag() .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)) .setDefaultAnchor(GridBagConstraints.LINE_START) .setDefaultFill(GridBagConstraints.HORIZONTAL); rootPanel.add(icon, g.nextLine().next().coverColumn(4)); rootPanel.add(description, g.next()); rootPanel.add(readMore, g.nextLine().next().next()); rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP)); rootPanel.add(myDontWarn, g.nextLine().next().next().insets(0, 0, 0, 0)); return rootPanel; }
public ErrorDialog(String message, String detail) { super(JOptionPane.getRootFrame(), "Error", true); JButton ok = new JButton("OK"); ok.addActionListener(this); JPanel buttons = new JPanel(new FlowLayout(FlowLayout.CENTER)); buttons.add(ok); JTextPane detailPane = new JTextPane(); detailPane.setText(detail); final JBScrollPane pane = new JBScrollPane(detailPane); pane.setPreferredSize(new Dimension(600, 300)); getContentPane().add(buttons, BorderLayout.SOUTH); final JPanel content = new JPanel(); content.add(new JLabel(IconLoader.getIcon("/general/errorDialog.png"))); content.add(new JLabel(message)); final LinkLabel showMoreLink = new LinkLabel("(show details)", null); LinkListener showMoreListener = new LinkListener() { public void linkSelected(LinkLabel aSource, Object aLinkData) { content.remove(showMoreLink); getContentPane().add(pane, BorderLayout.CENTER); setResizable(true); pack(); } }; showMoreLink.setListener(showMoreListener, null); content.add(showMoreLink); getContentPane().add(content, BorderLayout.NORTH); setDefaultCloseOperation(DISPOSE_ON_CLOSE); pack(); setResizable(false); setLocationRelativeTo(getOwner()); }
public TreePanel(Project project, HierarchicalEntityModel treeModel) { super(new BorderLayout()); JPanel filerPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); filter = new JTextField(16); filter.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { filterChanged(); } }); filerPanel.add(filter); LinkLabel filterIcon = new LinkLabel("", findIcon); filterIcon.setListener(new LinkListener() { public void linkSelected(LinkLabel linkLabel, Object o) { filterChanged(); } }, null); filterIcon.setBorder(new EmptyBorder(0, 2, 0, 0)); filerPanel.add(filterIcon); add(filerPanel, BorderLayout.NORTH); tree = new FilterableTree(project, treeModel); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); tree.setCellRenderer(new ALMTreeCellRenderer()); JPanel panel = new JPanel(new BorderLayout()); panel.add(new JBScrollPane(tree), BorderLayout.CENTER); EntityStatusPanel status = new EntityStatusPanel(project); treeModel.setStatus(status); status.setBorder(BorderFactory.createEtchedBorder()); panel.add(status, BorderLayout.SOUTH); add(panel, BorderLayout.CENTER); }
@Nonnull public static LinkLabel createRegExLink(@Nonnull String title, @Nullable final Component owner, @Nullable final Logger logger) { return new LinkLabel(title, null, new LinkListener() { JBPopup helpPopup; @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { try { if (helpPopup != null && !helpPopup.isDisposed() && helpPopup.isVisible()) { return; } helpPopup = createRegExHelpPopup(); Disposer.register(helpPopup, new Disposable() { @Override public void dispose() { destroyPopup(); } }); helpPopup.showInCenterOf(owner); } catch (BadLocationException e) { if (logger != null) logger.info(e); } } private void destroyPopup() { helpPopup = null; } }); }
@Override public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { final JCheckBox checkBox = new JCheckBox(VcsBundle.message("before.checkin.new.todo.check", "")); return new RefreshableOnComponent() { @Override public JComponent getComponent() { JPanel panel = new JPanel(new BorderLayout(4, 0)); panel.add(checkBox, BorderLayout.WEST); setFilterText(myConfiguration.myTodoPanelSettings.todoFilterName); if (myConfiguration.myTodoPanelSettings.todoFilterName != null) { myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.todoFilterName); } final Consumer<TodoFilter> consumer = new Consumer<TodoFilter>() { @Override public void consume(TodoFilter todoFilter) { myTodoFilter = todoFilter; final String name = todoFilter == null ? null : todoFilter.getName(); myConfiguration.myTodoPanelSettings.todoFilterName = name; setFilterText(name); } }; final LinkLabel linkLabel = new LinkLabel("Configure", null); linkLabel.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group); popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight()); } }, null); panel.add(linkLabel, BorderLayout.CENTER); CheckinHandlerUtil.disableWhenDumb(myProject, checkBox, "TODO check is impossible until indices are up-to-date"); return panel; } private void setFilterText(final String filterName) { if (filterName == null) { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", IdeBundle.message("action.todo.show.all"))); } else { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", "Filter: " + filterName)); } } @Override public void refresh() { } @Override public void saveState() { myConfiguration.CHECK_NEW_TODO = checkBox.isSelected(); } @Override public void restoreState() { checkBox.setSelected(myConfiguration.CHECK_NEW_TODO); } }; }
public MyLinkLabel(final int height, final String text, final LinkListener linkListener) { super(text, null, linkListener); myHeight = height; }
@Override public RefreshableOnComponent getBeforeCheckinConfigurationPanel() { final JCheckBox checkBox = new JCheckBox(VcsBundle.message("before.checkin.new.todo.check", "")); return new RefreshableOnComponent() { @Override public JComponent getComponent() { JPanel panel = new JPanel(new BorderLayout(4, 0)); panel.add(checkBox, BorderLayout.WEST); setFilterText(myConfiguration.myTodoPanelSettings.getTodoFilterName()); if (myConfiguration.myTodoPanelSettings.getTodoFilterName() != null) { myTodoFilter = TodoConfiguration.getInstance().getTodoFilter(myConfiguration.myTodoPanelSettings.getTodoFilterName()); } final Consumer<TodoFilter> consumer = new Consumer<TodoFilter>() { @Override public void consume(TodoFilter todoFilter) { myTodoFilter = todoFilter; final String name = todoFilter == null ? null : todoFilter.getName(); myConfiguration.myTodoPanelSettings.setTodoFilterName(name); setFilterText(name); } }; final LinkLabel linkLabel = new LinkLabel("Configure", null); linkLabel.setListener(new LinkListener() { @Override public void linkSelected(LinkLabel aSource, Object aLinkData) { DefaultActionGroup group = SetTodoFilterAction.createPopupActionGroup(myProject, myConfiguration.myTodoPanelSettings, consumer); ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(ActionPlaces.TODO_VIEW_TOOLBAR, group); popupMenu.getComponent().show(linkLabel, 0, linkLabel.getHeight()); } }, null); panel.add(linkLabel, BorderLayout.CENTER); refreshEnable(checkBox); return panel; } private void setFilterText(final String filterName) { if (filterName == null) { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", IdeBundle.message("action.todo.show.all"))); } else { checkBox.setText(VcsBundle.message("before.checkin.new.todo.check", "Filter: " + filterName)); } } @Override public void refresh() { } @Override public void saveState() { myConfiguration.CHECK_NEW_TODO = checkBox.isSelected(); } @Override public void restoreState() { checkBox.setSelected(myConfiguration.CHECK_NEW_TODO); } }; }
public WherePanel(String entityType, String prop, String value, LinkListener listener) { super(EntityFilterPanel.this, entityType, prop, value, listener); }
public OrderPanel(EntityFilterPanel parent, String entityType, String prop, SortOrder value, LinkListener listener) { super(parent, entityType, prop, value, listener); }
private JLabel createDirectionLabel(SortOrder order, final LinkListener linkListener) { return createLinkLabel(order == SortOrder.ASCENDING ? sortAscIcon : sortDescIcon, linkListener, SwingConstants.CENTER); }