|
| 1 | +package org.mastodon.revised.mamut; |
| 2 | + |
| 3 | +import static org.mastodon.revised.mamut.MastodonIcons.BDV_ICON; |
| 4 | +import static org.mastodon.revised.mamut.MastodonIcons.FEATURE_ICON; |
| 5 | +import static org.mastodon.revised.mamut.MastodonIcons.MAMUT_ICON; |
| 6 | +import static org.mastodon.revised.mamut.MastodonIcons.SAVEAS_ICON; |
| 7 | +import static org.mastodon.revised.mamut.MastodonIcons.SAVE_ICON; |
| 8 | +import static org.mastodon.revised.mamut.MastodonIcons.TABLE_ICON; |
| 9 | +import static org.mastodon.revised.mamut.MastodonIcons.TAG_ICON; |
| 10 | +import static org.mastodon.revised.mamut.MastodonIcons.TRACKSCHEME_ICON; |
| 11 | + |
| 12 | +import java.awt.Font; |
| 13 | +import java.awt.GridBagConstraints; |
| 14 | +import java.awt.GridBagLayout; |
| 15 | +import java.awt.Insets; |
| 16 | + |
| 17 | +import javax.swing.ActionMap; |
| 18 | +import javax.swing.JButton; |
| 19 | +import javax.swing.JLabel; |
| 20 | +import javax.swing.JPanel; |
| 21 | +import javax.swing.JSeparator; |
| 22 | + |
| 23 | +import org.scijava.ui.behaviour.util.RunnableAction; |
| 24 | + |
| 25 | +public class MainButtonPanel extends JPanel |
| 26 | +{ |
| 27 | + |
| 28 | + private static final long serialVersionUID = 1L; |
| 29 | + |
| 30 | + public MainButtonPanel(final WindowManager windowManager) |
| 31 | + { |
| 32 | + final ActionMap actionMap = windowManager.getGlobalAppActions().getActionMap(); |
| 33 | + |
| 34 | + final MastodonLogger logger = windowManager.getContext().getService( MastodonLogger.class ); |
| 35 | + final RunnableAction notImplementedAction = new RunnableAction( |
| 36 | + "Notify not implemeted", () -> logger.error( "Not implemented yet." ) ); |
| 37 | + |
| 38 | + final GridBagLayout gridBagLayout = new GridBagLayout(); |
| 39 | + gridBagLayout.columnWidths = new int[]{0, 0, 0}; |
| 40 | + gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 41 | + gridBagLayout.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE}; |
| 42 | + gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; |
| 43 | + setLayout(gridBagLayout); |
| 44 | + |
| 45 | + final JLabel lblViews = new JLabel("Windows."); |
| 46 | + lblViews.setFont(lblViews.getFont().deriveFont(lblViews.getFont().getStyle() | Font.BOLD)); |
| 47 | + final GridBagConstraints gbc_lblViews = new GridBagConstraints(); |
| 48 | + gbc_lblViews.gridwidth = 2; |
| 49 | + gbc_lblViews.insets = new Insets(0, 0, 5, 0); |
| 50 | + gbc_lblViews.anchor = GridBagConstraints.WEST; |
| 51 | + gbc_lblViews.gridx = 0; |
| 52 | + gbc_lblViews.gridy = 2; |
| 53 | + add(lblViews, gbc_lblViews); |
| 54 | + |
| 55 | + final JLabel lblBigDataViewer = new JLabel("Big Data Viewer"); |
| 56 | + final GridBagConstraints gbc_lblBigDataViewer = new GridBagConstraints(); |
| 57 | + gbc_lblBigDataViewer.anchor = GridBagConstraints.EAST; |
| 58 | + gbc_lblBigDataViewer.insets = new Insets(0, 0, 5, 5); |
| 59 | + gbc_lblBigDataViewer.gridx = 0; |
| 60 | + gbc_lblBigDataViewer.gridy = 3; |
| 61 | + add(lblBigDataViewer, gbc_lblBigDataViewer); |
| 62 | + |
| 63 | + final JButton btnBdv = new JButton(); |
| 64 | + btnBdv.setAction( actionMap.get( WindowManager.NEW_BDV_VIEW ) ); |
| 65 | + btnBdv.setIcon( BDV_ICON ); |
| 66 | + btnBdv.setText( "" ); |
| 67 | + final GridBagConstraints gbc_btnBdv = new GridBagConstraints(); |
| 68 | + gbc_btnBdv.insets = new Insets(0, 0, 5, 0); |
| 69 | + gbc_btnBdv.gridx = 1; |
| 70 | + gbc_btnBdv.gridy = 3; |
| 71 | + add(btnBdv, gbc_btnBdv); |
| 72 | + |
| 73 | + final JLabel lblTrackscheme = new JLabel("TrackScheme"); |
| 74 | + final GridBagConstraints gbc_lblTrackscheme = new GridBagConstraints(); |
| 75 | + gbc_lblTrackscheme.anchor = GridBagConstraints.EAST; |
| 76 | + gbc_lblTrackscheme.insets = new Insets(0, 0, 5, 5); |
| 77 | + gbc_lblTrackscheme.gridx = 0; |
| 78 | + gbc_lblTrackscheme.gridy = 4; |
| 79 | + add(lblTrackscheme, gbc_lblTrackscheme); |
| 80 | + |
| 81 | + final JButton btnTs = new JButton(); |
| 82 | + btnTs.setAction( actionMap.get( WindowManager.NEW_TRACKSCHEME_VIEW ) ); |
| 83 | + btnTs.setIcon( TRACKSCHEME_ICON ); |
| 84 | + btnTs.setText( "" ); |
| 85 | + final GridBagConstraints gbc_btnTs = new GridBagConstraints(); |
| 86 | + gbc_btnTs.insets = new Insets(0, 0, 5, 0); |
| 87 | + gbc_btnTs.gridx = 1; |
| 88 | + gbc_btnTs.gridy = 4; |
| 89 | + add(btnTs, gbc_btnTs); |
| 90 | + |
| 91 | + final JLabel lblTable = new JLabel("Table"); |
| 92 | + final GridBagConstraints gbc_lblTable = new GridBagConstraints(); |
| 93 | + gbc_lblTable.anchor = GridBagConstraints.EAST; |
| 94 | + gbc_lblTable.insets = new Insets(0, 0, 5, 5); |
| 95 | + gbc_lblTable.gridx = 0; |
| 96 | + gbc_lblTable.gridy = 5; |
| 97 | + add(lblTable, gbc_lblTable); |
| 98 | + |
| 99 | + final JButton btnTa = new JButton(); |
| 100 | + btnTa.setAction( notImplementedAction ); |
| 101 | + btnTa.setText( "" ); |
| 102 | + btnTa.setIcon( TABLE_ICON ); |
| 103 | + final GridBagConstraints gbc_btnTa = new GridBagConstraints(); |
| 104 | + gbc_btnTa.insets = new Insets(0, 0, 5, 0); |
| 105 | + gbc_btnTa.gridx = 1; |
| 106 | + gbc_btnTa.gridy = 5; |
| 107 | + add(btnTa, gbc_btnTa); |
| 108 | + |
| 109 | + final JSeparator separator_1 = new JSeparator(); |
| 110 | + final GridBagConstraints gbc_separator_1 = new GridBagConstraints(); |
| 111 | + gbc_separator_1.insets = new Insets(0, 0, 5, 0); |
| 112 | + gbc_separator_1.fill = GridBagConstraints.HORIZONTAL; |
| 113 | + gbc_separator_1.gridwidth = 2; |
| 114 | + gbc_separator_1.gridx = 0; |
| 115 | + gbc_separator_1.gridy = 6; |
| 116 | + add(separator_1, gbc_separator_1); |
| 117 | + |
| 118 | + final JLabel lblTags = new JLabel("Tags."); |
| 119 | + lblTags.setFont(lblTags.getFont().deriveFont(lblTags.getFont().getStyle() | Font.BOLD)); |
| 120 | + final GridBagConstraints gbc_lblTags = new GridBagConstraints(); |
| 121 | + gbc_lblTags.insets = new Insets(0, 0, 5, 0); |
| 122 | + gbc_lblTags.gridwidth = 2; |
| 123 | + gbc_lblTags.anchor = GridBagConstraints.WEST; |
| 124 | + gbc_lblTags.gridx = 0; |
| 125 | + gbc_lblTags.gridy = 7; |
| 126 | + add(lblTags, gbc_lblTags); |
| 127 | + |
| 128 | + final JLabel lblDefineTags = new JLabel("Define tags"); |
| 129 | + final GridBagConstraints gbc_lblDefineTags = new GridBagConstraints(); |
| 130 | + gbc_lblDefineTags.anchor = GridBagConstraints.EAST; |
| 131 | + gbc_lblDefineTags.insets = new Insets(0, 0, 5, 5); |
| 132 | + gbc_lblDefineTags.gridx = 0; |
| 133 | + gbc_lblDefineTags.gridy = 8; |
| 134 | + add(lblDefineTags, gbc_lblDefineTags); |
| 135 | + |
| 136 | + final JButton btnTg = new JButton(); |
| 137 | + btnTg.setAction( actionMap.get( WindowManager.TAGSETS_DIALOG ) ); |
| 138 | + btnTg.setIcon( TAG_ICON ); |
| 139 | + btnTg.setText( "" ); |
| 140 | + final GridBagConstraints gbc_btnTg = new GridBagConstraints(); |
| 141 | + gbc_btnTg.insets = new Insets(0, 0, 5, 0); |
| 142 | + gbc_btnTg.gridx = 1; |
| 143 | + gbc_btnTg.gridy = 8; |
| 144 | + add(btnTg, gbc_btnTg); |
| 145 | + |
| 146 | + final JSeparator separator_2 = new JSeparator(); |
| 147 | + final GridBagConstraints gbc_separator_2 = new GridBagConstraints(); |
| 148 | + gbc_separator_2.insets = new Insets(0, 0, 5, 0); |
| 149 | + gbc_separator_2.fill = GridBagConstraints.HORIZONTAL; |
| 150 | + gbc_separator_2.gridwidth = 2; |
| 151 | + gbc_separator_2.gridx = 0; |
| 152 | + gbc_separator_2.gridy = 9; |
| 153 | + add(separator_2, gbc_separator_2); |
| 154 | + |
| 155 | + final JLabel lblFeatures = new JLabel("Features."); |
| 156 | + lblFeatures.setFont(lblFeatures.getFont().deriveFont(lblFeatures.getFont().getStyle() | Font.BOLD)); |
| 157 | + final GridBagConstraints gbc_lblFeatures = new GridBagConstraints(); |
| 158 | + gbc_lblFeatures.insets = new Insets(0, 0, 5, 0); |
| 159 | + gbc_lblFeatures.gridwidth = 2; |
| 160 | + gbc_lblFeatures.anchor = GridBagConstraints.WEST; |
| 161 | + gbc_lblFeatures.gridx = 0; |
| 162 | + gbc_lblFeatures.gridy = 10; |
| 163 | + add(lblFeatures, gbc_lblFeatures); |
| 164 | + |
| 165 | + final JLabel lblComputeFeatures = new JLabel("Compute features"); |
| 166 | + final GridBagConstraints gbc_lblComputeFeatures = new GridBagConstraints(); |
| 167 | + gbc_lblComputeFeatures.anchor = GridBagConstraints.EAST; |
| 168 | + gbc_lblComputeFeatures.insets = new Insets(0, 0, 5, 5); |
| 169 | + gbc_lblComputeFeatures.gridx = 0; |
| 170 | + gbc_lblComputeFeatures.gridy = 11; |
| 171 | + add(lblComputeFeatures, gbc_lblComputeFeatures); |
| 172 | + |
| 173 | + final JButton btnFc = new JButton(); |
| 174 | + btnFc.setAction( notImplementedAction ); |
| 175 | + btnFc.setText( "" ); |
| 176 | + btnFc.setIcon( FEATURE_ICON ); |
| 177 | + final GridBagConstraints gbc_btnFc = new GridBagConstraints(); |
| 178 | + gbc_btnFc.insets = new Insets(0, 0, 5, 0); |
| 179 | + gbc_btnFc.gridx = 1; |
| 180 | + gbc_btnFc.gridy = 11; |
| 181 | + add(btnFc, gbc_btnFc); |
| 182 | + |
| 183 | + final JSeparator separator_3 = new JSeparator(); |
| 184 | + final GridBagConstraints gbc_separator_3 = new GridBagConstraints(); |
| 185 | + gbc_separator_3.insets = new Insets(0, 0, 5, 0); |
| 186 | + gbc_separator_3.fill = GridBagConstraints.HORIZONTAL; |
| 187 | + gbc_separator_3.gridwidth = 2; |
| 188 | + gbc_separator_3.gridx = 0; |
| 189 | + gbc_separator_3.gridy = 12; |
| 190 | + add(separator_3, gbc_separator_3); |
| 191 | + |
| 192 | + final JLabel lblSaving = new JLabel("Saving."); |
| 193 | + lblSaving.setFont(lblSaving.getFont().deriveFont(lblSaving.getFont().getStyle() | Font.BOLD)); |
| 194 | + final GridBagConstraints gbc_lblSaving = new GridBagConstraints(); |
| 195 | + gbc_lblSaving.insets = new Insets(0, 0, 5, 0); |
| 196 | + gbc_lblSaving.gridwidth = 2; |
| 197 | + gbc_lblSaving.anchor = GridBagConstraints.WEST; |
| 198 | + gbc_lblSaving.gridx = 0; |
| 199 | + gbc_lblSaving.gridy = 13; |
| 200 | + add(lblSaving, gbc_lblSaving); |
| 201 | + |
| 202 | + final JLabel lblSave = new JLabel("Save"); |
| 203 | + final GridBagConstraints gbc_lblSave = new GridBagConstraints(); |
| 204 | + gbc_lblSave.anchor = GridBagConstraints.EAST; |
| 205 | + gbc_lblSave.insets = new Insets(0, 0, 5, 5); |
| 206 | + gbc_lblSave.gridx = 0; |
| 207 | + gbc_lblSave.gridy = 14; |
| 208 | + add(lblSave, gbc_lblSave); |
| 209 | + |
| 210 | + final JButton btnS = new JButton(); |
| 211 | + btnS.setAction( notImplementedAction ); |
| 212 | + btnS.setText( "" ); |
| 213 | + btnS.setIcon( SAVE_ICON ); |
| 214 | + final GridBagConstraints gbc_btnS = new GridBagConstraints(); |
| 215 | + gbc_btnS.insets = new Insets(0, 0, 5, 0); |
| 216 | + gbc_btnS.gridx = 1; |
| 217 | + gbc_btnS.gridy = 14; |
| 218 | + add(btnS, gbc_btnS); |
| 219 | + |
| 220 | + final JLabel lblSaveAs = new JLabel("Save as..."); |
| 221 | + final GridBagConstraints gbc_lblSaveAs = new GridBagConstraints(); |
| 222 | + gbc_lblSaveAs.anchor = GridBagConstraints.EAST; |
| 223 | + gbc_lblSaveAs.insets = new Insets(0, 0, 5, 5); |
| 224 | + gbc_lblSaveAs.gridx = 0; |
| 225 | + gbc_lblSaveAs.gridy = 15; |
| 226 | + add(lblSaveAs, gbc_lblSaveAs); |
| 227 | + |
| 228 | + final JButton btnSa = new JButton(); |
| 229 | + btnSa.setAction( actionMap.get( ProjectManager.SAVE_PROJECT ) ); |
| 230 | + btnSa.setIcon( SAVEAS_ICON ); |
| 231 | + btnSa.setText( "" ); |
| 232 | + final GridBagConstraints gbc_btnSa = new GridBagConstraints(); |
| 233 | + gbc_btnSa.insets = new Insets(0, 0, 5, 0); |
| 234 | + gbc_btnSa.gridx = 1; |
| 235 | + gbc_btnSa.gridy = 15; |
| 236 | + add(btnSa, gbc_btnSa); |
| 237 | + |
| 238 | + final JLabel lblExportToMamut = new JLabel("Export to MaMuT"); |
| 239 | + final GridBagConstraints gbc_lblExportToMamut = new GridBagConstraints(); |
| 240 | + gbc_lblExportToMamut.anchor = GridBagConstraints.EAST; |
| 241 | + gbc_lblExportToMamut.insets = new Insets(0, 0, 0, 5); |
| 242 | + gbc_lblExportToMamut.gridx = 0; |
| 243 | + gbc_lblExportToMamut.gridy = 16; |
| 244 | + add(lblExportToMamut, gbc_lblExportToMamut); |
| 245 | + |
| 246 | + final JButton btnEm = new JButton(); |
| 247 | + btnEm.setAction( actionMap.get( ProjectManager.EXPORT_MAMUT ) ); |
| 248 | + btnEm.setText( "" ); |
| 249 | + btnEm.setIcon( MAMUT_ICON ); |
| 250 | + final GridBagConstraints gbc_btnEm = new GridBagConstraints(); |
| 251 | + gbc_btnEm.gridx = 1; |
| 252 | + gbc_btnEm.gridy = 16; |
| 253 | + add( btnEm, gbc_btnEm ); |
| 254 | + } |
| 255 | +} |
0 commit comments