当前位置: 首页>>代码示例>>Java>>正文


Java JBTable.setModel方法代码示例

本文整理汇总了Java中com.intellij.ui.table.JBTable.setModel方法的典型用法代码示例。如果您正苦于以下问题:Java JBTable.setModel方法的具体用法?Java JBTable.setModel怎么用?Java JBTable.setModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.table.JBTable的用法示例。


在下文中一共展示了JBTable.setModel方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupTable

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void setupTable() {
  myTable = new JBTable();
  myTableModel = new MyTableModel();
  myTable.setModel(myTableModel);

  myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    @Override
    public void valueChanged(ListSelectionEvent e) {
      refreshValidatingComponent();
    }
  });
  myTable.setCellSelectionEnabled(false);
  myTable.setColumnSelectionAllowed(false);
  myTable.setRowSelectionAllowed(false);
  myTable.getTableHeader().setReorderingAllowed(false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AutomaticUsageRenamingDialog.java

示例2: RevisionsList

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public RevisionsList(SelectionListener l) {
  table = new JBTable();
  table.setModel(new MyModel(Collections.<RevisionItem>emptyList(), Collections.<RevisionItem, Period>emptyMap()));

  table.setTableHeader(null);
  table.setShowGrid(false);
  table.setRowMargin(0);
  table.getColumnModel().setColumnMargin(0);

  table.resetDefaultFocusTraversalKeys();

  table.setDefaultRenderer(Object.class, new MyCellRenderer(table));

  table.getEmptyText().setText(VcsBundle.message("history.empty"));

  addSelectionListener(l);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:RevisionsList.java

示例3: init

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
public void init() {
  setLayout(new BorderLayout());
  myTable = new JBTable();
  myTextArea = new JTextArea(0, 0);
  myTextArea.setEditable(false);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable);
  mySplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, scrollPane, ScrollPaneFactory.createScrollPane(myTextArea));
  add(mySplitPane, BorderLayout.CENTER);
  add(createToolbar(), BorderLayout.WEST);
  final DefaultTableModel model = new DefaultTableModel(createTableModel(new HashMap<String, String>()), new Object[]{"Name", "Value"}) {
    public boolean isCellEditable(final int row, final int column) {
      return false;
    }
  };
  myTable.setModel(model);
  myTable.setShowVerticalLines(true);
  myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
  myTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent e) {
      int index = myTable.getSelectedRow();
      if (index >= 0) {
        Object value = myTable.getValueAt(index, 1);
        if (value instanceof String) {
          myTextArea.setText(((String) value));
        } else {
          myTextArea.setText("");
        }
      } else {
        myTextArea.setText("");
      }
    }
  });
  myPopupActionGroup = createPopup();
  PopupHandler.installPopupHandler(myTable, myPopupActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance());
  PopupHandler.installPopupHandler(scrollPane, myPopupActionGroup, ActionPlaces.UNKNOWN, ActionManager.getInstance());
  final Shortcut[] shortcuts = KeymapManager.getInstance().getActiveKeymap().getShortcuts(IdeActions.ACTION_CLOSE_ACTIVE_TAB);
  myCloseAction.registerCustomShortcutSet(new CustomShortcutSet(shortcuts), this);
  myRefreshAction.registerCustomShortcutSet(CommonShortcuts.getRerun(), this);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:PropertiesComponent.java

示例4: createUIComponents

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
/** Create UI components. */
private void createUIComponents() {
    templatesListPanel = new TemplatesListPanel();
    editorPanel = new EditorPanel();
    editorPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE, 200));

    templatesSplitter = new Splitter(false, 0.3f);
    templatesSplitter.setFirstComponent(templatesListPanel);
    templatesSplitter.setSecondComponent(editorPanel);

    languagesTable = new JBTable();
    languagesTable.setModel(new LanguagesTableModel());
    languagesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    languagesTable.setColumnSelectionAllowed(false);
    languagesTable.setRowHeight(22);
    languagesTable.setPreferredScrollableViewportSize(new Dimension(-1,
            languagesTable.getRowHeight() * IgnoreBundle.LANGUAGES.size() / 2));

    languagesTable.setStriped(true);
    languagesTable.setShowGrid(false);
    languagesTable.setBorder(createEmptyBorder());
    languagesTable.setDragEnabled(false);

    languagesPanel = ScrollPaneFactory.createScrollPane(languagesTable);

    donatePanel = new JBPanel(new BorderLayout());
    donatePanel.setBorder(new EmptyBorder(10, 0, 10, 0));
    donatePanel.add(new JBLabel(IgnoreBundle.message("settings.general.donate")), BorderLayout.WEST);
    donatePanel.add(createLink(
            "Donate with PayPal",
            "https://www.paypal.me/hsz"
    ), BorderLayout.CENTER);
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:34,代码来源:IgnoreSettingsPanel.java

