1 /*
2 * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
357 bias[0] = Position.Bias.Forward;
358 return getStartOffset();
359 }
360 bias[0] = Position.Bias.Backward;
361 return getEndOffset();
362 }
363
364 // --- member variables ------------------------------------------------
365
366 private Component createdC;
367 private Invalidator c;
368
369 /**
370 * This class feeds the invalidate back to the
371 * hosting View. This is needed to get the View
372 * hierarchy to consider giving the component
373 * a different size (i.e. layout may have been
374 * cached between the associated view and the
375 * container hosting this component).
376 */
377 class Invalidator extends Container implements PropertyChangeListener {
378
379 // NOTE: When we remove this class we are going to have to some
380 // how enforce setting of the focus traversal keys on the children
381 // so that they don't inherit them from the JEditorPane. We need
382 // to do this as JEditorPane has abnormal bindings (it is a focus cycle
383 // root) and the children typically don't want these bindings as well.
384
385 Invalidator(Component child) {
386 setLayout(null);
387 add(child);
388 cacheChildSizes();
389 }
390
391 /**
392 * The components invalid layout needs
393 * to be propagated through the view hierarchy
394 * so the views (which position the component)
395 * can have their layout recomputed.
396 */
|
1 /*
2 * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
357 bias[0] = Position.Bias.Forward;
358 return getStartOffset();
359 }
360 bias[0] = Position.Bias.Backward;
361 return getEndOffset();
362 }
363
364 // --- member variables ------------------------------------------------
365
366 private Component createdC;
367 private Invalidator c;
368
369 /**
370 * This class feeds the invalidate back to the
371 * hosting View. This is needed to get the View
372 * hierarchy to consider giving the component
373 * a different size (i.e. layout may have been
374 * cached between the associated view and the
375 * container hosting this component).
376 */
377 @SuppressWarnings("serial") // JDK-implementation class
378 class Invalidator extends Container implements PropertyChangeListener {
379
380 // NOTE: When we remove this class we are going to have to some
381 // how enforce setting of the focus traversal keys on the children
382 // so that they don't inherit them from the JEditorPane. We need
383 // to do this as JEditorPane has abnormal bindings (it is a focus cycle
384 // root) and the children typically don't want these bindings as well.
385
386 Invalidator(Component child) {
387 setLayout(null);
388 add(child);
389 cacheChildSizes();
390 }
391
392 /**
393 * The components invalid layout needs
394 * to be propagated through the view hierarchy
395 * so the views (which position the component)
396 * can have their layout recomputed.
397 */
|