~boginw/tapaal/multiplayer

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/gui/smartDraw/SmartDrawDialog.java

  • Committer: Bogi Napoleon Wennerstrøm
  • Date: 2020-04-08 13:12:38 UTC
  • mfrom: (998.2.361 testbranch)
  • Revision ID: bogi.wennerstrom@gmail.com-20200408131238-6daa9ocph3zgx1ag
merged ~yrke changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
import java.awt.GridBagLayout;
8
8
import java.awt.Insets;
9
9
import java.awt.Window;
10
 
import java.awt.GraphicsDevice.WindowTranslucency;
11
10
import java.awt.event.ActionEvent;
12
11
import java.awt.event.ActionListener;
13
12
import java.awt.event.MouseListener;
14
 
import java.time.LocalDateTime;
15
13
import java.util.ArrayList;
16
14
import java.util.Arrays;
17
15
import java.util.Iterator;
32
30
import javax.swing.JSpinner;
33
31
import javax.swing.JTextPane;
34
32
import javax.swing.SwingConstants;
35
 
import javax.swing.SwingUtilities;
36
33
import javax.swing.Timer;
37
34
import javax.swing.border.TitledBorder;
38
35
import javax.swing.event.ChangeEvent;
39
36
import javax.swing.event.ChangeListener;
 
37
 
 
38
import net.tapaal.swinghelpers.CustomJSpinner;
40
39
import pipe.gui.CreateGui;
41
40
import pipe.gui.graphicElements.PetriNetObject;
42
 
import pipe.gui.graphicElements.PlaceTransitionObject;
43
 
import pipe.gui.widgets.CustomJSpinner;
44
41
 
45
42
public class SmartDrawDialog extends JDialog {
46
43
        private static final long serialVersionUID = 6116530047981607501L;
221
218
                                        
222
219
                                        @Override
223
220
                                        public void fireStatusChanged(int objectsPlaced) {
224
 
                                                progressLabel.setText("Objects placed: " + objectsPlaced +"/" + CreateGui.getDrawingSurface().getPlaceTransitionObjects().size());
225
 
                                                
 
221
                                                progressLabel.setText("Objects placed: " + objectsPlaced +"/" + CreateGui.getDrawingSurface().getGuiModel().getPlaceTransitionObjects().size());
226
222
                                        }
227
223
                                        
228
224
                                        @Override
688
684
        
689
685
        static private String[] getObjectNames() {
690
686
                ArrayList<String> names = new ArrayList<String>();
691
 
                for(PetriNetObject object : CreateGui.getDrawingSurface().getPlaceTransitionObjects()) {
 
687
                for(PetriNetObject object : CreateGui.getDrawingSurface().getGuiModel().getPlaceTransitionObjects()) {
692
688
                        names.add(object.getName());
693
689
                }
694
690
                return Arrays.copyOf(names.toArray(), names.toArray().length, String[].class);
698
694
                loadingDialogFrame = new JDialog(CreateGui.getApp(), "Working...", true);
699
695
                loadingDialogFrame.setLayout(new GridBagLayout());
700
696
                loadingDialogFrame.setType(Window.Type.POPUP);
701
 
                ImageIcon loadingGIF = new ImageIcon(CreateGui.imgPath + "ajax-loader.gif");
702
 
                
 
697
                ImageIcon loadingGIF = new ImageIcon(Thread.currentThread().getContextClassLoader().getResource(CreateGui.imgPath + "ajax-loader.gif"));
 
698
 
703
699
                JLabel workingLabel = new JLabel("<html><div style='text-align: center;'>Currently doing layout...<br/>This may take several minutes depending on the size of the net...</div></html>", SwingConstants.CENTER);
704
700
                GridBagConstraints gbc = new GridBagConstraints();
705
701
                gbc.gridx = 0;
746
742
                        @Override
747
743
                        public void actionPerformed(ActionEvent e) {
748
744
                                cancelWorker();
749
 
                                CreateGui.getDrawingSurface().getUndoManager().undo();
 
745
                                CreateGui.getCurrentTab().getUndoManager().undo();
750
746
                                CreateGui.getDrawingSurface().repaintAll();
751
747
                                loadingDialogFrame.setVisible(false);
752
748
                                //smartDrawDialog.setVisible(true);
889
885
        }
890
886
        
891
887
        private void enableButtons() {
892
 
                if(CreateGui.getDrawingSurface().getPlaceTransitionObjects().size() > 0) {
 
888
                if(CreateGui.getDrawingSurface().getGuiModel().getPlaceTransitionObjects().size() > 0) {
893
889
                        drawButton.setEnabled(true);
894
890
                        drawButton.setToolTipText("Smart draw with the current options");
895
891
                        if(!(randomStartObjectCheckBox.isSelected()))