Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release beta-34 #363

Merged
merged 17 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.scijava</groupId>
<artifactId>pom-scijava</artifactId>
<version>38.0.1</version>
<version>40.0.0</version>
</parent>

<groupId>org.mastodon</groupId>
Expand All @@ -31,11 +31,6 @@
<dependencies>

<!-- Mastodon dependencies -->
<dependency>
<groupId>org.mastodon</groupId>
<artifactId>mastodon-collection</artifactId>
<version>${mastodon-collection.version}</version>
</dependency>
<dependency>
<groupId>org.mastodon</groupId>
<artifactId>mastodon-graph</artifactId>
Expand Down Expand Up @@ -189,8 +184,7 @@
<license.organizationName>Mastodon authors</license.organizationName>
<license.copyrightOwners>Tobias Pietzsch, Jean-Yves Tinevez</license.copyrightOwners>

<mastodon-collection.version>1.0.0-beta-29</mastodon-collection.version>
<mastodon-graph.version>1.0.0-beta-29</mastodon-graph.version>
<mastodon-graph.version>1.0.0-beta-30</mastodon-graph.version>

<!-- NB: Deploy releases to the SciJava Maven repository. -->
<releaseProfiles>sign,deploy-to-scijava</releaseProfiles>
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/mastodon/app/MastodonIcons.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public class MastodonIcons
*/

public static final Image MAINWINDOW_BG =
new ImageIcon( MastodonIcons.class.getResource( "MastodonMainWindowBG.png" ) ).getImage();
new ImageIcon( MastodonIcons.class.getResource( "MastodonMainWindowBG-flipped.png" ) ).getImage();

/*
* General use icons.
Expand All @@ -248,4 +248,8 @@ public class MastodonIcons

public static final ImageIcon REMOVE_ICON = new ImageIcon( AbstractTagTable.class.getResource( "delete.png" ) );

public static final ImageIcon BIN_EMPTY_ICON = new ImageIcon( FeatureComputationPanel.class.getResource( "bin.png" ) );

public static final ImageIcon BIN_ICON = new ImageIcon( FeatureComputationPanel.class.getResource( "bin_closed.png" ) );

}
27 changes: 23 additions & 4 deletions src/main/java/org/mastodon/mamut/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ActionMap;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JComponent;
Expand Down Expand Up @@ -105,12 +107,27 @@ public MainWindow( final ProjectModel appModel )
// Re-register save actions, this time using this frame as parent
// component.
ProjectActions.installAppActions( appModel.getProjectActions(), appModel, this );
final ActionMap projectActionMap = appModel.getProjectActions().getActionMap();

// Views:
// Main Panel
final JPanel buttonsPanel = new JPanel();
buttonsPanel.setLayout( new MigLayout() );
final ActionMap projectActionMap = appModel.getProjectActions().getActionMap();
buttonsPanel.setLayout( new MigLayout( "wrap 2", "[150px!]10[150px!]" ) );

// Project:
final JPanel titlePanel = new JPanel();
final BoxLayout boxLayout = new BoxLayout( titlePanel, BoxLayout.LINE_AXIS );
titlePanel.setLayout( boxLayout );
titlePanel.setOpaque( false );
final JLabel projectLabel = new JLabel( "Project: " );
projectLabel.setFont( buttonsPanel.getFont().deriveFont( Font.BOLD ) );
final JLabel projectNameLabel = new JLabel( appModel.getProjectName() );
titlePanel.add( projectLabel );
titlePanel.add( Box.createHorizontalGlue() );
titlePanel.add( projectNameLabel );
buttonsPanel.add( titlePanel, "span 2, grow, wrap, align left" );
buttonsPanel.add( new JSeparator(), "span, grow, wrap" );

// Views:
final JLabel viewsLabel = new JLabel( "Views:" );
viewsLabel.setFont( buttonsPanel.getFont().deriveFont( Font.BOLD ) );
buttonsPanel.add( viewsLabel, "span, wrap" );
Expand Down Expand Up @@ -182,7 +199,9 @@ public MainWindow( final ProjectModel appModel )
public void paintComponent( final Graphics g )
{
super.paintComponent( g );
g.drawImage( MAINWINDOW_BG, 0, 0, this );
final int x = getWidth() - MAINWINDOW_BG.getWidth( null );
final int y = 0;
g.drawImage( MAINWINDOW_BG, x, y, this );
}
};
setContentPane( content );
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/mastodon/mamut/launcher/LauncherGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void insertString( final FilterBypass fb, final int offset, final String
final StringBuilder modifiedText = new StringBuilder();
for ( final char c : string.toCharArray() )
{
if ( c == '/' )
if ( c == '/' || c == '\\' )
{
modifiedText.append( c ).append( ' ' );
}
Expand Down Expand Up @@ -385,7 +385,8 @@ public void mouseClicked( final java.awt.event.MouseEvent e )
public void paintComponent( final Graphics g )
{
super.paintComponent( g );
g.drawImage( MAINWINDOW_BG, 0, 0, this );
final int x = getWidth() - MAINWINDOW_BG.getWidth( null );
g.drawImage( MAINWINDOW_BG, x, 0, this );
}
}

Expand Down
107 changes: 65 additions & 42 deletions src/main/java/org/mastodon/mamut/launcher/RecentProjectsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
*/
package org.mastodon.mamut.launcher;