示例5: createFilterTable

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
protected JPanel createFilterTable(final E query, final Metadata metadata) {
    final EntityFilterTableModel<E> model = new EntityFilterTableModel<E>(project, metadata, query, hiddenFields);

    JBTable table = new JBTable() {
        public TableCellEditor getCellEditor(int row, int col) {
            int modelRow = convertRowIndexToModel(row);
            Field field = model.getFields().get(modelRow);
            FilterFactory factory = fieldManager.getFilterFactory(new Context<E>(query), entityType, field, true);
            if(factory != null) {
                if(factory.getCustomChoices() == null) {
                    return new ReferenceCellEditor(factory, model);
                } else {
                    return new LookupCellEditor(factory.getCustomChoices(), false);
                }
            } else if(field.getListId() != null) {
                List<String> list = project.getComponent(ProjectListService.class).getProjectList(entityType, field);
                return new LookupCellEditor(list, true);
            } else {
                return super.getCellEditor(row, col);
            }
        }
    };
    table.setRowSelectionAllowed(false);
    table.setCellSelectionEnabled(true);
    table.setModel(model);
    TableRowSorter<TableModel> sorter = new TableRowSorter<TableModel>(model);
    table.setRowSorter(sorter);
    new TableFilterHeader(table);
    model.addTableModelListener(new TableModelListener() {
        public void tableChanged(TableModelEvent tableModelEvent) {
            queryModel.fireFilterUpdated(true);
        }
    });
    sorter.setSortKeys(Arrays.asList(new RowSorter.SortKey(0, SortOrder.ASCENDING)));
    JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JBScrollPane(table), BorderLayout.CENTER);
    return panel;
}
 
开发者ID:janotav,项目名称:ali-idea-plugin,代码行数:39,代码来源:EntityFilterDialog.java

示例6: initTable

import com.intellij.ui.table.JBTable; //导入方法依赖的package包/类
private void initTable(List<PropTypeBean> paramList){
    table = new JBTable();
    PropTypesModel model = new PropTypesModel();
    String[] columnNames = {
            "name",
            "type",
            "isRequired",
            "describe",
            "ops"};
    Object[][] data = new Object[paramList.size()][5];
    for (int i = 0; i < paramList.size(); i++) {
        data[i][0] = paramList.get(i).name;
        data[i][1] = paramList.get(i).type;
        data[i][2] = paramList.get(i).isRequired;
        data[i][3] = paramList.get(i).describe;
        data[i][4] = false;
    }
    model.setDataVector(data,columnNames);
    table.setModel(model);
    final DefaultListSelectionModel defaultListSelectionModel = new DefaultListSelectionModel();
    defaultListSelectionModel.setSelectionMode(SINGLE_SELECTION);
    table.setSelectionModel(defaultListSelectionModel);
    // form header center
    DefaultTableCellHeaderRenderer thr = new DefaultTableCellHeaderRenderer();
    thr.setHorizontalAlignment(JLabel.CENTER);
    table.getTableHeader().setDefaultRenderer(thr);
    //render special column
    TableColumn nameColumn = table.getColumn("name");
    TableColumn typeColumn = table.getColumn("type");
    TableColumn isRequireColumn = table.getColumn("isRequired");
    TableColumn infoColumn = table.getColumn("describe");
    TableColumn operationColumn = table.getColumn("ops");
    nameColumn.setCellRenderer(new TextRenderer(true));
    nameColumn.setCellEditor(new DefaultCellEditor(new TextRenderer(false)));
    typeColumn.setCellEditor(new DefaultCellEditor(new ComboBoxRenderer()));
    typeColumn.setCellRenderer(new ComboBoxRenderer());
    typeColumn.setMaxWidth(150);
    isRequireColumn.setCellEditor(new DefaultCellEditor(new CheckBoxRenderer()));
    isRequireColumn.setCellRenderer(new CheckBoxRenderer());
    isRequireColumn.setMaxWidth(100);
    infoColumn.setCellEditor(new DefaultCellEditor(new JTextField()){
        @Override
        public boolean isCellEditable(EventObject anEvent) {
            return false;
        }
    });
    infoColumn.setMinWidth(120);
    infoColumn.setMaxWidth(150);
    ButtonEditor buttonEditor = new ButtonEditor();
    operationColumn.setCellRenderer(new ButtonRenderer());
    operationColumn.setCellEditor(buttonEditor);
    operationColumn.setMinWidth(100);
    operationColumn.setMaxWidth(100);
    sp.setViewportView(table);
}
 
开发者ID:dpzxsm,项目名称:ReactPropTypes-Plugin,代码行数:56,代码来源:PropTypesDialog.java


注:本文中的com.intellij.ui.table.JBTable.setModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。