PY-19960 PY-14096 Merge right-click menu creation for toggle output and split/merge...
[idea/community.git] / python / ipnb / src / org / jetbrains / plugins / ipnb / editor / panels / code / IpnbLatexPanel.java
1 package org.jetbrains.plugins.ipnb.editor.panels.code;
2
3 import com.intellij.openapi.ui.VerticalFlowLayout;
4 import com.intellij.openapi.util.text.StringUtil;
5 import org.jetbrains.annotations.NotNull;
6 import org.jetbrains.annotations.Nullable;
7 import org.jetbrains.plugins.ipnb.IpnbUtils;
8 import org.jetbrains.plugins.ipnb.editor.IpnbEditorUtil;
9 import org.jetbrains.plugins.ipnb.editor.panels.IpnbFilePanel;
10 import org.jetbrains.plugins.ipnb.format.cells.output.IpnbLatexOutputCell;
11
12 import javax.swing.*;
13
14 public class IpnbLatexPanel extends IpnbCodeOutputPanel<IpnbLatexOutputCell> {
15
16   public IpnbLatexPanel(@NotNull final IpnbLatexOutputCell cell, @NotNull final IpnbFilePanel parent,
17                         @Nullable IpnbCodePanel ipnbCodePanel) {
18     super(cell, parent, ipnbCodePanel);
19     setLayout(new VerticalFlowLayout(VerticalFlowLayout.TOP));
20     setBackground(IpnbEditorUtil.getBackground());
21   }
22
23   @Override
24   protected JComponent createViewPanel() {
25     final int width = myParent.getWidth();
26     return IpnbUtils.createLatexPane(StringUtil.join(myCell.getLatex(), ""), width);
27   }
28 }