@Override public void setUI(ListUI ui) { if (Util.getUseSubstanceRenderers() && SUBSTANCE_LIST_UI.equals(ui.getClass().getName())) { // Substance requires its special ListUI be installed for // its renderers to actually render (!), but long completion // lists (e.g. PHPCompletionProvider in RSTALanguageSupport) // will simply populate too slowly on initial display (when // calculating preferred size of all items), so in this case // we give a prototype cell value. CompletionProvider p = ac.getCompletionProvider(); BasicCompletion bc = new BasicCompletion(p, "Hello world"); setPrototypeCellValue(bc); } else { // Our custom UI that is faster for long HTML completion lists. ui = new FastListUI(); setPrototypeCellValue(null); } super.setUI(ui); }
/** * Invokes the <code>locationToIndex</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int locationToIndex(JList a, Point b) { int returnValue = ((ListUI) (uis.elementAt(0))).locationToIndex(a,b); for (int i = 1; i < uis.size(); i++) { ((ListUI) (uis.elementAt(i))).locationToIndex(a,b); } return returnValue; }
/** * Invokes the <code>indexToLocation</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Point indexToLocation(JList a, int b) { Point returnValue = ((ListUI) (uis.elementAt(0))).indexToLocation(a,b); for (int i = 1; i < uis.size(); i++) { ((ListUI) (uis.elementAt(i))).indexToLocation(a,b); } return returnValue; }
/** * Invokes the <code>getCellBounds</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Rectangle getCellBounds(JList a, int b, int c) { Rectangle returnValue = ((ListUI) (uis.elementAt(0))).getCellBounds(a,b,c); for (int i = 1; i < uis.size(); i++) { ((ListUI) (uis.elementAt(i))).getCellBounds(a,b,c); } return returnValue; }
/** * Invokes the <code>locationToIndex</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public int locationToIndex(JList<?> a, Point b) { int returnValue = ((ListUI) (uis.elementAt(0))).locationToIndex(a,b); for (int i = 1; i < uis.size(); i++) { ((ListUI) (uis.elementAt(i))).locationToIndex(a,b); } return returnValue; }
/** * Invokes the <code>indexToLocation</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Point indexToLocation(JList<?> a, int b) { Point returnValue = ((ListUI) (uis.elementAt(0))).indexToLocation(a,b); for (int i = 1; i < uis.size(); i++) { ((ListUI) (uis.elementAt(i))).indexToLocation(a,b); } return returnValue; }
/** * Invokes the <code>getCellBounds</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> */ public Rectangle getCellBounds(JList<?> a, int b, int c) { Rectangle returnValue = ((ListUI) (uis.elementAt(0))).getCellBounds(a,b,c); for (int i = 1; i < uis.size(); i++) { ((ListUI) (uis.elementAt(i))).getCellBounds(a,b,c); } return returnValue; }
/** * Maps {@code JList.getUI()} through queue */ public ListUI getUI() { return (runMapping(new MapAction<ListUI>("getUI") { @Override public ListUI map() { return ((JList) getSource()).getUI(); } })); }
/** * Maps {@code JList.setUI(ListUI)} through queue */ public void setUI(final ListUI listUI) { runMapping(new MapVoidAction("setUI") { @Override public void map() { ((JList) getSource()).setUI(listUI); } }); }
/** * Returns the bounds of the rectangle that encloses both list cells * with index0 and index1. * * @param index0 the index of the first cell * @param index1 the index of the second cell * * @return the bounds of the rectangle that encloses both list cells * with index0 and index1, <code>null</code> if one of the indices is * not valid */ public Rectangle getCellBounds(int index0, int index1) { ListUI ui = getUI(); Rectangle bounds = null; if (ui != null) { bounds = ui.getCellBounds(this, index0, index1); } // When the UI is null, this method also returns null in the RI. return bounds; }
/** * {@inheritDoc} <p> * * Overridden to update renderer and Highlighters. */ @Override public void updateUI() { // PENDING JW: temporary during dev to quickly switch between default and custom ui if (getUIClassID() == super.getUIClassID()) { super.updateUI(); } else { setUI((ListUI) LookAndFeelAddons.getUI(this, ListUI.class)); } updateRendererUI(); updateHighlighterUI(); }
@Override protected void buildChooser() { initComponents(); setUI(PalettePanelUI.createUI(this)); jList.setUI((ListUI) PaletteListUI.createUI(jList)); Object[] byRows=HSB_COLORS_AS_RGB.toArray(); Object[] byColumns=new Object[byRows.length]; for (int y=0,my=byRows.length/HSB_COLORS_AS_RGB_COLUMN_COUNT;y<my;y++) { for (int x=0;x< HSB_COLORS_AS_RGB_COLUMN_COUNT;x++) { if (x*my+y<byColumns.length) byColumns[x*my+y]=byRows[y*HSB_COLORS_AS_RGB_COLUMN_COUNT+x]; } } byColumns[byColumns.length-1]=byRows[byRows.length-1]; jList.setListData(byColumns); jList.setVisibleRowCount(HSB_COLORS_AS_RGB.size() / HSB_COLORS_AS_RGB_COLUMN_COUNT); jList.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (updateRecursion++ == 0) { ColorIcon item = (ColorIcon) jList.getSelectedValue(); setColorToModel(item == null ? null : item.getColor()); } updateRecursion--; } }); }