Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

TopicBar.java 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665
  1. /*
  2. *
  3. * Copyright (c) 2006-2010 Chris Smith, Shane Mc Cormack, Gregory Holmes
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a copy
  6. * of this software and associated documentation files (the "Software"), to deal
  7. * in the Software without restriction, including without limitation the rights
  8. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. * copies of the Software, and to permit persons to whom the Software is
  10. * furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in
  13. * all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. */
  23. package com.dmdirc.addons.ui_swing.components;
  24. import com.dmdirc.Channel;
  25. import com.dmdirc.addons.ui_swing.SwingController;
  26. import com.dmdirc.addons.ui_swing.UIUtilities;
  27. import com.dmdirc.addons.ui_swing.actions.NoNewlinesPasteAction;
  28. import com.dmdirc.addons.ui_swing.components.frames.ChannelFrame;
  29. import com.dmdirc.config.IdentityManager;
  30. import com.dmdirc.interfaces.ConfigChangeListener;
  31. import com.dmdirc.parser.interfaces.ChannelInfo;
  32. import com.dmdirc.parser.interfaces.Parser;
  33. import com.dmdirc.parser.interfaces.callbacks.ChannelTopicListener;
  34. import com.dmdirc.ui.IconManager;
  35. import com.dmdirc.ui.messages.ColourManager;
  36. import com.dmdirc.ui.messages.Styliser;
  37. import com.dmdirc.util.URLHandler;
  38. import java.awt.Color;
  39. import java.awt.event.ActionEvent;
  40. import java.awt.event.ActionListener;
  41. import java.awt.event.MouseEvent;
  42. import java.awt.event.MouseListener;
  43. import javax.swing.AbstractAction;
  44. import javax.swing.JButton;
  45. import javax.swing.JComponent;
  46. import javax.swing.JLabel;
  47. import javax.swing.JScrollPane;
  48. import javax.swing.KeyStroke;
  49. import javax.swing.SwingUtilities;
  50. import javax.swing.event.DocumentEvent;
  51. import javax.swing.event.DocumentListener;
  52. import javax.swing.event.HyperlinkEvent;
  53. import javax.swing.event.HyperlinkListener;
  54. import javax.swing.text.AbstractDocument;
  55. import javax.swing.text.BadLocationException;
  56. import javax.swing.text.BoxView;
  57. import javax.swing.text.ComponentView;
  58. import javax.swing.text.DefaultStyledDocument;
  59. import javax.swing.text.Element;
  60. import javax.swing.text.GlyphView;
  61. import javax.swing.text.IconView;
  62. import javax.swing.text.LabelView;
  63. import javax.swing.text.ParagraphView;
  64. import javax.swing.text.SimpleAttributeSet;
  65. import javax.swing.text.StyleConstants;
  66. import javax.swing.text.StyledDocument;
  67. import javax.swing.text.StyledEditorKit;
  68. import javax.swing.text.View;
  69. import javax.swing.text.ViewFactory;
  70. import net.miginfocom.swing.MigLayout;
  71. /**
  72. * Component to show and edit topics for a channel.
  73. */
  74. public class TopicBar extends JComponent implements ActionListener,
  75. ConfigChangeListener, ChannelTopicListener, HyperlinkListener,
  76. MouseListener, DocumentListener {
  77. /**
  78. * A version number for this class. It should be changed whenever the class
  79. * structure is changed (or anything else that would prevent serialized
  80. * objects being unserialized with the new class).
  81. */
  82. private static final long serialVersionUID = 1;
  83. /** Topic text. */
  84. private final TextPaneInputField topicText;
  85. /** Edit button. */
  86. private final JButton topicEdit;
  87. /** Cancel button. */
  88. private final JButton topicCancel;
  89. /** Associated channel. */
  90. private Channel channel;
  91. /** Controller. */
  92. private SwingController controller;
  93. /** Empty Attrib set. */
  94. private SimpleAttributeSet as;
  95. /** Foreground Colour. */
  96. private Color foregroundColour;
  97. /** Background Colour. */
  98. private Color backgroundColour;
  99. /** the maximum length allowed for a topic. */
  100. private int topicLengthMax;
  101. /** Error icon. */
  102. private final JLabel errorIcon;
  103. /**
  104. * Instantiates a new topic bar.
  105. *
  106. * @param channelFrame Parent channel frame
  107. */
  108. public TopicBar(final ChannelFrame channelFrame) {
  109. this.channel = channelFrame.getChannel();
  110. controller = channelFrame.getController();
  111. topicText = new TextPaneInputField();
  112. topicLengthMax = channel.getServer().getParser().getMaxTopicLength();
  113. errorIcon =
  114. new JLabel(IconManager.getIconManager().getIcon("input-error"));
  115. //TODO issue 3251
  116. //if (channelFrame.getConfigManager().getOptionBool(controller.
  117. // getDomain(), "showfulltopic")) {
  118. // topicText.setEditorKit(new StyledEditorKit());
  119. //} else {
  120. topicText.setEditorKit(new WrapEditorKit());
  121. //}
  122. ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
  123. new NewlinesDocumentFilter());
  124. topicText.getActionMap().put("paste-from-clipboard",
  125. new NoNewlinesPasteAction());
  126. topicEdit = new ImageButton("edit", IconManager.getIconManager().
  127. getIcon("edit-inactive"), IconManager.getIconManager().
  128. getIcon("edit"));
  129. topicCancel = new ImageButton("cancel", IconManager.getIconManager().
  130. getIcon("close"), IconManager.getIconManager().
  131. getIcon("close-active"));
  132. new SwingInputHandler(topicText, channelFrame.getCommandParser(),
  133. channelFrame).setTypes(false, false, true, false);
  134. final JScrollPane sp = new JScrollPane(topicText);
  135. sp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
  136. sp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
  137. setLayout(new MigLayout("fillx, ins 0, hidemode 3"));
  138. add(sp, "growx, pushx");
  139. add(errorIcon, "");
  140. add(topicCancel, "");
  141. add(topicEdit, "");
  142. channel.getChannelInfo().getParser().getCallbackManager().addCallback(
  143. ChannelTopicListener.class, this, channel.getChannelInfo().
  144. getName());
  145. topicText.addActionListener(this);
  146. topicEdit.addActionListener(this);
  147. topicCancel.addActionListener(this);
  148. topicText.getInputMap().put(KeyStroke.getKeyStroke("ENTER"),
  149. "enterButton");
  150. topicText.getActionMap().put("enterButton", new AbstractAction(
  151. "enterButton") {
  152. private static final long serialVersionUID = 1;
  153. /** {@inheritDoc} */
  154. @Override
  155. public void actionPerformed(ActionEvent e) {
  156. TopicBar.this.actionPerformed(e);
  157. }
  158. });
  159. topicText.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"),
  160. "escapeButton");
  161. topicText.getActionMap().put("escapeButton", new AbstractAction(
  162. "escapeButton") {
  163. private static final long serialVersionUID = 1;
  164. /** {@inheritDoc} */
  165. @Override
  166. public void actionPerformed(ActionEvent e) {
  167. e.setSource(topicCancel);
  168. TopicBar.this.actionPerformed(e);
  169. }
  170. });
  171. topicText.addHyperlinkListener(this);
  172. topicText.addMouseListener(this);
  173. topicText.getDocument().addDocumentListener(this);
  174. IdentityManager.getGlobalConfig().addChangeListener(
  175. "ui", "backgroundcolour", this);
  176. IdentityManager.getGlobalConfig().addChangeListener(
  177. "ui", "foregroundcolour", this);
  178. IdentityManager.getGlobalConfig().addChangeListener(
  179. "ui", "inputbackgroundcolour", this);
  180. IdentityManager.getGlobalConfig().addChangeListener(
  181. "ui", "inputforegroundcolour", this);
  182. IdentityManager.getGlobalConfig().addChangeListener(
  183. controller.getDomain(), "showfulltopic", this);
  184. IdentityManager.getGlobalConfig().addChangeListener(
  185. controller.getDomain(), "hideEmptyTopicBar", this);
  186. topicText.setFocusable(false);
  187. topicText.setEditable(false);
  188. topicCancel.setVisible(false);
  189. setColours();
  190. }
  191. /** {@inheritDoc} */
  192. @Override
  193. public void onChannelTopic(final Parser tParser, ChannelInfo cChannel,
  194. boolean bIsJoinTopic) {
  195. topicChanged();
  196. }
  197. /**
  198. * Topic has changed, update topic.
  199. */
  200. private void topicChanged() {
  201. if (topicText.isEditable()) {
  202. return;
  203. }
  204. topicText.setText("");
  205. if (channel.getCurrentTopic() != null) {
  206. Styliser.addStyledString((StyledDocument) topicText.getDocument(),
  207. new String[]{Styliser.CODE_HEXCOLOUR + ColourManager.getHex(
  208. foregroundColour) + channel.getCurrentTopic().getTopic(),},
  209. as);
  210. }
  211. if (channel.getConfigManager().getOptionBool(controller.getDomain(),
  212. "hideEmptyTopicBar")) {
  213. setVisible(topicText.getDocument().getLength() != 0);
  214. }
  215. topicText.setCaretPosition(0);
  216. validateTopic();
  217. }
  218. /**
  219. * {@inheritDoc}
  220. *
  221. * @param e Action event
  222. */
  223. @Override
  224. public void actionPerformed(final ActionEvent e) {
  225. if (e.getSource() == topicEdit || e.getSource() == topicText) {
  226. if (topicText.isEditable()) {
  227. channel.setTopic(topicText.getText());
  228. ((ChannelFrame) channel.getFrame()).getInputField().
  229. requestFocusInWindow();
  230. topicChanged();
  231. topicText.setFocusable(false);
  232. topicText.setEditable(false);
  233. topicCancel.setVisible(false);
  234. } else {
  235. topicText.setVisible(false);
  236. topicText.setText("");
  237. if (channel.getCurrentTopic() != null) {
  238. topicText.setText(channel.getCurrentTopic().getTopic());
  239. }
  240. topicText.setCaretPosition(0);
  241. topicText.setFocusable(true);
  242. topicText.setEditable(true);
  243. topicText.setVisible(true);
  244. topicText.requestFocusInWindow();
  245. topicCancel.setVisible(true);
  246. }
  247. } else if (e.getSource() == topicCancel) {
  248. topicText.setFocusable(false);
  249. topicText.setEditable(false);
  250. topicCancel.setVisible(false);
  251. ((ChannelFrame) channel.getFrame()).getInputField().
  252. requestFocusInWindow();
  253. topicChanged();
  254. }
  255. }
  256. /** {@inheritDoc} */
  257. @Override
  258. public void hyperlinkUpdate(final HyperlinkEvent e) {
  259. if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
  260. URLHandler.getURLHander().launchApp(e.getURL());
  261. }
  262. }
  263. private void setColours() {
  264. backgroundColour = channel.getConfigManager().getOptionColour(
  265. "ui", "inputbackgroundcolour", "ui", "backgroundcolour");
  266. foregroundColour = channel.getConfigManager().getOptionColour(
  267. "ui", "inputforegroundcolour", "ui", "foregroundcolour");
  268. setBackground(backgroundColour);
  269. setForeground(foregroundColour);
  270. setDisabledTextColour(foregroundColour);
  271. setCaretColor(foregroundColour);
  272. setAttributes();
  273. }
  274. private void setAttributes() {
  275. as = new SimpleAttributeSet();
  276. StyleConstants.setFontFamily(as, topicText.getFont().getFamily());
  277. StyleConstants.setFontSize(as, topicText.getFont().getSize());
  278. StyleConstants.setBackground(as, backgroundColour);
  279. StyleConstants.setForeground(as, foregroundColour);
  280. StyleConstants.setUnderline(as, false);
  281. StyleConstants.setBold(as, false);
  282. StyleConstants.setItalic(as, false);
  283. }
  284. /**
  285. * Sets the caret position in this topic bar.
  286. *
  287. * @param position New position
  288. */
  289. public void setCaretPosition(final int position) {
  290. UIUtilities.invokeLater(new Runnable() {
  291. /** {@inheritDoc} */
  292. @Override
  293. public void run() {
  294. topicText.setCaretPosition(position);
  295. }
  296. });
  297. }
  298. /**
  299. * Sets the caret colour to the specified coloour.
  300. *
  301. * @param optionColour Colour for the caret
  302. */
  303. public void setCaretColor(final Color optionColour) {
  304. UIUtilities.invokeLater(new Runnable() {
  305. /** {@inheritDoc} */
  306. @Override
  307. public void run() {
  308. topicText.setCaretColor(optionColour);
  309. }
  310. });
  311. }
  312. /**
  313. * Sets the foreground colour to the specified coloour.
  314. *
  315. * @param optionColour Colour for the foreground
  316. */
  317. @Override
  318. public void setForeground(final Color optionColour) {
  319. UIUtilities.invokeLater(new Runnable() {
  320. /** {@inheritDoc} */
  321. @Override
  322. public void run() {
  323. topicText.setForeground(optionColour);
  324. }
  325. });
  326. }
  327. /**
  328. * Sets the disabled text colour to the specified coloour.
  329. *
  330. * @param optionColour Colour for the disabled text
  331. */
  332. public void setDisabledTextColour(final Color optionColour) {
  333. UIUtilities.invokeLater(new Runnable() {
  334. /** {@inheritDoc} */
  335. @Override
  336. public void run() {
  337. topicText.setDisabledTextColor(optionColour);
  338. }
  339. });
  340. }
  341. /**
  342. * Sets the background colour to the specified coloour.
  343. *
  344. * @param optionColour Colour for the caret
  345. */
  346. @Override
  347. public void setBackground(final Color optionColour) {
  348. UIUtilities.invokeLater(new Runnable() {
  349. /** {@inheritDoc} */
  350. @Override
  351. public void run() {
  352. topicText.setBackground(optionColour);
  353. }
  354. });
  355. }
  356. /** {@inheritDoc} */
  357. @Override
  358. public void configChanged(String domain, String key) {
  359. //TODO issue 3251
  360. //if ("showfulltopic".equals(key)) {
  361. // if (channel.getConfigManager().getOptionBool(controller.getDomain(),
  362. // "showfulltopic")) {
  363. // topicText.setEditorKit(new StyledEditorKit());
  364. // } else {
  365. // topicText.setEditorKit(new WrapEditorKit());
  366. // }
  367. // ((DefaultStyledDocument) topicText.getDocument()).setDocumentFilter(
  368. // new NewlinesDocumentFilter());
  369. //}
  370. setColours();
  371. if ("hideEmptyTopicBar".equals(key)) {
  372. setVisible(true);
  373. if (channel.getConfigManager().getOptionBool(controller.getDomain(),
  374. "hideEmptyTopicBar")) {
  375. setVisible(topicText.getDocument().getLength() != 0);
  376. }
  377. }
  378. }
  379. /**
  380. * Closes this topic bar.
  381. */
  382. public void close() {
  383. channel.getChannelInfo().getParser().getCallbackManager().delCallback(
  384. ChannelTopicListener.class, this);
  385. }
  386. /**
  387. * Validates the topic text and shows errors as appropriate.
  388. */
  389. public void validateTopic() {
  390. UIUtilities.invokeLater(new Runnable() {
  391. /** {@inheritDoc} */
  392. @Override
  393. public void run() {
  394. if (topicText.isEditable()) {
  395. final int charsLeft = topicLengthMax - topicText.getText().
  396. length();
  397. if (charsLeft < 0) {
  398. errorIcon.setVisible(true);
  399. errorIcon.setToolTipText("Topic too long: " + topicText.
  400. getText().length() + " of " + topicLengthMax);
  401. } else {
  402. errorIcon.setVisible(false);
  403. errorIcon.setToolTipText(null);
  404. }
  405. } else {
  406. errorIcon.setVisible(false);
  407. }
  408. }
  409. });
  410. }
  411. /**
  412. * {@inheritDoc}
  413. *
  414. * @param e Mouse event
  415. */
  416. @Override
  417. public void mouseClicked(MouseEvent e) {
  418. if (e.getClickCount() == 2) {
  419. topicEdit.doClick();
  420. }
  421. }
  422. /**
  423. * {@inheritDoc}
  424. *
  425. * @param e Mouse event
  426. */
  427. @Override
  428. public void mousePressed(final MouseEvent e) {
  429. //Ignore
  430. }
  431. /**
  432. * {@inheritDoc}
  433. *
  434. * @param e Mouse event
  435. */
  436. @Override
  437. public void mouseReleased(final MouseEvent e) {
  438. //Ignore
  439. }
  440. /**
  441. * {@inheritDoc}
  442. *
  443. * @param e Mouse event
  444. */
  445. @Override
  446. public void mouseEntered(final MouseEvent e) {
  447. //Ignore
  448. }
  449. /**
  450. * {@inheritDoc}
  451. *
  452. * @param e Mouse event
  453. */
  454. @Override
  455. public void mouseExited(final MouseEvent e) {
  456. //Ignore
  457. }
  458. /** {@inheritDoc} */
  459. @Override
  460. public void insertUpdate(final DocumentEvent e) {
  461. validateTopic();
  462. if (topicText.isEditable()) {
  463. SwingUtilities.invokeLater(new Runnable() {
  464. @Override
  465. public void run() {
  466. setAttributes();
  467. ((DefaultStyledDocument) topicText.getDocument()).
  468. setCharacterAttributes(0, Integer.MAX_VALUE, as,
  469. true);
  470. }
  471. });
  472. }
  473. }
  474. /** {@inheritDoc} */
  475. @Override
  476. public void removeUpdate(final DocumentEvent e) {
  477. validateTopic();
  478. }
  479. /** {@inheritDoc} */
  480. @Override
  481. public void changedUpdate(final DocumentEvent e) {
  482. validateTopic();
  483. }
  484. }
  485. /**
  486. * @author Stanislav Lapitsky
  487. * @version 1.0
  488. */
  489. class WrapEditorKit extends StyledEditorKit {
  490. private static final long serialVersionUID = 1;
  491. private ViewFactory defaultFactory = new WrapColumnFactory();
  492. /** {@inheritDoc} */
  493. @Override
  494. public ViewFactory getViewFactory() {
  495. return defaultFactory;
  496. }
  497. }
  498. /**
  499. * @author Stanislav Lapitsky
  500. * @version 1.0
  501. */
  502. class WrapColumnFactory implements ViewFactory {
  503. /** {@inheritDoc} */
  504. @Override
  505. public View create(final Element elem) {
  506. String kind = elem.getName();
  507. if (kind != null) {
  508. if (kind.equals(AbstractDocument.ContentElementName)) {
  509. return new WrapLabelView(elem);
  510. } else if (kind.equals(AbstractDocument.ParagraphElementName)) {
  511. return new NoWrapParagraphView(elem);
  512. } else if (kind.equals(AbstractDocument.SectionElementName)) {
  513. return new BoxView(elem, View.Y_AXIS);
  514. } else if (kind.equals(StyleConstants.ComponentElementName)) {
  515. return new ComponentView(elem);
  516. } else if (kind.equals(StyleConstants.IconElementName)) {
  517. return new IconView(elem);
  518. }
  519. }
  520. // default to text display
  521. return new LabelView(elem);
  522. }
  523. }
  524. /**
  525. * @author Stanislav Lapitsky
  526. * @version 1.0
  527. */
  528. class NoWrapParagraphView extends ParagraphView {
  529. /**
  530. * Creates a new no wrap paragraph view.
  531. *
  532. * @param elem Element to view
  533. */
  534. public NoWrapParagraphView(final Element elem) {
  535. super(elem);
  536. }
  537. /** {@inheritDoc} */
  538. @Override
  539. public void layout(final int width, final int height) {
  540. super.layout(Short.MAX_VALUE, height);
  541. }
  542. /** {@inheritDoc} */
  543. @Override
  544. public float getMinimumSpan(final int axis) {
  545. return super.getPreferredSpan(axis);
  546. }
  547. }
  548. /**
  549. * @author Stanislav Lapitsky
  550. * @version 1.0
  551. */
  552. class WrapLabelView extends LabelView {
  553. /**
  554. * Creates a new wrap label view.
  555. *
  556. * @param elem Element to view
  557. */
  558. public WrapLabelView(final Element elem) {
  559. super(elem);
  560. }
  561. /** {@inheritDoc} */
  562. @Override
  563. public int getBreakWeight(final int axis, final float pos, final float len) {
  564. if (axis == View.X_AXIS) {
  565. checkPainter();
  566. int p0 = getStartOffset();
  567. int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos, len);
  568. if (p1 == p0) {
  569. // can't even fit a single character
  570. return View.BadBreakWeight;
  571. }
  572. try {
  573. //if the view contains line break char return forced break
  574. if (getDocument().getText(p0, p1 - p0).indexOf("\r") >= 0) {
  575. return View.ForcedBreakWeight;
  576. }
  577. } catch (BadLocationException ex) {
  578. //should never happen
  579. }
  580. }
  581. return super.getBreakWeight(axis, pos, len);
  582. }
  583. /** {@inheritDoc} */
  584. @Override
  585. public View breakView(final int axis, final int p0, final float pos,
  586. final float len) {
  587. if (axis == View.X_AXIS) {
  588. checkPainter();
  589. int p1 = getGlyphPainter().getBoundedPosition(this, p0, pos, len);
  590. try {
  591. //if the view contains line break char break the view
  592. int index = getDocument().getText(p0, p1 - p0).indexOf("\r");
  593. if (index >= 0) {
  594. GlyphView v = (GlyphView) createFragment(p0, p0 + index + 1);
  595. return v;
  596. }
  597. } catch (BadLocationException ex) {
  598. //should never happen
  599. }
  600. }
  601. return super.breakView(axis, p0, pos, len);
  602. }
  603. }