Search in sources :

Example 1 with HTMLDocumentImpl

use of org.loboevolution.html.dom.domimpl.HTMLDocumentImpl in project LoboEvolution by LoboEvolution.

the class GoAction method goURL.

private void goURL(String text, HttpURLConnection httpcon) {
    final ITabbedPane tabbedPane = panel.getTabbedPane();
    tabbedPane.setComponentPopupMenu(this.panel);
    final int indexPanel = tabbedPane.getSelectedIndex();
    HtmlPanel htmlPanel;
    if (httpcon == null) {
        htmlPanel = HtmlPanel.createHtmlPanel(panel, text);
    } else {
        htmlPanel = HtmlPanel.createHtmlPanel(panel, text, httpcon);
    }
    final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) htmlPanel.getRootNode();
    final String title = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
    tabbedPane.remove(indexPanel);
    tabbedPane.insertTab(title, null, htmlPanel, title, indexPanel);
    this.addressBar.setText(text);
    panel.getScroll().getViewport().add((Component) tabbedPane);
    TabStore.deleteTab(indexPanel);
    TabStore.insertTab(indexPanel, text, title);
    NavigationManager.insertHistory(text, title, indexPanel);
    addressBar.removeAll();
    Autocomplete.setupAutoComplete(addressBar, TabStore.getUrls());
}
Also used : HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HtmlPanel(org.loboevolution.html.gui.HtmlPanel)

Example 2 with HTMLDocumentImpl

use of org.loboevolution.html.dom.domimpl.HTMLDocumentImpl in project LoboEvolution by LoboEvolution.

the class DragDropListener method openFileDrop.

private void openFileDrop(String fullURL) {
    fullURL = fullURL.replace("\\", "/");
    final ITabbedPane tabbedPane = bpanel.getTabbedPane();
    tabbedPane.setComponentPopupMenu(bpanel);
    int index = TabStore.getTabs().size();
    final HtmlPanel hpanel = HtmlPanel.createHtmlPanel(bpanel, fullURL);
    final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) hpanel.getRootNode();
    final String title = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
    tabbedPane.insertTab(title, null, hpanel, title, index + 1);
    tabbedPane.setSelectedIndex(index + 1);
    final IBrowserFrame browserFrame = bpanel.getBrowserFrame();
    IBrowserPanel panel = browserFrame.getPanel();
    IWelcomePanel welcome = panel.getWelcome();
    browserFrame.getToolbar().getAddressBar().setText(fullURL);
    TabStore.insertTab(index + 1, fullURL, title);
    welcome.setBackground(new Color(37, 51, 61));
    bpanel.getScroll().getViewport().add((Component) tabbedPane);
}
Also used : HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HtmlPanel(org.loboevolution.html.gui.HtmlPanel)

Example 3 with HTMLDocumentImpl

use of org.loboevolution.html.dom.domimpl.HTMLDocumentImpl in project LoboEvolution by LoboEvolution.

the class HtmlPanel method scrollToElementImpl.

private void scrollToElementImpl(String nameOrId) {
    final NodeImpl node = this.rootNode;
    if (node instanceof HTMLDocumentImpl) {
        final HTMLDocumentImpl doc = (HTMLDocumentImpl) node;
        final Element element = doc.getElementById(nameOrId);
        if (element != null) {
            this.scrollTo(element);
        }
    }
}
Also used : HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) NodeImpl(org.loboevolution.html.dom.nodeimpl.NodeImpl) Element(org.loboevolution.html.node.Element)

Example 4 with HTMLDocumentImpl

use of org.loboevolution.html.dom.domimpl.HTMLDocumentImpl in project LoboEvolution by LoboEvolution.

the class ExpressionTimerTask method actionPerformed.

/**
 * {@inheritDoc}
 */
@Override
public void actionPerformed(final ActionEvent e) {
    // This executes in the GUI thread and that's good.
    try {
        final WindowImpl window = this.getWindow();
        if (window == null) {
            if (logger.isLoggable(Level.INFO)) {
                logger.info("actionPerformed(): WindowImpl is no longer available.");
            }
            return;
        }
        if (this.removeTask) {
            window.forgetTask(this.timeIDInt, false);
        }
        final HTMLDocumentImpl doc = (HTMLDocumentImpl) window.getDocument();
        if (doc == null) {
            throw new IllegalStateException("Cannot perform operation when document is unset.");
        }
        evalInScope(window, this.expression);
    } catch (final Throwable err) {
        logger.log(Level.WARNING, "actionPerformed()", err);
    }
}
Also used : HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)

Example 5 with HTMLDocumentImpl

use of org.loboevolution.html.dom.domimpl.HTMLDocumentImpl in project LoboEvolution by LoboEvolution.

the class ExpressionTimerTask method evalInScope.

private Object evalInScope(WindowImpl window, final String javascript) {
    HTMLDocumentImpl document = (HTMLDocumentImpl) window.getDocumentNode();
    final Context ctx = Executor.createContext(document.getDocumentURL(), window.getUaContext());
    try {
        final String scriptURI = "window.eval";
        return ctx.evaluateString(window.getWindowScope(), javascript, scriptURI, 1, null);
    } finally {
        Context.exit();
    }
}
Also used : Context(org.mozilla.javascript.Context) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)

Aggregations

HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)61 HtmlPanel (org.loboevolution.html.gui.HtmlPanel)20 HTMLElementImpl (org.loboevolution.html.dom.domimpl.HTMLElementImpl)13 ITabbedPane (org.loboevolution.component.ITabbedPane)11 IBrowserFrame (org.loboevolution.component.IBrowserFrame)6 HtmlRendererContext (org.loboevolution.http.HtmlRendererContext)6 BookmarkInfo (org.loboevolution.info.BookmarkInfo)6 ArrayList (java.util.ArrayList)5 IBrowserPanel (org.loboevolution.component.IBrowserPanel)5 HTMLElement (org.loboevolution.html.dom.HTMLElement)5 AbstractCSSProperties (org.loboevolution.html.style.AbstractCSSProperties)5 HtmlLength (org.loboevolution.html.style.HtmlLength)5 NavigationStore (org.loboevolution.store.NavigationStore)5 BrowserPanel (org.loboevolution.component.BrowserPanel)4 LoboPanel (com.jtattoo.plaf.lobo.LoboPanel)3 HTMLCollectionImpl (org.loboevolution.html.dom.domimpl.HTMLCollectionImpl)3 WritableLineReader (org.loboevolution.html.io.WritableLineReader)3 Document (org.loboevolution.html.node.Document)3 MetaInfo (org.loboevolution.info.MetaInfo)3 LoboButton (com.jtattoo.plaf.lobo.LoboButton)2