Package de.ailis.xadrian.components

Examples of de.ailis.xadrian.components.ComplexEditor


            final SelectGameDialog dialog = SelectGameDialog.getInstance();
            if (dialog.open() != Result.OK) return;
            game = dialog.getGame();
            if (dialog.isRemember()) config.setDefaultGame(game.getId());
        }
        createComplexTab(new ComplexEditor(new Complex(game)));
    }
View Full Code Here


    public boolean closeCurrentTab()
    {
        final Component current = getCurrentTab();
        if (current != null)
        {
            final ComplexEditor editor = (ComplexEditor) current;
            if (editor.isChanged())
            {
                final int answer =
                    JOptionPane.showConfirmDialog(null, I18N
                        .getString("confirm.saveChanges", editor.getComplex()
                            .getName()), I18N.getTitle("confirm.saveChanges"),
                        JOptionPane.YES_NO_CANCEL_OPTION);
                if (answer == JOptionPane.CLOSED_OPTION) return false;
                if (answer == JOptionPane.CANCEL_OPTION) return false;
                if (answer == JOptionPane.YES_OPTION)
                {
                    editor.save();
                    if (editor.isChanged()) return false;
                }
            }

            this.tabs.remove(current);
View Full Code Here

        {
            for (final Component component: getTabs().getComponents())
            {
                if (component instanceof ComplexEditor)
                {
                    final ComplexEditor editor = (ComplexEditor) component;
                    editor.updateBaseComplex();
                }
            }
        }
    }
View Full Code Here

     *            The template code to import.
     */
    public void importFromTemplateCode(final String templateCode)
    {
        final Complex complex = Complex.fromTemplateCode(templateCode);
        final ComplexEditor editor = new ComplexEditor(complex);
        createLoadedComplexTab(editor);
    }
View Full Code Here

    {
        for (int i = this.tabs.getTabCount() - 1; i >= 0; i -= 1)
        {
            final Component component = this.tabs.getComponentAt(i);
            if (!(component instanceof ComplexEditor)) continue;
            final ComplexEditor editor = (ComplexEditor) component;
            final File editorFile = editor.getFile();
            if (editorFile == null) continue;
            try
            {
                if (file.getCanonicalFile().equals(
                    editorFile.getCanonicalFile()))
View Full Code Here

     *            The file to open.
     */
    public void open(final File file)
    {
        // Select already open editor if possible
        ComplexEditor editor = getEditor(file);
        if (editor != null)
        {
            this.tabs.setSelectedComponent(editor);
            return;
        }

        try
        {
            final SAXReader reader = new SAXReader();
            final Document document = reader.read(file);
            final Complex complex = Complex.fromXML(document);
            complex.setName(FileUtils.getNameWithoutExt(file));
            editor = new ComplexEditor(complex, file);
            createLoadedComplexTab(editor);
        }
        catch (final DocumentException e)
        {
            JOptionPane.showMessageDialog(null, I18N.getString(
View Full Code Here

    @Override
    public void actionPerformed(final ActionEvent e)
    {
        for (final Component component: this.frame.getTabs().getComponents())
        {
            final ComplexEditor editor = (ComplexEditor) component;
            if (editor.isChanged())
            {
                editor.save();
                if (editor.isChanged()) return;
            }
        }
    }
View Full Code Here

    @Override
    public void mainStateChanged(final MainFrame sender)
    {
        for (final Component component: sender.getTabs().getComponents())
        {
            final ComplexEditor editor = (ComplexEditor) component;
            if (editor.isChanged())
            {
                setEnabled(true);
                return;
            }
        }
View Full Code Here

    public void actionPerformed(final ActionEvent e)
    {
        final Component component = this.frame.getCurrentTab();
        if (component instanceof ComplexEditor)
        {
            final ComplexEditor editor = (ComplexEditor) component;
            final String ascii = editor.getComplex().getASCII();
            final Clipboard clipboard = editor.getToolkit().getSystemClipboard();
            clipboard.setContents(new StringSelection(ascii), null);
        }
    }
View Full Code Here

     * @see MainStateListener#mainStateChanged(MainFrame)
     */
    @Override
    public void mainStateChanged(final MainFrame sender)
    {
        final ComplexEditor editor = (ComplexEditor) sender.getCurrentTab();
        setEnabled(editor != null && !editor.getComplex().isEmpty());
    }
View Full Code Here

TOP

Related Classes of de.ailis.xadrian.components.ComplexEditor

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.