import java.awt.Font;
import java.awt.Desktop;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.io.IOException;
Expand All @@ -41,11 +43,11 @@
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTextArea;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingConstants;
import javax.swing.JScrollPane;

import org.mastodon.app.MastodonIcons;
import org.mastodon.ui.util.RecentProjects;
Expand All @@ -61,7 +63,7 @@ public class RecentProjectsPanel extends JPanel

public RecentProjectsPanel( final Consumer< String > projectOpener )
{
setLayout( new MigLayout( "fill, wrap 3", "[grow, fill][shrink 0][shrink 0]", "[][grow, fill][]" ) );
setLayout( new MigLayout( "fill", "[grow]", "[]10[grow]10[]10[]" ) );
remakeGUI( projectOpener );
}

Expand All @@ -71,63 +73,84 @@ private void remakeGUI( final Consumer< String > projectOpener )

final JLabel lblTitle = new JLabel( "Recent projects" );
lblTitle.setFont( lblTitle.getFont().deriveFont( lblTitle.getFont().getStyle() | Font.BOLD ) );
lblTitle.setHorizontalAlignment( SwingConstants.CENTER );
add( lblTitle, "span, wrap" );

final JPanel listPanel = new JPanel( new MigLayout( "fillx, wrap 3", "[fill][shrink 0][shrink 0]", "" ) );
final JScrollPane scrollPane = new JScrollPane( listPanel );
scrollPane.setVerticalScrollBarPolicy( ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED );
scrollPane.setHorizontalScrollBarPolicy( ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER );
add( scrollPane, "span, wrap" );
add( lblTitle, "align center, wrap" );

final JPanel listPanel;
if ( !recentProjects.isempty() )
{
listPanel = new JPanel( new MigLayout( "fillx", "[grow]", "[]10[]" ) );
final JLabel lblTitleHint = new JLabel( "Double-click to open the containing folder." );
lblTitleHint.setFont( lblTitleHint.getFont().deriveFont( lblTitleHint.getFont().getStyle() | Font.ITALIC ) );
lblTitleHint.setHorizontalAlignment( SwingConstants.CENTER );
listPanel.add( lblTitleHint, "span, wrap" );
listPanel.add( lblTitleHint, "align center, wrap" );

// list of recent projects
for ( final String projectPath : recentProjects )
{
final JTextArea ta = new JTextArea( projectPath );
ta.setEditable( true );
ta.setLineWrap( true );
ta.addMouseListener( new MouseDblClickOpenPath( ta.getText() ) );
listPanel.add( ta );

final JButton btnOpen = new JButton( MastodonIcons.LOAD_ICON_SMALL );
btnOpen.addActionListener( l -> projectOpener.accept( ta.getText() ) ); // Recent projects will be updated in the launcher method.
listPanel.add( btnOpen );

final JButton btnClear = new JButton( MastodonIcons.REMOVE_ICON );
btnClear.addActionListener( l -> {
recentProjects.remove( projectPath );
remakeGUI( projectOpener );
} );
listPanel.add( btnClear, "wrap" );
final ListItem listItem = new ListItem( projectPath, projectOpener );
listPanel.add( listItem, "grow, wrap" );
}
}
else
{
// No recent projects.
listPanel = new JPanel( new GridBagLayout() );
final JLabel lblNo = new JLabel( "No recent projects." );
lblNo.setFont( getFont().deriveFont( getFont().getStyle() | Font.ITALIC ) );
lblNo.setHorizontalAlignment( SwingConstants.CENTER );
listPanel.add( lblNo, "span, wrap" );
listPanel.add( lblNo, new GridBagConstraints() );
}

