<commit_before>package name.abuchen.portfolio.ui.views.panes;

import javax.inject.Inject;
import javax.inject.Named;

import org.eclipse.e4.ui.services.IStylingEngine;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

import name.abuchen.portfolio.model.Adaptor;
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.Security;
import name.abuchen.portfolio.money.CurrencyConverterImpl;
import name.abuchen.portfolio.money.ExchangeRateProviderFactory;
import name.abuchen.portfolio.ui.Messages;
import name.abuchen.portfolio.ui.UIConstants;
import name.abuchen.portfolio.ui.views.SecuritiesChart;

public class SecurityPriceChartPane implements InformationPanePage
{
    @Inject
    @Named(UIConstants.Context.ACTIVE_CLIENT)
    private Client client;

    @Inject
    private ExchangeRateProviderFactory factory;

    @Inject
    private IStylingEngine stylingEngine;

    private Security security;
    private SecuritiesChart chart;

    @Override
    public String getLabel()
    {
        return Messages.SecurityTabChart;
    }

    @Override
    public Control createViewControl(Composite parent)
    {
        chart = new SecuritiesChart(parent, client, new CurrencyConverterImpl(factory, client.getBaseCurrency()));

        stylingEngine.style(chart.getControl());

        return chart.getControl();
    }

    @Override
    public void setInput(Object input)
    {
        security = Adaptor.adapt(Security.class, input);
        chart.updateChart(security);
    }

    @Override
    public void onRecalculationNeeded()
    {
        if (security != null)
            setInput(security);<commit_msg>Re-enable security details viewer next to chart<commit_after>package name.abuchen.portfolio.ui.views.panes;

import javax.inject.Inject;
import javax.inject.Named;

import org.eclipse.e4.ui.services.IStylingEngine;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;

import name.abuchen.portfolio.model.Adaptor;
import name.abuchen.portfolio.model.Client;
import name.abuchen.portfolio.model.Security;
import name.abuchen.portfolio.money.CurrencyConverterImpl;
import name.abuchen.portfolio.money.ExchangeRateProviderFactory;
import name.abuchen.portfolio.ui.Messages;
import name.abuchen.portfolio.ui.UIConstants;
import name.abuchen.portfolio.ui.util.SWTHelper;
import name.abuchen.portfolio.ui.util.swt.SashLayout;
import name.abuchen.portfolio.ui.util.swt.SashLayoutData;
import name.abuchen.portfolio.ui.views.SecuritiesChart;
import name.abuchen.portfolio.ui.views.SecurityDetailsViewer;

public class SecurityPriceChartPane implements InformationPanePage
{
    @Inject
    @Named(UIConstants.Context.ACTIVE_CLIENT)
    private Client client;

    @Inject
    private ExchangeRateProviderFactory factory;

    @Inject
    private IStylingEngine stylingEngine;

    private Security security;
    private SecuritiesChart chart;
    private SecurityDetailsViewer details;

    @Override
    public String getLabel()
    {
        return Messages.SecurityTabChart;
    }

    @Override
    public Control createViewControl(Composite parent)
    {
        Composite sash = new Composite(parent, SWT.NONE);
        sash.setLayout(new SashLayout(sash, SWT.HORIZONTAL | SWT.END));

        chart = new SecuritiesChart(sash, client, new CurrencyConverterImpl(factory, client.getBaseCurrency()));
        stylingEngine.style(chart.getControl());

        details = new SecurityDetailsViewer(sash, SWT.NONE, client, true);
        details.getControl().setLayoutData(new SashLayoutData(SWTHelper.getPackedWidth(details.getControl())));

        return sash;
    }

    @Override
    public void setInput(Object input)
    {
        security = Adaptor.adapt(Security.class, input);
        chart.updateChart(security);
        details.setInput(security);
    }

    @Override
    public void onRecalculationNeeded()
    {
        if (security != null)
            setInput(security);
{'fraction_non_alphanumeric': 0.09186220668996506, 'fraction_numerical': 0.0004992511233150275, 'mean_word_length': 3.977639751552795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3638885', 'n_tokens_mistral': 1222, 'n_tokens_neox': 1187, 'n_words': 216}