Premier commit - Introduction au système git
This commit is contained in:
commit
90cd59ed9a
8
.gitignore
vendored
Normal file
8
.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
.classpath
|
||||
.settings
|
||||
.project
|
||||
bin/
|
||||
gradle/
|
||||
.gradle/
|
||||
gradlew
|
||||
gradlew.bat
|
||||
23
build.gradle
Normal file
23
build.gradle
Normal file
@ -0,0 +1,23 @@
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
|
||||
maven {
|
||||
url "http://ftp.bernard.890m.com/mavenRepository/"
|
||||
credentials {
|
||||
username 'u890869027.maven'
|
||||
password 'bernard'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
//Pour gradle
|
||||
compile 'org.slf4j:slf4j-api:1.7.21'
|
||||
testCompile 'junit:junit:4.12'
|
||||
|
||||
compile 'com.bernard:bernardUtil:alpha'
|
||||
}
|
||||
19
settings.gradle
Normal file
19
settings.gradle
Normal file
@ -0,0 +1,19 @@
|
||||
/*
|
||||
* This settings file was auto generated by the Gradle buildInit task
|
||||
* by 'Samy' at '02/02/17 18:25' with Gradle 3.2.1
|
||||
*
|
||||
* The settings file is used to specify which projects to include in your build.
|
||||
* In a single project build this file can be empty or even removed.
|
||||
*
|
||||
* Detailed information about configuring a multi-project build in Gradle can be found
|
||||
* in the user guide at https://docs.gradle.org/3.2.1/userguide/multi_project_builds.html
|
||||
*/
|
||||
|
||||
/*
|
||||
// To declare projects as part of a multi-project build use the 'include' method
|
||||
include 'shared'
|
||||
include 'api'
|
||||
include 'services:webservice'
|
||||
*/
|
||||
|
||||
rootProject.name = 'Zikator'
|
||||
34
src/main/java/com/bernard/zikator/Download.java
Normal file
34
src/main/java/com/bernard/zikator/Download.java
Normal file
@ -0,0 +1,34 @@
|
||||
package com.bernard.zikator;
|
||||
|
||||
public class Download
|
||||
{
|
||||
protected String type;
|
||||
protected String downloadUrl;
|
||||
protected String storeUrl;
|
||||
protected long size;
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
public String getDownloadUrl() {
|
||||
return downloadUrl;
|
||||
}
|
||||
public void setDownloadUrl(String downloadUrl) {
|
||||
this.downloadUrl = downloadUrl;
|
||||
}
|
||||
public String getStoreUrl() {
|
||||
return storeUrl;
|
||||
}
|
||||
public void setStoreUrl(String storeUrl) {
|
||||
this.storeUrl = storeUrl;
|
||||
}
|
||||
public long getSize() {
|
||||
return size;
|
||||
}
|
||||
public void setSize(long size) {
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
}
|
||||
23
src/main/java/com/bernard/zikator/ZiKonfig.java
Normal file
23
src/main/java/com/bernard/zikator/ZiKonfig.java
Normal file
@ -0,0 +1,23 @@
|
||||
package com.bernard.zikator;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
public class ZiKonfig
|
||||
{
|
||||
public Download[] downloads;
|
||||
public Color progressColor;
|
||||
public Color progressBackground;
|
||||
public Color progressTextColor;
|
||||
public String fileProgressFormat;
|
||||
public String filesProgressFormat;
|
||||
|
||||
public ZiKonfig()
|
||||
{
|
||||
downloads = new Download[0];
|
||||
progressColor = Color.GREEN;
|
||||
progressBackground = Color.DARK_GRAY;
|
||||
progressTextColor = Color.BLACK;
|
||||
fileProgressFormat = "%l octets sur %l";
|
||||
filesProgressFormat = "Fichier %i sur %i";
|
||||
}
|
||||
}
|
||||
19
src/main/java/com/bernard/zikator/Zikator.java
Normal file
19
src/main/java/com/bernard/zikator/Zikator.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.bernard.zikator;
|
||||
|
||||
import com.bernard.zikator.view.MainFrame;
|
||||
|
||||
public class Zikator {
|
||||
|
||||
public static final MainFrame theFrame;
|
||||
static{
|
||||
theFrame = new MainFrame();
|
||||
}
|
||||
public static final ZiKonfig theKonfig;
|
||||
static{
|
||||
theKonfig = new ZiKonfig();
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
}
|
||||
}
|
||||
64
src/main/java/com/bernard/zikator/view/MainFrame.java
Normal file
64
src/main/java/com/bernard/zikator/view/MainFrame.java
Normal file
@ -0,0 +1,64 @@
|
||||
package com.bernard.zikator.view;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.bernard.util.ConfiguredFrame;
|
||||
import com.bernard.zikator.ZiKonfig;
|
||||
|
||||
public class MainFrame extends ConfiguredFrame<ZiKonfig>
|
||||
{
|
||||
|
||||
JButton addDownloadButton,viewDownloadsButton,switchDownloadButton;
|
||||
|
||||
/** JFESH */
|
||||
private static final long serialVersionUID = 849892775235695501L;
|
||||
|
||||
public MainFrame()
|
||||
{
|
||||
super("Zikator", 400, 600, ZiKonfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init()
|
||||
{
|
||||
JPanel buttonsPanel = new JPanel();
|
||||
GridLayout buttonLayout = new GridLayout(3,1);
|
||||
buttonLayout.setVgap(10);
|
||||
buttonsPanel.setLayout(buttonLayout);
|
||||
addDownloadButton = new JButton("Add a download");
|
||||
viewDownloadsButton = new JButton("View downloads");
|
||||
switchDownloadButton = new JButton("No downloads");
|
||||
buttonsPanel.add(addDownloadButton);
|
||||
buttonsPanel.add(viewDownloadsButton);
|
||||
buttonsPanel.add(switchDownloadButton);
|
||||
|
||||
|
||||
JPanel progressPanel = new JPanel();
|
||||
|
||||
|
||||
this.getContentPane().setLayout(new BorderLayout());
|
||||
this.getContentPane().add(progressPanel, BorderLayout.SOUTH);
|
||||
this.getContentPane().add(buttonsPanel,BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
//TODO supress this function (for offline tests)
|
||||
public ZiKonfig getConfig(){
|
||||
return new ZiKonfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
public static void main(String[] args) {
|
||||
new MainFrame();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,51 @@
|
||||
package com.bernard.zikator.view;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.util.List;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.bernard.zikator.Download;
|
||||
|
||||
/**
|
||||
*
|
||||
* Affche deux barres de progression
|
||||
*
|
||||
* Cycle de vie :
|
||||
* setDownloads();
|
||||
* prepareDownload(); return the next download in the list
|
||||
* startDownload(); the download starts. before that,the progress bar will print "Preparing"
|
||||
* setCurrentFileProgress();looping
|
||||
* downloadFinished();//prints Done
|
||||
*
|
||||
* @author Mysaa
|
||||
*
|
||||
*/
|
||||
public class ZikaProgressPanel extends JPanel {
|
||||
|
||||
private static final long serialVersionUID = 3133794283368644062L;
|
||||
|
||||
List<Download> download;
|
||||
int currentDownload;
|
||||
long currentFileProgress;
|
||||
|
||||
|
||||
|
||||
public void setCurrentFileProgress(long currentProgress){
|
||||
currentFileProgress = currentProgress;
|
||||
}
|
||||
|
||||
public void setCurrentFileProgress(float currentProgress){
|
||||
currentFileProgress = (long)(currentProgress*download.get(currentDownload).getSize());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void paintComponent(Graphics arg0) {
|
||||
|
||||
int filesProgressWidth = (int) (Math.floorDiv(currentDownload*this.getWidth(),download.size()));
|
||||
int fileProgressWidth = (int) (Math.floorDiv(currentFileProgress*this.getWidth(),download.get(currentDownload).getSize()));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user