Search in sources :

Example 1 with IBrowserPanel

use of org.loboevolution.component.IBrowserPanel in project LoboEvolution by LoboEvolution.

the class HtmlRendererContext method back.

/**
 * It should navigate back one page. This implementation does nothing and should
 * be overridden.
 */
public void back() {
    final IBrowserPanel bpanel = htmlPanel.getBrowserPanel();
    final ITabbedPane tabbedPane = bpanel.getTabbedPane();
    final IBrowserFrame browserFrame = bpanel.getBrowserFrame();
    final IToolBar toolbar = browserFrame.getToolbar();
    final JTextField addressBar = toolbar.getAddressBar();
    String url = addressBar.getText();
    tabbedPane.setComponentPopupMenu(bpanel);
    NavigationStore nh = new NavigationStore();
    final int indexPanel = tabbedPane.getSelectedIndex();
    List<BookmarkInfo> tabsById = nh.getRecentHost(indexPanel, true);
    for (int i = 0; i < tabsById.size(); i++) {
        BookmarkInfo info = tabsById.get(i);
        String tab = info.getUrl();
        if (tab.equals(url) && i > 0) {
            url = tabsById.get(i - 1).getUrl();
        }
    }
    final HtmlPanel hpanel = HtmlPanel.createHtmlPanel(bpanel, url);
    final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) hpanel.getRootNode();
    final String title = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
    tabbedPane.remove(indexPanel);
    tabbedPane.insertTab(title, null, htmlPanel, title, indexPanel);
    browserFrame.getToolbar().getAddressBar().setText(url);
    bpanel.getScroll().getViewport().add((Component) tabbedPane);
    TabStore.deleteTab(indexPanel);
    TabStore.insertTab(indexPanel, url, title);
}
Also used : BookmarkInfo(org.loboevolution.info.BookmarkInfo) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) IBrowserFrame(org.loboevolution.component.IBrowserFrame) NavigationStore(org.loboevolution.store.NavigationStore) HtmlPanel(org.loboevolution.html.gui.HtmlPanel) IBrowserPanel(org.loboevolution.component.IBrowserPanel) ITabbedPane(org.loboevolution.component.ITabbedPane) IToolBar(org.loboevolution.component.IToolBar)

Example 2 with IBrowserPanel

use of org.loboevolution.component.IBrowserPanel in project LoboEvolution by LoboEvolution.

the class HtmlRendererContext method getCurrentURL.

/**
 * <p>getCurrentURL.</p>
 *
 * @return a {@link java.lang.String} object.
 */
public String getCurrentURL() {
    HtmlPanel html = htmlPanel;
    IBrowserPanel panel = html.getBrowserPanel();
    if (panel != null) {
        IBrowserFrame frame = panel.getBrowserFrame();
        IToolBar toolbar = frame.getToolbar();
        JTextField jtf = toolbar.getAddressBar();
        return jtf.getText();
    } else {
        return "";
    }
}
Also used : IBrowserFrame(org.loboevolution.component.IBrowserFrame) HtmlPanel(org.loboevolution.html.gui.HtmlPanel) IBrowserPanel(org.loboevolution.component.IBrowserPanel) IToolBar(org.loboevolution.component.IToolBar)

Example 3 with IBrowserPanel

use of org.loboevolution.component.IBrowserPanel in project LoboEvolution by LoboEvolution.

the class HtmlRendererContext method getInnerHeight.

/**
 * <p> getInnerHeight.</p>
 *
 * @return a int.
 */
public int getInnerHeight() {
    final IBrowserPanel bpanel = htmlPanel.getBrowserPanel();
    if (bpanel != null && bpanel.getHeight() > 0) {
        return bpanel.getHeight();
    }
    final Rectangle initialWindowBounds = GeneralStore.getInitialWindowBounds();
    return Double.valueOf(initialWindowBounds.getHeight()).intValue();
}
Also used : IBrowserPanel(org.loboevolution.component.IBrowserPanel)

Example 4 with IBrowserPanel

use of org.loboevolution.component.IBrowserPanel in project LoboEvolution by LoboEvolution.

the class HtmlRendererContext method getOuterWidth.

/**
 * <p> getOuterWidth.</p>
 *
 * @return a int.
 */
public int getOuterWidth() {
    final IBrowserPanel bpanel = htmlPanel.getBrowserPanel();
    if (bpanel != null && bpanel.getWidth() > 0) {
        return bpanel.getWidth();
    }
    final Rectangle initialWindowBounds = GeneralStore.getInitialWindowBounds();
    return Double.valueOf(initialWindowBounds.getWidth()).intValue();
}
Also used : IBrowserPanel(org.loboevolution.component.IBrowserPanel)

Example 5 with IBrowserPanel

use of org.loboevolution.component.IBrowserPanel in project LoboEvolution by LoboEvolution.

the class HtmlRendererContext method openImageViewer.

/**
 * <p>openImageViewer.</p>
 *
 * @param fullURL a {@link java.lang.String} object.
 * @param stream a {@link java.io.InputStream} object.
 */
public void openImageViewer(String fullURL, InputStream stream) {
    try {
        final IBrowserPanel bpanel = htmlPanel.getBrowserPanel();
        final ITabbedPane tabbedPane = bpanel.getTabbedPane();
        final IBrowserFrame browserFrame = bpanel.getBrowserFrame();
        final BufferedImage img = ImageIO.read(stream);
        final ImageViewer viewer = new ImageViewer(img);
        final String title = "Image Viewer";
        int index = TabStore.getTabs().size();
        JPanel jPanel = new JPanel();
        jPanel.add(viewer.getComponent());
        browserFrame.getToolbar().getAddressBar().setText(fullURL);
        tabbedPane.insertTab(title, null, viewer.getComponent(), title, index);
        bpanel.getScroll().getViewport().add((Component) tabbedPane);
    } catch (IOException e) {
        logger.log(Level.SEVERE, e.getMessage(), e);
    }
}
Also used : IBrowserFrame(org.loboevolution.component.IBrowserFrame) IBrowserPanel(org.loboevolution.component.IBrowserPanel) ITabbedPane(org.loboevolution.component.ITabbedPane) ImageViewer(org.loboevolution.img.ImageViewer) BufferedImage(java.awt.image.BufferedImage)

Aggregations

IBrowserPanel (org.loboevolution.component.IBrowserPanel)14 IBrowserFrame (org.loboevolution.component.IBrowserFrame)9 ITabbedPane (org.loboevolution.component.ITabbedPane)9 HtmlPanel (org.loboevolution.html.gui.HtmlPanel)7 HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)6 IToolBar (org.loboevolution.component.IToolBar)3 java.awt (java.awt)2 BufferedImage (java.awt.image.BufferedImage)2 javax.swing (javax.swing)2 ChangeListener (javax.swing.event.ChangeListener)2 Strings (org.loboevolution.common.Strings)2 ImageViewer (org.loboevolution.img.ImageViewer)2 BookmarkInfo (org.loboevolution.info.BookmarkInfo)2 NavigationStore (org.loboevolution.store.NavigationStore)2 LoboCheckBox (com.jtattoo.plaf.lobo.LoboCheckBox)1 LoboPanel (com.jtattoo.plaf.lobo.LoboPanel)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 BufferExceededException (org.loboevolution.common.BufferExceededException)1 BrowserFrame (org.loboevolution.component.BrowserFrame)1