Search in sources :

Example 1 with BrowserPanel

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;
}
Also used : LoboPanel(com.jtattoo.plaf.lobo.LoboPanel) LoboButton(com.jtattoo.plaf.lobo.LoboButton) ITabbedPane(org.loboevolution.component.ITabbedPane) Dimension(java.awt.Dimension) Font(java.awt.Font) BookmarksStore(org.loboevolution.store.BookmarksStore) BookmarkInfo(org.loboevolution.info.BookmarkInfo) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HtmlPanel(org.loboevolution.html.gui.HtmlPanel) LoboTextField(com.jtattoo.plaf.lobo.LoboTextField) BrowserPanel(org.loboevolution.component.BrowserPanel)

Example 2 with BrowserPanel

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);
    }
}
Also used : HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) JFileChooser(javax.swing.JFileChooser) HtmlPanel(org.loboevolution.html.gui.HtmlPanel) BrowserPanel(org.loboevolution.component.BrowserPanel) ITabbedPane(org.loboevolution.component.ITabbedPane) File(java.io.File)

Example 3 with BrowserPanel

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);
}
Also used : HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HtmlPanel(org.loboevolution.html.gui.HtmlPanel) WelcomePanel(org.loboevolution.welcome.WelcomePanel) JComponent(javax.swing.JComponent) BrowserPanel(org.loboevolution.component.BrowserPanel) ITabbedPane(org.loboevolution.component.ITabbedPane)

Example 4 with BrowserPanel

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;
}
Also used : LoboPanel(com.jtattoo.plaf.lobo.LoboPanel) LoboButton(com.jtattoo.plaf.lobo.LoboButton) NavigationStore(org.loboevolution.store.NavigationStore) ITabbedPane(org.loboevolution.component.ITabbedPane) Dimension(java.awt.Dimension) Font(java.awt.Font) BookmarkInfo(org.loboevolution.info.BookmarkInfo) HTMLDocumentImpl(org.loboevolution.html.dom.domimpl.HTMLDocumentImpl) HtmlPanel(org.loboevolution.html.gui.HtmlPanel) LoboTextField(com.jtattoo.plaf.lobo.LoboTextField) BrowserPanel(org.loboevolution.component.BrowserPanel)

Aggregations

BrowserPanel (org.loboevolution.component.BrowserPanel)4 ITabbedPane (org.loboevolution.component.ITabbedPane)4 HTMLDocumentImpl (org.loboevolution.html.dom.domimpl.HTMLDocumentImpl)4 HtmlPanel (org.loboevolution.html.gui.HtmlPanel)4 LoboButton (com.jtattoo.plaf.lobo.LoboButton)2 LoboPanel (com.jtattoo.plaf.lobo.LoboPanel)2 LoboTextField (com.jtattoo.plaf.lobo.LoboTextField)2 Dimension (java.awt.Dimension)2 Font (java.awt.Font)2 BookmarkInfo (org.loboevolution.info.BookmarkInfo)2 File (java.io.File)1 JComponent (javax.swing.JComponent)1 JFileChooser (javax.swing.JFileChooser)1 BookmarksStore (org.loboevolution.store.BookmarksStore)1 NavigationStore (org.loboevolution.store.NavigationStore)1 WelcomePanel (org.loboevolution.welcome.WelcomePanel)1