use of org.loboevolution.component.BrowserPanel in project LoboEvolution by LoboEvolution.
the class ShowBookmarksWindow method createItemPanel.
private LoboPanel createItemPanel(BrowserFrame frame) {
LoboPanel panel_3 = new LoboPanel();
panel_3.setLayout(null);
panel_3.setBounds(0, 191, 750, 70);
int debutCpDesc = 15;
int debutCpTitle = 15;
int debutCpUrl = 15;
int debutCpSeparator = 58;
int incrementNouvelleLigne = 67;
try {
final BookmarksStore history = new BookmarksStore();
final List<BookmarkInfo> allEntries = history.getBookmarks(100);
for (final BookmarkInfo binfo : allEntries) {
final String url = binfo.getUrl();
LoboTextField description = new LoboTextField();
description.setText(binfo.getDescription());
description.setToolTipText(binfo.getDescription());
description.setFont(new Font("Tahoma", Font.BOLD, 12));
description.setEditable(false);
description.setColumns(10);
description.setBorder(null);
description.setBounds(12, debutCpDesc, 180, 22);
panel_3.add(description);
LoboTextField title = new LoboTextField();
title.setText(binfo.getTitle());
title.setToolTipText(binfo.getTitle());
title.setFont(new Font("Tahoma", Font.BOLD, 12));
title.setEditable(false);
title.setColumns(10);
title.setBorder(null);
title.setBounds(190, debutCpTitle, 150, 22);
panel_3.add(title);
LoboButton edit = new LoboButton();
edit.setText("Edit");
edit.setActionCommand("okButton");
edit.setBounds(370, debutCpUrl, 40, 40);
edit.addActionListener(e -> {
desc.setText(description.getText());
titleEditTxtFld.setText(title.getText());
urlEditTxtFld.setText(url);
tmpUrl = url;
});
panel_3.add(edit);
LoboButton delete = new LoboButton();
delete.setText("Delete");
delete.setActionCommand("okButton");
delete.setBounds(410, debutCpUrl, 50, 40);
delete.addActionListener(e -> {
final BookmarksStore book = new BookmarksStore();
book.deleteBookmark(binfo.getUrl());
JOptionPane.showMessageDialog(panel_3, "Delete Ok!");
setVisible(false);
dispose();
new ShowBookmarksWindow(frame, 100).setVisible(true);
});
panel_3.add(delete);
LoboButton go = new LoboButton();
go.setText("Go");
go.setActionCommand("goButton");
go.setBounds(460, debutCpUrl, 40, 40);
go.addActionListener(e -> {
final BrowserPanel panel = frame.getPanel();
final int indexPanel = panel.getTabbedPane().getIndex() + 1;
final ITabbedPane tabbedPane = panel.getTabbedPane();
HtmlPanel hpanel = HtmlPanel.createHtmlPanel(panel, url);
final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) hpanel.getRootNode();
String htmlTitle = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
tabbedPane.setComponentPopupMenu(panel);
tabbedPane.insertTab(htmlTitle, null, hpanel, htmlTitle, indexPanel);
tabbedPane.setSelectedIndex(indexPanel);
TabStore.insertTab(indexPanel, url, htmlTitle);
NavigationManager.insertHistory(url, htmlTitle, indexPanel);
});
panel_3.add(go);
debutCpDesc = debutCpDesc + incrementNouvelleLigne;
debutCpTitle = debutCpTitle + incrementNouvelleLigne;
debutCpUrl = debutCpUrl + incrementNouvelleLigne;
debutCpSeparator = debutCpSeparator + incrementNouvelleLigne;
}
} catch (Exception e) {
e.printStackTrace();
}
panel_3.setPreferredSize(new Dimension(0, 1000));
panel_3.revalidate();
panel_3.repaint();
return panel_3;
}
use of org.loboevolution.component.BrowserPanel in project LoboEvolution by LoboEvolution.
the class OpenFileAction method actionPerformed.
/**
* {@inheritDoc}
*/
@Override
public void actionPerformed(final ActionEvent e) {
final BrowserPanel panel = this.frame.getPanel();
final JFileChooser fileChooser = new JFileChooser();
fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
final int returnValue = fileChooser.showOpenDialog(panel);
if (returnValue == JFileChooser.APPROVE_OPTION) {
final File selectedFile = fileChooser.getSelectedFile();
final String url = selectedFile.toURI().toString();
final int indexPanel = panel.getTabbedPane().getIndex() + 1;
final ITabbedPane tabbedPane = panel.getTabbedPane();
tabbedPane.setComponentPopupMenu(panel);
HtmlPanel hpanel = HtmlPanel.createHtmlPanel(panel, url);
final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) hpanel.getRootNode();
final String title = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
tabbedPane.insertTab(title, null, hpanel, title, indexPanel);
tabbedPane.setSelectedIndex(indexPanel);
TabStore.insertTab(indexPanel, url, title);
NavigationManager.insertHistory(url, title, indexPanel);
}
}
use of org.loboevolution.component.BrowserPanel in project LoboEvolution by LoboEvolution.
the class OpenInTabAction method actionPerformed.
/**
* {@inheritDoc}
*/
@Override
public void actionPerformed(final ActionEvent e) {
final BrowserPanel panel = this.frame.getPanel();
final int indexPanel = panel.getTabbedPane().getIndex() + 1;
final ITabbedPane tabbedPane = panel.getTabbedPane();
tabbedPane.setComponentPopupMenu(panel);
JComponent comp = null;
String title = "";
if (this.address != null) {
comp = HtmlPanel.createHtmlPanel(panel, this.address);
final HtmlPanel hpanel = (HtmlPanel) comp;
final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) hpanel.getRootNode();
title = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
} else {
comp = new WelcomePanel(panel);
title = "Welcome";
}
tabbedPane.insertTab(title, null, comp, title, indexPanel);
tabbedPane.setSelectedIndex(indexPanel);
TabStore.insertTab(indexPanel, this.address, title);
NavigationManager.insertHistory(this.address, title, indexPanel);
}
use of org.loboevolution.component.BrowserPanel in project LoboEvolution by LoboEvolution.
the class ShowRecentWindow method createItemPanel.
private LoboPanel createItemPanel(BrowserFrame frame) {
LoboPanel panel_3 = new LoboPanel();
panel_3.setLayout(null);
panel_3.setBounds(0, 191, 750, 70);
int debutCpDesc = 15;
int debutCpTitle = 15;
int debutCpUrl = 15;
int debutCpSeparator = 58;
int incrementNouvelleLigne = 67;
try {
final NavigationStore nav = new NavigationStore();
final List<BookmarkInfo> allEntries = nav.getRecentHost(1000, false);
for (final BookmarkInfo binfo : allEntries) {
final String url = binfo.getUrl();
LoboTextField title = new LoboTextField();
title.setText(binfo.getTitle());
title.setToolTipText(binfo.getTitle());
title.setFont(new Font("Tahoma", Font.BOLD, 12));
title.setEditable(false);
title.setColumns(10);
title.setBorder(null);
title.setBounds(12, debutCpDesc, 250, 22);
panel_3.add(title);
LoboButton edit = new LoboButton();
edit.setText("Edit");
edit.setActionCommand("okButton");
edit.setBounds(370, debutCpUrl, 40, 40);
edit.addActionListener(e -> {
titleEditTxtFld.setText(title.getText());
urlEditTxtFld.setText(url);
tmpUrl = url;
});
panel_3.add(edit);
LoboButton delete = new LoboButton();
delete.setText("Delete");
delete.setActionCommand("okButton");
delete.setBounds(410, debutCpUrl, 50, 40);
delete.addActionListener(e -> {
final NavigationStore nstore = new NavigationStore();
nstore.deleteHost(binfo.getUrl());
JOptionPane.showMessageDialog(panel_3, "Delete Ok!");
setVisible(false);
dispose();
new ShowRecentWindow(frame).setVisible(true);
});
panel_3.add(delete);
LoboButton go = new LoboButton();
go.setText("Go");
go.setActionCommand("goButton");
go.setBounds(460, debutCpUrl, 40, 40);
go.addActionListener(e -> {
final BrowserPanel panel = frame.getPanel();
final int indexPanel = panel.getTabbedPane().getIndex() + 1;
final ITabbedPane tabbedPane = panel.getTabbedPane();
HtmlPanel hpanel = HtmlPanel.createHtmlPanel(panel, url);
final HTMLDocumentImpl nodeImpl = (HTMLDocumentImpl) hpanel.getRootNode();
String htmlTitle = Strings.isNotBlank(nodeImpl.getTitle()) ? nodeImpl.getTitle() : "New Tab";
tabbedPane.setComponentPopupMenu(panel);
tabbedPane.insertTab(htmlTitle, null, hpanel, htmlTitle, indexPanel);
tabbedPane.setSelectedIndex(indexPanel);
TabStore.insertTab(indexPanel, url, htmlTitle);
NavigationManager.insertHistory(url, htmlTitle, indexPanel);
});
panel_3.add(go);
debutCpDesc = debutCpDesc + incrementNouvelleLigne;
debutCpTitle = debutCpTitle + incrementNouvelleLigne;
debutCpUrl = debutCpUrl + incrementNouvelleLigne;
debutCpSeparator = debutCpSeparator + incrementNouvelleLigne;
}
} catch (Exception e) {
e.printStackTrace();
}
panel_3.setPreferredSize(new Dimension(0, 1000));
panel_3.revalidate();
panel_3.repaint();
return panel_3;
}
Aggregations