consulo.ui.Component Java Examples

The following examples show how to use consulo.ui.Component. 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: WebDockLayoutImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void removeComponent(com.vaadin.ui.Component c) {
  DockLayoutState.Constraint constraint = null;

  for (Map.Entry<DockLayoutState.Constraint, com.vaadin.ui.Component> entry : myChildren.entrySet()) {
    if (entry.getValue() == c) {
      constraint = entry.getKey();
    }
  }

  if (constraint != null) {
    myChildren.remove(constraint);
  }

  super.removeComponent(c);
}
 
Example #2
Source File: WebToolWindowPanelImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void setComponent(@Nullable ToolWindowInternalDecorator d, @Nonnull ToolWindowAnchor anchor, final float weight) {
  WebToolWindowInternalDecorator decorator = (WebToolWindowInternalDecorator)d;

  consulo.ui.Component component = decorator == null ? null : decorator.getComponent();

  if (ToolWindowAnchor.TOP == anchor) {
    //myVerticalSplitter.setFirstComponent(component);
    //myVerticalSplitter.setFirstSize((int)(myLayeredPane.getHeight() * weight));
  }
  else if (ToolWindowAnchor.LEFT == anchor) {
    myHorizontalSplitter.setFirstComponent(component);
    //myHorizontalSplitter.setFirstSize((int)(myLayeredPane.getWidth() * weight));
  }
  else if (ToolWindowAnchor.BOTTOM == anchor) {
    //myVerticalSplitter.setLastComponent(component);
    //myVerticalSplitter.setLastSize((int)(myLayeredPane.getHeight() * weight));
  }
  else if (ToolWindowAnchor.RIGHT == anchor) {
    myHorizontalSplitter.setSecondComponent(component);
    //myHorizontalSplitter.setLastSize((int)(myLayeredPane.getWidth() * weight));
  }
  else {
    //LOG.error("unknown anchor: " + anchor);
  }
}
 
Example #3
Source File: WebDockLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
public void removeAll() {
  for (com.vaadin.ui.Component child : new ArrayList<>(myChildren.values())) {
    removeComponent(child);
  }
  markAsDirty();
}
 
Example #4
Source File: LabeledComponents.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
public static Component leftWithRight(@Nonnull String text, @Nonnull PseudoComponent component) {
  DockLayout dock = DockLayout.create();
  dock.left(Label.create(text));
  dock.right(component);
  return dock;
}
 
Example #5
Source File: SandServerType.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public UnnamedConfigurable createConfigurable(@Nonnull SandServerConfiguration configuration) {
  return new UnnamedConfigurable() {
    @RequiredUIAccess
    @Override
    public boolean isModified() {
      return false;
    }

    @RequiredUIAccess
    @Nullable
    @Override
    public Component createUIComponent() {
      return Label.create("Sand stub UI");
    }

    @RequiredUIAccess
    @Override
    public void apply() throws ConfigurationException {

    }

    @RequiredUIAccess
    @Override
    public void reset() {

    }
  };
}
 
Example #6
Source File: WebToolWindowManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void initAll(List<FinalizableCommand> commandsList) {
  appendUpdateToolWindowsPaneCmd(commandsList);

  Component editorComponent = getEditorComponent(myProject);
  //myEditorComponentFocusWatcher.install(editorComponent);

  appendSetEditorComponentCmd(editorComponent, commandsList);
  //if (myEditorWasActive && editorComponent instanceof DesktopEditorsSplitters) {
  //  activateEditorComponentImpl(commandsList, true);
  //}
}
 
Example #7
Source File: LabeledComponents.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
public static Component left(@Nonnull String text, @Nonnull PseudoComponent component) {
  if (!StringUtil.endsWithChar(text, ':')) {
    text += ": ";
  }

  HorizontalLayout horizontal = HorizontalLayout.create(5);
  horizontal.add(Label.create(text));
  horizontal.add(component);
  return horizontal;
}
 
Example #8
Source File: Unity3dScriptMutableModuleExtension.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createConfigurationComponent(@Nonnull Disposable disposable, @Nonnull Runnable runnable)
{
	return null;
}
 
