亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來(lái)到蟲(chóng)蟲(chóng)下載站! | ?? 資源下載 ?? 資源專(zhuān)輯 ?? 關(guān)于我們
? 蟲(chóng)蟲(chóng)下載站

?? propertysheettable.java

?? 精美開(kāi)源Swing組件
?? JAVA
?? 第 1 頁(yè) / 共 2 頁(yè)
字號(hào):
  }

  /**
   * Helper method to lookup a cell renderer based on type.
   * @param type the type for which a renderer should be found
   * @return a renderer for the given object type
   */
  private TableCellRenderer getCellRenderer(Class type) {
    // try to create one from the factory
    TableCellRenderer renderer = getRendererFactory().createTableCellRenderer(type);

    // if that fails, recursively try again with the superclass
    if (renderer == null && type != null)
      renderer = getCellRenderer(type.getSuperclass());

    // if that fails, just use the default Object renderer
    if (renderer == null)
      renderer = super.getDefaultRenderer(Object.class);

    return renderer;
  }

  public final PropertySheetTableModel getSheetModel() {
    return (PropertySheetTableModel) getModel();
  }

  /**
   * Overriden
   * <li>to prevent the cell focus rect to be painted
   * <li>to disable ({@link Component#setEnabled(boolean)} the renderer if the
   * Property is not editable
   */
  public Component prepareRenderer(TableCellRenderer renderer, int row,
    int column) {
    Object value = getValueAt(row, column);
    boolean isSelected = isCellSelected(row, column);
    Component component = renderer.getTableCellRendererComponent(this, value,
      isSelected, false, row, column);
    
    PropertySheetTableModel.Item item = getSheetModel()
      .getPropertySheetElement(row);
    if (item.isProperty()) {
      component.setEnabled(item.getProperty().isEditable());
    }
    return component;
  }

  /**
   * Overriden to register a listener on the model. This listener ensures
   * editing is cancelled when editing row is being changed.
   * 
   * @see javax.swing.JTable#setModel(javax.swing.table.TableModel)
   * @throws IllegalArgumentException
   *           if dataModel is not a {@link PropertySheetTableModel}
   */
  public void setModel(TableModel newModel) {
    if (!(newModel instanceof PropertySheetTableModel)) {
      throw new IllegalArgumentException("dataModel must be of type "
          + PropertySheetTableModel.class.getName());
    }

    if (cancelEditing == null) {
      cancelEditing = new CancelEditing();
    }

    TableModel oldModel = getModel();
    if (oldModel != null) {
      oldModel.removeTableModelListener(cancelEditing);
    }
    super.setModel(newModel);
    newModel.addTableModelListener(cancelEditing);

    // ensure the "value" column can not be resized
    getColumnModel().getColumn(1).setResizable(false);
  }

  /**
   * @see #setWantsExtraIndent(boolean)
   */
  public boolean getWantsExtraIndent() {
    return wantsExtraIndent;
  }

  /**
   * By default, properties with children are painted with the same indent level
   * as other properties and categories. When nested properties exist within the
   * set of properties, the end-user might be confused by the category and
   * property handles. Sets this property to true to add an extra indent level
   * to properties.
   * 
   * @param wantsExtraIndent
   */
  public void setWantsExtraIndent(boolean wantsExtraIndent) {
    this.wantsExtraIndent = wantsExtraIndent;
    repaint();
  }
  
  /**
   * Ensures the table uses the full height of its parent
   * {@link javax.swing.JViewport}.
   */
  public boolean getScrollableTracksViewportHeight() {
    return getPreferredSize().height < getParent().getHeight();
  }
  
  /**
   * Commits on-going cell editing 
   */
  public void commitEditing() {
    TableCellEditor editor = getCellEditor();
    if (editor != null) {
      editor.stopCellEditing();
    }    
  }

  /**
   * Cancels on-going cell editing 
   */
  public void cancelEditing() {
    TableCellEditor editor = getCellEditor();
    if (editor != null) {
      editor.cancelCellEditing();
    }    
  }

  /**
   * Cancels the cell editing if any update happens while modifying a value.
   */
  private class CancelEditing implements TableModelListener {
    public void tableChanged(TableModelEvent e) {
      // in case the table changes for the following reasons:
      // * the editing row has changed
      // * the editing row was removed
      // * all rows were changed
      // * rows were added
      //
      // it is better to cancel the editing of the row as our editor
      // may no longer be the right one. It happens when you play with
      // the sorting while having the focus in one editor.
      if (e.getType() == TableModelEvent.UPDATE) {
        int first = e.getFirstRow();
        int last = e.getLastRow();
        int editingRow = PropertySheetTable.this.getEditingRow();

        TableCellEditor editor = PropertySheetTable.this.getCellEditor();
        if (editor != null && first <= editingRow && editingRow <= last) {
          editor.cancelCellEditing();
        }
      }
    }
  }

  /**
   * Starts value cell editing even if value cell does not have the focus but
   * only if row is selected.
   */
  private static class StartEditingAction extends AbstractAction {
    public void actionPerformed(ActionEvent e) {
      JTable table = (JTable)e.getSource();
      if (!table.hasFocus()) {
        CellEditor cellEditor = table.getCellEditor();
        if (cellEditor != null && !cellEditor.stopCellEditing()) { return; }
        table.requestFocus();
        return;
      }
      ListSelectionModel rsm = table.getSelectionModel();
      int anchorRow = rsm.getAnchorSelectionIndex();
      table.editCellAt(anchorRow, PropertySheetTableModel.VALUE_COLUMN);
      Component editorComp = table.getEditorComponent();
      if (editorComp != null) {
        editorComp.requestFocus();
      }
    }
  }

  /**
   * Toggles the state of a row between expanded/collapsed. Works only for rows
   * with "toggle" knob.
   */
  private class ToggleAction extends AbstractAction {
    public void actionPerformed(ActionEvent e) {      
      int row = PropertySheetTable.this.getSelectedRow();
      Item item = PropertySheetTable.this.getSheetModel()
        .getPropertySheetElement(row);
      item.toggle();
      PropertySheetTable.this.addRowSelectionInterval(row, row);
    }
    public boolean isEnabled() {
      int row = PropertySheetTable.this.getSelectedRow();
      if (row != -1) {
        Item item = PropertySheetTable.this.getSheetModel()
          .getPropertySheetElement(row);        
        return item.hasToggle();
      } else {
        return false;
      }
    }
  }

  /**
   * @see ToggleAction
   */
  private static class ToggleMouseHandler extends MouseAdapter {
    public void mouseReleased(MouseEvent event) {
      PropertySheetTable table = (PropertySheetTable) event.getComponent();
      int row = table.rowAtPoint(event.getPoint());
      int column = table.columnAtPoint(event.getPoint());
      if (row != -1 && column == 0) {
        // if we clicked on an Item, see if we clicked on its hotspot
        Item item = table.getSheetModel().getPropertySheetElement(row);        
        int x = event.getX() - getIndent(table, item);
        if (x > 0 && x < HOTSPOT_SIZE)
          item.toggle();
      }
    }
  }

  /**
   * Calculates the required left indent for a given item, given its type and
   * its hierarchy level.
   */
  static int getIndent(PropertySheetTable table, Item item) {
    int indent = 0;
    
    if (item.isProperty()) {
      // it is a property, it has no parent or a category, and no child
      if ((item.getParent() == null || !item.getParent().isProperty())
        && !item.hasToggle()) {
        indent = table.getWantsExtraIndent()?HOTSPOT_SIZE:0;
      } else {
        // it is a property with children
        if (item.hasToggle()) {
          indent = item.getDepth() * HOTSPOT_SIZE;
        } else {          
          indent = (item.getDepth() + 1) * HOTSPOT_SIZE;
        }        
      }
      
      if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES
        && table.getWantsExtraIndent()) {
        indent += HOTSPOT_SIZE;
      }

    } else {
      // category has no indent
      indent = 0;
    }    
    return indent;
  }
  
  /**
   * Paints the border around the name cell. It handles the indent from the left
   * side and the painting of the toggle knob.
   */
  private static class CellBorder implements Border {
    
    private int indentWidth; // space before hotspot
    private boolean showToggle;
    private boolean toggleState;
    private Icon expandedIcon;
    private Icon collapsedIcon;
    private Insets insets = new Insets(1, 0, 1, 1);
    private boolean isProperty;
    
    public CellBorder() {
      expandedIcon = (Icon)UIManager.get(TREE_EXPANDED_ICON_KEY);
      collapsedIcon = (Icon)UIManager.get(TREE_COLLAPSED_ICON_KEY);
      if (expandedIcon == null) {
        expandedIcon = new ExpandedIcon();
      }
      if (collapsedIcon == null) {
        collapsedIcon = new CollapsedIcon();
      }
    }

    public void configure(PropertySheetTable table, Item item) {      
      isProperty = item.isProperty();      
      toggleState =  item.isVisible();
      showToggle = item.hasToggle();
      
      indentWidth = getIndent(table, item);      
      insets.left = indentWidth + (showToggle?HOTSPOT_SIZE:0) + 2;;
    }
    
    public Insets getBorderInsets(Component c) {
      return insets;
    }

    public void paintBorder(Component c, Graphics g, int x, int y, int width,
        int height) {      
      if (!isProperty) {
        Color oldColor = g.getColor();      
        g.setColor(c.getBackground());
        g.fillRect(x, y, x + HOTSPOT_SIZE - 2, y + height);
        g.setColor(oldColor);
      }
      
      if (showToggle) {
        Icon drawIcon = (toggleState ? expandedIcon : collapsedIcon);
        drawIcon.paintIcon(c, g,
          x + indentWidth + (HOTSPOT_SIZE - 2 - drawIcon.getIconWidth()) / 2,
          y + (height - drawIcon.getIconHeight()) / 2);
      }
    }

    public boolean isBorderOpaque() {
      return true;
    }
    
  }

  private static class ExpandedIcon implements Icon {
    public void paintIcon(Component c, Graphics g, int x, int y) {
      Color backgroundColor = c.getBackground();

      if (backgroundColor != null)
        g.setColor(backgroundColor);
      else g.setColor(Color.white);
      g.fillRect(x, y, 8, 8);
      g.setColor(Color.gray);
      g.drawRect(x, y, 8, 8);
      g.setColor(Color.black);
      g.drawLine(x + 2, y + 4, x + (6), y + 4);
    }
    public int getIconWidth() {
      return 9;
    }
    public int getIconHeight() {
      return 9;
    }
  }

  private static class CollapsedIcon extends ExpandedIcon {
    public void paintIcon(Component c, Graphics g, int x, int y) {
      super.paintIcon(c, g, x, y);
      g.drawLine(x + 4, y + 2, x + 4, y + 6);
    }
  }

  /**
   * A {@link TableCellRenderer} for property names.
   */
  private class NameRenderer extends DefaultTableCellRenderer {

    private CellBorder border;
    
    public NameRenderer() {
      border = new CellBorder();
    }
    
    private Color getForeground(boolean isProperty, boolean isSelected) {
      return (isProperty ? (isSelected ? selectedPropertyForeground : propertyForeground) :
        (isSelected ? selectedCategoryForeground : categoryForeground));
    }

    private Color getBackground(boolean isProperty, boolean isSelected) {
      return (isProperty ? (isSelected ? selectedPropertyBackground : propertyBackground) :
        (isSelected ? selectedCategoryBackground : categoryBackground));
    }

    public Component getTableCellRendererComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
      super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
      PropertySheetTableModel.Item item = (Item) value;

      // shortcut if we are painting the category column
      if (column == PropertySheetTableModel.VALUE_COLUMN && !item.isProperty()) {
        setBackground(getBackground(item.isProperty(), isSelected));
        setText("");
        return this;
      }
      
      setBorder(border);

      // configure the border
      border.configure((PropertySheetTable)table, item);
      
      setBackground(getBackground(item.isProperty(), isSelected));
      setForeground(getForeground(item.isProperty(), isSelected));
      
      setEnabled(isSelected || !item.isProperty() ? true : item.getProperty().isEditable());
      setText(item.getName());

      return this;
    }
  }

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久无码精品亚洲日韩按摩| 99久久久国产精品| 亚洲国产精品久久人人爱蜜臀 | 国产欧美一区二区三区在线老狼| 国产69精品一区二区亚洲孕妇| 国产精品久久看| 欧美日韩视频不卡| 成人黄色在线看| 麻豆精品精品国产自在97香蕉| 国产精品超碰97尤物18| 精品国产乱码久久久久久老虎| 色综合久久久久久久久久久| 一本色道久久加勒比精品 | 国产成人免费视频网站| 亚洲午夜久久久久久久久久久| 国产肉丝袜一区二区| 欧美一卡在线观看| 在线一区二区三区四区| 不卡视频一二三| 国产一区二区美女诱惑| 日韩国产欧美在线观看| 亚洲国产精品一区二区www在线| 欧美高清一级片在线观看| 日韩视频免费观看高清在线视频| 欧美自拍偷拍午夜视频| 不卡一区二区中文字幕| 国产精品综合二区| 青青草伊人久久| 天堂成人免费av电影一区| 中文字幕字幕中文在线中不卡视频| 精品1区2区在线观看| 日韩一区二区免费高清| 337p亚洲精品色噜噜狠狠| 91福利在线播放| 91在线看国产| 91在线观看地址| 97精品电影院| 91小宝寻花一区二区三区| 成人国产一区二区三区精品| 国产999精品久久久久久绿帽| 久久91精品久久久久久秒播| 精品一区二区三区久久久| 日韩在线一区二区三区| 午夜精品福利一区二区三区av | 国产精品国产三级国产aⅴ中文| 日韩欧美亚洲一区二区| 天天av天天翘天天综合网色鬼国产 | 色婷婷综合久久久中文字幕| 99亚偷拍自图区亚洲| 成人不卡免费av| av在线不卡免费看| 99国产精品久| 日本韩国欧美一区二区三区| 91首页免费视频| 色婷婷综合久久久中文字幕| 欧美综合一区二区| 欧美日韩国产bt| 欧美本精品男人aⅴ天堂| 精品欧美黑人一区二区三区| 欧美不卡一区二区| 国产亚洲视频系列| 亚洲欧美偷拍三级| 天涯成人国产亚洲精品一区av| 欧美综合亚洲图片综合区| 欧美日韩精品免费| 国产成人三级在线观看| 成人国产电影网| 色综合久久综合网97色综合| 在线欧美日韩国产| 欧美一区二区视频免费观看| 精品久久99ma| 国产精品久久久久久久久免费相片| 亚洲男人的天堂网| 天天影视网天天综合色在线播放| 韩日av一区二区| av在线综合网| 欧美卡1卡2卡| 日本一区二区三区国色天香 | 中文字幕一区二区三区在线不卡 | 91美女视频网站| 777久久久精品| 久久久精品欧美丰满| 国产精品美女一区二区三区 | 国产综合久久久久久鬼色| 成人免费视频视频在线观看免费| 欧美性受xxxx黑人xyx性爽| 日韩一级二级三级精品视频| 国产精品初高中害羞小美女文| 亚洲国产毛片aaaaa无费看| 国内久久婷婷综合| 欧美日韩一区二区在线观看| 欧美一区午夜精品| 国产精品视频第一区| 天天色综合成人网| 97se亚洲国产综合自在线观| 日韩一区二区在线观看视频播放| 国产精品久久久久久久久搜平片 | 欧美日韩一级黄| 久久精品视频在线免费观看| 夜夜嗨av一区二区三区四季av| 激情五月激情综合网| 欧美色倩网站大全免费| 国产色产综合产在线视频| 亚洲成人精品在线观看| 成人激情文学综合网| 日韩一级在线观看| 亚洲成a人片在线观看中文| 成人免费视频一区二区| 亚洲精品在线三区| 日韩电影在线免费看| 色哟哟亚洲精品| 欧美激情在线一区二区三区| 老司机精品视频导航| 欧美精品自拍偷拍| 一区二区三区不卡视频在线观看| 成人丝袜高跟foot| 精品99999| 日本欧美一区二区在线观看| 91黄视频在线| 中文字幕成人av| 国产黄人亚洲片| 久久蜜桃av一区精品变态类天堂| 日韩一区精品视频| 在线精品国精品国产尤物884a| 国产精品乱子久久久久| 国产精品1区二区.| 久久这里只有精品6| 日韩av一区二区三区| 欧美日韩国产电影| 亚洲午夜激情av| 色综合一区二区三区| 亚洲国产成人一区二区三区| 国产成都精品91一区二区三| 国产午夜精品一区二区三区四区| 久久成人久久爱| 日韩亚洲欧美在线| 美腿丝袜亚洲一区| 欧美一级专区免费大片| 免费在线成人网| 精品国产乱码久久久久久牛牛| 久久不见久久见免费视频7| 日韩一级欧美一级| 蜜臀久久99精品久久久画质超高清| 7777精品伊人久久久大香线蕉的 | 337p日本欧洲亚洲大胆色噜噜| 水野朝阳av一区二区三区| 欧美日韩国产中文| 午夜视频一区二区三区| 在线91免费看| 麻豆成人久久精品二区三区红| 日韩一区二区三区视频在线| 免费美女久久99| 久久综合九色综合97_久久久| 极品尤物av久久免费看| 久久免费看少妇高潮| 高清成人在线观看| 综合欧美亚洲日本| 欧美日本一区二区三区| 日本在线不卡一区| www久久精品| 99久久久国产精品免费蜜臀| 一区二区三区国产| 欧美一区二区三区在线观看视频| 免费av网站大全久久| 久久久电影一区二区三区| 国产不卡高清在线观看视频| 中文字幕在线观看一区| 欧美在线视频日韩| 蜜臀av一区二区| 国产精品丝袜黑色高跟| 欧美在线看片a免费观看| 日本午夜精品一区二区三区电影| 精品久久久久久综合日本欧美| 懂色av一区二区三区免费看| 亚洲欧美日韩电影| 欧美大片在线观看一区| 粉嫩av一区二区三区在线播放 | 在线观看国产一区二区| 日韩精品乱码av一区二区| 久久精品夜夜夜夜久久| 一本色道**综合亚洲精品蜜桃冫| 天天综合日日夜夜精品| 国产欧美日产一区| 欧美性受极品xxxx喷水| 国产传媒久久文化传媒| 亚洲精品亚洲人成人网 | 亚洲精品成a人| 日韩天堂在线观看| 94-欧美-setu| 久久国产免费看| 一区二区三区四区在线免费观看| 日韩亚洲欧美高清| 色美美综合视频| 国产做a爰片久久毛片| 亚洲一二三四在线观看| 久久久久国产成人精品亚洲午夜| 欧美日韩国产综合一区二区三区| 风间由美一区二区三区在线观看 | 亚洲777理论| 中文幕一区二区三区久久蜜桃|