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());
}
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);
}
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);
}
}
}
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);
}
}
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();
}
}
Aggregations