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