コード例 #1
0
  /** @see org.openquark.gems.client.valueentry.ValueEditor#setInitialValue() */
  @Override
  public void setInitialValue() {

    IntellicutAdapter adapter = new IntellicutAdapter();

    adapter.setNamingPolicy(
        new UnqualifiedUnlessAmbiguous(
            valueEditorManager.getPerspective().getWorkingModuleTypeInfo()));

    intellicutPanel = new IntellicutPanel(this, adapter, null, IntellicutMode.NOTHING);

    intellicutPanel.loadListModel();
    intellicutPanel.setBorder(null);
    intellicutPanel.setMoveable(false);

    // Select the correct item in the list.
    GemEntity gemEntity = (GemEntity) getValueNode().getValue();
    IntellicutListEntry listEntry = adapter.getListEntryForData(gemEntity);

    if (listEntry != null) {
      intellicutPanel.getIntellicutList().setSelectedValue(listEntry, true);
    } else {
      intellicutPanel.getIntellicutList().clearSelection();
    }

    add(intellicutPanel, BorderLayout.CENTER);
    setSize(getPreferredSize());

    // Add a dummy MouseListener so that Swing doesn't forward mouse events intended for
    // us to the component below us. Swing does that if a component has no mouse listeners at all.
    addMouseListener(new MouseAdapter() {});
  }
コード例 #2
0
  /** {@inheritDoc} */
  @Override
  public void setInitialValue() {

    setLayout(new BorderLayout());
    setResizable(true);

    IntellicutAdapter adapter = new IntellicutAdapter();
    adapter.setNamingPolicy(
        new UnqualifiedUnlessAmbiguous(
            valueEditorManager.getPerspective().getWorkingModuleTypeInfo()));

    intellicutPanel = new IntellicutPanel(this, adapter, null, IntellicutMode.NOTHING);
    intellicutPanel.loadListModel();
    intellicutPanel.setBorder(null);
    intellicutPanel.setMoveable(false);
    intellicutPanel
        .getIntellicutList()
        .setCellRenderer(new ParametricValueListRenderer(IntellicutMode.NOTHING));

    // By default there is no item selected.
    intellicutPanel.getIntellicutList().clearSelection();

    add(intellicutPanel, BorderLayout.CENTER);

    resetSize();
  }