add( new JSeparator(), "span, wrap" );
final JScrollPane scrollPane = new JScrollPane( listPanel );
scrollPane.setVerticalScrollBarPolicy( ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED );
scrollPane.setHorizontalScrollBarPolicy( ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER );
add( scrollPane, "grow, wrap" );

add( new JSeparator(), "span" );
add( getBottomPanel( projectOpener ), "right" );

revalidate();
repaint();
}

private class ListItem extends JPanel
{
private static final long serialVersionUID = 1L;

private ListItem( final String path, final Consumer< String > projectOpener )
{
super( new MigLayout( "fill, ins 0, gapy 0", "[fill][][]", "" ) );

final JTextArea ta = new JTextArea( path );
ta.setEditable( true );
ta.setLineWrap( true );
ta.addMouseListener( new MouseDblClickOpenPath( ta.getText() ) );
add( ta, "pushx, w 0:5" );

final JButton btnOpen = new JButton( MastodonIcons.LOAD_ICON_SMALL );
btnOpen.addActionListener( l -> projectOpener.accept( ta.getText() ) ); // Recent projects will be updated in the launcher method.
add( btnOpen, "" );

final JButton btnClear = new JButton( MastodonIcons.BIN_ICON );
btnClear.addActionListener( l -> {
recentProjects.remove( path );
remakeGUI( projectOpener );
} );
add( btnClear, "wrap" );
}
}

private static JPanel getBottomPanel( final Consumer< String > projectOpener )
{
final JPanel bottomPanel = new JPanel( new MigLayout( "", "[][]", "" ) );

final JLabel lblTitle2 = new JLabel( "Open another project" );
lblTitle2.setHorizontalAlignment( SwingConstants.CENTER );
lblTitle2.setFont( lblTitle2.getFont().deriveFont( lblTitle2.getFont().getStyle() | Font.BOLD ) );
add( lblTitle2 );
bottomPanel.add( lblTitle2, "" );

final JButton btnBrowse = new JButton( MastodonIcons.LOAD_ICON_SMALL );
btnBrowse.addActionListener( l -> projectOpener.accept( null ) );
add( btnBrowse );

revalidate();
repaint();
bottomPanel.add( btnBrowse, "" );
return bottomPanel;
}

public static final class MouseDblClickOpenPath implements MouseListener
Expand All @@ -140,26 +163,26 @@ public MouseDblClickOpenPath( final String pathOnDblClick )
}

@Override
public void mouseClicked( MouseEvent mouseEvent )
public void mouseClicked( final MouseEvent mouseEvent )
{
if ( mouseEvent.getClickCount() == 2 )
openUrl( Uri );
}

@Override
public void mousePressed( MouseEvent mouseEvent )
public void mousePressed( final MouseEvent mouseEvent )
{ /* empty */ }

@Override
public void mouseReleased( MouseEvent mouseEvent )
public void mouseReleased( final MouseEvent mouseEvent )
{ /* empty */ }

@Override
public void mouseEntered( MouseEvent mouseEvent )
public void mouseEntered( final MouseEvent mouseEvent )
{ /* empty */ }

