Sets the specified editor and updates the component layout. @param text editor @param srch triggers a search in the specified editor
(final TextPanel text, final boolean srch)
| 158 | * @param srch triggers a search in the specified editor |
| 159 | */ |
| 160 | public void editor(final TextPanel text, final boolean srch) { |
| 161 | final boolean editable = text.isEditable(); |
| 162 | if(editor == null || editable != editor.isEditable()) { |
| 163 | removeAll(); |
| 164 | final BaseXToolBar west = new BaseXToolBar(); |
| 165 | west.add(mcase); |
| 166 | west.add(word); |
| 167 | west.add(regex); |
| 168 | west.add(multi); |
| 169 | |
| 170 | final BaseXBack center = new BaseXBack(false).layout(new GridLayout(1, 2, 2, 0)); |
| 171 | center.add(find); |
| 172 | if(editable) center.add(replace); |
| 173 | |
| 174 | final BaseXToolBar east = new BaseXToolBar(); |
| 175 | if(editable) east.add(rplc); |
| 176 | east.add(cls); |
| 177 | |
| 178 | add(west, BorderLayout.WEST); |
| 179 | add(center, BorderLayout.CENTER); |
| 180 | add(east, BorderLayout.EAST); |
| 181 | } |
| 182 | |
| 183 | editor = text; |
| 184 | refreshLayout(); |
| 185 | text.setSearch(this); |
| 186 | |
| 187 | if(srch) search(false); |
| 188 | } |
| 189 | |
| 190 | /** |
| 191 | * Returns a search button. |
no test coverage detected