Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 53dcc7b9

Přidáno uživatelem Marek Sobota před téměř 6 roky(ů)

Přidány výpisy, doplněny komentáře a menší úpravy ve Window (Re #7320)

Zobrazit rozdíly:

src/data/BitmapBuilder.java
44 44

  
45 45
        } catch (IOException e) {
46 46
            e.printStackTrace();
47
            window.printMessage("Nečekaná chyba při práci s výstupním souborem");
47 48
        }
48 49
    }
49 50

  
......
109 110
    }
110 111

  
111 112
    public void writeBitmaps(Calendar dateFrom, Calendar dateTo) {
113
        
112 114
        try(BufferedWriter writer = Files.newBufferedWriter(outputFile, Charset.defaultCharset(), StandardOpenOption.APPEND)) {
113 115
            SimpleDateFormat format = new SimpleDateFormat("d.M.yyyy");
114 116
            String formatedDateFrom = format.format(dateFrom.getTime());
115 117
            String formatedDateTo = format.format(dateTo.getTime());
116 118
            writer.write("Období;" + formatedDateFrom + ";" + formatedDateTo + "\n\n");
117

  
119
            window.printMessage("Zapisuji bitmapy..");
118 120
            for (int i = 0; i < lineList.length ; i++) {
119 121

  
120 122

  
......
135 137

  
136 138
        } catch (IOException e) {
137 139
            e.printStackTrace();
140
            window.printMessage("Nečekaná chyba při zapisování bitmapy");
138 141
        }
142
        window.printMessage("Bitmapy úspěšně zapsány");
139 143
    }
140 144

  
141 145
}
src/gui/Window.java
36 36
	private static final long serialVersionUID = 1L;
37 37
	
38 38
	/**Minimalni rozmer vypisoveho okna*/
39
	private static final Dimension OUTPUT_WINDOW_MIN_DIM = new Dimension(320, 160);
39
	private static final Dimension OUTPUT_WINDOW_MIN_DIM = new Dimension(640, 320);
40 40
	
41 41
	/**konstanta pro oznaceni souboru se spoji*/
42 42
	private static final int SEZNAM_LINEK_FILE = 0;
......
136 136
		JPanel jdfPathP = new JPanel();
137 137
		JPanel outputP = new JPanel();
138 138
		inputP.setLayout(new GridLayout(5, 1));
139
		ImageIcon icon = new ImageIcon(Window.class.getResource("/resources/poved.png"));
140
        ImageIcon logo = new ImageIcon(Window.class.getResource("/resources/logo.png"));
141
		this.setIconImage(icon.getImage());
142 139
		dateFromP.setLayout(new FlowLayout());
143 140
		dateToP.setLayout(new FlowLayout());
144 141
		spojPathP.setLayout(new FlowLayout());
......
146 143
		outputP.setLayout(new FlowLayout());
147 144
		
148 145
		//inicializace kompoment
146
		ImageIcon icon = new ImageIcon(Window.class.getResource("/resources/poved.png"));
147
        ImageIcon logo = new ImageIcon(Window.class.getResource("/resources/logo.png"));
149 148
		JLabel povedLB = new JLabel(logo, JLabel.CENTER);
150 149
		JLabel dateFromLB = new JLabel("Obdobi od: ");
151 150
		JLabel dateToLB = new JLabel ("Obdobi do: ");
......
167 166
		initDatePicker();
168 167
		
169 168
		//nastaveni komponent
169
		this.setIconImage(icon.getImage());
170 170
		linkyPathTF.setEditable(false);
171 171
		jdfPathTF.setEditable(false);
172 172
		outputPathTF.setEditable(false);
173 173
		outputNameTF.setText("Nazev souboru");
174
		infoTA.setEditable(false);
175
		fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
176
		
177
		
178
		//pridani listeneru 
174 179
		outputNameTF.addMouseListener(new MouseAdapter() {
175 180
            @Override
181
            /**
182
             * pokud je zapsan vychozi text, po kliknuti se vymaze
183
             * 
184
             * @param e kod udalosti
185
             */
176 186
            public void mouseClicked(MouseEvent e) {
177 187
                if (outputNameTF.getText().trim().equals("Nazev souboru") ) outputNameTF.setText("");
178 188
            }
179 189
        });
180
		infoTA.setEditable(false);
181
		fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
182
		
183
		
184
		//pridani listeneru k buttonum
185 190
		confirmBT.addActionListener(new ConfirmListener());
186 191
		endBT.addActionListener(new ActionListener(){
187
			//@Override
192
			@Override
188 193
			/**
189 194
			 * ukonci program
190 195
			 * 
......
277 282
		infoTA.append(message + "\n");
278 283
	}
279 284

  
285
	/**
286
	 * vytvori instanci {@code BitmapBuilder} a vrati ji
287
	 * 
288
	 * @return nove vytvořena instance
289
	 */
280 290
	private BitmapBuilder createBitmapBuilder(){
281 291
		return new BitmapBuilder(this, outputFile);
282 292
	}
......
313 323

  
314 324

  
315 325
			ArrayList<String[]> loadedData;
316

  
317 326
	        BitmapBuilder bitmapBuilder = createBitmapBuilder();
327
	        
318 328
	        //loader pro načtení dat
319 329
	        DataLoader loader = new DataLoader(jdfDir);
320 330

  
321 331
	        //načítání konkrétních dat
322

  
323 332
			String[] lineList = loader.loadLines(linkyFile);
324 333
			bitmapBuilder.getLineList(lineList);
325 334

  
......
334 343
	        loadedData = loader.loadData(SPOJE);
335 344
	        bitmapBuilder.getSpoje(loadedData);
336 345

  
337
	        printMessage("Zapisuji bitmapy..");
338 346
	        bitmapBuilder.writeBitmaps(dateFrom, dateTo);
339 347

  
340 348
	        printMessage("Ukončuji program..");
......
520 528
	
521 529
	/**
522 530
	 * 
523
	 * hlavni metoda pro ozkouseni funkcnosti {@code Window}
531
	 * hlavni metoda a vstupni bod aplikace
524 532
	 * 
525 533
	 * @param args parametry programu
526 534
	 */

Také k dispozici: Unified diff