@Override
public void mouseExited( MouseEvent mouseEvent )
public void mouseExited( final MouseEvent mouseEvent )
{ /* empty */ }
}

Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/mastodon/mamut/views/MamutBranchView.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ public MamutBranchView( final ProjectModel appModel, final VG viewGraph, final S
final ModelBranchGraph branchGraph = appModel.getModel().getBranchGraph();
final ModelGraph graph = appModel.getModel().getGraph();

// Highlight.
final HighlightModel< Spot, Link > graphHighlightModel = appModel.getHighlightModel();
final HighlightModel< BranchSpot, BranchLink > branchHighlightModel =
new BranchGraphHighlightAdapter<>( branchGraph, graph, graph.getGraphIdBimap(), graphHighlightModel );
this.highlightModel = new HighlightModelAdapter<>( branchHighlightModel, vertexMap, edgeMap );

// Focus
final FocusModel< Spot > graphFocusModel = appModel.getFocusModel();
final FocusModel< BranchSpot > branchFocusfocusModel =
Expand All @@ -185,6 +179,12 @@ public MamutBranchView( final ProjectModel appModel, final VG viewGraph, final S
// Time-point.
this.timepointModel = new TimepointModelAdapter( groupHandle.getModel( appModel.TIMEPOINT ) );

// Highlight.
final HighlightModel< Spot, Link > graphHighlightModel = appModel.getHighlightModel();
final HighlightModel< BranchSpot, BranchLink > branchHighlightModel =
new BranchGraphHighlightAdapter<>( branchGraph, graph, graph.getGraphIdBimap(), graphHighlightModel, timepointModel );
this.highlightModel = new HighlightModelAdapter<>( branchHighlightModel, vertexMap, edgeMap );

// Tag-set.
this.tagSetModel = branchTagSetModel( appModel );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public class GrapherInitializer< V extends Vertex< E > & HasTimepoint & HasLabel
GrapherInitializer( final DataGraph< V, E > graph, final ProjectModel appModel,
final SelectionModel< DataVertex, DataEdge > selectionModel, final NavigationHandler< DataVertex, DataEdge > navigationHandler,
final FocusModel< DataVertex > focusModel, final HighlightModel< DataVertex, DataEdge > highlightModel,
final GroupHandle groupHandle
final GroupHandle groupHandle, final DataContextListener< V > contextListener
)
{
this.viewGraph = graph;
Expand All @@ -143,8 +143,7 @@ public class GrapherInitializer< V extends Vertex< E > & HasTimepoint & HasLabel
layout = new DataGraphLayout<>( viewGraph, selectionModel );

// ContextChooser
final DataContextListener< V > contextListener = new DataContextListener<>( viewGraph );
contextChooser = new ContextChooser<>( contextListener );
this.contextChooser = contextListener == null ? null : new ContextChooser<>( contextListener );

// Style
final DataDisplayStyleManager dataDisplayStyleManager = appModel.getWindowManager().getManager( DataDisplayStyleManager.class );
Expand Down Expand Up @@ -178,7 +177,8 @@ public class GrapherInitializer< V extends Vertex< E > & HasTimepoint & HasLabel

// Panel
this.panel = frame.getDataDisplayPanel();
contextListener.setContextListener( panel );
if ( contextListener != null )
contextListener.setContextListener( panel );

// Style listener
styleUpdateListener = panel::repaint;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@
import org.mastodon.ui.coloring.HasColorBarOverlay;
import org.mastodon.ui.coloring.HasColoringModel;
import org.mastodon.ui.keymap.KeyConfigContexts;
import org.mastodon.views.context.ContextChooser;
import org.mastodon.views.context.HasContextChooser;
import org.mastodon.views.grapher.datagraph.DataEdge;
import org.mastodon.views.grapher.datagraph.DataGraph;
import org.mastodon.views.grapher.datagraph.DataVertex;
Expand All @@ -59,7 +57,7 @@
import java.util.function.BiConsumer;

public class MamutBranchViewGrapher extends MamutBranchView< DataGraph< BranchSpot, BranchLink >, DataVertex, DataEdge >
implements HasContextChooser< BranchSpot >, HasColoringModel, HasColorBarOverlay, DataDisplayFrameSupplier< BranchSpot, BranchLink >
implements HasColoringModel, HasColorBarOverlay, DataDisplayFrameSupplier< BranchSpot, BranchLink >
{

private final GrapherInitializer< BranchSpot, BranchLink > grapherInitializer;
Expand All @@ -74,7 +72,7 @@ public class MamutBranchViewGrapher extends MamutBranchView< DataGraph< BranchSp
new String[] { KeyConfigContexts.GRAPHER } );

grapherInitializer = new GrapherInitializer<>( viewGraph, appModel, selectionModel, navigationHandler, focusModel, highlightModel,
getGroupHandle() );
getGroupHandle(), null );
grapherInitializer.getFrame().setTitle( "Grapher Branch" );
InertialScreenTransformEventHandler handler = grapherInitializer.getFrame().getDataDisplayPanel().getTransformEventHandler();
handler.setMinScaleX( 0.1d );
Expand Down Expand Up @@ -119,12 +117,6 @@ public DataDisplayFrame< BranchSpot, BranchLink > getFrame()
return ( DataDisplayFrame< BranchSpot, BranchLink > ) super.getFrame();
}

@Override
public ContextChooser< BranchSpot > getContextChooser()
{
return grapherInitializer.getContextChooser();
}

@Override
public ColoringModel getColoringModel()
{
Expand Down
Loading
Loading