コード例 #1
0
  @Override
  public void setupErrorOutdatingUserActivityWatcher(
      final CommittablePanel panel, final DomElement... elements) {
    final UserActivityWatcher userActivityWatcher = createEditorAwareUserActivityWatcher();
    userActivityWatcher.addUserActivityListener(
        new UserActivityListener() {
          private boolean isProcessingChange;

          @Override
          public void stateChanged() {
            if (isProcessingChange) return;
            isProcessingChange = true;
            try {
              for (final DomElement element : elements) {
                DomElementAnnotationsManagerImpl.outdateProblemHolder(element);
              }
              CommittableUtil.updateHighlighting(panel);
            } finally {
              isProcessingChange = false;
            }
          }
        },
        panel);
    userActivityWatcher.register(panel.getComponent());
  }
コード例 #2
0
  public static BasicDomElementComponent createComponentWithCaption(
      final CommittablePanel committablePanel,
      final CaptionComponent captionComponent,
      final DomElement element) {
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(captionComponent, BorderLayout.NORTH);
    panel.add(
        element.isValid() ? committablePanel.getComponent() : new JPanel(), BorderLayout.CENTER);

    BasicDomElementComponent component =
        new BasicDomElementComponent(element) {
          @Override
          public JComponent getComponent() {
            return panel;
          }
        };

    component.addComponent(committablePanel);
    component.addComponent(captionComponent);
    return component;
  }