Example #9
Source File: WebDockLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public DockLayout right(@Nonnull Component component) {
  getVaadinComponent().placeAt(component, DockLayoutState.Constraint.RIGHT);
  return this;
}
 
Example #10
Source File: TargetVaddin.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Contract("null -> null")
public static com.vaadin.ui.Component to(@Nullable Component component) {
  if (component == null) {
    return null;
  }

  if (component instanceof ToVaddinComponentWrapper) {
    return ((ToVaddinComponentWrapper)component).toVaadinComponent();
  }

  throw new UnsupportedOperationException("Component " + component + " is not impl ToVaddinComponentWrapper");
}
 
Example #11
Source File: DebuggerConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createUIComponent() {
  compute();
  return myRootConfigurable != null ? myRootConfigurable.createUIComponent() : null;
}
 
Example #12
Source File: CodeFoldingConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
protected Component createLayout(PropertyBuilder propertyBuilder) {
  VerticalLayout verticalLayout = VerticalLayout.create();

  CheckBox outlineBox = CheckBox.create(ApplicationBundle.message("checkbox.show.code.folding.outline"));
  verticalLayout.add(outlineBox);
  EditorSettingsExternalizable externalizable = EditorSettingsExternalizable.getInstance();
  propertyBuilder.add(outlineBox, externalizable::isFoldingOutlineShown, externalizable::setFoldingOutlineShown);
  return verticalLayout;
}
 
Example #13
Source File: Sand2MutableModuleExtension.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createConfigurationComponent(@Nonnull Disposable uiDisposable, @Nonnull Runnable updateOnCheck) {
  final VerticalLayout vertical = VerticalLayout.create();
  vertical.add(CheckBox.create(LocalizeValue.of("Check Me (New UI)")));
  return vertical;
}
 
Example #14
Source File: SimpleConfigurableByProperties.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
protected final SimpleConfigurableByProperties.LayoutWrapper createPanel() {
  PropertyBuilder builder;
  Component panel = createLayout(builder = new PropertyBuilder());
  myProperties = builder.myProperties;
  return new LayoutWrapper(panel);
}
 
Example #15
Source File: SandMutableModuleExtension.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createConfigurationComponent(@Nonnull Disposable uiDisposable, @Nonnull Runnable updateOnCheck) {
  VerticalLayout panel = VerticalLayout.create();
  panel.add(ModuleExtensionBundleBoxBuilder.createAndDefine(this, uiDisposable, updateOnCheck).uiDisposable(uiDisposable).build());
  return panel;
}
 
Example #16
Source File: Unity3dRootMutableModuleExtension.java    From consulo-unity3d with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createConfigurationComponent(@Nonnull Disposable disposable, @Nonnull Runnable runnable)
{
	return VerticalLayout.create().add(Label.create("Unsupported UI"));
}
 
Example #17
Source File: SimpleConfigurable.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nullable
@Override
public Component createUIComponent() {
  if (myComponent == null) {
    myComponent = createPanel();
  }
  return myComponent.compute();
}
 
Example #18
Source File: DesktopThreeComponentSplitLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public ThreeComponentSplitLayout setFirstComponent(@Nullable Component component) {
  toAWTComponent().setFirstComponent((JComponent)TargetAWT.to(component));
  return this;
}
 
Example #19
Source File: WizardStep.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Deprecated
@DeprecationInfo("Temp UI version")
@RequiredUIAccess
default java.awt.Component getSwingComponent() {
  return TargetAWT.to(getComponent());
}
 
Example #20
Source File: CustomStatusBarWidget.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
default JComponent getComponent() {
  Component uiComponent = getUIComponent();
  if (uiComponent != null) {
    return (JComponent)TargetAWT.to(uiComponent);
  }

  throw new AbstractMethodError();
}
 
