195 * @return list of all frames
196 */
197 private static List<JEditorPane> getFrames(final JEditorPane editor) {
198 List<JEditorPane> list = new ArrayList<JEditorPane>();
199 getFrames(editor, list);
200 if (list.size() == 0) {
201 //the frames have not been created yet.
202 //let's trigger the frames creation.
203 createFrames(editor);
204 getFrames(editor, list);
205 }
206 return list;
207 }
208
209 /**
210 * Adds all {@code JEditorPanes} under {@code container} tagged by {@code
211 * FrameEditorPaneTag} to the {@code list}. It adds only top
212 * level {@code JEditorPanes}. For instance if there is a frame
213 * inside the frame it will return the top frame only.
214 *
215 * @param c the container to find all frames under
216 * @param list {@code List} to append the results too
217 */
218 private static void getFrames(final Container container, List<JEditorPane> list) {
219 for (Component c : container.getComponents()) {
220 if (c instanceof FrameEditorPaneTag
221 && c instanceof JEditorPane ) { //it should be always JEditorPane
222 list.add((JEditorPane) c);
223 } else {
224 if (c instanceof Container) {
225 getFrames((Container) c, list);
226 }
227 }
228 }
229 }
230
231 /**
232 * Triggers the frames creation for {@code JEditorPane}
233 *
234 * @param editor the {@code JEditorPane} to create frames for
235 */
|
195 * @return list of all frames
196 */
197 private static List<JEditorPane> getFrames(final JEditorPane editor) {
198 List<JEditorPane> list = new ArrayList<JEditorPane>();
199 getFrames(editor, list);
200 if (list.size() == 0) {
201 //the frames have not been created yet.
202 //let's trigger the frames creation.
203 createFrames(editor);
204 getFrames(editor, list);
205 }
206 return list;
207 }
208
209 /**
210 * Adds all {@code JEditorPanes} under {@code container} tagged by {@code
211 * FrameEditorPaneTag} to the {@code list}. It adds only top
212 * level {@code JEditorPanes}. For instance if there is a frame
213 * inside the frame it will return the top frame only.
214 *
215 * @param container the container to find all frames under
216 * @param list {@code List} to append the results too
217 */
218 private static void getFrames(final Container container, List<JEditorPane> list) {
219 for (Component c : container.getComponents()) {
220 if (c instanceof FrameEditorPaneTag
221 && c instanceof JEditorPane ) { //it should be always JEditorPane
222 list.add((JEditorPane) c);
223 } else {
224 if (c instanceof Container) {
225 getFrames((Container) c, list);
226 }
227 }
228 }
229 }
230
231 /**
232 * Triggers the frames creation for {@code JEditorPane}
233 *
234 * @param editor the {@code JEditorPane} to create frames for
235 */
|