home *** CD-ROM | disk | FTP | other *** search
- package javax.swing;
-
- import java.net.MalformedURLException;
- import java.net.URL;
- import javax.accessibility.AccessibleHyperlink;
- import javax.swing.JEditorPane.JEditorPaneAccessibleHypertextSupport;
- import javax.swing.event.HyperlinkEvent;
- import javax.swing.event.HyperlinkEvent.EventType;
- import javax.swing.text.AttributeSet;
- import javax.swing.text.BadLocationException;
- import javax.swing.text.Document;
- import javax.swing.text.Element;
- import javax.swing.text.html.HTML.Attribute;
- import javax.swing.text.html.HTML.Tag;
-
- public class JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink extends AccessibleHyperlink {
- // $FF: synthetic field
- private final JEditorPane.JEditorPaneAccessibleHypertextSupport this$1;
- Element element;
-
- public JEditorPane$JEditorPaneAccessibleHypertextSupport$HTMLLink(JEditorPane.JEditorPaneAccessibleHypertextSupport var1, Element var2) {
- this.this$1 = var1;
- this.element = var2;
- }
-
- public boolean doAccessibleAction(int var1) {
- if (var1 == 0 && this.isValid()) {
- URL var2 = (URL)this.getAccessibleActionObject(var1);
- if (var2 != null) {
- HyperlinkEvent var3 = new HyperlinkEvent(JEditorPaneAccessibleHypertextSupport.access$0(this.this$1), EventType.ACTIVATED, var2);
- JEditorPaneAccessibleHypertextSupport.access$0(this.this$1).fireHyperlinkUpdate(var3);
- return true;
- }
- }
-
- return false;
- }
-
- public Object getAccessibleActionAnchor(int var1) {
- return this.getAccessibleActionDescription(var1);
- }
-
- public int getAccessibleActionCount() {
- return 1;
- }
-
- public String getAccessibleActionDescription(int var1) {
- if (var1 == 0 && this.isValid()) {
- Document var2 = JEditorPaneAccessibleHypertextSupport.access$0(this.this$1).getDocument();
- if (var2 != null) {
- try {
- return var2.getText(this.getStartIndex(), this.getEndIndex() - this.getStartIndex());
- } catch (BadLocationException var3) {
- return null;
- }
- }
- }
-
- return null;
- }
-
- public Object getAccessibleActionObject(int var1) {
- if (var1 == 0 && this.isValid()) {
- AttributeSet var2 = this.element.getAttributes();
- AttributeSet var3 = (AttributeSet)var2.getAttribute(Tag.A);
- String var4 = var3 != null ? (String)var3.getAttribute(Attribute.HREF) : null;
- if (var4 != null) {
- URL var5;
- try {
- var5 = new URL(JEditorPaneAccessibleHypertextSupport.access$0(this.this$1).getPage(), var4);
- } catch (MalformedURLException var6) {
- var5 = null;
- }
-
- return var5;
- }
- }
-
- return null;
- }
-
- public int getEndIndex() {
- return this.element.getEndOffset();
- }
-
- public int getStartIndex() {
- return this.element.getStartOffset();
- }
-
- public boolean isValid() {
- return this.this$1.linksValid;
- }
- }
-