Example #21
Source File: ExtensionEditor.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
@RequiredUIAccess
@SuppressWarnings("deprecation")
private JComponent createConfigurationPanel(final @Nonnull MutableModuleExtension extension) {
  myConfigurablePanelExtension = extension;
  @RequiredUIAccess Runnable updateOnCheck = () -> extensionChanged(extension);

  Disposable uiDisposable = Disposable.newDisposable("module extension: " + extension.getId());

  JComponent result = null;

  if (extension instanceof SwingMutableModuleExtension) {
    result = ((SwingMutableModuleExtension)extension).createConfigurablePanel(uiDisposable, updateOnCheck);
  }
  else {
    Component component = extension.createConfigurationComponent(uiDisposable, updateOnCheck);

    if (component != null) {
      if (component instanceof Layout) {
        component.removeBorders();

        component.addBorders(BorderStyle.EMPTY, null, 5);
      }

      result = (JComponent)TargetAWT.to(component);
    }
  }

  if (result != null) {
    myExtensionDisposables.put(result, uiDisposable);
  }

  return result;
}
 
Example #22
Source File: DesktopTabbedLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public Tab addTab(@Nonnull String tabName, @Nonnull Component component) {
  Tab tab = createTab();
  tab.append(tabName);
  return addTab(tab, component);
}
 
Example #23
Source File: DesktopTabbedLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public Tab addTab(@Nonnull Tab tab, @Nonnull Component component) {
  DesktopTabImpl desktopTab = (DesktopTabImpl)tab;

  desktopTab.setComponent(component);

  toAWTComponent().addTab(desktopTab.getTabInfo());

  return tab;
}
 
Example #24
Source File: WebDockLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public DockLayout bottom(@Nonnull Component component) {
  getVaadinComponent().placeAt(component, DockLayoutState.Constraint.BOTTOM);
  return this;
}
 
Example #25
Source File: WebLabeledLayoutImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public LabeledLayout set(@Nonnull Component component) {
  getVaadinComponent().setContent(TargetVaddin.to(component));
  return this;
}
 
Example #26
Source File: TargetAWTFacadeImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
@Contract("null -> null")
public Component from(@Nullable java.awt.Component component) {
  if (component == null) {
    return null;
  }

  if (component instanceof FromSwingComponentWrapper) {
    return ((FromSwingComponentWrapper)component).toUIComponent();
  }
  throw new IllegalArgumentException(component + " is not FromSwingComponentWrapper");
}
 
Example #27
Source File: UITester.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
protected Component createCenterComponent() {
  TabbedLayout tabbedLayout = TabbedLayout.create();

  tabbedLayout.addTab("Layouts", layouts()).setCloseHandler((tab, component) -> {
  });
  tabbedLayout.addTab("Components", components());

  return tabbedLayout;
}
 
Example #28
Source File: UnifiedContentManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
@RequiredUIAccess
@Nonnull
@Override
public Component getUIComponent() {
  if (myComponent == null) {
    DockLayout dock = DockLayout.create();
    dock.addUserDataProvider(dataId -> {
      if (PlatformDataKeys.CONTENT_MANAGER == dataId || PlatformDataKeys.NONEMPTY_CONTENT_MANAGER == dataId && getContentCount() > 1) {
        return this;
      }

      for (DataProvider dataProvider : myDataProviders) {
        Object data = dataProvider.getData(dataId);
        if (data != null) {
          return data;
        }
      }

      if (myUI instanceof DataProvider) {
        return ((DataProvider)myUI).getData(dataId);
      }

      return null;
    });
    dock.center(myUI.getUIComponent());

    myComponent = dock;

  }
  return myComponent;
}
 
Example #29
Source File: DesktopFoldoutLayoutImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public DesktopFoldoutLayoutImpl(LocalizeValue titleValue, Component component, boolean state) {
  myTitleValue = titleValue;
  initialize(new HideableTitledPanel(titleValue.getValue(), (JComponent)TargetAWT.to(component), this));
  toAWTComponent().setOn(state);
}
 
Example #30
Source File: WebDockLayoutImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void remove(@Nonnull Component component) {
  getVaadinComponent().removeComponent(TargetVaddin.to(component));
}