Beispiel #1
0
  private void initView() {
    this.setLayout(new BorderLayout());

    JToolBar toolBar = new JToolBar();
    ActionManager actionManager = Application.getInstance().getActionManager();
    toolBar.add(actionManager.getAction(CreateAttributeAction.class).buildButton());

    add(toolBar, BorderLayout.NORTH);

    className =
        new TextAdapter(new JTextField()) {

          @Override
          protected void updateModel(String text) {
            setClassName(text);
          }
        };

    FormLayout layout = new FormLayout("right:50dlu, 3dlu, fill:150dlu, 3dlu, fill:100", "");
    DefaultFormBuilder builder = new DefaultFormBuilder(layout);
    builder.setDefaultDialogBorder();
    builder.append("Class Name:", className.getComponent(), 3);

    add(builder.getPanel(), BorderLayout.CENTER);
  }
  public TextCompoundEdit(JTextComponent editor, JTextFieldUndoListener listener) {

    this.editor = editor;
    this.listener = listener;

    EditorView editorView =
        ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();

    treePath = editorView.getProjectTreeView().getSelectionPath();

    DefaultMutableTreeNode newPath = (DefaultMutableTreeNode) treePath.getLastPathComponent();

    targetObject = newPath.getUserObject();

    if (targetObject instanceof ObjEntity) {
      tabbedPane = editorView.getObjDetailView();
    }

    if (targetObject instanceof DbEntity) {
      tabbedPane = editorView.getDbDetailView();
    }

    if (targetObject instanceof Embeddable) {
      tabbedPane = editorView.getEmbeddableView();
    }

    if (targetObject instanceof SQLTemplate) {
      tabbedPane = editorView.getSqlTemplateView();

      if (tabbedPane != null) {
        selectedItem = ((SQLTemplateTabbedView) tabbedPane).getScriptsTab().getSelectedIndex();
      }
    }

    if (targetObject instanceof EJBQLQuery) {
      tabbedPane = editorView.getEjbqlQueryView();
    }

    if (targetObject instanceof DataNodeDescriptor) {
      tabbedPane = editorView.getDataNodeView();
    }

    if (targetObject instanceof DataMap) {
      tabbedPane = editorView.getDataMapView();
    }

    if (targetObject instanceof DataChannelDescriptor) {
      tabbedPane = editorView.getDataDomainView();
    }

    if (tabbedPane != null) {
      selectedTabIndex = tabbedPane.getSelectedIndex();
    }
  }
  private void restoreSelections() {

    EditorView editorView =
        ((CayenneModelerFrame) Application.getInstance().getFrameController().getView()).getView();

    editorView.getProjectTreeView().getSelectionModel().setSelectionPath(treePath);

    if (tabbedPane != null) {
      tabbedPane.setSelectedIndex(selectedTabIndex);

      if (tabbedPane instanceof SQLTemplateTabbedView) {
        ((SQLTemplateTabbedView) tabbedPane).getScriptsTab().setSelectedIndex(selectedItem);
      }
    }
  }