Java Code Examples for com.intellij.ui.components.panels.NonOpaquePanel#setBorder()

The following examples show how to use com.intellij.ui.components.panels.NonOpaquePanel#setBorder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InlineProgressIndicator.java    From consulo with Apache License 2.0 5 votes vote down vote up
protected void createCompactTextAndProgress() {
  JPanel textAndProgress = new NonOpaquePanel(new BorderLayout());
  textAndProgress.add(myText, BorderLayout.CENTER);

  final NonOpaquePanel progressWrapper = new NonOpaquePanel(new BorderLayout());
  progressWrapper.setBorder(JBUI.Borders.empty(0, 4));
  progressWrapper.add(myProgress, BorderLayout.CENTER);

  textAndProgress.add(progressWrapper, BorderLayout.EAST);
  myComponent.add(textAndProgress, BorderLayout.CENTER);
}
 
Example 2
Source File: RunConfigurationsComboBoxAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public JComponent createCustomComponent(final Presentation presentation) {
  ComboBoxButton button = createComboBoxButton(presentation);
  NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
  panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2));
  panel.add(button.getComponent());
  return panel;
}
 
Example 3
Source File: JSGraphQLLanguageUIProjectService.java    From js-graphql-intellij-plugin with MIT License 4 votes vote down vote up
private JComponent createHeaderComponent(FileEditor fileEditor, Editor editor, VirtualFile file) {

        final JSGraphQLEditorHeaderComponent headerComponent = new JSGraphQLEditorHeaderComponent();

        // variables & settings actions
        final DefaultActionGroup settingsActions = new DefaultActionGroup();
        settingsActions.add(new GraphQLEditConfigAction());
        settingsActions.add(new JSGraphQLToggleVariablesAction());

        final JComponent settingsToolbar = createToolbar(settingsActions);
        headerComponent.add(settingsToolbar, BorderLayout.WEST);

        // query execute
        final DefaultActionGroup queryActions = new DefaultActionGroup();
        final AnAction executeGraphQLAction = ActionManager.getInstance().getAction(JSGraphQLExecuteEditorAction.class.getName());
        queryActions.add(executeGraphQLAction);
        final JComponent queryToolbar = createToolbar(queryActions);

        // configured endpoints combo box
        final List<GraphQLConfigEndpoint> endpoints = GraphQLConfigManager.getService(myProject).getEndpoints(file);
        final JSGraphQLEndpointsModel endpointsModel = new JSGraphQLEndpointsModel(endpoints, PropertiesComponent.getInstance(myProject));
        final ComboBox endpointComboBox = new ComboBox(endpointsModel);
        endpointComboBox.setToolTipText("GraphQL endpoint");
        editor.putUserData(JS_GRAPH_QL_ENDPOINTS_MODEL, endpointsModel);
        final JPanel endpointComboBoxPanel = new JPanel(new BorderLayout());
        endpointComboBoxPanel.setBorder(BorderFactory.createEmptyBorder(1, 2, 2, 2));
        endpointComboBoxPanel.add(endpointComboBox);

        // splitter to resize endpoints
        final OnePixelSplitter splitter = new OnePixelSplitter(false, .25F);
        splitter.setBorder(BorderFactory.createEmptyBorder());
        splitter.setFirstComponent(endpointComboBoxPanel);
        splitter.setSecondComponent(queryToolbar);
        splitter.setHonorComponentsMinimumSize(true);
        splitter.setAndLoadSplitterProportionKey("JSGraphQLEndpointSplitterProportion");
        splitter.setOpaque(false);
        splitter.getDivider().setOpaque(false);

        headerComponent.add(splitter, BorderLayout.CENTER);

        // variables editor
        final LightVirtualFile virtualFile = new LightVirtualFile(GRAPH_QL_VARIABLES_JSON, JsonFileType.INSTANCE, "");
        final FileEditor variablesFileEditor = PsiAwareTextEditorProvider.getInstance().createEditor(myProject, virtualFile);
        final EditorEx variablesEditor = (EditorEx) ((TextEditor) variablesFileEditor).getEditor();
        virtualFile.putUserData(IS_GRAPH_QL_VARIABLES_VIRTUAL_FILE, Boolean.TRUE);
        variablesEditor.setPlaceholder("{ variables }");
        variablesEditor.setShowPlaceholderWhenFocused(true);
        variablesEditor.getSettings().setRightMarginShown(false);
        variablesEditor.getSettings().setAdditionalLinesCount(0);
        variablesEditor.getSettings().setShowIntentionBulb(false);
        variablesEditor.getSettings().setFoldingOutlineShown(false);
        variablesEditor.getSettings().setLineNumbersShown(false);
        variablesEditor.getSettings().setLineMarkerAreaShown(false);
        variablesEditor.getSettings().setCaretRowShown(false);
        variablesEditor.putUserData(JS_GRAPH_QL_ENDPOINTS_MODEL, endpointsModel);

        // hide variables by default
        variablesEditor.getComponent().setVisible(false);

        // link the query and variables editor together
        variablesEditor.putUserData(GRAPH_QL_QUERY_EDITOR, editor);
        editor.putUserData(GRAPH_QL_VARIABLES_EDITOR, variablesEditor);

        final NonOpaquePanel variablesPanel = new NonOpaquePanel(variablesFileEditor.getComponent());
        variablesPanel.setBorder(IdeBorderFactory.createBorder(SideBorder.TOP));

        Disposer.register(fileEditor, variablesFileEditor);

        headerComponent.add(variablesPanel, BorderLayout.SOUTH);

        return headerComponent;
    }
 
Example 4
Source File: InlineProgressIndicator.java    From consulo with Apache License 2.0 4 votes vote down vote up
public InlineProgressIndicator(boolean compact, @Nonnull TaskInfo processInfo) {
  myCompact = compact;
  myInfo = processInfo;

  myProgress = new JProgressBar(SwingConstants.HORIZONTAL);
  UIUtil.applyStyle(UIUtil.ComponentStyle.MINI, myProgress);

  myComponent = new MyComponent(compact, myProcessName);
  myEastButtons = createEastButtons();
  if (myCompact) {
    myComponent.setLayout(new BorderLayout(2, 0));
    createCompactTextAndProgress();
    myComponent.add(createButtonPanel(myEastButtons.map(b -> b.button)), BorderLayout.EAST);
    myComponent.setToolTipText(processInfo.getTitle() + ". " + IdeBundle.message("progress.text.clickToViewProgressWindow"));
  }
  else {
    myComponent.setLayout(new BorderLayout());
    myProcessName.setText(processInfo.getTitle());
    myComponent.add(myProcessName, BorderLayout.NORTH);
    myProcessName.setForeground(UIUtil.getPanelBackground().brighter().brighter());
    myProcessName.setBorder(JBUI.Borders.empty(2));

    final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout());
    content.setBorder(JBUI.Borders.empty(2, 2, 2, myInfo.isCancellable() ? 2 : 4));
    myComponent.add(content, BorderLayout.CENTER);

    content.add(createButtonPanel(myEastButtons.map(b -> withBorder(b.button))), BorderLayout.EAST);
    content.add(myText, BorderLayout.NORTH);
    content.add(myProgress, BorderLayout.CENTER);
    content.add(myText2, BorderLayout.SOUTH);

    myComponent.setBorder(JBUI.Borders.empty(2));
  }
  UIUtil.uiTraverser(myComponent).forEach(o -> ((JComponent)o).setOpaque(false));

  if (!myCompact) {
    myProcessName.recomputeSize();
    myText.recomputeSize();
    myText2.recomputeSize();
  }
}