repo_name
stringlengths
7
104
file_path
stringlengths
13
198
context
stringlengths
67
7.15k
import_statement
stringlengths
16
4.43k
code
stringlengths
40
6.98k
prompt
stringlengths
227
8.27k
next_line
stringlengths
8
795
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/ReadContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/ArticleOne.java // public class ArticleOne { // // /** // * articleTitle : 过冬 // * pubTime : 2017-01-02 // * articleId : 157 // * articleContent : content // * articleUrl : http://www.wufafuwu.com//a/ONE_wenzhang/2017/0102/5494.html // * articleAuthor : 康夫 // */ // // private String articleTitle; // private String pubTime; // private String articleId; // private String articleContent; // private String articleUrl; // private String articleAuthor; // // public String getArticleTitle() { // return articleTitle; // } // // public void setArticleTitle(String articleTitle) { // this.articleTitle = articleTitle; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getArticleId() { // return articleId; // } // // public void setArticleId(String articleId) { // this.articleId = articleId; // } // // public String getArticleContent() { // return articleContent; // } // // public void setArticleContent(String articleContent) { // this.articleContent = articleContent; // } // // public String getArticleUrl() { // return articleUrl; // } // // public void setArticleUrl(String articleUrl) { // this.articleUrl = articleUrl; // } // // public String getArticleAuthor() { // return articleAuthor; // } // // public void setArticleAuthor(String articleAuthor) { // this.articleAuthor = articleAuthor; // } // }
import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.ArticleOne;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/8. */ public interface ReadContract { interface View extends BaseView {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/ArticleOne.java // public class ArticleOne { // // /** // * articleTitle : 过冬 // * pubTime : 2017-01-02 // * articleId : 157 // * articleContent : content // * articleUrl : http://www.wufafuwu.com//a/ONE_wenzhang/2017/0102/5494.html // * articleAuthor : 康夫 // */ // // private String articleTitle; // private String pubTime; // private String articleId; // private String articleContent; // private String articleUrl; // private String articleAuthor; // // public String getArticleTitle() { // return articleTitle; // } // // public void setArticleTitle(String articleTitle) { // this.articleTitle = articleTitle; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getArticleId() { // return articleId; // } // // public void setArticleId(String articleId) { // this.articleId = articleId; // } // // public String getArticleContent() { // return articleContent; // } // // public void setArticleContent(String articleContent) { // this.articleContent = articleContent; // } // // public String getArticleUrl() { // return articleUrl; // } // // public void setArticleUrl(String articleUrl) { // this.articleUrl = articleUrl; // } // // public String getArticleAuthor() { // return articleAuthor; // } // // public void setArticleAuthor(String articleAuthor) { // this.articleAuthor = articleAuthor; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/ReadContract.java import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.ArticleOne; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/8. */ public interface ReadContract { interface View extends BaseView {
void showArticle(ArticleOne article);
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/ReadContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/ArticleOne.java // public class ArticleOne { // // /** // * articleTitle : 过冬 // * pubTime : 2017-01-02 // * articleId : 157 // * articleContent : content // * articleUrl : http://www.wufafuwu.com//a/ONE_wenzhang/2017/0102/5494.html // * articleAuthor : 康夫 // */ // // private String articleTitle; // private String pubTime; // private String articleId; // private String articleContent; // private String articleUrl; // private String articleAuthor; // // public String getArticleTitle() { // return articleTitle; // } // // public void setArticleTitle(String articleTitle) { // this.articleTitle = articleTitle; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getArticleId() { // return articleId; // } // // public void setArticleId(String articleId) { // this.articleId = articleId; // } // // public String getArticleContent() { // return articleContent; // } // // public void setArticleContent(String articleContent) { // this.articleContent = articleContent; // } // // public String getArticleUrl() { // return articleUrl; // } // // public void setArticleUrl(String articleUrl) { // this.articleUrl = articleUrl; // } // // public String getArticleAuthor() { // return articleAuthor; // } // // public void setArticleAuthor(String articleAuthor) { // this.articleAuthor = articleAuthor; // } // }
import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.ArticleOne;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/8. */ public interface ReadContract { interface View extends BaseView { void showArticle(ArticleOne article); }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/ArticleOne.java // public class ArticleOne { // // /** // * articleTitle : 过冬 // * pubTime : 2017-01-02 // * articleId : 157 // * articleContent : content // * articleUrl : http://www.wufafuwu.com//a/ONE_wenzhang/2017/0102/5494.html // * articleAuthor : 康夫 // */ // // private String articleTitle; // private String pubTime; // private String articleId; // private String articleContent; // private String articleUrl; // private String articleAuthor; // // public String getArticleTitle() { // return articleTitle; // } // // public void setArticleTitle(String articleTitle) { // this.articleTitle = articleTitle; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getArticleId() { // return articleId; // } // // public void setArticleId(String articleId) { // this.articleId = articleId; // } // // public String getArticleContent() { // return articleContent; // } // // public void setArticleContent(String articleContent) { // this.articleContent = articleContent; // } // // public String getArticleUrl() { // return articleUrl; // } // // public void setArticleUrl(String articleUrl) { // this.articleUrl = articleUrl; // } // // public String getArticleAuthor() { // return articleAuthor; // } // // public void setArticleAuthor(String articleAuthor) { // this.articleAuthor = articleAuthor; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/ReadContract.java import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.ArticleOne; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/8. */ public interface ReadContract { interface View extends BaseView { void showArticle(ArticleOne article); }
interface Presenter extends BasePresenter<View> {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/di/module/AppModule.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/RetrofitUtil.java // public class RetrofitUtil { // public static final int DEFAULT_TIMEOUT = 10; // public static final String BASE_URL = "http://www.icodes.vip/4Fun/"; // private static Retrofit mRetrofit; // // public RetrofitUtil() { // mRetrofit = new Retrofit.Builder().baseUrl(BASE_URL) // .client(initOkHttp()) // .addConverterFactory(GsonConverterFactory.create()) // .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .build(); // } // // private OkHttpClient initOkHttp() { // OkHttpClient.Builder builder = new OkHttpClient.Builder(); // Interceptor cacheInterceptor = new Interceptor() { // @Override // public Response intercept(Chain chain) throws IOException { // Request request = chain.request(); // if (!SystemUtil.isNetworkConnected()) { // request = request.newBuilder() // .cacheControl(CacheControl.FORCE_CACHE) // .build(); // } // Response response = chain.proceed(request); // if (SystemUtil.isNetworkConnected()) { // int maxAge = 0; // // 有网络时, 不缓存, 最大保存时长为0 // response.newBuilder() // .header("Cache-Control", "public, max-age=" + maxAge) // .removeHeader("Pragma") // .build(); // } else { // // 无网络时,设置超时为4周 // int maxStale = 60 * 60 * 24 * 28; // response.newBuilder() // .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) // .removeHeader("Pragma") // .build(); // } // // return response; // } // }; // if (BuildConfig.DEBUG) { // HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); // interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // builder.addInterceptor(interceptor); // } // File cacheFile = new File(FourFun.getInstance().getCacheDir().getPath()); // // 设置缓存文件 20MB // Cache cache = new Cache(cacheFile, 1024 * 1024 * 20); // return builder // .addInterceptor(cacheInterceptor) // .addNetworkInterceptor(cacheInterceptor) // .cache(cache) // .connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .retryOnConnectionFailure(true) // .build(); // } // // public <T> T create(Class<T> service) { // return mRetrofit.create(service); // } // }
import android.app.Application; import com.joker.fourfun.FourFun; import com.joker.fourfun.utils.RetrofitUtil; import javax.inject.Singleton; import dagger.Module; import dagger.Provides;
package com.joker.fourfun.di.module; /** * Created by joker on 2016/11/28. */ @Module public class AppModule { private Application application; public AppModule(Application application) { this.application = application; } @Singleton @Provides
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/RetrofitUtil.java // public class RetrofitUtil { // public static final int DEFAULT_TIMEOUT = 10; // public static final String BASE_URL = "http://www.icodes.vip/4Fun/"; // private static Retrofit mRetrofit; // // public RetrofitUtil() { // mRetrofit = new Retrofit.Builder().baseUrl(BASE_URL) // .client(initOkHttp()) // .addConverterFactory(GsonConverterFactory.create()) // .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .build(); // } // // private OkHttpClient initOkHttp() { // OkHttpClient.Builder builder = new OkHttpClient.Builder(); // Interceptor cacheInterceptor = new Interceptor() { // @Override // public Response intercept(Chain chain) throws IOException { // Request request = chain.request(); // if (!SystemUtil.isNetworkConnected()) { // request = request.newBuilder() // .cacheControl(CacheControl.FORCE_CACHE) // .build(); // } // Response response = chain.proceed(request); // if (SystemUtil.isNetworkConnected()) { // int maxAge = 0; // // 有网络时, 不缓存, 最大保存时长为0 // response.newBuilder() // .header("Cache-Control", "public, max-age=" + maxAge) // .removeHeader("Pragma") // .build(); // } else { // // 无网络时,设置超时为4周 // int maxStale = 60 * 60 * 24 * 28; // response.newBuilder() // .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) // .removeHeader("Pragma") // .build(); // } // // return response; // } // }; // if (BuildConfig.DEBUG) { // HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); // interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // builder.addInterceptor(interceptor); // } // File cacheFile = new File(FourFun.getInstance().getCacheDir().getPath()); // // 设置缓存文件 20MB // Cache cache = new Cache(cacheFile, 1024 * 1024 * 20); // return builder // .addInterceptor(cacheInterceptor) // .addNetworkInterceptor(cacheInterceptor) // .cache(cache) // .connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .retryOnConnectionFailure(true) // .build(); // } // // public <T> T create(Class<T> service) { // return mRetrofit.create(service); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/AppModule.java import android.app.Application; import com.joker.fourfun.FourFun; import com.joker.fourfun.utils.RetrofitUtil; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; package com.joker.fourfun.di.module; /** * Created by joker on 2016/11/28. */ @Module public class AppModule { private Application application; public AppModule(Application application) { this.application = application; } @Singleton @Provides
FourFun provideFourFun() {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/di/module/AppModule.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/RetrofitUtil.java // public class RetrofitUtil { // public static final int DEFAULT_TIMEOUT = 10; // public static final String BASE_URL = "http://www.icodes.vip/4Fun/"; // private static Retrofit mRetrofit; // // public RetrofitUtil() { // mRetrofit = new Retrofit.Builder().baseUrl(BASE_URL) // .client(initOkHttp()) // .addConverterFactory(GsonConverterFactory.create()) // .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .build(); // } // // private OkHttpClient initOkHttp() { // OkHttpClient.Builder builder = new OkHttpClient.Builder(); // Interceptor cacheInterceptor = new Interceptor() { // @Override // public Response intercept(Chain chain) throws IOException { // Request request = chain.request(); // if (!SystemUtil.isNetworkConnected()) { // request = request.newBuilder() // .cacheControl(CacheControl.FORCE_CACHE) // .build(); // } // Response response = chain.proceed(request); // if (SystemUtil.isNetworkConnected()) { // int maxAge = 0; // // 有网络时, 不缓存, 最大保存时长为0 // response.newBuilder() // .header("Cache-Control", "public, max-age=" + maxAge) // .removeHeader("Pragma") // .build(); // } else { // // 无网络时,设置超时为4周 // int maxStale = 60 * 60 * 24 * 28; // response.newBuilder() // .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) // .removeHeader("Pragma") // .build(); // } // // return response; // } // }; // if (BuildConfig.DEBUG) { // HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); // interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // builder.addInterceptor(interceptor); // } // File cacheFile = new File(FourFun.getInstance().getCacheDir().getPath()); // // 设置缓存文件 20MB // Cache cache = new Cache(cacheFile, 1024 * 1024 * 20); // return builder // .addInterceptor(cacheInterceptor) // .addNetworkInterceptor(cacheInterceptor) // .cache(cache) // .connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .retryOnConnectionFailure(true) // .build(); // } // // public <T> T create(Class<T> service) { // return mRetrofit.create(service); // } // }
import android.app.Application; import com.joker.fourfun.FourFun; import com.joker.fourfun.utils.RetrofitUtil; import javax.inject.Singleton; import dagger.Module; import dagger.Provides;
package com.joker.fourfun.di.module; /** * Created by joker on 2016/11/28. */ @Module public class AppModule { private Application application; public AppModule(Application application) { this.application = application; } @Singleton @Provides FourFun provideFourFun() { return (FourFun) this.application; } @Singleton @Provides
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/RetrofitUtil.java // public class RetrofitUtil { // public static final int DEFAULT_TIMEOUT = 10; // public static final String BASE_URL = "http://www.icodes.vip/4Fun/"; // private static Retrofit mRetrofit; // // public RetrofitUtil() { // mRetrofit = new Retrofit.Builder().baseUrl(BASE_URL) // .client(initOkHttp()) // .addConverterFactory(GsonConverterFactory.create()) // .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .build(); // } // // private OkHttpClient initOkHttp() { // OkHttpClient.Builder builder = new OkHttpClient.Builder(); // Interceptor cacheInterceptor = new Interceptor() { // @Override // public Response intercept(Chain chain) throws IOException { // Request request = chain.request(); // if (!SystemUtil.isNetworkConnected()) { // request = request.newBuilder() // .cacheControl(CacheControl.FORCE_CACHE) // .build(); // } // Response response = chain.proceed(request); // if (SystemUtil.isNetworkConnected()) { // int maxAge = 0; // // 有网络时, 不缓存, 最大保存时长为0 // response.newBuilder() // .header("Cache-Control", "public, max-age=" + maxAge) // .removeHeader("Pragma") // .build(); // } else { // // 无网络时,设置超时为4周 // int maxStale = 60 * 60 * 24 * 28; // response.newBuilder() // .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) // .removeHeader("Pragma") // .build(); // } // // return response; // } // }; // if (BuildConfig.DEBUG) { // HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); // interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); // builder.addInterceptor(interceptor); // } // File cacheFile = new File(FourFun.getInstance().getCacheDir().getPath()); // // 设置缓存文件 20MB // Cache cache = new Cache(cacheFile, 1024 * 1024 * 20); // return builder // .addInterceptor(cacheInterceptor) // .addNetworkInterceptor(cacheInterceptor) // .cache(cache) // .connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .writeTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS) // .retryOnConnectionFailure(true) // .build(); // } // // public <T> T create(Class<T> service) { // return mRetrofit.create(service); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/AppModule.java import android.app.Application; import com.joker.fourfun.FourFun; import com.joker.fourfun.utils.RetrofitUtil; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; package com.joker.fourfun.di.module; /** * Created by joker on 2016/11/28. */ @Module public class AppModule { private Application application; public AppModule(Application application) { this.application = application; } @Singleton @Provides FourFun provideFourFun() { return (FourFun) this.application; } @Singleton @Provides
RetrofitUtil provideRetrofitUtil() {
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException {
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException {
File file = new File(LOCAL_PICTURE_PATH);
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); }
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); }
if (picType.equals(PICTURE_ONE)) {
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE;
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE;
projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE;
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE;
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE;
} else if (picType.equals(PICTURE_MOVIE)) {
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE; } else if (picType.equals(PICTURE_MOVIE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MOVIE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MOVIE;
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE; } else if (picType.equals(PICTURE_MOVIE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MOVIE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MOVIE;
} else if (picType.equals(PICTURE_ZHIHU)) {
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE; } else if (picType.equals(PICTURE_MOVIE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MOVIE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MOVIE; } else if (picType.equals(PICTURE_ZHIHU)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ZHIHU; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ZHIHU;
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; package com.mollychin.utils; public class DownloadUtil { /** * 下载一个的图片 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadPicture(String urlString, String fileName, String picType) throws IOException { File file = new File(LOCAL_PICTURE_PATH); String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE; } else if (picType.equals(PICTURE_MOVIE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MOVIE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MOVIE; } else if (picType.equals(PICTURE_ZHIHU)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ZHIHU; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ZHIHU;
} else if (picType.equals(PICTURE_MUSIC)) {
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE; } else if (picType.equals(PICTURE_MOVIE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MOVIE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MOVIE; } else if (picType.equals(PICTURE_ZHIHU)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ZHIHU; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ZHIHU; } else if (picType.equals(PICTURE_MUSIC)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MUSIC; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MUSIC; } if (!(fileName.endsWith(".jpg") || fileName.endsWith(".png"))) { fileName = changeName(fileName) + ".jpg"; } else { String prex = fileName.substring(0, fileName.length() - 4); fileName.replace(prex, changeName(prex)); } download(urlString, fileName, localPicturePath, projectPicturePath); if (picType.equals(PICTURE_ONE)) {
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; String localPicturePath = ""; String projectPicturePath = ""; if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (picType.equals(PICTURE_ONE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ONE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ONE; } else if (picType.equals(PICTURE_MOVIE)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MOVIE; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MOVIE; } else if (picType.equals(PICTURE_ZHIHU)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_ZHIHU; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_ZHIHU; } else if (picType.equals(PICTURE_MUSIC)) { localPicturePath = LOCAL_PICTURE_PATH + PICTURE_MUSIC; projectPicturePath = PICTURE_PROJECT_PATH + PICTURE_MUSIC; } if (!(fileName.endsWith(".jpg") || fileName.endsWith(".png"))) { fileName = changeName(fileName) + ".jpg"; } else { String prex = fileName.substring(0, fileName.length() - 4); fileName.replace(prex, changeName(prex)); } download(urlString, fileName, localPicturePath, projectPicturePath); if (picType.equals(PICTURE_ONE)) {
return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ONE
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
} download(urlString, fileName, localPicturePath, projectPicturePath); if (picType.equals(PICTURE_ONE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ONE + fileName; } else if (picType.equals(PICTURE_MOVIE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MOVIE + fileName; } else if (picType.equals(PICTURE_ZHIHU)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ZHIHU + fileName; } else if (picType.equals(PICTURE_MUSIC)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MUSIC + fileName; } return projectPicturePath; } /** * 下载音乐 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException {
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; } download(urlString, fileName, localPicturePath, projectPicturePath); if (picType.equals(PICTURE_ONE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ONE + fileName; } else if (picType.equals(PICTURE_MOVIE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MOVIE + fileName; } else if (picType.equals(PICTURE_ZHIHU)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ZHIHU + fileName; } else if (picType.equals(PICTURE_MUSIC)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MUSIC + fileName; } return projectPicturePath; } /** * 下载音乐 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException {
String localFile = LOCAL_MUSIC_PATH;
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
download(urlString, fileName, localPicturePath, projectPicturePath); if (picType.equals(PICTURE_ONE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ONE + fileName; } else if (picType.equals(PICTURE_MOVIE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MOVIE + fileName; } else if (picType.equals(PICTURE_ZHIHU)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ZHIHU + fileName; } else if (picType.equals(PICTURE_MUSIC)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MUSIC + fileName; } return projectPicturePath; } /** * 下载音乐 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException { String localFile = LOCAL_MUSIC_PATH;
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; download(urlString, fileName, localPicturePath, projectPicturePath); if (picType.equals(PICTURE_ONE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ONE + fileName; } else if (picType.equals(PICTURE_MOVIE)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MOVIE + fileName; } else if (picType.equals(PICTURE_ZHIHU)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_ZHIHU + fileName; } else if (picType.equals(PICTURE_MUSIC)) { return COMPUTER_IP_ADDRESS + "/4Fun/PictureFile/" + PICTURE_MUSIC + fileName; } return projectPicturePath; } /** * 下载音乐 * * @param urlString * @param fileName * @return * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException { String localFile = LOCAL_MUSIC_PATH;
String projectFile = MUSIC_PROJECT_PATH;
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
* @return * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException { String localFile = LOCAL_MUSIC_PATH; String projectFile = MUSIC_PROJECT_PATH; File file = new File(localFile); if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (!fileName.endsWith(".mp3")) { fileName = fileName + ".mp3"; } download(urlString, fileName, localFile, projectFile); return COMPUTER_IP_ADDRESS + "/4Fun/MusicFile/" + fileName; } /** * 下载诗歌朗诵 * * @param urlString * @param filename * @return * @throws IOException */ public static String downloadRecitation(String urlString, String filename) throws IOException {
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; * @return * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException { String localFile = LOCAL_MUSIC_PATH; String projectFile = MUSIC_PROJECT_PATH; File file = new File(localFile); if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (!fileName.endsWith(".mp3")) { fileName = fileName + ".mp3"; } download(urlString, fileName, localFile, projectFile); return COMPUTER_IP_ADDRESS + "/4Fun/MusicFile/" + fileName; } /** * 下载诗歌朗诵 * * @param urlString * @param filename * @return * @throws IOException */ public static String downloadRecitation(String urlString, String filename) throws IOException {
String localFile = LOCAL_RECITATION_PATH;
4FunApp/4Fun
server/4FunServer/src/com/mollychin/utils/DownloadUtil.java
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/";
import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder;
* @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException { String localFile = LOCAL_MUSIC_PATH; String projectFile = MUSIC_PROJECT_PATH; File file = new File(localFile); if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (!fileName.endsWith(".mp3")) { fileName = fileName + ".mp3"; } download(urlString, fileName, localFile, projectFile); return COMPUTER_IP_ADDRESS + "/4Fun/MusicFile/" + fileName; } /** * 下载诗歌朗诵 * * @param urlString * @param filename * @return * @throws IOException */ public static String downloadRecitation(String urlString, String filename) throws IOException { String localFile = LOCAL_RECITATION_PATH;
// Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String COMPUTER_IP_ADDRESS = "http://www.icodes.vip"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_MUSIC_PATH = LOCAL_PATH + "/musicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_PICTURE_PATH = LOCAL_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String LOCAL_RECITATION_PATH = LOCAL_PATH // + "/recitationFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String MUSIC_PROJECT_PATH = FILE_PATH + "/MusicFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MOVIE = "Picture4Movie/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_MUSIC = "Picture4Music/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ONE = "Picture4One/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_PROJECT_PATH = FILE_PATH // + "/PictureFile/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String PICTURE_ZHIHU = "Picture4Zhihu/"; // // Path: server/4FunServer/src/com/mollychin/utils/ConstantsUtil.java // public static final String RECITATION_PROJECT_PATH = FILE_PATH // + "/RecitationFile/"; // Path: server/4FunServer/src/com/mollychin/utils/DownloadUtil.java import static com.mollychin.utils.ConstantsUtil.COMPUTER_IP_ADDRESS; import static com.mollychin.utils.ConstantsUtil.LOCAL_MUSIC_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_PICTURE_PATH; import static com.mollychin.utils.ConstantsUtil.LOCAL_RECITATION_PATH; import static com.mollychin.utils.ConstantsUtil.MUSIC_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_MOVIE; import static com.mollychin.utils.ConstantsUtil.PICTURE_MUSIC; import static com.mollychin.utils.ConstantsUtil.PICTURE_ONE; import static com.mollychin.utils.ConstantsUtil.PICTURE_PROJECT_PATH; import static com.mollychin.utils.ConstantsUtil.PICTURE_ZHIHU; import static com.mollychin.utils.ConstantsUtil.RECITATION_PROJECT_PATH; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import sun.misc.BASE64Encoder; * @throws IOException */ public static String downloadMusic(String urlString, String fileName) throws IOException { String localFile = LOCAL_MUSIC_PATH; String projectFile = MUSIC_PROJECT_PATH; File file = new File(localFile); if (!file.exists() && !file.isDirectory()) { file.mkdir(); } if (!fileName.endsWith(".mp3")) { fileName = fileName + ".mp3"; } download(urlString, fileName, localFile, projectFile); return COMPUTER_IP_ADDRESS + "/4Fun/MusicFile/" + fileName; } /** * 下载诗歌朗诵 * * @param urlString * @param filename * @return * @throws IOException */ public static String downloadRecitation(String urlString, String filename) throws IOException { String localFile = LOCAL_RECITATION_PATH;
String projectFile = RECITATION_PROJECT_PATH;
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/RegisterContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java // public class LoginInfo { // /** // * error : false // * result : [{"userName":"1","password":"1","sex":0,"code":1051}] // */ // /** // * userName : 1 // * password : 1 // * sex : 0 // * code : 1051 // */ // private String userName; // private String password; // private int sex; // private int code; // // public String getUserName() { // return userName; // } // // public void setUserName(String userName) { // this.userName = userName; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/User.java // public class User { // @SerializedName("userName") // private String username; // private String password; // private int sex; // private String email; // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // }
import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.LoginInfo; import com.joker.fourfun.model.User;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/30. */ public interface RegisterContract { interface View extends BaseView { void registerSuccess(String message); void autoLoginSuccess(String message);
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java // public class LoginInfo { // /** // * error : false // * result : [{"userName":"1","password":"1","sex":0,"code":1051}] // */ // /** // * userName : 1 // * password : 1 // * sex : 0 // * code : 1051 // */ // private String userName; // private String password; // private int sex; // private int code; // // public String getUserName() { // return userName; // } // // public void setUserName(String userName) { // this.userName = userName; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/User.java // public class User { // @SerializedName("userName") // private String username; // private String password; // private int sex; // private String email; // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/RegisterContract.java import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.LoginInfo; import com.joker.fourfun.model.User; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/30. */ public interface RegisterContract { interface View extends BaseView { void registerSuccess(String message); void autoLoginSuccess(String message);
void showDialog(LoginInfo loginInfo);
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/RegisterContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java // public class LoginInfo { // /** // * error : false // * result : [{"userName":"1","password":"1","sex":0,"code":1051}] // */ // /** // * userName : 1 // * password : 1 // * sex : 0 // * code : 1051 // */ // private String userName; // private String password; // private int sex; // private int code; // // public String getUserName() { // return userName; // } // // public void setUserName(String userName) { // this.userName = userName; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/User.java // public class User { // @SerializedName("userName") // private String username; // private String password; // private int sex; // private String email; // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // }
import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.LoginInfo; import com.joker.fourfun.model.User;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/30. */ public interface RegisterContract { interface View extends BaseView { void registerSuccess(String message); void autoLoginSuccess(String message); void showDialog(LoginInfo loginInfo); void cancelLogin(String message); }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java // public class LoginInfo { // /** // * error : false // * result : [{"userName":"1","password":"1","sex":0,"code":1051}] // */ // /** // * userName : 1 // * password : 1 // * sex : 0 // * code : 1051 // */ // private String userName; // private String password; // private int sex; // private int code; // // public String getUserName() { // return userName; // } // // public void setUserName(String userName) { // this.userName = userName; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/User.java // public class User { // @SerializedName("userName") // private String username; // private String password; // private int sex; // private String email; // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/RegisterContract.java import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.LoginInfo; import com.joker.fourfun.model.User; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/30. */ public interface RegisterContract { interface View extends BaseView { void registerSuccess(String message); void autoLoginSuccess(String message); void showDialog(LoginInfo loginInfo); void cancelLogin(String message); }
interface Presenter extends BasePresenter<View> {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/RegisterContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java // public class LoginInfo { // /** // * error : false // * result : [{"userName":"1","password":"1","sex":0,"code":1051}] // */ // /** // * userName : 1 // * password : 1 // * sex : 0 // * code : 1051 // */ // private String userName; // private String password; // private int sex; // private int code; // // public String getUserName() { // return userName; // } // // public void setUserName(String userName) { // this.userName = userName; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/User.java // public class User { // @SerializedName("userName") // private String username; // private String password; // private int sex; // private String email; // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // }
import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.LoginInfo; import com.joker.fourfun.model.User;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/30. */ public interface RegisterContract { interface View extends BaseView { void registerSuccess(String message); void autoLoginSuccess(String message); void showDialog(LoginInfo loginInfo); void cancelLogin(String message); } interface Presenter extends BasePresenter<View> {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/LoginInfo.java // public class LoginInfo { // /** // * error : false // * result : [{"userName":"1","password":"1","sex":0,"code":1051}] // */ // /** // * userName : 1 // * password : 1 // * sex : 0 // * code : 1051 // */ // private String userName; // private String password; // private int sex; // private int code; // // public String getUserName() { // return userName; // } // // public void setUserName(String userName) { // this.userName = userName; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public int getCode() { // return code; // } // // public void setCode(int code) { // this.code = code; // } // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/User.java // public class User { // @SerializedName("userName") // private String username; // private String password; // private int sex; // private String email; // // public String getUsername() { // return username; // } // // public void setUsername(String username) { // this.username = username; // } // // public String getPassword() { // return password; // } // // public void setPassword(String password) { // this.password = password; // } // // public int getSex() { // return sex; // } // // public void setSex(int sex) { // this.sex = sex; // } // // public String getEmail() { // return email; // } // // public void setEmail(String email) { // this.email = email; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/RegisterContract.java import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.LoginInfo; import com.joker.fourfun.model.User; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/30. */ public interface RegisterContract { interface View extends BaseView { void registerSuccess(String message); void autoLoginSuccess(String message); void showDialog(LoginInfo loginInfo); void cancelLogin(String message); } interface Presenter extends BasePresenter<View> {
void register(User user);
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/MineContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // }
import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/27. */ public interface MineContract { interface View extends BaseView { }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/MineContract.java import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/27. */ public interface MineContract { interface View extends BaseView { }
interface Presenter extends BasePresenter<View> {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/utils/GlideUtil.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/widget/GlideCircleTransform.java // public class GlideCircleTransform extends BitmapTransformation { // public GlideCircleTransform(Context context) { // super(context); // } // // public GlideCircleTransform(BitmapPool bitmapPool) { // super(bitmapPool); // } // // @Override // protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { // return circleCrop(pool, toTransform); // } // // private Bitmap circleCrop(BitmapPool pool, Bitmap source) { // // int size = Math.min(source.getWidth(), source.getHeight()); // // int width = (source.getWidth() - size) / 2; // int height = (source.getHeight() - size) / 2; // // Bitmap bitmap = pool.get(size, size, Bitmap.Config.ARGB_8888); // if (bitmap == null) { // bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); // } // // Canvas canvas = new Canvas(bitmap); // Paint paint = new Paint(); // BitmapShader shader = // new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); // if (width != 0 || height != 0) { // // source isn't square, move viewport to center // Matrix matrix = new Matrix(); // matrix.setTranslate(-width, -height); // shader.setLocalMatrix(matrix); // } // paint.setShader(shader); // paint.setAntiAlias(true); // // float r = size / 2f; // canvas.drawCircle(r, r, r, paint); // // return bitmap; // } // // @Override // public String getId() { // return getClass().getName(); // } // }
import android.content.Context; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.joker.fourfun.widget.GlideCircleTransform;
package com.joker.fourfun.utils; /** * Created by joker on 2016/12/6. */ public class GlideUtil { // 磁盘缓存图片所有大小,centerCrop 大小 public static void setImage(Context context, String imageUrl, ImageView targetView) { Glide.with(context) .load(imageUrl) .diskCacheStrategy(DiskCacheStrategy.ALL) // .thumbnail(0.5f) .centerCrop() .into(targetView); } //圆形 ImageView public static void setCirCleImage(Context context, String imageUrl, ImageView targetView) { Glide.with(context) .load(imageUrl)
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/widget/GlideCircleTransform.java // public class GlideCircleTransform extends BitmapTransformation { // public GlideCircleTransform(Context context) { // super(context); // } // // public GlideCircleTransform(BitmapPool bitmapPool) { // super(bitmapPool); // } // // @Override // protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) { // return circleCrop(pool, toTransform); // } // // private Bitmap circleCrop(BitmapPool pool, Bitmap source) { // // int size = Math.min(source.getWidth(), source.getHeight()); // // int width = (source.getWidth() - size) / 2; // int height = (source.getHeight() - size) / 2; // // Bitmap bitmap = pool.get(size, size, Bitmap.Config.ARGB_8888); // if (bitmap == null) { // bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888); // } // // Canvas canvas = new Canvas(bitmap); // Paint paint = new Paint(); // BitmapShader shader = // new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP); // if (width != 0 || height != 0) { // // source isn't square, move viewport to center // Matrix matrix = new Matrix(); // matrix.setTranslate(-width, -height); // shader.setLocalMatrix(matrix); // } // paint.setShader(shader); // paint.setAntiAlias(true); // // float r = size / 2f; // canvas.drawCircle(r, r, r, paint); // // return bitmap; // } // // @Override // public String getId() { // return getClass().getName(); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/GlideUtil.java import android.content.Context; import android.widget.ImageView; import com.bumptech.glide.Glide; import com.bumptech.glide.load.engine.DiskCacheStrategy; import com.joker.fourfun.widget.GlideCircleTransform; package com.joker.fourfun.utils; /** * Created by joker on 2016/12/6. */ public class GlideUtil { // 磁盘缓存图片所有大小,centerCrop 大小 public static void setImage(Context context, String imageUrl, ImageView targetView) { Glide.with(context) .load(imageUrl) .diskCacheStrategy(DiskCacheStrategy.ALL) // .thumbnail(0.5f) .centerCrop() .into(targetView); } //圆形 ImageView public static void setCirCleImage(Context context, String imageUrl, ImageView targetView) { Glide.with(context) .load(imageUrl)
.transform(new GlideCircleTransform(context))
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/view/VerticalTextView.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/SystemUtil.java // public class SystemUtil { // public static final String RUNNING_FONT = "running_font.ttf"; // private static Toast mToast; // // private SystemUtil() { // } // // /** // * 网络是否连接 // * // * @return // */ // public static boolean isNetworkConnected() { // ConnectivityManager connectivityManager = (ConnectivityManager) FourFun.getInstance() // .getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); // return connectivityManager.getActiveNetworkInfo() != null; // } // // /** // * 获取项目缓存路径 // * @return // */ // public static String getCacheFileDirPath() { // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getPath()); // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getAbsolutePath()); // return FourFun.getInstance().getApplicationContext().getCacheDir().getPath(); // } // // /** // * toast 优化显示 // * // * @param content // */ // public static void showToast(Context context, String content) { // if (mToast == null) { // mToast = Toast.makeText(FourFun.getInstance().getContext(), content, Toast // .LENGTH_SHORT); // } else { // mToast.setText(content); // } // // mToast.show(); // } // // /** // * 取消 toast // */ // public static void cancelToast() { // if (mToast != null) { // mToast.cancel(); // } // } // // /** // * 前几天的日期 // * // * @param before 和今天相差的天数 // * @return // */ // public static String beforeToday(int before) { // Date now = new Date(); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); //设置时间格式 // // if (before < 0) { // Calendar calendar = Calendar.getInstance(); // calendar.setTime(now); // calendar.add(Calendar.DATE, before); // now = calendar.getTime(); // } // // return sdf.format(now); // } // // /** // * 像素转 sp // * // * @param context // * @param textSizePixel // * @return // */ // public static int px2sp(Context context, float textSizePixel) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizePixel / fontScale + 0.5f); // } // // /** // * sp 转 px // * // * @param context // * @param textSizeSp // * @return // */ // public static float sp2px(Context context, float textSizeSp) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizeSp * fontScale + 0.5f); // } // // /** // * dp 转 px // * // * @param dp // * @return // */ // public static int dp2px(float dp) { // float DENSITY = Resources.getSystem().getDisplayMetrics().density; // return Math.round(dp * DENSITY); // } // // public static Typeface getTypeface(Context context) { // return Typeface.createFromAsset(context.getAssets(), "fonts/" + RUNNING_FONT); // } // // /** // * 输入流转文件 // * @param file // * @param stream // */ // public static void inputStream2file(File file, InputStream stream) { // OutputStream os = null; // try { // os = new FileOutputStream(file); // int bytesRead = 0; // byte[] buffer = new byte[1024]; // while ((bytesRead = stream.read(buffer)) != -1) { // os.write(buffer, 0, bytesRead); // } // // os.close(); // stream.close(); // } catch (IOException e) { // e.printStackTrace(); // } finally { // try { // if (os != null) { // os.close(); // } // if (stream != null) { // stream.close(); // } // } catch (IOException e) { // e.printStackTrace(); // } // } // } // }
import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; import com.joker.fourfun.R; import com.joker.fourfun.utils.SystemUtil;
private int mFontHeight = 0; private float mFontSize = 24; private int mLineWidth = 0; private int textLength = 0; private String text = ""; public VerticalTextView(Context context) { this(context, null); } public VerticalTextView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public VerticalTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initWith(context, attrs); } private void initWith(Context context, AttributeSet attrs) { paint = new Paint(); paint.setTextAlign(Paint.Align.CENTER); paint.setAntiAlias(true); paint.setColor(Color.BLACK); TypedArray typedArray = context.getTheme() .obtainStyledAttributes(attrs, R.styleable.VerticalTextView, 0, 0); try { float textSizePixel = typedArray.getDimension( R.styleable.VerticalTextView_rowTextSize, getResources().getDimension(R.dimen.vertical_text_view_normal_text_size));
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/SystemUtil.java // public class SystemUtil { // public static final String RUNNING_FONT = "running_font.ttf"; // private static Toast mToast; // // private SystemUtil() { // } // // /** // * 网络是否连接 // * // * @return // */ // public static boolean isNetworkConnected() { // ConnectivityManager connectivityManager = (ConnectivityManager) FourFun.getInstance() // .getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); // return connectivityManager.getActiveNetworkInfo() != null; // } // // /** // * 获取项目缓存路径 // * @return // */ // public static String getCacheFileDirPath() { // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getPath()); // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getAbsolutePath()); // return FourFun.getInstance().getApplicationContext().getCacheDir().getPath(); // } // // /** // * toast 优化显示 // * // * @param content // */ // public static void showToast(Context context, String content) { // if (mToast == null) { // mToast = Toast.makeText(FourFun.getInstance().getContext(), content, Toast // .LENGTH_SHORT); // } else { // mToast.setText(content); // } // // mToast.show(); // } // // /** // * 取消 toast // */ // public static void cancelToast() { // if (mToast != null) { // mToast.cancel(); // } // } // // /** // * 前几天的日期 // * // * @param before 和今天相差的天数 // * @return // */ // public static String beforeToday(int before) { // Date now = new Date(); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); //设置时间格式 // // if (before < 0) { // Calendar calendar = Calendar.getInstance(); // calendar.setTime(now); // calendar.add(Calendar.DATE, before); // now = calendar.getTime(); // } // // return sdf.format(now); // } // // /** // * 像素转 sp // * // * @param context // * @param textSizePixel // * @return // */ // public static int px2sp(Context context, float textSizePixel) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizePixel / fontScale + 0.5f); // } // // /** // * sp 转 px // * // * @param context // * @param textSizeSp // * @return // */ // public static float sp2px(Context context, float textSizeSp) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizeSp * fontScale + 0.5f); // } // // /** // * dp 转 px // * // * @param dp // * @return // */ // public static int dp2px(float dp) { // float DENSITY = Resources.getSystem().getDisplayMetrics().density; // return Math.round(dp * DENSITY); // } // // public static Typeface getTypeface(Context context) { // return Typeface.createFromAsset(context.getAssets(), "fonts/" + RUNNING_FONT); // } // // /** // * 输入流转文件 // * @param file // * @param stream // */ // public static void inputStream2file(File file, InputStream stream) { // OutputStream os = null; // try { // os = new FileOutputStream(file); // int bytesRead = 0; // byte[] buffer = new byte[1024]; // while ((bytesRead = stream.read(buffer)) != -1) { // os.write(buffer, 0, bytesRead); // } // // os.close(); // stream.close(); // } catch (IOException e) { // e.printStackTrace(); // } finally { // try { // if (os != null) { // os.close(); // } // if (stream != null) { // stream.close(); // } // } catch (IOException e) { // e.printStackTrace(); // } // } // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/view/VerticalTextView.java import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Typeface; import android.util.AttributeSet; import android.view.View; import com.joker.fourfun.R; import com.joker.fourfun.utils.SystemUtil; private int mFontHeight = 0; private float mFontSize = 24; private int mLineWidth = 0; private int textLength = 0; private String text = ""; public VerticalTextView(Context context) { this(context, null); } public VerticalTextView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public VerticalTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); initWith(context, attrs); } private void initWith(Context context, AttributeSet attrs) { paint = new Paint(); paint.setTextAlign(Paint.Align.CENTER); paint.setAntiAlias(true); paint.setColor(Color.BLACK); TypedArray typedArray = context.getTheme() .obtainStyledAttributes(attrs, R.styleable.VerticalTextView, 0, 0); try { float textSizePixel = typedArray.getDimension( R.styleable.VerticalTextView_rowTextSize, getResources().getDimension(R.dimen.vertical_text_view_normal_text_size));
int textSizeSp = SystemUtil.px2sp(context, textSizePixel);
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/utils/RetrofitUtil.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // }
import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import com.joker.fourfun.BuildConfig; import com.joker.fourfun.FourFun; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import okhttp3.Cache; import okhttp3.CacheControl; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory;
if (!SystemUtil.isNetworkConnected()) { request = request.newBuilder() .cacheControl(CacheControl.FORCE_CACHE) .build(); } Response response = chain.proceed(request); if (SystemUtil.isNetworkConnected()) { int maxAge = 0; // 有网络时, 不缓存, 最大保存时长为0 response.newBuilder() .header("Cache-Control", "public, max-age=" + maxAge) .removeHeader("Pragma") .build(); } else { // 无网络时,设置超时为4周 int maxStale = 60 * 60 * 24 * 28; response.newBuilder() .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) .removeHeader("Pragma") .build(); } return response; } }; if (BuildConfig.DEBUG) { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); builder.addInterceptor(interceptor); }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/RetrofitUtil.java import com.jakewharton.retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import com.joker.fourfun.BuildConfig; import com.joker.fourfun.FourFun; import java.io.File; import java.io.IOException; import java.util.concurrent.TimeUnit; import okhttp3.Cache; import okhttp3.CacheControl; import okhttp3.Interceptor; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; import okhttp3.logging.HttpLoggingInterceptor; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; if (!SystemUtil.isNetworkConnected()) { request = request.newBuilder() .cacheControl(CacheControl.FORCE_CACHE) .build(); } Response response = chain.proceed(request); if (SystemUtil.isNetworkConnected()) { int maxAge = 0; // 有网络时, 不缓存, 最大保存时长为0 response.newBuilder() .header("Cache-Control", "public, max-age=" + maxAge) .removeHeader("Pragma") .build(); } else { // 无网络时,设置超时为4周 int maxStale = 60 * 60 * 24 * 28; response.newBuilder() .header("Cache-Control", "public, only-if-cached, max-stale=" + maxStale) .removeHeader("Pragma") .build(); } return response; } }; if (BuildConfig.DEBUG) { HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor(); interceptor.setLevel(HttpLoggingInterceptor.Level.BODY); builder.addInterceptor(interceptor); }
File cacheFile = new File(FourFun.getInstance().getCacheDir().getPath());
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/utils/PreferenceUtil.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // }
import android.app.Activity; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import com.joker.fourfun.FourFun; import static android.content.Context.MODE_PRIVATE;
package com.joker.fourfun.utils; /** * Created by joker on 2017/1/4. */ public class PreferenceUtil { public static final String DEFAULT_PREFERENCES_FILE = "fourfun"; public static SharedPreferences getSp() {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/PreferenceUtil.java import android.app.Activity; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import com.joker.fourfun.FourFun; import static android.content.Context.MODE_PRIVATE; package com.joker.fourfun.utils; /** * Created by joker on 2017/1/4. */ public class PreferenceUtil { public static final String DEFAULT_PREFERENCES_FILE = "fourfun"; public static SharedPreferences getSp() {
return FourFun.getInstance().getContext().getSharedPreferences
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/login/LoginState.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/login/contract/UserState.java // public interface UserState { // // 收藏 // void collect(Context context); // // // 投稿 // void submit(Context context); // // // 个人中心 // void personCenter(Context context); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/SystemUtil.java // public class SystemUtil { // public static final String RUNNING_FONT = "running_font.ttf"; // private static Toast mToast; // // private SystemUtil() { // } // // /** // * 网络是否连接 // * // * @return // */ // public static boolean isNetworkConnected() { // ConnectivityManager connectivityManager = (ConnectivityManager) FourFun.getInstance() // .getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); // return connectivityManager.getActiveNetworkInfo() != null; // } // // /** // * 获取项目缓存路径 // * @return // */ // public static String getCacheFileDirPath() { // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getPath()); // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getAbsolutePath()); // return FourFun.getInstance().getApplicationContext().getCacheDir().getPath(); // } // // /** // * toast 优化显示 // * // * @param content // */ // public static void showToast(Context context, String content) { // if (mToast == null) { // mToast = Toast.makeText(FourFun.getInstance().getContext(), content, Toast // .LENGTH_SHORT); // } else { // mToast.setText(content); // } // // mToast.show(); // } // // /** // * 取消 toast // */ // public static void cancelToast() { // if (mToast != null) { // mToast.cancel(); // } // } // // /** // * 前几天的日期 // * // * @param before 和今天相差的天数 // * @return // */ // public static String beforeToday(int before) { // Date now = new Date(); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); //设置时间格式 // // if (before < 0) { // Calendar calendar = Calendar.getInstance(); // calendar.setTime(now); // calendar.add(Calendar.DATE, before); // now = calendar.getTime(); // } // // return sdf.format(now); // } // // /** // * 像素转 sp // * // * @param context // * @param textSizePixel // * @return // */ // public static int px2sp(Context context, float textSizePixel) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizePixel / fontScale + 0.5f); // } // // /** // * sp 转 px // * // * @param context // * @param textSizeSp // * @return // */ // public static float sp2px(Context context, float textSizeSp) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizeSp * fontScale + 0.5f); // } // // /** // * dp 转 px // * // * @param dp // * @return // */ // public static int dp2px(float dp) { // float DENSITY = Resources.getSystem().getDisplayMetrics().density; // return Math.round(dp * DENSITY); // } // // public static Typeface getTypeface(Context context) { // return Typeface.createFromAsset(context.getAssets(), "fonts/" + RUNNING_FONT); // } // // /** // * 输入流转文件 // * @param file // * @param stream // */ // public static void inputStream2file(File file, InputStream stream) { // OutputStream os = null; // try { // os = new FileOutputStream(file); // int bytesRead = 0; // byte[] buffer = new byte[1024]; // while ((bytesRead = stream.read(buffer)) != -1) { // os.write(buffer, 0, bytesRead); // } // // os.close(); // stream.close(); // } catch (IOException e) { // e.printStackTrace(); // } finally { // try { // if (os != null) { // os.close(); // } // if (stream != null) { // stream.close(); // } // } catch (IOException e) { // e.printStackTrace(); // } // } // } // }
import android.content.Context; import com.joker.fourfun.login.contract.UserState; import com.joker.fourfun.utils.SystemUtil;
package com.joker.fourfun.login; /** * Created by joker on 2016/12/31. */ public class LoginState implements UserState { @Override public void collect(Context context) {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/login/contract/UserState.java // public interface UserState { // // 收藏 // void collect(Context context); // // // 投稿 // void submit(Context context); // // // 个人中心 // void personCenter(Context context); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/SystemUtil.java // public class SystemUtil { // public static final String RUNNING_FONT = "running_font.ttf"; // private static Toast mToast; // // private SystemUtil() { // } // // /** // * 网络是否连接 // * // * @return // */ // public static boolean isNetworkConnected() { // ConnectivityManager connectivityManager = (ConnectivityManager) FourFun.getInstance() // .getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); // return connectivityManager.getActiveNetworkInfo() != null; // } // // /** // * 获取项目缓存路径 // * @return // */ // public static String getCacheFileDirPath() { // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getPath()); // Logger.e(FourFun.getInstance().getApplicationContext().getCacheDir().getAbsolutePath()); // return FourFun.getInstance().getApplicationContext().getCacheDir().getPath(); // } // // /** // * toast 优化显示 // * // * @param content // */ // public static void showToast(Context context, String content) { // if (mToast == null) { // mToast = Toast.makeText(FourFun.getInstance().getContext(), content, Toast // .LENGTH_SHORT); // } else { // mToast.setText(content); // } // // mToast.show(); // } // // /** // * 取消 toast // */ // public static void cancelToast() { // if (mToast != null) { // mToast.cancel(); // } // } // // /** // * 前几天的日期 // * // * @param before 和今天相差的天数 // * @return // */ // public static String beforeToday(int before) { // Date now = new Date(); // SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA); //设置时间格式 // // if (before < 0) { // Calendar calendar = Calendar.getInstance(); // calendar.setTime(now); // calendar.add(Calendar.DATE, before); // now = calendar.getTime(); // } // // return sdf.format(now); // } // // /** // * 像素转 sp // * // * @param context // * @param textSizePixel // * @return // */ // public static int px2sp(Context context, float textSizePixel) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizePixel / fontScale + 0.5f); // } // // /** // * sp 转 px // * // * @param context // * @param textSizeSp // * @return // */ // public static float sp2px(Context context, float textSizeSp) { // final float fontScale = context.getResources().getDisplayMetrics().scaledDensity; // return (int) (textSizeSp * fontScale + 0.5f); // } // // /** // * dp 转 px // * // * @param dp // * @return // */ // public static int dp2px(float dp) { // float DENSITY = Resources.getSystem().getDisplayMetrics().density; // return Math.round(dp * DENSITY); // } // // public static Typeface getTypeface(Context context) { // return Typeface.createFromAsset(context.getAssets(), "fonts/" + RUNNING_FONT); // } // // /** // * 输入流转文件 // * @param file // * @param stream // */ // public static void inputStream2file(File file, InputStream stream) { // OutputStream os = null; // try { // os = new FileOutputStream(file); // int bytesRead = 0; // byte[] buffer = new byte[1024]; // while ((bytesRead = stream.read(buffer)) != -1) { // os.write(buffer, 0, bytesRead); // } // // os.close(); // stream.close(); // } catch (IOException e) { // e.printStackTrace(); // } finally { // try { // if (os != null) { // os.close(); // } // if (stream != null) { // stream.close(); // } // } catch (IOException e) { // e.printStackTrace(); // } // } // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/login/LoginState.java import android.content.Context; import com.joker.fourfun.login.contract.UserState; import com.joker.fourfun.utils.SystemUtil; package com.joker.fourfun.login; /** * Created by joker on 2016/12/31. */ public class LoginState implements UserState { @Override public void collect(Context context) {
SystemUtil.showToast(context, "已经登录,可以使用该功能");
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/utils/SystemUtil.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // }
import android.content.Context; import android.content.res.Resources; import android.graphics.Typeface; import android.net.ConnectivityManager; import android.widget.Toast; import com.joker.fourfun.FourFun; import com.orhanobut.logger.Logger; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale;
package com.joker.fourfun.utils; /** * Created by joker on 2016/11/27. */ public class SystemUtil { public static final String RUNNING_FONT = "running_font.ttf"; private static Toast mToast; private SystemUtil() { } /** * 网络是否连接 * * @return */ public static boolean isNetworkConnected() {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/FourFun.java // public class FourFun extends Application { // private static FourFun instance; // // public static FourFun getInstance() { // return instance; // } // // @Override // public void onCreate() { // super.onCreate(); // instance = this; // if (LeakCanary.isInAnalyzerProcess(this)) { // return; // } // LeakCanary.install(this); // } // // public Context getContext() { // return instance.getApplicationContext(); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/utils/SystemUtil.java import android.content.Context; import android.content.res.Resources; import android.graphics.Typeface; import android.net.ConnectivityManager; import android.widget.Toast; import com.joker.fourfun.FourFun; import com.orhanobut.logger.Logger; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import java.util.Locale; package com.joker.fourfun.utils; /** * Created by joker on 2016/11/27. */ public class SystemUtil { public static final String RUNNING_FONT = "running_font.ttf"; private static Toast mToast; private SystemUtil() { } /** * 网络是否连接 * * @return */ public static boolean isNetworkConnected() {
ConnectivityManager connectivityManager = (ConnectivityManager) FourFun.getInstance()
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/PictureChildContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/Picture.java // public class Picture implements Parcelable { // /** // * result : [{"picUrl":"/uploads/160903/161128/1-16112Q62024415.jpg","picDate":"27 Nov 2016 ", // * "pubTime":"发布时间:2016-11-28 16:08","authorWork":"Grand-Central-Terminal", // * "picDescription":"等待中有欢乐,有焦虑,有\u201c无可奈何\u201d与\u201c迫不及待\u201d,等待中包含人间百味。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622162Y20.jpg","picDate":"26 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:16","authorWork":"路过德黑兰", // * "picDescription // * ":"很多时候,人们内心所认为的可能并不是事实的真相,但还是宁愿去按照自己的思维逻辑来认识这个世界,认识自己的生活,到最后,可能我们就是带着这份误解,过完了此生。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622154TC.jpg","picDate":"25 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:15","authorWork":"探索", // * "picDescription":"一流的情人永远不必殉陨,永远不会失恋,因为\u201c我爱你,与你何涉\u201d。"}] // * error : false // */ // public static final Creator<Picture> CREATOR = new Creator<Picture>() { // @Override // public Picture createFromParcel(Parcel source) { // return new Picture(source); // } // // @Override // public Picture[] newArray(int size) { // return new Picture[size]; // } // }; // /** // * picUrl : /uploads/160903/161128/1-16112Q62024415.jpg // * picDate : 27 Nov 2016 // * VOL:VOL.1514 // * pubTime : 发布时间:2016-11-28 16:08 // * authorWork : Grand-Central-Terminal // * picDescription : 等待中有欢乐,有焦虑,有“无可奈何”与“迫不及待”,等待中包含人间百味。 // */ // // private String VOL; // private String picUrl; // private String picDate; // private String pubTime; // private String authorWork; // private String picDescription; // // public Picture() { // } // // protected Picture(Parcel in) { // this.VOL = in.readString(); // this.picUrl = in.readString(); // this.picDate = in.readString(); // this.pubTime = in.readString(); // this.authorWork = in.readString(); // this.picDescription = in.readString(); // } // // public String getVOL() { // return VOL; // } // // public void setVOL(String VOL) { // this.VOL = VOL; // } // // public String getPicUrl() { // return picUrl; // } // // public void setPicUrl(String picUrl) { // this.picUrl = picUrl; // } // // public String getPicDate() { // return picDate; // } // // public void setPicDate(String picDate) { // this.picDate = picDate; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getAuthorWork() { // return authorWork; // } // // public void setAuthorWork(String authorWork) { // this.authorWork = authorWork; // } // // public String getPicDescription() { // return picDescription; // } // // public void setPicDescription(String picDescription) { // this.picDescription = picDescription; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.VOL); // dest.writeString(this.picUrl); // dest.writeString(this.picDate); // dest.writeString(this.pubTime); // dest.writeString(this.authorWork); // dest.writeString(this.picDescription); // } // }
import android.os.Bundle; import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.Picture;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/1. */ public interface PictureChildContract { interface View extends BaseView {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/Picture.java // public class Picture implements Parcelable { // /** // * result : [{"picUrl":"/uploads/160903/161128/1-16112Q62024415.jpg","picDate":"27 Nov 2016 ", // * "pubTime":"发布时间:2016-11-28 16:08","authorWork":"Grand-Central-Terminal", // * "picDescription":"等待中有欢乐,有焦虑,有\u201c无可奈何\u201d与\u201c迫不及待\u201d,等待中包含人间百味。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622162Y20.jpg","picDate":"26 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:16","authorWork":"路过德黑兰", // * "picDescription // * ":"很多时候,人们内心所认为的可能并不是事实的真相,但还是宁愿去按照自己的思维逻辑来认识这个世界,认识自己的生活,到最后,可能我们就是带着这份误解,过完了此生。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622154TC.jpg","picDate":"25 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:15","authorWork":"探索", // * "picDescription":"一流的情人永远不必殉陨,永远不会失恋,因为\u201c我爱你,与你何涉\u201d。"}] // * error : false // */ // public static final Creator<Picture> CREATOR = new Creator<Picture>() { // @Override // public Picture createFromParcel(Parcel source) { // return new Picture(source); // } // // @Override // public Picture[] newArray(int size) { // return new Picture[size]; // } // }; // /** // * picUrl : /uploads/160903/161128/1-16112Q62024415.jpg // * picDate : 27 Nov 2016 // * VOL:VOL.1514 // * pubTime : 发布时间:2016-11-28 16:08 // * authorWork : Grand-Central-Terminal // * picDescription : 等待中有欢乐,有焦虑,有“无可奈何”与“迫不及待”,等待中包含人间百味。 // */ // // private String VOL; // private String picUrl; // private String picDate; // private String pubTime; // private String authorWork; // private String picDescription; // // public Picture() { // } // // protected Picture(Parcel in) { // this.VOL = in.readString(); // this.picUrl = in.readString(); // this.picDate = in.readString(); // this.pubTime = in.readString(); // this.authorWork = in.readString(); // this.picDescription = in.readString(); // } // // public String getVOL() { // return VOL; // } // // public void setVOL(String VOL) { // this.VOL = VOL; // } // // public String getPicUrl() { // return picUrl; // } // // public void setPicUrl(String picUrl) { // this.picUrl = picUrl; // } // // public String getPicDate() { // return picDate; // } // // public void setPicDate(String picDate) { // this.picDate = picDate; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getAuthorWork() { // return authorWork; // } // // public void setAuthorWork(String authorWork) { // this.authorWork = authorWork; // } // // public String getPicDescription() { // return picDescription; // } // // public void setPicDescription(String picDescription) { // this.picDescription = picDescription; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.VOL); // dest.writeString(this.picUrl); // dest.writeString(this.picDate); // dest.writeString(this.pubTime); // dest.writeString(this.authorWork); // dest.writeString(this.picDescription); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/PictureChildContract.java import android.os.Bundle; import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.Picture; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/1. */ public interface PictureChildContract { interface View extends BaseView {
void showContent(Picture picture);
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/PictureChildContract.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/Picture.java // public class Picture implements Parcelable { // /** // * result : [{"picUrl":"/uploads/160903/161128/1-16112Q62024415.jpg","picDate":"27 Nov 2016 ", // * "pubTime":"发布时间:2016-11-28 16:08","authorWork":"Grand-Central-Terminal", // * "picDescription":"等待中有欢乐,有焦虑,有\u201c无可奈何\u201d与\u201c迫不及待\u201d,等待中包含人间百味。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622162Y20.jpg","picDate":"26 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:16","authorWork":"路过德黑兰", // * "picDescription // * ":"很多时候,人们内心所认为的可能并不是事实的真相,但还是宁愿去按照自己的思维逻辑来认识这个世界,认识自己的生活,到最后,可能我们就是带着这份误解,过完了此生。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622154TC.jpg","picDate":"25 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:15","authorWork":"探索", // * "picDescription":"一流的情人永远不必殉陨,永远不会失恋,因为\u201c我爱你,与你何涉\u201d。"}] // * error : false // */ // public static final Creator<Picture> CREATOR = new Creator<Picture>() { // @Override // public Picture createFromParcel(Parcel source) { // return new Picture(source); // } // // @Override // public Picture[] newArray(int size) { // return new Picture[size]; // } // }; // /** // * picUrl : /uploads/160903/161128/1-16112Q62024415.jpg // * picDate : 27 Nov 2016 // * VOL:VOL.1514 // * pubTime : 发布时间:2016-11-28 16:08 // * authorWork : Grand-Central-Terminal // * picDescription : 等待中有欢乐,有焦虑,有“无可奈何”与“迫不及待”,等待中包含人间百味。 // */ // // private String VOL; // private String picUrl; // private String picDate; // private String pubTime; // private String authorWork; // private String picDescription; // // public Picture() { // } // // protected Picture(Parcel in) { // this.VOL = in.readString(); // this.picUrl = in.readString(); // this.picDate = in.readString(); // this.pubTime = in.readString(); // this.authorWork = in.readString(); // this.picDescription = in.readString(); // } // // public String getVOL() { // return VOL; // } // // public void setVOL(String VOL) { // this.VOL = VOL; // } // // public String getPicUrl() { // return picUrl; // } // // public void setPicUrl(String picUrl) { // this.picUrl = picUrl; // } // // public String getPicDate() { // return picDate; // } // // public void setPicDate(String picDate) { // this.picDate = picDate; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getAuthorWork() { // return authorWork; // } // // public void setAuthorWork(String authorWork) { // this.authorWork = authorWork; // } // // public String getPicDescription() { // return picDescription; // } // // public void setPicDescription(String picDescription) { // this.picDescription = picDescription; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.VOL); // dest.writeString(this.picUrl); // dest.writeString(this.picDate); // dest.writeString(this.pubTime); // dest.writeString(this.authorWork); // dest.writeString(this.picDescription); // } // }
import android.os.Bundle; import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.Picture;
package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/1. */ public interface PictureChildContract { interface View extends BaseView { void showContent(Picture picture); }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BasePresenter.java // public interface BasePresenter<T extends BaseView> { // void attach(T mView); // // void detach(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseView.java // public interface BaseView { // void showError(String message); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/model/Picture.java // public class Picture implements Parcelable { // /** // * result : [{"picUrl":"/uploads/160903/161128/1-16112Q62024415.jpg","picDate":"27 Nov 2016 ", // * "pubTime":"发布时间:2016-11-28 16:08","authorWork":"Grand-Central-Terminal", // * "picDescription":"等待中有欢乐,有焦虑,有\u201c无可奈何\u201d与\u201c迫不及待\u201d,等待中包含人间百味。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622162Y20.jpg","picDate":"26 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:16","authorWork":"路过德黑兰", // * "picDescription // * ":"很多时候,人们内心所认为的可能并不是事实的真相,但还是宁愿去按照自己的思维逻辑来认识这个世界,认识自己的生活,到最后,可能我们就是带着这份误解,过完了此生。"}, // * {"picUrl":"/uploads/150129/161126/1-16112622154TC.jpg","picDate":"25 Nov 2016 ", // * "pubTime":"发布时间:2016-11-26 22:15","authorWork":"探索", // * "picDescription":"一流的情人永远不必殉陨,永远不会失恋,因为\u201c我爱你,与你何涉\u201d。"}] // * error : false // */ // public static final Creator<Picture> CREATOR = new Creator<Picture>() { // @Override // public Picture createFromParcel(Parcel source) { // return new Picture(source); // } // // @Override // public Picture[] newArray(int size) { // return new Picture[size]; // } // }; // /** // * picUrl : /uploads/160903/161128/1-16112Q62024415.jpg // * picDate : 27 Nov 2016 // * VOL:VOL.1514 // * pubTime : 发布时间:2016-11-28 16:08 // * authorWork : Grand-Central-Terminal // * picDescription : 等待中有欢乐,有焦虑,有“无可奈何”与“迫不及待”,等待中包含人间百味。 // */ // // private String VOL; // private String picUrl; // private String picDate; // private String pubTime; // private String authorWork; // private String picDescription; // // public Picture() { // } // // protected Picture(Parcel in) { // this.VOL = in.readString(); // this.picUrl = in.readString(); // this.picDate = in.readString(); // this.pubTime = in.readString(); // this.authorWork = in.readString(); // this.picDescription = in.readString(); // } // // public String getVOL() { // return VOL; // } // // public void setVOL(String VOL) { // this.VOL = VOL; // } // // public String getPicUrl() { // return picUrl; // } // // public void setPicUrl(String picUrl) { // this.picUrl = picUrl; // } // // public String getPicDate() { // return picDate; // } // // public void setPicDate(String picDate) { // this.picDate = picDate; // } // // public String getPubTime() { // return pubTime; // } // // public void setPubTime(String pubTime) { // this.pubTime = pubTime; // } // // public String getAuthorWork() { // return authorWork; // } // // public void setAuthorWork(String authorWork) { // this.authorWork = authorWork; // } // // public String getPicDescription() { // return picDescription; // } // // public void setPicDescription(String picDescription) { // this.picDescription = picDescription; // } // // @Override // public int describeContents() { // return 0; // } // // @Override // public void writeToParcel(Parcel dest, int flags) { // dest.writeString(this.VOL); // dest.writeString(this.picUrl); // dest.writeString(this.picDate); // dest.writeString(this.pubTime); // dest.writeString(this.authorWork); // dest.writeString(this.picDescription); // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/presenter/contract/PictureChildContract.java import android.os.Bundle; import com.joker.fourfun.base.BasePresenter; import com.joker.fourfun.base.BaseView; import com.joker.fourfun.model.Picture; package com.joker.fourfun.presenter.contract; /** * Created by joker on 2016/12/1. */ public interface PictureChildContract { interface View extends BaseView { void showContent(Picture picture); }
interface Presenter extends BasePresenter<View> {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseMvpFragment.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/AppComponent.java // @Singleton // @Component(modules = AppModule.class) // public abstract class AppComponent { // private static AppComponent mComponent; // // public static AppComponent getInstance() { // if (mComponent == null) { // synchronized (AppComponent.class) { // if (mComponent == null) { // mComponent = DaggerAppComponent.builder().appModule(new AppModule(FourFun.getInstance // ())).build(); // } // } // } // // return mComponent; // } // // public abstract FourFun fourFun(); // // public abstract RetrofitUtil retrofitUtil(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/FragmentComponent.java // @PerFragment // @Component(dependencies = AppComponent.class, modules = FragmentModule.class) // public interface FragmentComponent { // SupportFragment fragment(); // // void inject(ReadFragment fragment); // // void inject(PictureFragment fragment); // // void inject(PictureChildFragment fragment); // // void inject(MediaFragment fragment); // // void inject(MineFragment fragment); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/FragmentModule.java // @Module // public class FragmentModule { // private SupportFragment mFragment; // // public FragmentModule(SupportFragment fragment) { // mFragment = fragment; // } // // @Provides // @PerFragment // SupportFragment provideSupportFragment() { // return mFragment; // } // }
import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.joker.fourfun.di.component.AppComponent; import com.joker.fourfun.di.component.DaggerFragmentComponent; import com.joker.fourfun.di.component.FragmentComponent; import com.joker.fourfun.di.module.FragmentModule; import javax.inject.Inject; import me.yokeyword.fragmentation.SupportActivity; import me.yokeyword.fragmentation.SupportFragment;
package com.joker.fourfun.base; public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends SupportFragment implements BaseView { @Inject protected T mPresenter; protected SupportActivity mActivity; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return createView(inflater, container, savedInstanceState); } protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override @SuppressWarnings("unchecked") public void onAttach(Activity activity) { super.onAttach(activity); initInject(); mActivity = _mActivity; mPresenter.attach((V) this); }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/AppComponent.java // @Singleton // @Component(modules = AppModule.class) // public abstract class AppComponent { // private static AppComponent mComponent; // // public static AppComponent getInstance() { // if (mComponent == null) { // synchronized (AppComponent.class) { // if (mComponent == null) { // mComponent = DaggerAppComponent.builder().appModule(new AppModule(FourFun.getInstance // ())).build(); // } // } // } // // return mComponent; // } // // public abstract FourFun fourFun(); // // public abstract RetrofitUtil retrofitUtil(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/FragmentComponent.java // @PerFragment // @Component(dependencies = AppComponent.class, modules = FragmentModule.class) // public interface FragmentComponent { // SupportFragment fragment(); // // void inject(ReadFragment fragment); // // void inject(PictureFragment fragment); // // void inject(PictureChildFragment fragment); // // void inject(MediaFragment fragment); // // void inject(MineFragment fragment); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/FragmentModule.java // @Module // public class FragmentModule { // private SupportFragment mFragment; // // public FragmentModule(SupportFragment fragment) { // mFragment = fragment; // } // // @Provides // @PerFragment // SupportFragment provideSupportFragment() { // return mFragment; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseMvpFragment.java import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.joker.fourfun.di.component.AppComponent; import com.joker.fourfun.di.component.DaggerFragmentComponent; import com.joker.fourfun.di.component.FragmentComponent; import com.joker.fourfun.di.module.FragmentModule; import javax.inject.Inject; import me.yokeyword.fragmentation.SupportActivity; import me.yokeyword.fragmentation.SupportFragment; package com.joker.fourfun.base; public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends SupportFragment implements BaseView { @Inject protected T mPresenter; protected SupportActivity mActivity; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return createView(inflater, container, savedInstanceState); } protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override @SuppressWarnings("unchecked") public void onAttach(Activity activity) { super.onAttach(activity); initInject(); mActivity = _mActivity; mPresenter.attach((V) this); }
protected FragmentComponent getComponent() {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseMvpFragment.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/AppComponent.java // @Singleton // @Component(modules = AppModule.class) // public abstract class AppComponent { // private static AppComponent mComponent; // // public static AppComponent getInstance() { // if (mComponent == null) { // synchronized (AppComponent.class) { // if (mComponent == null) { // mComponent = DaggerAppComponent.builder().appModule(new AppModule(FourFun.getInstance // ())).build(); // } // } // } // // return mComponent; // } // // public abstract FourFun fourFun(); // // public abstract RetrofitUtil retrofitUtil(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/FragmentComponent.java // @PerFragment // @Component(dependencies = AppComponent.class, modules = FragmentModule.class) // public interface FragmentComponent { // SupportFragment fragment(); // // void inject(ReadFragment fragment); // // void inject(PictureFragment fragment); // // void inject(PictureChildFragment fragment); // // void inject(MediaFragment fragment); // // void inject(MineFragment fragment); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/FragmentModule.java // @Module // public class FragmentModule { // private SupportFragment mFragment; // // public FragmentModule(SupportFragment fragment) { // mFragment = fragment; // } // // @Provides // @PerFragment // SupportFragment provideSupportFragment() { // return mFragment; // } // }
import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.joker.fourfun.di.component.AppComponent; import com.joker.fourfun.di.component.DaggerFragmentComponent; import com.joker.fourfun.di.component.FragmentComponent; import com.joker.fourfun.di.module.FragmentModule; import javax.inject.Inject; import me.yokeyword.fragmentation.SupportActivity; import me.yokeyword.fragmentation.SupportFragment;
package com.joker.fourfun.base; public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends SupportFragment implements BaseView { @Inject protected T mPresenter; protected SupportActivity mActivity; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return createView(inflater, container, savedInstanceState); } protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override @SuppressWarnings("unchecked") public void onAttach(Activity activity) { super.onAttach(activity); initInject(); mActivity = _mActivity; mPresenter.attach((V) this); } protected FragmentComponent getComponent() {
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/AppComponent.java // @Singleton // @Component(modules = AppModule.class) // public abstract class AppComponent { // private static AppComponent mComponent; // // public static AppComponent getInstance() { // if (mComponent == null) { // synchronized (AppComponent.class) { // if (mComponent == null) { // mComponent = DaggerAppComponent.builder().appModule(new AppModule(FourFun.getInstance // ())).build(); // } // } // } // // return mComponent; // } // // public abstract FourFun fourFun(); // // public abstract RetrofitUtil retrofitUtil(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/FragmentComponent.java // @PerFragment // @Component(dependencies = AppComponent.class, modules = FragmentModule.class) // public interface FragmentComponent { // SupportFragment fragment(); // // void inject(ReadFragment fragment); // // void inject(PictureFragment fragment); // // void inject(PictureChildFragment fragment); // // void inject(MediaFragment fragment); // // void inject(MineFragment fragment); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/FragmentModule.java // @Module // public class FragmentModule { // private SupportFragment mFragment; // // public FragmentModule(SupportFragment fragment) { // mFragment = fragment; // } // // @Provides // @PerFragment // SupportFragment provideSupportFragment() { // return mFragment; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseMvpFragment.java import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.joker.fourfun.di.component.AppComponent; import com.joker.fourfun.di.component.DaggerFragmentComponent; import com.joker.fourfun.di.component.FragmentComponent; import com.joker.fourfun.di.module.FragmentModule; import javax.inject.Inject; import me.yokeyword.fragmentation.SupportActivity; import me.yokeyword.fragmentation.SupportFragment; package com.joker.fourfun.base; public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends SupportFragment implements BaseView { @Inject protected T mPresenter; protected SupportActivity mActivity; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return createView(inflater, container, savedInstanceState); } protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override @SuppressWarnings("unchecked") public void onAttach(Activity activity) { super.onAttach(activity); initInject(); mActivity = _mActivity; mPresenter.attach((V) this); } protected FragmentComponent getComponent() {
return DaggerFragmentComponent.builder().appComponent(AppComponent.getInstance()).fragmentModule
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseMvpFragment.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/AppComponent.java // @Singleton // @Component(modules = AppModule.class) // public abstract class AppComponent { // private static AppComponent mComponent; // // public static AppComponent getInstance() { // if (mComponent == null) { // synchronized (AppComponent.class) { // if (mComponent == null) { // mComponent = DaggerAppComponent.builder().appModule(new AppModule(FourFun.getInstance // ())).build(); // } // } // } // // return mComponent; // } // // public abstract FourFun fourFun(); // // public abstract RetrofitUtil retrofitUtil(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/FragmentComponent.java // @PerFragment // @Component(dependencies = AppComponent.class, modules = FragmentModule.class) // public interface FragmentComponent { // SupportFragment fragment(); // // void inject(ReadFragment fragment); // // void inject(PictureFragment fragment); // // void inject(PictureChildFragment fragment); // // void inject(MediaFragment fragment); // // void inject(MineFragment fragment); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/FragmentModule.java // @Module // public class FragmentModule { // private SupportFragment mFragment; // // public FragmentModule(SupportFragment fragment) { // mFragment = fragment; // } // // @Provides // @PerFragment // SupportFragment provideSupportFragment() { // return mFragment; // } // }
import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.joker.fourfun.di.component.AppComponent; import com.joker.fourfun.di.component.DaggerFragmentComponent; import com.joker.fourfun.di.component.FragmentComponent; import com.joker.fourfun.di.module.FragmentModule; import javax.inject.Inject; import me.yokeyword.fragmentation.SupportActivity; import me.yokeyword.fragmentation.SupportFragment;
package com.joker.fourfun.base; public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends SupportFragment implements BaseView { @Inject protected T mPresenter; protected SupportActivity mActivity; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return createView(inflater, container, savedInstanceState); } protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override @SuppressWarnings("unchecked") public void onAttach(Activity activity) { super.onAttach(activity); initInject(); mActivity = _mActivity; mPresenter.attach((V) this); } protected FragmentComponent getComponent() { return DaggerFragmentComponent.builder().appComponent(AppComponent.getInstance()).fragmentModule (getModule()).build(); }
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/AppComponent.java // @Singleton // @Component(modules = AppModule.class) // public abstract class AppComponent { // private static AppComponent mComponent; // // public static AppComponent getInstance() { // if (mComponent == null) { // synchronized (AppComponent.class) { // if (mComponent == null) { // mComponent = DaggerAppComponent.builder().appModule(new AppModule(FourFun.getInstance // ())).build(); // } // } // } // // return mComponent; // } // // public abstract FourFun fourFun(); // // public abstract RetrofitUtil retrofitUtil(); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/component/FragmentComponent.java // @PerFragment // @Component(dependencies = AppComponent.class, modules = FragmentModule.class) // public interface FragmentComponent { // SupportFragment fragment(); // // void inject(ReadFragment fragment); // // void inject(PictureFragment fragment); // // void inject(PictureChildFragment fragment); // // void inject(MediaFragment fragment); // // void inject(MineFragment fragment); // } // // Path: client/FourFun/app/src/main/java/com/joker/fourfun/di/module/FragmentModule.java // @Module // public class FragmentModule { // private SupportFragment mFragment; // // public FragmentModule(SupportFragment fragment) { // mFragment = fragment; // } // // @Provides // @PerFragment // SupportFragment provideSupportFragment() { // return mFragment; // } // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/base/BaseMvpFragment.java import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.joker.fourfun.di.component.AppComponent; import com.joker.fourfun.di.component.DaggerFragmentComponent; import com.joker.fourfun.di.component.FragmentComponent; import com.joker.fourfun.di.module.FragmentModule; import javax.inject.Inject; import me.yokeyword.fragmentation.SupportActivity; import me.yokeyword.fragmentation.SupportFragment; package com.joker.fourfun.base; public abstract class BaseMvpFragment<V extends BaseView, T extends BaseMvpPresenter<V>> extends SupportFragment implements BaseView { @Inject protected T mPresenter; protected SupportActivity mActivity; @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { return createView(inflater, container, savedInstanceState); } protected abstract View createView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState); @Override @SuppressWarnings("unchecked") public void onAttach(Activity activity) { super.onAttach(activity); initInject(); mActivity = _mActivity; mPresenter.attach((V) this); } protected FragmentComponent getComponent() { return DaggerFragmentComponent.builder().appComponent(AppComponent.getInstance()).fragmentModule (getModule()).build(); }
protected FragmentModule getModule() {
4FunApp/4Fun
client/FourFun/app/src/main/java/com/joker/fourfun/login/LoginContext.java
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/login/contract/UserState.java // public interface UserState { // // 收藏 // void collect(Context context); // // // 投稿 // void submit(Context context); // // // 个人中心 // void personCenter(Context context); // }
import android.content.Context; import com.joker.fourfun.login.contract.UserState;
package com.joker.fourfun.login; /** * 全局单例获取登录状态 * Created by joker on 2016/12/31. */ public class LoginContext { private static LoginContext mLoginContext = null;
// Path: client/FourFun/app/src/main/java/com/joker/fourfun/login/contract/UserState.java // public interface UserState { // // 收藏 // void collect(Context context); // // // 投稿 // void submit(Context context); // // // 个人中心 // void personCenter(Context context); // } // Path: client/FourFun/app/src/main/java/com/joker/fourfun/login/LoginContext.java import android.content.Context; import com.joker.fourfun.login.contract.UserState; package com.joker.fourfun.login; /** * 全局单例获取登录状态 * Created by joker on 2016/12/31. */ public class LoginContext { private static LoginContext mLoginContext = null;
UserState mState = new LogoutState();
chenlichao-cn/wmi4j
src/test/java/org/wmi4j/SWbemObjectTest.java
// Path: src/test/java/config/Config.java // public class Config { // // private static final Logger logger = LoggerFactory.getLogger(Config.class); // // private static final Config instance = new Config(); // // private Properties prop = new Properties(); // private Config() { // logger.debug("Load test config."); // InputStream in = Config.class.getClassLoader().getResourceAsStream("TestConfig.properties"); // try { // prop.load(in); // } catch (IOException e) { // logger.error("Load test config failed.", e); // } // } // // public static String getServer() { // return instance.prop.getProperty("host.server"); // } // // public static String getUsername() { // return instance.prop.getProperty("host.username"); // } // // public static String getPassword() { // return instance.prop.getProperty("host.password"); // } // }
import cn.chenlichao.wmi4j.*; import config.Config; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import static org.junit.Assert.*;
/* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wmi4j; public class SWbemObjectTest { private static final Logger logger = LoggerFactory.getLogger(SWbemObjectTest.class); private static SWbemLocator locator; private static SWbemServices services; @BeforeClass public static void setUpClass() throws Exception {
// Path: src/test/java/config/Config.java // public class Config { // // private static final Logger logger = LoggerFactory.getLogger(Config.class); // // private static final Config instance = new Config(); // // private Properties prop = new Properties(); // private Config() { // logger.debug("Load test config."); // InputStream in = Config.class.getClassLoader().getResourceAsStream("TestConfig.properties"); // try { // prop.load(in); // } catch (IOException e) { // logger.error("Load test config failed.", e); // } // } // // public static String getServer() { // return instance.prop.getProperty("host.server"); // } // // public static String getUsername() { // return instance.prop.getProperty("host.username"); // } // // public static String getPassword() { // return instance.prop.getProperty("host.password"); // } // } // Path: src/test/java/org/wmi4j/SWbemObjectTest.java import cn.chenlichao.wmi4j.*; import config.Config; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import static org.junit.Assert.*; /* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.wmi4j; public class SWbemObjectTest { private static final Logger logger = LoggerFactory.getLogger(SWbemObjectTest.class); private static SWbemLocator locator; private static SWbemServices services; @BeforeClass public static void setUpClass() throws Exception {
locator = new SWbemLocator(Config.getServer(),Config.getUsername(), Config.getPassword(), "root\\cimv2");
chenlichao-cn/wmi4j
src/examples/service/ProcessManager.java
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemCimTypeEnum.java // public enum WbemCimTypeEnum { // /** 2(0x2): Signed 16-bit integer */ // Sint16(0x2), // /** 3(0x3): Signed 32-bit integer */ // Sint32(0x3), // /** 4(0x4): 32-bit real number */ // Real32(0x4), // /** 5(0x5): 64-bit real number */ // Real64(0x5), // /** 8(0x8): String */ // String(0x8), // /** 11(0xB): Boolean value*/ // Boolean(0xB), // /** 13(0xD): CIM object */ // Object(0xD), // /** 16(0x10): Signed 8-bit integer */ // Sint8(0x10), // /** 17(0x11): Unsigned 8-bit integer */ // Uint8(0x11), // /** 18(0x12): Unsigned 16-bit integer */ // Uint16(0x12), // /** 19(0x13): Unsigned 32-bit integer */ // Uint32(0x13), // /** 20(0x14): Signed 64-bit integer */ // Sint64(0x14), // /** 21(0x15): Unsigned 64-bit integer */ // Uint64(0x15), // /** 101(0x65): Date/time value */ // Datetime(0x65), // /** 102(0x66): Reference to a CIM object */ // Reference(0x66), // /** 103(0x67): 16-bit character */ // Char16(0x67); // // final private int value; // WbemCimTypeEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemCimTypeEnum parse(int value) { // for(WbemCimTypeEnum e : WbemCimTypeEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // }
import java.net.UnknownHostException; import cn.chenlichao.wmi4j.*; import cn.chenlichao.wmi4j.consts.WbemCimTypeEnum;
/* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package service; public class ProcessManager { private SWbemLocator locator; private SWbemServices wbemServices; public ProcessManager() throws UnknownHostException, WMIException { locator = new SWbemLocator("192.168.1.201","administrator","password","root\\cimv2"); wbemServices = locator.connectServer(); } void startNotepad() throws WMIException { SWbemObject startConfig = wbemServices.get("Win32_ProcessStartup").spawnInstance(); startConfig.getProperties().item("ShowWindow").setValue(new WMIVariant(1));
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemCimTypeEnum.java // public enum WbemCimTypeEnum { // /** 2(0x2): Signed 16-bit integer */ // Sint16(0x2), // /** 3(0x3): Signed 32-bit integer */ // Sint32(0x3), // /** 4(0x4): 32-bit real number */ // Real32(0x4), // /** 5(0x5): 64-bit real number */ // Real64(0x5), // /** 8(0x8): String */ // String(0x8), // /** 11(0xB): Boolean value*/ // Boolean(0xB), // /** 13(0xD): CIM object */ // Object(0xD), // /** 16(0x10): Signed 8-bit integer */ // Sint8(0x10), // /** 17(0x11): Unsigned 8-bit integer */ // Uint8(0x11), // /** 18(0x12): Unsigned 16-bit integer */ // Uint16(0x12), // /** 19(0x13): Unsigned 32-bit integer */ // Uint32(0x13), // /** 20(0x14): Signed 64-bit integer */ // Sint64(0x14), // /** 21(0x15): Unsigned 64-bit integer */ // Uint64(0x15), // /** 101(0x65): Date/time value */ // Datetime(0x65), // /** 102(0x66): Reference to a CIM object */ // Reference(0x66), // /** 103(0x67): 16-bit character */ // Char16(0x67); // // final private int value; // WbemCimTypeEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemCimTypeEnum parse(int value) { // for(WbemCimTypeEnum e : WbemCimTypeEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // Path: src/examples/service/ProcessManager.java import java.net.UnknownHostException; import cn.chenlichao.wmi4j.*; import cn.chenlichao.wmi4j.consts.WbemCimTypeEnum; /* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package service; public class ProcessManager { private SWbemLocator locator; private SWbemServices wbemServices; public ProcessManager() throws UnknownHostException, WMIException { locator = new SWbemLocator("192.168.1.201","administrator","password","root\\cimv2"); wbemServices = locator.connectServer(); } void startNotepad() throws WMIException { SWbemObject startConfig = wbemServices.get("Win32_ProcessStartup").spawnInstance(); startConfig.getProperties().item("ShowWindow").setValue(new WMIVariant(1));
startConfig.getProperties().add("PriorityClass", WbemCimTypeEnum.Uint32).setValue(new WMIVariant(128));
chenlichao-cn/wmi4j
src/main/java/cn/chenlichao/wmi4j/SWbemPropertySet.java
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemCimTypeEnum.java // public enum WbemCimTypeEnum { // /** 2(0x2): Signed 16-bit integer */ // Sint16(0x2), // /** 3(0x3): Signed 32-bit integer */ // Sint32(0x3), // /** 4(0x4): 32-bit real number */ // Real32(0x4), // /** 5(0x5): 64-bit real number */ // Real64(0x5), // /** 8(0x8): String */ // String(0x8), // /** 11(0xB): Boolean value*/ // Boolean(0xB), // /** 13(0xD): CIM object */ // Object(0xD), // /** 16(0x10): Signed 8-bit integer */ // Sint8(0x10), // /** 17(0x11): Unsigned 8-bit integer */ // Uint8(0x11), // /** 18(0x12): Unsigned 16-bit integer */ // Uint16(0x12), // /** 19(0x13): Unsigned 32-bit integer */ // Uint32(0x13), // /** 20(0x14): Signed 64-bit integer */ // Sint64(0x14), // /** 21(0x15): Unsigned 64-bit integer */ // Uint64(0x15), // /** 101(0x65): Date/time value */ // Datetime(0x65), // /** 102(0x66): Reference to a CIM object */ // Reference(0x66), // /** 103(0x67): 16-bit character */ // Char16(0x67); // // final private int value; // WbemCimTypeEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemCimTypeEnum parse(int value) { // for(WbemCimTypeEnum e : WbemCimTypeEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // }
import org.jinterop.dcom.core.JIString; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; import cn.chenlichao.wmi4j.consts.WbemCimTypeEnum; import static org.apache.commons.lang3.StringUtils.isEmpty;
/* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * An SWbemPropertySet object is a collection of {@link SWbemProperty} objects. * You can add items to the collection using the {@link #add(String, cn.chenlichao.wmi4j.consts.WbemCimTypeEnum, Boolean, Integer) add()} method, * retrieve items from the collection using the {@link #item(String, Integer) item()} method, * and remove items from the collection using the {@link #remove(String, Integer) remove()} method. * * Created by chenlichao on 14-7-26. */ public class SWbemPropertySet extends AbstractWbemSet<SWbemProperty> { SWbemPropertySet(IJIDispatch dispatch) { super(dispatch); } /** * Adds an {@link SWbemProperty} object to this collection. * If a property with the same name already exists in the collection, its contents are replaced with the new definition. * * <p><strong>Note: </strong> The value of the added property is NULL (unassigned) after this operation. * To set or change the value of a WMI property, you must set the value property of the returned {@link SWbemProperty} object.</p> * * @param name Name of the new property. * @param cimType An integer that represents the CIMType qualifier of the new property. See {@link cn.chenlichao.wmi4j.consts.WbemCimTypeEnum} * @param isArray <strong>[Optional]</strong> Specifies whether the property is an array type. The default value for this parameter is FALSE. * @param flags <strong>[Optional]</strong> Reserved and must be zero if specified. * @return If successful, this method returns an {@link SWbemProperty} object that represents the new property. * Otherwise, a null object is returned. * @throws WMIException */
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemCimTypeEnum.java // public enum WbemCimTypeEnum { // /** 2(0x2): Signed 16-bit integer */ // Sint16(0x2), // /** 3(0x3): Signed 32-bit integer */ // Sint32(0x3), // /** 4(0x4): 32-bit real number */ // Real32(0x4), // /** 5(0x5): 64-bit real number */ // Real64(0x5), // /** 8(0x8): String */ // String(0x8), // /** 11(0xB): Boolean value*/ // Boolean(0xB), // /** 13(0xD): CIM object */ // Object(0xD), // /** 16(0x10): Signed 8-bit integer */ // Sint8(0x10), // /** 17(0x11): Unsigned 8-bit integer */ // Uint8(0x11), // /** 18(0x12): Unsigned 16-bit integer */ // Uint16(0x12), // /** 19(0x13): Unsigned 32-bit integer */ // Uint32(0x13), // /** 20(0x14): Signed 64-bit integer */ // Sint64(0x14), // /** 21(0x15): Unsigned 64-bit integer */ // Uint64(0x15), // /** 101(0x65): Date/time value */ // Datetime(0x65), // /** 102(0x66): Reference to a CIM object */ // Reference(0x66), // /** 103(0x67): 16-bit character */ // Char16(0x67); // // final private int value; // WbemCimTypeEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemCimTypeEnum parse(int value) { // for(WbemCimTypeEnum e : WbemCimTypeEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // Path: src/main/java/cn/chenlichao/wmi4j/SWbemPropertySet.java import org.jinterop.dcom.core.JIString; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; import cn.chenlichao.wmi4j.consts.WbemCimTypeEnum; import static org.apache.commons.lang3.StringUtils.isEmpty; /* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * An SWbemPropertySet object is a collection of {@link SWbemProperty} objects. * You can add items to the collection using the {@link #add(String, cn.chenlichao.wmi4j.consts.WbemCimTypeEnum, Boolean, Integer) add()} method, * retrieve items from the collection using the {@link #item(String, Integer) item()} method, * and remove items from the collection using the {@link #remove(String, Integer) remove()} method. * * Created by chenlichao on 14-7-26. */ public class SWbemPropertySet extends AbstractWbemSet<SWbemProperty> { SWbemPropertySet(IJIDispatch dispatch) { super(dispatch); } /** * Adds an {@link SWbemProperty} object to this collection. * If a property with the same name already exists in the collection, its contents are replaced with the new definition. * * <p><strong>Note: </strong> The value of the added property is NULL (unassigned) after this operation. * To set or change the value of a WMI property, you must set the value property of the returned {@link SWbemProperty} object.</p> * * @param name Name of the new property. * @param cimType An integer that represents the CIMType qualifier of the new property. See {@link cn.chenlichao.wmi4j.consts.WbemCimTypeEnum} * @param isArray <strong>[Optional]</strong> Specifies whether the property is an array type. The default value for this parameter is FALSE. * @param flags <strong>[Optional]</strong> Reserved and must be zero if specified. * @return If successful, this method returns an {@link SWbemProperty} object that represents the new property. * Otherwise, a null object is returned. * @throws WMIException */
public SWbemProperty add(String name, WbemCimTypeEnum cimType, Boolean isArray, Integer flags) throws WMIException {
chenlichao-cn/wmi4j
src/main/java/cn/chenlichao/wmi4j/SWbemProperty.java
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemCimTypeEnum.java // public enum WbemCimTypeEnum { // /** 2(0x2): Signed 16-bit integer */ // Sint16(0x2), // /** 3(0x3): Signed 32-bit integer */ // Sint32(0x3), // /** 4(0x4): 32-bit real number */ // Real32(0x4), // /** 5(0x5): 64-bit real number */ // Real64(0x5), // /** 8(0x8): String */ // String(0x8), // /** 11(0xB): Boolean value*/ // Boolean(0xB), // /** 13(0xD): CIM object */ // Object(0xD), // /** 16(0x10): Signed 8-bit integer */ // Sint8(0x10), // /** 17(0x11): Unsigned 8-bit integer */ // Uint8(0x11), // /** 18(0x12): Unsigned 16-bit integer */ // Uint16(0x12), // /** 19(0x13): Unsigned 32-bit integer */ // Uint32(0x13), // /** 20(0x14): Signed 64-bit integer */ // Sint64(0x14), // /** 21(0x15): Unsigned 64-bit integer */ // Uint64(0x15), // /** 101(0x65): Date/time value */ // Datetime(0x65), // /** 102(0x66): Reference to a CIM object */ // Reference(0x66), // /** 103(0x67): 16-bit character */ // Char16(0x67); // // final private int value; // WbemCimTypeEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemCimTypeEnum parse(int value) { // for(WbemCimTypeEnum e : WbemCimTypeEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // }
import cn.chenlichao.wmi4j.consts.WbemCimTypeEnum; import org.jinterop.dcom.common.JIException; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch;
/* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * Represents a single WMI property of a managed object. * * Created by chenlichao on 14-7-26. */ public class SWbemProperty extends AbstractScriptingObject { SWbemProperty(IJIDispatch dispatch) { super(dispatch); } /** * Return an integer that can be used to determine the CIM type of this property. This property is read-only. * @return An integer that can be used to determine the CIM type of this property * @throws WMIException */
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemCimTypeEnum.java // public enum WbemCimTypeEnum { // /** 2(0x2): Signed 16-bit integer */ // Sint16(0x2), // /** 3(0x3): Signed 32-bit integer */ // Sint32(0x3), // /** 4(0x4): 32-bit real number */ // Real32(0x4), // /** 5(0x5): 64-bit real number */ // Real64(0x5), // /** 8(0x8): String */ // String(0x8), // /** 11(0xB): Boolean value*/ // Boolean(0xB), // /** 13(0xD): CIM object */ // Object(0xD), // /** 16(0x10): Signed 8-bit integer */ // Sint8(0x10), // /** 17(0x11): Unsigned 8-bit integer */ // Uint8(0x11), // /** 18(0x12): Unsigned 16-bit integer */ // Uint16(0x12), // /** 19(0x13): Unsigned 32-bit integer */ // Uint32(0x13), // /** 20(0x14): Signed 64-bit integer */ // Sint64(0x14), // /** 21(0x15): Unsigned 64-bit integer */ // Uint64(0x15), // /** 101(0x65): Date/time value */ // Datetime(0x65), // /** 102(0x66): Reference to a CIM object */ // Reference(0x66), // /** 103(0x67): 16-bit character */ // Char16(0x67); // // final private int value; // WbemCimTypeEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemCimTypeEnum parse(int value) { // for(WbemCimTypeEnum e : WbemCimTypeEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // Path: src/main/java/cn/chenlichao/wmi4j/SWbemProperty.java import cn.chenlichao.wmi4j.consts.WbemCimTypeEnum; import org.jinterop.dcom.common.JIException; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; /* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * Represents a single WMI property of a managed object. * * Created by chenlichao on 14-7-26. */ public class SWbemProperty extends AbstractScriptingObject { SWbemProperty(IJIDispatch dispatch) { super(dispatch); } /** * Return an integer that can be used to determine the CIM type of this property. This property is read-only. * @return An integer that can be used to determine the CIM type of this property * @throws WMIException */
public WbemCimTypeEnum getCIMType() throws WMIException {
chenlichao-cn/wmi4j
src/main/java/cn/chenlichao/wmi4j/SWbemSecurity.java
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemAuthenticationLevelEnum.java // public enum WbemAuthenticationLevelEnum { // // /** 0(0x0): WMI uses the default Windows Authentication setting. */ // Default(0x0), // /** 1(0x1): Uses no authentication. */ // None(0x1), // /** 2(0x2): Authenticates the credentials of the client only when the client establishes a relationship with the server. */ // Connect(0x2), // /** 3(0x3): Authenticates only at the beginning of each call when the server receives the request. */ // Call(0x3), // /** 4(0x4): Authenticates that all data received is from the expected client. */ // Pkt(0x4), // /** 5(0x5): Authenticates and verifies that none of the data transferred between client and server has been modified. */ // PktIntegrity(0x5), // /** 6(0x6): Authenticates all previous impersonation levels and encrypts the argument value of each remote procedure call. */ // PktPrivacy(0x6); // // final private int value; // WbemAuthenticationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemAuthenticationLevelEnum parse(int value) { // for(WbemAuthenticationLevelEnum e : WbemAuthenticationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // // Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemImpersonationLevelEnum.java // public enum WbemImpersonationLevelEnum { // // /** 1(0x1): Hides the credentials of the caller. Calls to WMI may fail with this impersonation level. */ // Anonymous(0x1), // /** 2(0x2): Allows objects to query the credentials of the caller. // * Calls to WMI may fail with this impersonation level. */ // Identify(0x2), // /** 3(0x3): Allows objects to use the credentials of the caller. // * This is the recommended impersonation level for Scripting API for WMI calls. */ // Impersonate(0x3), // /** 4(0x4): Allows objects to permit other objects to use the credentials of the caller. // * This impersonation will work with Scripting API for WMI calls but may constitute an unnecessary security risk. */ // Delegate(0x4); // // // final private int value; // WbemImpersonationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemImpersonationLevelEnum parse(int value) { // for(WbemImpersonationLevelEnum e : WbemImpersonationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // }
import cn.chenlichao.wmi4j.consts.WbemImpersonationLevelEnum; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; import cn.chenlichao.wmi4j.consts.WbemAuthenticationLevelEnum;
/* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * The SWbemSecurity object gets or sets security settings, such as privileges, COM impersonations, and authentication levels * assigned to an object. The {@link SWbemLocator}, {@link SWbemServices}, {@link SWbemObject}, * {@link SWbemObjectSet}, {@link SWbemObjectPath}, {@link SWbemLastError}, * and {@link SWbemEventSource} objects have a security property, which is the SWbemSecurity object. * When you retrieve an instance or view the WMI security log, you might need to set the properties of the SWbemSecurity object. * * Created by chenlichao on 14-7-23. */ public class SWbemSecurity extends AbstractScriptingObject{ SWbemSecurity(IJIDispatch dispatch) { super(dispatch); } /** * Get the COM Authentication level that is assigned to this object. * This setting determines how you protect information sent from WMI. * * @return The COM Authentication level that is assigned to this object. * @throws WMIException */
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemAuthenticationLevelEnum.java // public enum WbemAuthenticationLevelEnum { // // /** 0(0x0): WMI uses the default Windows Authentication setting. */ // Default(0x0), // /** 1(0x1): Uses no authentication. */ // None(0x1), // /** 2(0x2): Authenticates the credentials of the client only when the client establishes a relationship with the server. */ // Connect(0x2), // /** 3(0x3): Authenticates only at the beginning of each call when the server receives the request. */ // Call(0x3), // /** 4(0x4): Authenticates that all data received is from the expected client. */ // Pkt(0x4), // /** 5(0x5): Authenticates and verifies that none of the data transferred between client and server has been modified. */ // PktIntegrity(0x5), // /** 6(0x6): Authenticates all previous impersonation levels and encrypts the argument value of each remote procedure call. */ // PktPrivacy(0x6); // // final private int value; // WbemAuthenticationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemAuthenticationLevelEnum parse(int value) { // for(WbemAuthenticationLevelEnum e : WbemAuthenticationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // // Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemImpersonationLevelEnum.java // public enum WbemImpersonationLevelEnum { // // /** 1(0x1): Hides the credentials of the caller. Calls to WMI may fail with this impersonation level. */ // Anonymous(0x1), // /** 2(0x2): Allows objects to query the credentials of the caller. // * Calls to WMI may fail with this impersonation level. */ // Identify(0x2), // /** 3(0x3): Allows objects to use the credentials of the caller. // * This is the recommended impersonation level for Scripting API for WMI calls. */ // Impersonate(0x3), // /** 4(0x4): Allows objects to permit other objects to use the credentials of the caller. // * This impersonation will work with Scripting API for WMI calls but may constitute an unnecessary security risk. */ // Delegate(0x4); // // // final private int value; // WbemImpersonationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemImpersonationLevelEnum parse(int value) { // for(WbemImpersonationLevelEnum e : WbemImpersonationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // Path: src/main/java/cn/chenlichao/wmi4j/SWbemSecurity.java import cn.chenlichao.wmi4j.consts.WbemImpersonationLevelEnum; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; import cn.chenlichao.wmi4j.consts.WbemAuthenticationLevelEnum; /* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * The SWbemSecurity object gets or sets security settings, such as privileges, COM impersonations, and authentication levels * assigned to an object. The {@link SWbemLocator}, {@link SWbemServices}, {@link SWbemObject}, * {@link SWbemObjectSet}, {@link SWbemObjectPath}, {@link SWbemLastError}, * and {@link SWbemEventSource} objects have a security property, which is the SWbemSecurity object. * When you retrieve an instance or view the WMI security log, you might need to set the properties of the SWbemSecurity object. * * Created by chenlichao on 14-7-23. */ public class SWbemSecurity extends AbstractScriptingObject{ SWbemSecurity(IJIDispatch dispatch) { super(dispatch); } /** * Get the COM Authentication level that is assigned to this object. * This setting determines how you protect information sent from WMI. * * @return The COM Authentication level that is assigned to this object. * @throws WMIException */
public WbemAuthenticationLevelEnum getAuthenticationLevel() throws WMIException {
chenlichao-cn/wmi4j
src/main/java/cn/chenlichao/wmi4j/SWbemSecurity.java
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemAuthenticationLevelEnum.java // public enum WbemAuthenticationLevelEnum { // // /** 0(0x0): WMI uses the default Windows Authentication setting. */ // Default(0x0), // /** 1(0x1): Uses no authentication. */ // None(0x1), // /** 2(0x2): Authenticates the credentials of the client only when the client establishes a relationship with the server. */ // Connect(0x2), // /** 3(0x3): Authenticates only at the beginning of each call when the server receives the request. */ // Call(0x3), // /** 4(0x4): Authenticates that all data received is from the expected client. */ // Pkt(0x4), // /** 5(0x5): Authenticates and verifies that none of the data transferred between client and server has been modified. */ // PktIntegrity(0x5), // /** 6(0x6): Authenticates all previous impersonation levels and encrypts the argument value of each remote procedure call. */ // PktPrivacy(0x6); // // final private int value; // WbemAuthenticationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemAuthenticationLevelEnum parse(int value) { // for(WbemAuthenticationLevelEnum e : WbemAuthenticationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // // Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemImpersonationLevelEnum.java // public enum WbemImpersonationLevelEnum { // // /** 1(0x1): Hides the credentials of the caller. Calls to WMI may fail with this impersonation level. */ // Anonymous(0x1), // /** 2(0x2): Allows objects to query the credentials of the caller. // * Calls to WMI may fail with this impersonation level. */ // Identify(0x2), // /** 3(0x3): Allows objects to use the credentials of the caller. // * This is the recommended impersonation level for Scripting API for WMI calls. */ // Impersonate(0x3), // /** 4(0x4): Allows objects to permit other objects to use the credentials of the caller. // * This impersonation will work with Scripting API for WMI calls but may constitute an unnecessary security risk. */ // Delegate(0x4); // // // final private int value; // WbemImpersonationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemImpersonationLevelEnum parse(int value) { // for(WbemImpersonationLevelEnum e : WbemImpersonationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // }
import cn.chenlichao.wmi4j.consts.WbemImpersonationLevelEnum; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; import cn.chenlichao.wmi4j.consts.WbemAuthenticationLevelEnum;
/* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * The SWbemSecurity object gets or sets security settings, such as privileges, COM impersonations, and authentication levels * assigned to an object. The {@link SWbemLocator}, {@link SWbemServices}, {@link SWbemObject}, * {@link SWbemObjectSet}, {@link SWbemObjectPath}, {@link SWbemLastError}, * and {@link SWbemEventSource} objects have a security property, which is the SWbemSecurity object. * When you retrieve an instance or view the WMI security log, you might need to set the properties of the SWbemSecurity object. * * Created by chenlichao on 14-7-23. */ public class SWbemSecurity extends AbstractScriptingObject{ SWbemSecurity(IJIDispatch dispatch) { super(dispatch); } /** * Get the COM Authentication level that is assigned to this object. * This setting determines how you protect information sent from WMI. * * @return The COM Authentication level that is assigned to this object. * @throws WMIException */ public WbemAuthenticationLevelEnum getAuthenticationLevel() throws WMIException { int value = (Integer)getProperty(Integer.class, "AuthenticationLevel"); return WbemAuthenticationLevelEnum.parse(value); } /** * Set the COM Authentication level that is assigned to this object. * @param level the COM Authentication level that is assigned to this object. * @throws WMIException */ public void setAuthenticationLevel(WbemAuthenticationLevelEnum level) throws WMIException { putProperty("AuthenticationLevel", new JIVariant(level.getValue())); } /** * Get the COM impersonation level that is assigned to this object. * This setting determines if processes owned by Windows Management Instrumentation (WMI) * can detect or use your security credentials when making calls to other processes. * * @return the COM impersonation level that is assigned to this object. * @throws WMIException */
// Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemAuthenticationLevelEnum.java // public enum WbemAuthenticationLevelEnum { // // /** 0(0x0): WMI uses the default Windows Authentication setting. */ // Default(0x0), // /** 1(0x1): Uses no authentication. */ // None(0x1), // /** 2(0x2): Authenticates the credentials of the client only when the client establishes a relationship with the server. */ // Connect(0x2), // /** 3(0x3): Authenticates only at the beginning of each call when the server receives the request. */ // Call(0x3), // /** 4(0x4): Authenticates that all data received is from the expected client. */ // Pkt(0x4), // /** 5(0x5): Authenticates and verifies that none of the data transferred between client and server has been modified. */ // PktIntegrity(0x5), // /** 6(0x6): Authenticates all previous impersonation levels and encrypts the argument value of each remote procedure call. */ // PktPrivacy(0x6); // // final private int value; // WbemAuthenticationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemAuthenticationLevelEnum parse(int value) { // for(WbemAuthenticationLevelEnum e : WbemAuthenticationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // // Path: src/main/java/cn/chenlichao/wmi4j/consts/WbemImpersonationLevelEnum.java // public enum WbemImpersonationLevelEnum { // // /** 1(0x1): Hides the credentials of the caller. Calls to WMI may fail with this impersonation level. */ // Anonymous(0x1), // /** 2(0x2): Allows objects to query the credentials of the caller. // * Calls to WMI may fail with this impersonation level. */ // Identify(0x2), // /** 3(0x3): Allows objects to use the credentials of the caller. // * This is the recommended impersonation level for Scripting API for WMI calls. */ // Impersonate(0x3), // /** 4(0x4): Allows objects to permit other objects to use the credentials of the caller. // * This impersonation will work with Scripting API for WMI calls but may constitute an unnecessary security risk. */ // Delegate(0x4); // // // final private int value; // WbemImpersonationLevelEnum(int value) { // this.value = value; // } // // public int getValue() { // return value; // } // // public static WbemImpersonationLevelEnum parse(int value) { // for(WbemImpersonationLevelEnum e : WbemImpersonationLevelEnum.values()) { // if(e.getValue() == value) { // return e; // } // } // throw new IllegalArgumentException("WbemCimTypeEnum has no constant with the specified value"); // } // } // Path: src/main/java/cn/chenlichao/wmi4j/SWbemSecurity.java import cn.chenlichao.wmi4j.consts.WbemImpersonationLevelEnum; import org.jinterop.dcom.core.JIVariant; import org.jinterop.dcom.impls.automation.IJIDispatch; import cn.chenlichao.wmi4j.consts.WbemAuthenticationLevelEnum; /* * Copyright 2014-2014 Chen Lichao * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package cn.chenlichao.wmi4j; /** * The SWbemSecurity object gets or sets security settings, such as privileges, COM impersonations, and authentication levels * assigned to an object. The {@link SWbemLocator}, {@link SWbemServices}, {@link SWbemObject}, * {@link SWbemObjectSet}, {@link SWbemObjectPath}, {@link SWbemLastError}, * and {@link SWbemEventSource} objects have a security property, which is the SWbemSecurity object. * When you retrieve an instance or view the WMI security log, you might need to set the properties of the SWbemSecurity object. * * Created by chenlichao on 14-7-23. */ public class SWbemSecurity extends AbstractScriptingObject{ SWbemSecurity(IJIDispatch dispatch) { super(dispatch); } /** * Get the COM Authentication level that is assigned to this object. * This setting determines how you protect information sent from WMI. * * @return The COM Authentication level that is assigned to this object. * @throws WMIException */ public WbemAuthenticationLevelEnum getAuthenticationLevel() throws WMIException { int value = (Integer)getProperty(Integer.class, "AuthenticationLevel"); return WbemAuthenticationLevelEnum.parse(value); } /** * Set the COM Authentication level that is assigned to this object. * @param level the COM Authentication level that is assigned to this object. * @throws WMIException */ public void setAuthenticationLevel(WbemAuthenticationLevelEnum level) throws WMIException { putProperty("AuthenticationLevel", new JIVariant(level.getValue())); } /** * Get the COM impersonation level that is assigned to this object. * This setting determines if processes owned by Windows Management Instrumentation (WMI) * can detect or use your security credentials when making calls to other processes. * * @return the COM impersonation level that is assigned to this object. * @throws WMIException */
public WbemImpersonationLevelEnum getImpersonationLevel() throws WMIException {
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/core/ShadowRenderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // }
import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer;
} public void setLineJoint(String lineJoint) { this.lineJoint = lineJoint; } public Double getLineWidth() { return lineWidth; } public void setLineWidth(Double lineWidth) { this.lineWidth = lineWidth; } public Double getOffset() { return offset; } public void setOffset(Double offset) { this.offset = offset; } public String getStrokeStyle() { return strokeStyle; } public void setStrokeStyle(String strokeStyle) { this.strokeStyle = strokeStyle; }
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/core/ShadowRenderer.java import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer; } public void setLineJoint(String lineJoint) { this.lineJoint = lineJoint; } public Double getLineWidth() { return lineWidth; } public void setLineWidth(Double lineWidth) { this.lineWidth = lineWidth; } public Double getOffset() { return offset; } public void setOffset(Double offset) { this.offset = offset; } public String getStrokeStyle() { return strokeStyle; } public void setStrokeStyle(String strokeStyle) { this.strokeStyle = strokeStyle; }
public JqPlotResources resource() {
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/elements/Element.java // public interface Element extends Serializable { // // }
import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.elements.Element;
package br.com.digilabs.jqplot.renderer; /** * The Interface Renderer. */ @Deprecated public interface Renderer extends Element { /** * Resource. * * @return the jqplot resource */
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/elements/Element.java // public interface Element extends Serializable { // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.elements.Element; package br.com.digilabs.jqplot.renderer; /** * The Interface Renderer. */ @Deprecated public interface Renderer extends Element { /** * Resource. * * @return the jqplot resource */
JqPlotResources resource();
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/plugin/BarRenderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // }
import java.util.Collection; import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer;
} /** * @return the highlightMouseDown */ public boolean isHighlightMouseDown() { return highlightMouseDown; } /** * @param highlightMouseDown the highlightMouseDown to set */ public void setHighlightMouseDown(boolean highlightMouseDown) { this.highlightMouseDown = highlightMouseDown; } /** * @return the highlightColors */ public Collection<String> getHighlightColors() { return highlightColors; } /** * @param highlightColors the highlightColors to set */ public void setHighlightColors(Collection<String> highlightColors) { this.highlightColors = highlightColors; }
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/plugin/BarRenderer.java import java.util.Collection; import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer; } /** * @return the highlightMouseDown */ public boolean isHighlightMouseDown() { return highlightMouseDown; } /** * @param highlightMouseDown the highlightMouseDown to set */ public void setHighlightMouseDown(boolean highlightMouseDown) { this.highlightMouseDown = highlightMouseDown; } /** * @return the highlightColors */ public Collection<String> getHighlightColors() { return highlightColors; } /** * @param highlightColors the highlightColors to set */ public void setHighlightColors(Collection<String> highlightColors) { this.highlightColors = highlightColors; }
public JqPlotResources resource() {
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/plugin/DonutRenderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // }
import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer;
/* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.renderer.plugin; /** * Plugin renderer to draw a donut chart. x values, if present, will be used as slice labels. y values give slice size. * * @see <a href="http://www.jqplot.com/docs/files/plugins/jqplot-donutRenderer-js.html">http://www.jqplot.com/docs/files/plugins/jqplot-donutRenderer-js.html</a> * * @author inaiat */ @Deprecated public class DonutRenderer implements Renderer { private static final long serialVersionUID = -3572013159602499333L;
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/plugin/DonutRenderer.java import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer; /* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.renderer.plugin; /** * Plugin renderer to draw a donut chart. x values, if present, will be used as slice labels. y values give slice size. * * @see <a href="http://www.jqplot.com/docs/files/plugins/jqplot-donutRenderer-js.html">http://www.jqplot.com/docs/files/plugins/jqplot-donutRenderer-js.html</a> * * @author inaiat */ @Deprecated public class DonutRenderer implements Renderer { private static final long serialVersionUID = -3572013159602499333L;
public JqPlotResources resource() {
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/support/JqPlotJsonMapHierarchicalWriter.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // }
import br.com.digilabs.jqplot.JqPlotResources; import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.core.util.FastStack; import com.thoughtworks.xstream.core.util.Primitives; import com.thoughtworks.xstream.core.util.QuickWriter; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter; import java.io.Writer; import java.util.Collection; import java.util.Map;
endNode(); } } /** * * @param writer writer * @param text text */ protected void writeAttributeValue(QuickWriter writer, String text) { writeText(text, null); } /** * * @param writer writer * @param text text */ protected void writeText(QuickWriter writer, String text) { Node foo = (Node)elementStack.peek(); writeText(text, foo.clazz); } /** * * @param text text * @param clazz class */ private void writeText(String text, Class<?> clazz) {
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // Path: src/main/java/br/com/digilabs/jqplot/support/JqPlotJsonMapHierarchicalWriter.java import br.com.digilabs.jqplot.JqPlotResources; import com.thoughtworks.xstream.converters.ConversionException; import com.thoughtworks.xstream.core.util.FastStack; import com.thoughtworks.xstream.core.util.Primitives; import com.thoughtworks.xstream.core.util.QuickWriter; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.io.ExtendedHierarchicalStreamWriter; import java.io.Writer; import java.util.Collection; import java.util.Map; endNode(); } } /** * * @param writer writer * @param text text */ protected void writeAttributeValue(QuickWriter writer, String text) { writeText(text, null); } /** * * @param writer writer * @param text text */ protected void writeText(QuickWriter writer, String text) { Node foo = (Node)elementStack.peek(); writeText(text, foo.clazz); } /** * * @param text text * @param clazz class */ private void writeText(String text, Class<?> clazz) {
boolean isJqPlotResource = clazz.isAssignableFrom(JqPlotResources.class);
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/plugin/CanvasAxisLabelRenderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // }
import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer;
} /** * @return the enableFontSupport */ public Boolean getEnableFontSupport() { return enableFontSupport; } /** * @param enableFontSupport the enableFontSupport to set */ public void setEnableFontSupport(Boolean enableFontSupport) { this.enableFontSupport = enableFontSupport; } /** * @return the pt2px */ public String getPt2px() { return pt2px; } /** * @param pt2px the pt2px to set */ public void setPt2px(String pt2px) { this.pt2px = pt2px; }
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/plugin/CanvasAxisLabelRenderer.java import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer; } /** * @return the enableFontSupport */ public Boolean getEnableFontSupport() { return enableFontSupport; } /** * @param enableFontSupport the enableFontSupport to set */ public void setEnableFontSupport(Boolean enableFontSupport) { this.enableFontSupport = enableFontSupport; } /** * @return the pt2px */ public String getPt2px() { return pt2px; } /** * @param pt2px the pt2px to set */ public void setPt2px(String pt2px) { this.pt2px = pt2px; }
public JqPlotResources resource() {
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/metadata/JqPlotPlugin.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // }
import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import br.com.digilabs.jqplot.JqPlotResources;
/* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.metadata; /** * Annotation to inform the resources used by Chart * * @author inaiat */ @Retention(RetentionPolicy.RUNTIME) @Target( { ElementType.TYPE }) public @interface JqPlotPlugin {
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // Path: src/main/java/br/com/digilabs/jqplot/metadata/JqPlotPlugin.java import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import br.com.digilabs.jqplot.JqPlotResources; /* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.metadata; /** * Annotation to inform the resources used by Chart * * @author inaiat */ @Retention(RetentionPolicy.RUNTIME) @Target( { ElementType.TYPE }) public @interface JqPlotPlugin {
JqPlotResources[] values();
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/core/AxisTickRenderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // }
import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer;
/* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.renderer.core; /** * Renderizador AxisTick * @author inaiat */ @Deprecated public class AxisTickRenderer implements Renderer { private static final long serialVersionUID = 1L; private String mark; private Boolean showMark; private Boolean showGridline; private Boolean isMinorTick; private Integer size; private Integer markSize; private Boolean show;
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/core/AxisTickRenderer.java import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.renderer.Renderer; /* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.renderer.core; /** * Renderizador AxisTick * @author inaiat */ @Deprecated public class AxisTickRenderer implements Renderer { private static final long serialVersionUID = 1L; private String mark; private Boolean showMark; private Boolean showGridline; private Boolean isMinorTick; private Integer size; private Integer markSize; private Boolean show;
private JqPlotResources formatter;
inaiat/jqplot4java
src/main/java/br/com/digilabs/jqplot/renderer/plugin/PieRenderer.java
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // }
import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.metadata.JqPlotPlugin; import br.com.digilabs.jqplot.renderer.Renderer;
/* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.renderer.plugin; /** * Plugin renderer to draw a pie chart. x values, if present, will be used as slice labels. y values give slice size. * * @see <a href="http://www.jqplot.com/docs/files/plugins/jqplot-pieRenderer-js.html">http://www.jqplot.com/docs/files/plugins/jqplot-pieRenderer-js.html</a> * * @author inaiat */ @Deprecated @JqPlotPlugin(values = {JqPlotResources.PieRenderer})
// Path: src/main/java/br/com/digilabs/jqplot/JqPlotResources.java // public enum JqPlotResources { // // /** The Highlighter. */ // Highlighter("$.jqplot.Highlighter", "plugins/jqplot.highlighter.min.js"), // // /** The Cursor. */ // Cursor("$.jqplot.Cursor","plugins/jqplot.cursor.min.js"), // // /** The Bar renderer. */ // BarRenderer("$.jqplot.BarRenderer", "plugins/jqplot.barRenderer.min.js"), // // /** The Bubble renderer. */ // BubbleRenderer("$.jqplot.BubbleRenderer", "plugins/jqplot.bubbleRenderer.min.js"), // // /** The Pie renderer. */ // PieRenderer("$.jqplot.PieRenderer", "plugins/jqplot.pieRenderer.min.js"), // // /** The Donut renderer. */ // DonutRenderer("$.jqplot.DonutRenderer", "plugins/jqplot.donutRenderer.min.js"), // // /** The Canvas axis label renderer. */ // CanvasAxisLabelRenderer("$.jqplot.CanvasAxisLabelRenderer", "plugins/jqplot.canvasAxisLabelRenderer.min.js"), // // /** The Category axis renderer. */ // CategoryAxisRenderer("$.jqplot.CategoryAxisRenderer", "plugins/jqplot.categoryAxisRenderer.min.js"), // // /** The Canvas axis tick renderer. */ // CanvasAxisTickRenderer("$.jqplot.CanvasAxisTickRenderer", "plugins/jqplot.canvasAxisTickRenderer.min.js"), // // /** The Canvas text renderer. */ // CanvasTextRenderer("$.jqplot.CanvasTextRenderer","plugins/jqplot.canvasTextRenderer.min.js"), // // /** The CanvasOverlay renderer. */ // CanvasOverlay("$.jqplot.CanvasOverlay", "plugins/jqplot.canvasOverlay.min.js"), // // /** The Date axis renderer. */ // DateAxisRenderer("$.jqplot.DateAxisRenderer","plugins/jqplot.dateAxisRenderer.min.js"), // // /** The Meter gauge renderer. */ // MeterGaugeRenderer("$.jqplot.MeterGaugeRenderer","plugins/jqplot.meterGaugeRenderer.min.js"), // // /** The Point labels. */ // PointLabels("$.jqplot.PointLabels","plugins/jqplot.pointLabels.min.js"), // // /** The Shadow renderer. */ // ShadowRenderer("$.jqplot.ShadowRenderer", "jquery.jqplot.min.js"), // // // Core Renderer // /** The Axis tick renderer. */ // AxisTickRenderer("$.jqplot.AxisTickRenderer"), // // EnhancedLegendRenderer("$.jqplot.EnhancedLegendRenderer","plugins/jqplot.enhancedLegendRenderer.min.js"), // // /** A class of a formatter for the tick text. */ // DefaultTickFormatter("$.jqplot.DefaultTickFormatter"); // // // /** The class name. */ // private String className; // // /** The resource. */ // private String resource; // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // */ // private JqPlotResources(String className) { // this(className, null); // } // // /** // * Instantiates a new jq plot resources. // * // * @param className the class name // * @param resource the resource // */ // private JqPlotResources(String className, String resource) { // this.className = className; // this.resource = resource; // } // // /* (non-Javadoc) // * @see java.lang.Enum#toString() // */ // @Override // public String toString() { // return className; // } // // /** // * Gets the class name. // * // * @return the class name // */ // public String getClassName() { // return className; // } // // /** // * Gets the resource. // * // * @return the resource // */ // public String getResource() { // return resource; // } // } // // Path: src/main/java/br/com/digilabs/jqplot/renderer/Renderer.java // @Deprecated // public interface Renderer extends Element { // // /** // * Resource. // * // * @return the jqplot resource // */ // JqPlotResources resource(); // // } // Path: src/main/java/br/com/digilabs/jqplot/renderer/plugin/PieRenderer.java import br.com.digilabs.jqplot.JqPlotResources; import br.com.digilabs.jqplot.metadata.JqPlotPlugin; import br.com.digilabs.jqplot.renderer.Renderer; /* * Copyright 2011 Inaiat H. Moraes. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * under the License. */ package br.com.digilabs.jqplot.renderer.plugin; /** * Plugin renderer to draw a pie chart. x values, if present, will be used as slice labels. y values give slice size. * * @see <a href="http://www.jqplot.com/docs/files/plugins/jqplot-pieRenderer-js.html">http://www.jqplot.com/docs/files/plugins/jqplot-pieRenderer-js.html</a> * * @author inaiat */ @Deprecated @JqPlotPlugin(values = {JqPlotResources.PieRenderer})
public class PieRenderer implements Renderer {
K15t/spark
spark-confluence/src/test/java/com/k15t/spark/confluence/SparkConfluenceActionTemplatesTest.java
// Path: spark-common/src/main/java/com/k15t/spark/base/util/SparkTestUtils.java // public class SparkTestUtils { // // /** // * Extracts property names that could be used in a Velocity template from the public methods (including inherited ones) // * of the class using the patterns get... or is... // * // * @param clazz {@link Class} from which to extract the get... and is... methods // * @param prefix prefix to add to all properties, eg. getProp -> prefix.prop and prefix.Prop // * @return a set of strings that could be used as property names in a Velocity template when // * an object of the class is (a part of) the context // */ // public static Set<String> extractPossibleVelocityKeys(Class<?> clazz, String prefix) { // // HashSet<String> res = new HashSet<>(); // // // getMethods() returns only public methods, including inherited ones (no further checks needed) // for (Method method : clazz.getMethods()) { // String methodName = method.getName(); // String rest = null; // if (methodName.startsWith("get")) { // rest = methodName.substring("get".length()); // // } else if (methodName.startsWith("is")) { // rest = methodName.substring("is".length()); // } // if (rest != null) { // if ("".equals(rest)) { // throw new IllegalArgumentException("Method does not handle classes using get(\"property\""); // } else { // res.add(prefix + "." + rest.substring(0, 1).toLowerCase() + rest.substring(1)); // res.add(prefix + "." + rest.substring(0, 1).toUpperCase() + rest.substring(1)); // } // } // } // // return res; // } // // // /** // * Extracts the variable references from velocity template fragment ($variable or ${variable}) and // * counts how many times each of the variable names in the expRefs list is present in the fragment. // * // * @param velocityFragment fragment from which to extract variables // * @param expRefs list of variable names to count (that are expected to be used in the fragment) // * @param failOnUnExpectedRef if true, calls Assert.fail() when encountering a variable name not in the 'expRefs' list // * @return map from variable name to int, from variable names in 'expRefs' list to time used in the fragment // */ // public static Map<String, Integer> checkVelocityFragmentReferences( // String velocityFragment, Collection<String> expRefs, boolean failOnUnExpectedRef) { // // Map<String, Integer> refCount = new HashMap<>(); // for (String expRef : expRefs) { // refCount.put(expRef, 0); // } // // // this should really work like a parser to be able to exclude variables defined in the // // templates from those that need to be in the context // // now those kind of variables need to be added in the expRefs // // // in principle variables could probably contain also at least // // numbers and '_', update when needed // Pattern velocityLongKeyPattern = Pattern.compile("\\$\\{([a-zA-Z.]+)\\}"); // Matcher velocityLongKeys = velocityLongKeyPattern.matcher(velocityFragment); // // Pattern velocityShortKeyPattern = Pattern.compile("\\$([a-zA-Z.]+)"); // Matcher velocityShortKeys = velocityShortKeyPattern.matcher(velocityFragment); // // List<String> foundRefs = new LinkedList<>(); // // while (velocityLongKeys.find()) { // foundRefs.add(velocityLongKeys.group(1)); // } // while (velocityShortKeys.find()) { // foundRefs.add(velocityShortKeys.group(1)); // } // // for (String refKey : foundRefs) { // // Integer currCount = refCount.get(refKey); // // if (currCount == null) { // unexpected refKey // if (failOnUnExpectedRef) { // throw new AssertionError("Found velocity variable referencing key <" + refKey + "> that was not " + // "in the list of expected keys (" + expRefs + ")"); // } // } else { // refCount.put(refKey, currCount + 1); // } // // } // // return refCount; // } // // // /** // * Test that the properties used in the template file in given path come from the actionClass // * ({@link #extractPossibleVelocityKeys(Class, String) extractPossibleVelocityKeys()} is used with "action" as prefix) // * or from the list of extraProps known to be available (eg. properties defined inside the template). // * // * @param actionClass (action) class to test // * @param templatePath path from which to load the template // * @param extraProps list of extra property names known to be available in the context where the template will be used // * @throws Exception eg. if the template is not found // */ // public static void testActionClassHasTemplateProps( // Class<?> actionClass, String templatePath, String... extraProps) throws Exception { // // try (InputStream templateStream = // SparkTestUtils.class.getClassLoader() // .getResourceAsStream(templatePath)) { // String template = IOUtils.toString(templateStream, "UTF-8"); // // Set<String> possVariables = extractPossibleVelocityKeys(actionClass, "action"); // // Collections.addAll(possVariables, extraProps); // // checkVelocityFragmentReferences(template, possVariables, true); // } // // } // // }
import com.k15t.spark.base.util.SparkTestUtils; import org.junit.Test;
package com.k15t.spark.confluence; public class SparkConfluenceActionTemplatesTest { // some simple tests meant to act as an extra reminder to keep templates and actions using them in sync @Test public void confluenceSpaceAppActionWorksWithDefaultTemplate() throws Exception {
// Path: spark-common/src/main/java/com/k15t/spark/base/util/SparkTestUtils.java // public class SparkTestUtils { // // /** // * Extracts property names that could be used in a Velocity template from the public methods (including inherited ones) // * of the class using the patterns get... or is... // * // * @param clazz {@link Class} from which to extract the get... and is... methods // * @param prefix prefix to add to all properties, eg. getProp -> prefix.prop and prefix.Prop // * @return a set of strings that could be used as property names in a Velocity template when // * an object of the class is (a part of) the context // */ // public static Set<String> extractPossibleVelocityKeys(Class<?> clazz, String prefix) { // // HashSet<String> res = new HashSet<>(); // // // getMethods() returns only public methods, including inherited ones (no further checks needed) // for (Method method : clazz.getMethods()) { // String methodName = method.getName(); // String rest = null; // if (methodName.startsWith("get")) { // rest = methodName.substring("get".length()); // // } else if (methodName.startsWith("is")) { // rest = methodName.substring("is".length()); // } // if (rest != null) { // if ("".equals(rest)) { // throw new IllegalArgumentException("Method does not handle classes using get(\"property\""); // } else { // res.add(prefix + "." + rest.substring(0, 1).toLowerCase() + rest.substring(1)); // res.add(prefix + "." + rest.substring(0, 1).toUpperCase() + rest.substring(1)); // } // } // } // // return res; // } // // // /** // * Extracts the variable references from velocity template fragment ($variable or ${variable}) and // * counts how many times each of the variable names in the expRefs list is present in the fragment. // * // * @param velocityFragment fragment from which to extract variables // * @param expRefs list of variable names to count (that are expected to be used in the fragment) // * @param failOnUnExpectedRef if true, calls Assert.fail() when encountering a variable name not in the 'expRefs' list // * @return map from variable name to int, from variable names in 'expRefs' list to time used in the fragment // */ // public static Map<String, Integer> checkVelocityFragmentReferences( // String velocityFragment, Collection<String> expRefs, boolean failOnUnExpectedRef) { // // Map<String, Integer> refCount = new HashMap<>(); // for (String expRef : expRefs) { // refCount.put(expRef, 0); // } // // // this should really work like a parser to be able to exclude variables defined in the // // templates from those that need to be in the context // // now those kind of variables need to be added in the expRefs // // // in principle variables could probably contain also at least // // numbers and '_', update when needed // Pattern velocityLongKeyPattern = Pattern.compile("\\$\\{([a-zA-Z.]+)\\}"); // Matcher velocityLongKeys = velocityLongKeyPattern.matcher(velocityFragment); // // Pattern velocityShortKeyPattern = Pattern.compile("\\$([a-zA-Z.]+)"); // Matcher velocityShortKeys = velocityShortKeyPattern.matcher(velocityFragment); // // List<String> foundRefs = new LinkedList<>(); // // while (velocityLongKeys.find()) { // foundRefs.add(velocityLongKeys.group(1)); // } // while (velocityShortKeys.find()) { // foundRefs.add(velocityShortKeys.group(1)); // } // // for (String refKey : foundRefs) { // // Integer currCount = refCount.get(refKey); // // if (currCount == null) { // unexpected refKey // if (failOnUnExpectedRef) { // throw new AssertionError("Found velocity variable referencing key <" + refKey + "> that was not " + // "in the list of expected keys (" + expRefs + ")"); // } // } else { // refCount.put(refKey, currCount + 1); // } // // } // // return refCount; // } // // // /** // * Test that the properties used in the template file in given path come from the actionClass // * ({@link #extractPossibleVelocityKeys(Class, String) extractPossibleVelocityKeys()} is used with "action" as prefix) // * or from the list of extraProps known to be available (eg. properties defined inside the template). // * // * @param actionClass (action) class to test // * @param templatePath path from which to load the template // * @param extraProps list of extra property names known to be available in the context where the template will be used // * @throws Exception eg. if the template is not found // */ // public static void testActionClassHasTemplateProps( // Class<?> actionClass, String templatePath, String... extraProps) throws Exception { // // try (InputStream templateStream = // SparkTestUtils.class.getClassLoader() // .getResourceAsStream(templatePath)) { // String template = IOUtils.toString(templateStream, "UTF-8"); // // Set<String> possVariables = extractPossibleVelocityKeys(actionClass, "action"); // // Collections.addAll(possVariables, extraProps); // // checkVelocityFragmentReferences(template, possVariables, true); // } // // } // // } // Path: spark-confluence/src/test/java/com/k15t/spark/confluence/SparkConfluenceActionTemplatesTest.java import com.k15t.spark.base.util.SparkTestUtils; import org.junit.Test; package com.k15t.spark.confluence; public class SparkConfluenceActionTemplatesTest { // some simple tests meant to act as an extra reminder to keep templates and actions using them in sync @Test public void confluenceSpaceAppActionWorksWithDefaultTemplate() throws Exception {
SparkTestUtils.testActionClassHasTemplateProps(
K15t/spark
spark-common/src/test/java/com/k15t/spark/base/util/UrlUtilTest.java
// Path: spark-common/src/main/java/com/k15t/spark/base/util/UrlUtil.java // public static String rebaseUrl(String baseUrl, String relativeUrl) { // StringBuilder url = new StringBuilder(StringUtils.removeEnd(baseUrl, "/")); // // if (StringUtils.isNotEmpty(relativeUrl)) { // List<String> segments = new ArrayList<>(); // segments.addAll(Arrays.asList(StringUtils.split(StringUtils.defaultString(relativeUrl), '/'))); // for (String segment : segments) { // url.append("/").append(segment); // } // // Add trailing slash if required. // if (StringUtils.endsWith(relativeUrl, "/")) { // url.append("/"); // } // } else if (StringUtils.endsWith(baseUrl, "/")) { // url.append("/"); // } // // return url.toString(); // }
import org.junit.Test; import static com.k15t.spark.base.util.UrlUtil.rebaseUrl; import static org.junit.Assert.assertEquals;
package com.k15t.spark.base.util; public class UrlUtilTest { @Test public void rebaseUrlTest() throws Exception {
// Path: spark-common/src/main/java/com/k15t/spark/base/util/UrlUtil.java // public static String rebaseUrl(String baseUrl, String relativeUrl) { // StringBuilder url = new StringBuilder(StringUtils.removeEnd(baseUrl, "/")); // // if (StringUtils.isNotEmpty(relativeUrl)) { // List<String> segments = new ArrayList<>(); // segments.addAll(Arrays.asList(StringUtils.split(StringUtils.defaultString(relativeUrl), '/'))); // for (String segment : segments) { // url.append("/").append(segment); // } // // Add trailing slash if required. // if (StringUtils.endsWith(relativeUrl, "/")) { // url.append("/"); // } // } else if (StringUtils.endsWith(baseUrl, "/")) { // url.append("/"); // } // // return url.toString(); // } // Path: spark-common/src/test/java/com/k15t/spark/base/util/UrlUtilTest.java import org.junit.Test; import static com.k15t.spark.base.util.UrlUtil.rebaseUrl; import static org.junit.Assert.assertEquals; package com.k15t.spark.base.util; public class UrlUtilTest { @Test public void rebaseUrlTest() throws Exception {
assertEquals("https://dummy:123/wiki", rebaseUrl("https://dummy:123/wiki", ""));
K15t/spark
spark-common/src/main/java/com/k15t/spark/base/AppServlet.java
// Path: spark-common/src/main/java/com/k15t/spark/base/util/NgTranslateMessageBundleProvider.java // public class NgTranslateMessageBundleProvider implements MessageBundleProvider { // // private static final Logger logger = LoggerFactory.getLogger(NgTranslateMessageBundleProvider.class); // // private String msgBundleResourcePath; // // // public NgTranslateMessageBundleProvider(String msgBundleResourcePath) { // this.msgBundleResourcePath = msgBundleResourcePath; // } // // // @Override // public boolean isMessageBundle(RequestProperties props) { // // if (msgBundleResourcePath != null) { // return props.getLocalPath() != null && (this.msgBundleResourcePath).endsWith(props.getLocalPath()); // } // // return false; // } // // // @Override // public String loadBundle(RequestProperties props) { // // ResourceBundle rb; // Locale locale = props.getLocale(); // if (locale != null) { // logger.debug("Use local {} to load bundle from {}", locale, msgBundleResourcePath); // rb = ResourceBundle.getBundle(msgBundleResourcePath, locale, new ResourceBundle.Control() { // @Override // public Locale getFallbackLocale(String baseName, Locale locale) { // return Locale.ROOT; // } // }); // } else { // logger.debug("Use local {} to load bundle from {}", Locale.getDefault(), msgBundleResourcePath); // rb = ResourceBundle.getBundle(msgBundleResourcePath); // } // ObjectMapper mapper = new ObjectMapper(); // ObjectNode i18Properties = mapper.createObjectNode(); // for (String key : rb.keySet()) { // i18Properties.put(key, convertValue(rb.getString(key))); // } // // return i18Properties.toString(); // } // // // @Override // public String getContentType() { // return "application/json"; // } // // // /** // * Converts the value to work with ng-translate. Overwrite this method to enforce a custom transformation. // */ // protected String convertValue(String value) { // return value.replaceAll("\\{(\\d)\\}", "{{_$1}}").replaceAll("''", "'"); // } // // }
import com.k15t.spark.base.util.NgTranslateMessageBundleProvider; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashSet; import java.util.Set;
package com.k15t.spark.base; /** * <p>Serves resources.</p> * <p>As an example, this servlet is supposed to be listening to the URL pattern <code>https://example.com/servlet/**</code>. * Inside the classpath, there is a directory <code>/webapp</code> that contains a web application. The file * <code>/scripts/test.js</code> from this directory can be accessed using the following two URLs: * <code>https://example.com/servlet/scripts/test.js</code> and * <code>https://example.com/servlet/_/&lt;deploymentNumber&gt;/&lt;localeKey&gt;/scripts/test.js</code>.</p> * <p>The following terminology will be used in this code:</p> * <ul> * <li><code>resourcePath</code> is <code>&quot;/webapp/&quot;</code></li> * <li><code>cacheKey</code> would be <code>&quot;_/&lt;deploymentNumber&gt;/&lt;localeKey&gt;/&quot;</code> in the * second URL</li> * <li><code>localPath</code> is <code>&quot;scripts/test.js</code></li> * <li><code>localUrlPart</code> is <code>&quot;/scripts/test.js</code> in the first example, * <code>/_/&lt;deploymentNumber&gt;/&lt;localeKey&gt;/scripts/test.js</code> in the second.</li> * </ul> */ public abstract class AppServlet extends HttpServlet { protected final Set<String> VELOCITY_TYPES = Collections.unmodifiableSet(new HashSet<String>() {{ add("text/html"); }}); private MessageBundleProvider messageBundleProvider; private String resourcePath; @Override public void init() throws ServletException { resourcePath = getServletConfig().getInitParameter(Keys.RESOURCE_PATH); if (resourcePath == null) { throw new ServletException(Keys.RESOURCE_PATH + " parameter is not defined"); } if (!"/".equals(resourcePath.substring(resourcePath.length() - 1))) { resourcePath = resourcePath + "/"; } this.messageBundleProvider = initMessageBundleProvider(); } protected MessageBundleProvider initMessageBundleProvider() { String msgBundleResourcePath = getServletConfig().getInitParameter(Keys.NG_TRANS_MSG_BUNDLE); if (msgBundleResourcePath != null) {
// Path: spark-common/src/main/java/com/k15t/spark/base/util/NgTranslateMessageBundleProvider.java // public class NgTranslateMessageBundleProvider implements MessageBundleProvider { // // private static final Logger logger = LoggerFactory.getLogger(NgTranslateMessageBundleProvider.class); // // private String msgBundleResourcePath; // // // public NgTranslateMessageBundleProvider(String msgBundleResourcePath) { // this.msgBundleResourcePath = msgBundleResourcePath; // } // // // @Override // public boolean isMessageBundle(RequestProperties props) { // // if (msgBundleResourcePath != null) { // return props.getLocalPath() != null && (this.msgBundleResourcePath).endsWith(props.getLocalPath()); // } // // return false; // } // // // @Override // public String loadBundle(RequestProperties props) { // // ResourceBundle rb; // Locale locale = props.getLocale(); // if (locale != null) { // logger.debug("Use local {} to load bundle from {}", locale, msgBundleResourcePath); // rb = ResourceBundle.getBundle(msgBundleResourcePath, locale, new ResourceBundle.Control() { // @Override // public Locale getFallbackLocale(String baseName, Locale locale) { // return Locale.ROOT; // } // }); // } else { // logger.debug("Use local {} to load bundle from {}", Locale.getDefault(), msgBundleResourcePath); // rb = ResourceBundle.getBundle(msgBundleResourcePath); // } // ObjectMapper mapper = new ObjectMapper(); // ObjectNode i18Properties = mapper.createObjectNode(); // for (String key : rb.keySet()) { // i18Properties.put(key, convertValue(rb.getString(key))); // } // // return i18Properties.toString(); // } // // // @Override // public String getContentType() { // return "application/json"; // } // // // /** // * Converts the value to work with ng-translate. Overwrite this method to enforce a custom transformation. // */ // protected String convertValue(String value) { // return value.replaceAll("\\{(\\d)\\}", "{{_$1}}").replaceAll("''", "'"); // } // // } // Path: spark-common/src/main/java/com/k15t/spark/base/AppServlet.java import com.k15t.spark.base.util.NgTranslateMessageBundleProvider; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.HashSet; import java.util.Set; package com.k15t.spark.base; /** * <p>Serves resources.</p> * <p>As an example, this servlet is supposed to be listening to the URL pattern <code>https://example.com/servlet/**</code>. * Inside the classpath, there is a directory <code>/webapp</code> that contains a web application. The file * <code>/scripts/test.js</code> from this directory can be accessed using the following two URLs: * <code>https://example.com/servlet/scripts/test.js</code> and * <code>https://example.com/servlet/_/&lt;deploymentNumber&gt;/&lt;localeKey&gt;/scripts/test.js</code>.</p> * <p>The following terminology will be used in this code:</p> * <ul> * <li><code>resourcePath</code> is <code>&quot;/webapp/&quot;</code></li> * <li><code>cacheKey</code> would be <code>&quot;_/&lt;deploymentNumber&gt;/&lt;localeKey&gt;/&quot;</code> in the * second URL</li> * <li><code>localPath</code> is <code>&quot;scripts/test.js</code></li> * <li><code>localUrlPart</code> is <code>&quot;/scripts/test.js</code> in the first example, * <code>/_/&lt;deploymentNumber&gt;/&lt;localeKey&gt;/scripts/test.js</code> in the second.</li> * </ul> */ public abstract class AppServlet extends HttpServlet { protected final Set<String> VELOCITY_TYPES = Collections.unmodifiableSet(new HashSet<String>() {{ add("text/html"); }}); private MessageBundleProvider messageBundleProvider; private String resourcePath; @Override public void init() throws ServletException { resourcePath = getServletConfig().getInitParameter(Keys.RESOURCE_PATH); if (resourcePath == null) { throw new ServletException(Keys.RESOURCE_PATH + " parameter is not defined"); } if (!"/".equals(resourcePath.substring(resourcePath.length() - 1))) { resourcePath = resourcePath + "/"; } this.messageBundleProvider = initMessageBundleProvider(); } protected MessageBundleProvider initMessageBundleProvider() { String msgBundleResourcePath = getServletConfig().getInitParameter(Keys.NG_TRANS_MSG_BUNDLE); if (msgBundleResourcePath != null) {
return new NgTranslateMessageBundleProvider(msgBundleResourcePath);
K15t/spark
spark-jira/src/main/java/com/k15t/spark/jira/JiraAppAction.java
// Path: spark-common/src/main/java/com/k15t/spark/base/Keys.java // public class Keys { // // /** // * The param key used in the atlassian-plugin.xml servlet or xwork configuration. // */ // public static final String RESOURCE_PATH = "resource-path"; // // /** // * The system property key to be used for the SPARK development directory. Must contain a comma-separated list of absolute paths // * representing the base directories to which the app resource paths are relative to. Rule of thumb: one directory for each plugin. // * // * @see AppServlet#loadFromDevelopmentDirectory(java.lang.String) // */ // public static final String SPARK_DEV_RESOURCE_DIRECTORIES = "spark.dev.dir"; // // /** // * Param key to configure to use a specific message bundle provider for using ng-translate. // */ // public static final String NG_TRANS_MSG_BUNDLE = "ng-translate-message-bundle"; // // /** // * The param key used in the atlassian-plugin.xml action or servlet configuration for specifying the item to select // * in the admin side menu // */ // public static final String SPARK_SELECTED_WEB_ITEM_KEY = "spark-selected-web-item-key"; // // /** // * The param key used in the atlassian-plugin.xml action or servlet configuration for specifying the SPA base url. // */ // public static final String SPARK_SPA_BASE_URL = "spark-spa-base-url"; // // /** // * <p> // * The param key used in the atlassian-plugin.xml for specifying a list of resources that should be required // * when loading certain SPARK action. // * </p><p> // * The parameter value should be a comma-separated list of complete web-resource module keys // * </p> // */ // public static final String SPARK_REQUIRED_WEB_RESOURCE_KEYS = "spark-required-web-resource-keys"; // // }
import com.atlassian.jira.config.properties.JiraSystemProperties; import com.atlassian.jira.web.action.JiraWebActionSupport; import com.k15t.spark.base.Keys; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import webwork.action.ServletActionContext; import java.io.File; import java.io.IOException; import java.io.InputStream;
Document document = Jsoup.parse(indexHtml, "UTF-8", ""); this.title = document.title(); this.body = prepareBody(document); } } catch (IOException e) { logger.error("Error parsing HTML of template '" + indexHtmlPath + "'.", e); this.title = "Error loading index.html"; this.body = "<p>Error parsing HTML of template '" + indexHtmlPath + "':<br/>" + e.getMessage() + "</p><pre>" + ExceptionUtils.getStackTrace(e) + "</pre>"; } } private InputStream loadIndexHtml(String indexHtmlPath) throws IOException { if (JiraSystemProperties.isDevMode()) { InputStream dev = loadFromDevelopmentDirectory(indexHtmlPath); if (dev != null) { return dev; } } return getClass().getClassLoader().getResourceAsStream(indexHtmlPath); } protected InputStream loadFromDevelopmentDirectory(String localPath) throws IOException { InputStream fileIn = null;
// Path: spark-common/src/main/java/com/k15t/spark/base/Keys.java // public class Keys { // // /** // * The param key used in the atlassian-plugin.xml servlet or xwork configuration. // */ // public static final String RESOURCE_PATH = "resource-path"; // // /** // * The system property key to be used for the SPARK development directory. Must contain a comma-separated list of absolute paths // * representing the base directories to which the app resource paths are relative to. Rule of thumb: one directory for each plugin. // * // * @see AppServlet#loadFromDevelopmentDirectory(java.lang.String) // */ // public static final String SPARK_DEV_RESOURCE_DIRECTORIES = "spark.dev.dir"; // // /** // * Param key to configure to use a specific message bundle provider for using ng-translate. // */ // public static final String NG_TRANS_MSG_BUNDLE = "ng-translate-message-bundle"; // // /** // * The param key used in the atlassian-plugin.xml action or servlet configuration for specifying the item to select // * in the admin side menu // */ // public static final String SPARK_SELECTED_WEB_ITEM_KEY = "spark-selected-web-item-key"; // // /** // * The param key used in the atlassian-plugin.xml action or servlet configuration for specifying the SPA base url. // */ // public static final String SPARK_SPA_BASE_URL = "spark-spa-base-url"; // // /** // * <p> // * The param key used in the atlassian-plugin.xml for specifying a list of resources that should be required // * when loading certain SPARK action. // * </p><p> // * The parameter value should be a comma-separated list of complete web-resource module keys // * </p> // */ // public static final String SPARK_REQUIRED_WEB_RESOURCE_KEYS = "spark-required-web-resource-keys"; // // } // Path: spark-jira/src/main/java/com/k15t/spark/jira/JiraAppAction.java import com.atlassian.jira.config.properties.JiraSystemProperties; import com.atlassian.jira.web.action.JiraWebActionSupport; import com.k15t.spark.base.Keys; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.exception.ExceptionUtils; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import webwork.action.ServletActionContext; import java.io.File; import java.io.IOException; import java.io.InputStream; Document document = Jsoup.parse(indexHtml, "UTF-8", ""); this.title = document.title(); this.body = prepareBody(document); } } catch (IOException e) { logger.error("Error parsing HTML of template '" + indexHtmlPath + "'.", e); this.title = "Error loading index.html"; this.body = "<p>Error parsing HTML of template '" + indexHtmlPath + "':<br/>" + e.getMessage() + "</p><pre>" + ExceptionUtils.getStackTrace(e) + "</pre>"; } } private InputStream loadIndexHtml(String indexHtmlPath) throws IOException { if (JiraSystemProperties.isDevMode()) { InputStream dev = loadFromDevelopmentDirectory(indexHtmlPath); if (dev != null) { return dev; } } return getClass().getClassLoader().getResourceAsStream(indexHtmlPath); } protected InputStream loadFromDevelopmentDirectory(String localPath) throws IOException { InputStream fileIn = null;
String resourceDirectoryPaths = System.getProperty(Keys.SPARK_DEV_RESOURCE_DIRECTORIES);
geosolutions-it/geonetwork-manager
src/test/java/it/geosolutions/geonetwork/online/GeonetworkOnlineTests.java
// Path: src/main/java/it/geosolutions/geonetwork/util/GNVersion.java // public enum GNVersion // { // V26(26), // V28(28), // V210(210), // V3(3); // // private final int numvalue; // // private GNVersion(int numvalue) { // this.numvalue = numvalue; // } // // public static GNVersion get(int version) { // for (GNVersion v : GNVersion.values()) { // if(version == v.numvalue) { // return v; // } // } // return null; // } // }
import it.geosolutions.geonetwork.util.GNVersion; import java.util.Properties; import org.apache.log4j.Logger; import org.geotools.test.OnlineTestSupport;
/* * GeoNetwork-Manager - Simple Manager Library for GeoNetwork * * Copyright (C) 2007,2016 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package it.geosolutions.geonetwork.online; /** * * Utility class to enrich the {@link GeonetworkTest} base test class with the GeoTools OnlineTestCase behaviour. * see http://docs.geotools.org/latest/developer/conventions/test/online.html for more info * * @author DamianoG (damiano.giampaoli at geo-solutions.it) */ public class GeonetworkOnlineTests extends OnlineTestSupport{ private final static Logger LOGGER = Logger.getLogger(GeonetworkOnlineTests.class);
// Path: src/main/java/it/geosolutions/geonetwork/util/GNVersion.java // public enum GNVersion // { // V26(26), // V28(28), // V210(210), // V3(3); // // private final int numvalue; // // private GNVersion(int numvalue) { // this.numvalue = numvalue; // } // // public static GNVersion get(int version) { // for (GNVersion v : GNVersion.values()) { // if(version == v.numvalue) { // return v; // } // } // return null; // } // } // Path: src/test/java/it/geosolutions/geonetwork/online/GeonetworkOnlineTests.java import it.geosolutions.geonetwork.util.GNVersion; import java.util.Properties; import org.apache.log4j.Logger; import org.geotools.test.OnlineTestSupport; /* * GeoNetwork-Manager - Simple Manager Library for GeoNetwork * * Copyright (C) 2007,2016 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package it.geosolutions.geonetwork.online; /** * * Utility class to enrich the {@link GeonetworkTest} base test class with the GeoTools OnlineTestCase behaviour. * see http://docs.geotools.org/latest/developer/conventions/test/online.html for more info * * @author DamianoG (damiano.giampaoli at geo-solutions.it) */ public class GeonetworkOnlineTests extends OnlineTestSupport{ private final static Logger LOGGER = Logger.getLogger(GeonetworkOnlineTests.class);
protected GNVersion gnv;
geosolutions-it/geonetwork-manager
src/main/java/it/geosolutions/geonetwork/GN28Client.java
// Path: src/main/java/it/geosolutions/geonetwork/util/GNVersion.java // public enum GNVersion // { // V26(26), // V28(28), // V210(210), // V3(3); // // private final int numvalue; // // private GNVersion(int numvalue) { // this.numvalue = numvalue; // } // // public static GNVersion get(int version) { // for (GNVersion v : GNVersion.values()) { // if(version == v.numvalue) { // return v; // } // } // return null; // } // }
import org.apache.log4j.Logger; import it.geosolutions.geonetwork.util.GNVersion;
/* * GeoNetwork-Manager - Simple Manager Library for GeoNetwork * * Copyright (C) 2016 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package it.geosolutions.geonetwork; /** * @author ETj (etj at geo-solutions.it) */ public class GN28Client extends GN2xClient { private final static Logger LOGGER = Logger.getLogger(GN28Client.class); public GN28Client(String serviceURL) { this(serviceURL, null, null); } public GN28Client(String serviceURL, String username, String password) {
// Path: src/main/java/it/geosolutions/geonetwork/util/GNVersion.java // public enum GNVersion // { // V26(26), // V28(28), // V210(210), // V3(3); // // private final int numvalue; // // private GNVersion(int numvalue) { // this.numvalue = numvalue; // } // // public static GNVersion get(int version) { // for (GNVersion v : GNVersion.values()) { // if(version == v.numvalue) { // return v; // } // } // return null; // } // } // Path: src/main/java/it/geosolutions/geonetwork/GN28Client.java import org.apache.log4j.Logger; import it.geosolutions.geonetwork.util.GNVersion; /* * GeoNetwork-Manager - Simple Manager Library for GeoNetwork * * Copyright (C) 2016 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package it.geosolutions.geonetwork; /** * @author ETj (etj at geo-solutions.it) */ public class GN28Client extends GN2xClient { private final static Logger LOGGER = Logger.getLogger(GN28Client.class); public GN28Client(String serviceURL) { this(serviceURL, null, null); } public GN28Client(String serviceURL, String username, String password) {
super(GNVersion.V28, serviceURL, username, password);
geosolutions-it/geonetwork-manager
src/main/java/it/geosolutions/geonetwork/GN26Client.java
// Path: src/main/java/it/geosolutions/geonetwork/util/GNVersion.java // public enum GNVersion // { // V26(26), // V28(28), // V210(210), // V3(3); // // private final int numvalue; // // private GNVersion(int numvalue) { // this.numvalue = numvalue; // } // // public static GNVersion get(int version) { // for (GNVersion v : GNVersion.values()) { // if(version == v.numvalue) { // return v; // } // } // return null; // } // }
import org.apache.log4j.Logger; import it.geosolutions.geonetwork.util.GNVersion;
/* * GeoNetwork-Manager - Simple Manager Library for GeoNetwork * * Copyright (C) 2016 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package it.geosolutions.geonetwork; /** * @author ETj (etj at geo-solutions.it) */ public class GN26Client extends GN2xClient { private final static Logger LOGGER = Logger.getLogger(GN26Client.class); public GN26Client(String serviceURL) { this(serviceURL, null, null); } public GN26Client(String serviceURL, String username, String password) {
// Path: src/main/java/it/geosolutions/geonetwork/util/GNVersion.java // public enum GNVersion // { // V26(26), // V28(28), // V210(210), // V3(3); // // private final int numvalue; // // private GNVersion(int numvalue) { // this.numvalue = numvalue; // } // // public static GNVersion get(int version) { // for (GNVersion v : GNVersion.values()) { // if(version == v.numvalue) { // return v; // } // } // return null; // } // } // Path: src/main/java/it/geosolutions/geonetwork/GN26Client.java import org.apache.log4j.Logger; import it.geosolutions.geonetwork.util.GNVersion; /* * GeoNetwork-Manager - Simple Manager Library for GeoNetwork * * Copyright (C) 2016 GeoSolutions S.A.S. * http://www.geo-solutions.it * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package it.geosolutions.geonetwork; /** * @author ETj (etj at geo-solutions.it) */ public class GN26Client extends GN2xClient { private final static Logger LOGGER = Logger.getLogger(GN26Client.class); public GN26Client(String serviceURL) { this(serviceURL, null, null); } public GN26Client(String serviceURL, String username, String password) {
super(GNVersion.V26, serviceURL, username, password);
treeleafj/xDoc
samples/sample-springboot/src/main/java/org/treeleafj/xdoc/test/controller/UserController.java
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/User.java // public class User { // // /** // * 用户ID // */ // private String id; // // /** // * 用户名 // */ // private String username; // // /** // * 密码 // */ // private String password; // // public String getId() { // return id; // } // // public User setId(String id) { // this.id = id; // return this; // } // // public String getUsername() { // return username; // } // // public User setUsername(String username) { // this.username = username; // return this; // } // // public String getPassword() { // return password; // } // // public User setPassword(String password) { // this.password = password; // return this; // } // }
import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.treeleafj.xdoc.test.vo.User; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID;
package org.treeleafj.xdoc.test.controller; /** * 用户模块 * * @author leaf * @date 2017-03-03 10:11 */ @Controller @RequestMapping("user") public class UserController { /** * 登录 * * @param username 用户名|必填 * @param password 密码 * @return 当前登录用户的基本信息 * @resp code 返回码(0000表示登录成功,其它表示失败)|string|必填 * @resp msg 登录信息|string * @resp username 登录成功后返回的用户名|string */ @ResponseBody @PostMapping("login") public Map<String, String> login(String username, String password) { Map<String, String> model = new HashMap<>(); model.put("code", "0000"); model.put("msg", "登录成功"); model.put("username", username); return model; } /** * 用户注册 * * @param user :username 用户名|必填 * @param user :password 密码 * @return 注册后生成的用户的基本信息 * @respbody {"id":"123","password":"123456","username":"admin"} * @title 注册 * @see User * @resp score 分数 */ @ResponseBody @RequestMapping(value = "register", method = {RequestMethod.POST, RequestMethod.PUT})
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/User.java // public class User { // // /** // * 用户ID // */ // private String id; // // /** // * 用户名 // */ // private String username; // // /** // * 密码 // */ // private String password; // // public String getId() { // return id; // } // // public User setId(String id) { // this.id = id; // return this; // } // // public String getUsername() { // return username; // } // // public User setUsername(String username) { // this.username = username; // return this; // } // // public String getPassword() { // return password; // } // // public User setPassword(String password) { // this.password = password; // return this; // } // } // Path: samples/sample-springboot/src/main/java/org/treeleafj/xdoc/test/controller/UserController.java import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import org.treeleafj.xdoc.test.vo.User; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.UUID; package org.treeleafj.xdoc.test.controller; /** * 用户模块 * * @author leaf * @date 2017-03-03 10:11 */ @Controller @RequestMapping("user") public class UserController { /** * 登录 * * @param username 用户名|必填 * @param password 密码 * @return 当前登录用户的基本信息 * @resp code 返回码(0000表示登录成功,其它表示失败)|string|必填 * @resp msg 登录信息|string * @resp username 登录成功后返回的用户名|string */ @ResponseBody @PostMapping("login") public Map<String, String> login(String username, String password) { Map<String, String> model = new HashMap<>(); model.put("code", "0000"); model.put("msg", "登录成功"); model.put("username", username); return model; } /** * 用户注册 * * @param user :username 用户名|必填 * @param user :password 密码 * @return 注册后生成的用户的基本信息 * @respbody {"id":"123","password":"123456","username":"admin"} * @title 注册 * @see User * @resp score 分数 */ @ResponseBody @RequestMapping(value = "register", method = {RequestMethod.POST, RequestMethod.PUT})
User register(org.treeleafj.xdoc.test.vo.User user, @RequestParam(value = "abc", required = false)List<MultipartFile> list) {
treeleafj/xDoc
samples/sample-springboot/src/main/java/org/treeleafj/xdoc/test/controller/AccountController.java
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/Account.java // @Data // public class Account { // // /** // * 账户ID,跟用户ID一致 // */ // private String id; // // /** // * 用户余额 // */ // private Double balance; // // /** // * 用户积分 // */ // private Integer score; // }
import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.treeleafj.xdoc.test.vo.Account; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Date; import java.util.UUID; import java.util.concurrent.Callable;
package org.treeleafj.xdoc.test.controller; /** * 用户账户模块 * * @author leaf * @date 2017-03-10 10:43 */ @Controller @RequestMapping("api/account") public class AccountController { private Logger log = LoggerFactory.getLogger(AccountController.class); /** * 获取当前登录用户的账户资产信息,用户不存在会返回code为9999的错误信息,见:https://github.com/treeleafj/xDoc * * @param type 账户类型(1-普通账户)|必填 * @param balance 重写@paramObj中AccountEx的balance的注释 * @paramObj AccountEx * @return 用户的资产 * @title 查询用户资产 * @resp balance 账户余额|double * @see org.treeleafj.xdoc.test.vo.AccountEx */ @ResponseBody @RequestMapping(value = "info", method = RequestMethod.POST)
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/Account.java // @Data // public class Account { // // /** // * 账户ID,跟用户ID一致 // */ // private String id; // // /** // * 用户余额 // */ // private Double balance; // // /** // * 用户积分 // */ // private Integer score; // } // Path: samples/sample-springboot/src/main/java/org/treeleafj/xdoc/test/controller/AccountController.java import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.treeleafj.xdoc.test.vo.Account; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Date; import java.util.UUID; import java.util.concurrent.Callable; package org.treeleafj.xdoc.test.controller; /** * 用户账户模块 * * @author leaf * @date 2017-03-10 10:43 */ @Controller @RequestMapping("api/account") public class AccountController { private Logger log = LoggerFactory.getLogger(AccountController.class); /** * 获取当前登录用户的账户资产信息,用户不存在会返回code为9999的错误信息,见:https://github.com/treeleafj/xDoc * * @param type 账户类型(1-普通账户)|必填 * @param balance 重写@paramObj中AccountEx的balance的注释 * @paramObj AccountEx * @return 用户的资产 * @title 查询用户资产 * @resp balance 账户余额|double * @see org.treeleafj.xdoc.test.vo.AccountEx */ @ResponseBody @RequestMapping(value = "info", method = RequestMethod.POST)
Account info(String type) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamObjTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamObjTagImpl.java // public class ParamObjTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public ParamObjTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/SeeTagImpl.java // public class SeeTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public SeeTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamObjTagImpl; import org.treeleafj.xdoc.tag.SeeTagImpl;
package org.treeleafj.xdoc.resolver.javaparser.converter; public class ParamObjTagConverter extends SeeTagConverter { @Override
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamObjTagImpl.java // public class ParamObjTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public ParamObjTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/SeeTagImpl.java // public class SeeTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public SeeTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamObjTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamObjTagImpl; import org.treeleafj.xdoc.tag.SeeTagImpl; package org.treeleafj.xdoc.resolver.javaparser.converter; public class ParamObjTagConverter extends SeeTagConverter { @Override
public DocTag converter(String comment) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamObjTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamObjTagImpl.java // public class ParamObjTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public ParamObjTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/SeeTagImpl.java // public class SeeTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public SeeTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamObjTagImpl; import org.treeleafj.xdoc.tag.SeeTagImpl;
package org.treeleafj.xdoc.resolver.javaparser.converter; public class ParamObjTagConverter extends SeeTagConverter { @Override public DocTag converter(String comment) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamObjTagImpl.java // public class ParamObjTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public ParamObjTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/SeeTagImpl.java // public class SeeTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public SeeTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamObjTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamObjTagImpl; import org.treeleafj.xdoc.tag.SeeTagImpl; package org.treeleafj.xdoc.resolver.javaparser.converter; public class ParamObjTagConverter extends SeeTagConverter { @Override public DocTag converter(String comment) {
SeeTagImpl seeTag = (SeeTagImpl) super.converter(comment);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamObjTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamObjTagImpl.java // public class ParamObjTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public ParamObjTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/SeeTagImpl.java // public class SeeTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public SeeTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamObjTagImpl; import org.treeleafj.xdoc.tag.SeeTagImpl;
package org.treeleafj.xdoc.resolver.javaparser.converter; public class ParamObjTagConverter extends SeeTagConverter { @Override public DocTag converter(String comment) { SeeTagImpl seeTag = (SeeTagImpl) super.converter(comment); if (seeTag != null) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamObjTagImpl.java // public class ParamObjTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public ParamObjTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/SeeTagImpl.java // public class SeeTagImpl extends DocTag<ObjectInfo> { // // private ObjectInfo objectInfo; // // public SeeTagImpl(String tagName, ObjectInfo objectInfo) { // super(tagName); // this.objectInfo = objectInfo; // } // // @Override // public ObjectInfo getValues() { // return objectInfo; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamObjTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamObjTagImpl; import org.treeleafj.xdoc.tag.SeeTagImpl; package org.treeleafj.xdoc.resolver.javaparser.converter; public class ParamObjTagConverter extends SeeTagConverter { @Override public DocTag converter(String comment) { SeeTagImpl seeTag = (SeeTagImpl) super.converter(comment); if (seeTag != null) {
return new ParamObjTagImpl(seeTag.getTagName(), seeTag.getValues());
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // }
import lombok.Data; import org.apache.commons.lang3.StringUtils; import org.treeleafj.xdoc.utils.Constant;
package org.treeleafj.xdoc.tag; /** * 针对@Resp注释的内容封装 * * Created by leaf on 2017/3/12 0012. */ @Data public class RespTagImpl extends DocTag<String> { /** * 参数名 */ private String paramName; /** * 参数描述 */ private String paramDesc; /** * 是否必填,默认false */ private boolean require; /** * 类型 */ private String paramType; public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { super(tagName); this.paramName = paramName; this.paramDesc = paramDesc; this.paramType = paramType; this.require = require; } @Override public String getValues() { String s = paramName + " " + paramDesc; if (StringUtils.isNotBlank(paramType)) { s += " " + paramType; }
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java import lombok.Data; import org.apache.commons.lang3.StringUtils; import org.treeleafj.xdoc.utils.Constant; package org.treeleafj.xdoc.tag; /** * 针对@Resp注释的内容封装 * * Created by leaf on 2017/3/12 0012. */ @Data public class RespTagImpl extends DocTag<String> { /** * 参数名 */ private String paramName; /** * 参数描述 */ private String paramDesc; /** * 是否必填,默认false */ private boolean require; /** * 类型 */ private String paramType; public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { super(tagName); this.paramName = paramName; this.paramDesc = paramDesc; this.paramType = paramType; this.require = require; } @Override public String getValues() { String s = paramName + " " + paramDesc; if (StringUtils.isNotBlank(paramType)) { s += " " + paramType; }
s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH);
treeleafj/xDoc
samples/sample-springboot/src/test/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverterTest.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // }
import org.junit.Test; import org.treeleafj.xdoc.utils.JsonUtils;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * Created by leaf on 2018/3/8. */ public class ParamTagConverterTest { @Test public void converter() throws Exception { ParamTagConverter converter = new ParamTagConverter(); // String o = "@param type 账户类型(1-普通账户)|必填"; String o = "@param user :username 账户名称|必填";
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // } // Path: samples/sample-springboot/src/test/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverterTest.java import org.junit.Test; import org.treeleafj.xdoc.utils.JsonUtils; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * Created by leaf on 2018/3/8. */ public class ParamTagConverterTest { @Test public void converter() throws Exception { ParamTagConverter converter = new ParamTagConverter(); // String o = "@param type 账户类型(1-普通账户)|必填"; String o = "@param user :username 账户名称|必填";
System.out.println(JsonUtils.toJson(converter.converter("@param username 账户名称")));
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.utils.Constant;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@param的转换器 * @author leaf * @date 2017/3/4 */ public class ParamTagConverter extends DefaultJavaParserTagConverterImpl { @Override
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.utils.Constant; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@param的转换器 * @author leaf * @date 2017/3/4 */ public class ParamTagConverter extends DefaultJavaParserTagConverterImpl { @Override
public DocTag converter(String comment) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.utils.Constant;
//或者 "username 用户名|必填" 这种注释内容 //或者 "username 用户名|String|必填" 这种注释内容 //上面的"必填"两个字也可以换成英文的"Y" if (array.length > 0) { //先将第一个认为是参数名称 paramName = array[0]; if (array.length > 1) { int start = 1; if (array[1].startsWith(":") && array[1].length() > 1) { //获取 :username这种类型的参数名称 paramName = array[1].substring(1); start = 2; } StringBuilder sb = new StringBuilder(); for (int i = start; i < array.length; i++) { sb.append(array[i]).append(' '); } paramDesc = sb.toString(); } } String[] descs = paramDesc.split("\\|"); if (descs.length > 0) { paramDesc = descs[0]; if (descs.length > 2) { paramType = descs[1]; String requireString = descs[descs.length - 1].trim();
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.utils.Constant; //或者 "username 用户名|必填" 这种注释内容 //或者 "username 用户名|String|必填" 这种注释内容 //上面的"必填"两个字也可以换成英文的"Y" if (array.length > 0) { //先将第一个认为是参数名称 paramName = array[0]; if (array.length > 1) { int start = 1; if (array[1].startsWith(":") && array[1].length() > 1) { //获取 :username这种类型的参数名称 paramName = array[1].substring(1); start = 2; } StringBuilder sb = new StringBuilder(); for (int i = start; i < array.length; i++) { sb.append(array[i]).append(' '); } paramDesc = sb.toString(); } } String[] descs = paramDesc.split("\\|"); if (descs.length > 0) { paramDesc = descs[0]; if (descs.length > 2) { paramType = descs[1]; String requireString = descs[descs.length - 1].trim();
require = Constant.YES_ZH.equals(requireString) || Constant.YES_EN.equalsIgnoreCase(requireString);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.utils.Constant;
paramName = array[1].substring(1); start = 2; } StringBuilder sb = new StringBuilder(); for (int i = start; i < array.length; i++) { sb.append(array[i]).append(' '); } paramDesc = sb.toString(); } } String[] descs = paramDesc.split("\\|"); if (descs.length > 0) { paramDesc = descs[0]; if (descs.length > 2) { paramType = descs[1]; String requireString = descs[descs.length - 1].trim(); require = Constant.YES_ZH.equals(requireString) || Constant.YES_EN.equalsIgnoreCase(requireString); } else if (descs.length == 2) { String requireString = descs[1].trim(); require = Constant.YES_ZH.equals(requireString) || Constant.YES_EN.equalsIgnoreCase(requireString); //如果最后一个不是是否必填的描述,则认为是类型描述 if (!require && !(Constant.NOT_EN.equalsIgnoreCase(requireString) || Constant.NOT_ZH.equals(requireString))) { paramType = requireString; } } }
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/Constant.java // public class Constant { // // public static final String NOT_EN = "N"; // public static final String NOT_ZH = "非必填"; // public static final String YES_EN = "Y"; // public static final String YES_ZH = "必填"; // // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/ParamTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.utils.Constant; paramName = array[1].substring(1); start = 2; } StringBuilder sb = new StringBuilder(); for (int i = start; i < array.length; i++) { sb.append(array[i]).append(' '); } paramDesc = sb.toString(); } } String[] descs = paramDesc.split("\\|"); if (descs.length > 0) { paramDesc = descs[0]; if (descs.length > 2) { paramType = descs[1]; String requireString = descs[descs.length - 1].trim(); require = Constant.YES_ZH.equals(requireString) || Constant.YES_EN.equalsIgnoreCase(requireString); } else if (descs.length == 2) { String requireString = descs[1].trim(); require = Constant.YES_ZH.equals(requireString) || Constant.YES_EN.equalsIgnoreCase(requireString); //如果最后一个不是是否必填的描述,则认为是类型描述 if (!require && !(Constant.NOT_EN.equalsIgnoreCase(requireString) || Constant.NOT_ZH.equals(requireString))) { paramType = requireString; } } }
return new ParamTagImpl(docTag.getTagName(), paramName, paramDesc, paramType, require);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/DefaultJavaParserTagConverterImpl.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTagImpl.java // public class DocTagImpl extends DocTag<String> { // // private String value; // // public DocTagImpl(String tagName, String value) { // super(tagName); // this.value = value; // } // // @Override // public String getValues() { // return value; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/CommentUtils.java // public class CommentUtils { // // private static Pattern TAG_NAME_COMPILE = Pattern.compile("^@[\\w]+[\\t ]"); // // /** // * 获取注释的类型 // * // * @param comment 注释文本 // * @return @see @param @resp @return等 // */ // public static String getTagType(String comment) { // Matcher m = TAG_NAME_COMPILE.matcher(comment); // if (m.find()) { // return m.group().trim(); // } else { // return null; // } // } // // /** // * 解析基本的文本注释 // * // * @param comment 注释文本 // */ // public static String parseCommentText(String comment) { // List<String> comments = asCommentList(comment); // for (String s : comments) { // if (!s.startsWith("@")) { // return s; // } // } // return ""; // } // // /** // * 将注释转为多行文本 // * // * @param comment 注释文本 // */ // public static List<String> asCommentList(String comment) { // comment = comment.replaceAll("\\*", "").trim(); // String[] array = comment.split("\n"); // List<String> comments = new ArrayList(array.length); // int index = 0; // StringBuilder sb = new StringBuilder(); // for (; index < array.length; index++) { // String c = array[index].trim(); // // if (StringUtils.isBlank(c)) { // continue; // } // // String tagType = CommentUtils.getTagType(c); // if (StringUtils.isBlank(tagType)) { // sb.append(c); // sb.append("\n"); // } else { // break; // } // } // // if (sb.length() > 0) { // sb.deleteCharAt(sb.length() - 1); // comments.add(sb.toString()); // } // // for (int i = index; i < array.length; i++) { // String c = array[i].trim(); // if (StringUtils.isNotBlank(c)) { // comments.add(c); // } // } // return comments; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.DocTagImpl; import org.treeleafj.xdoc.utils.CommentUtils;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 基于JavaParser包的默认注释解析转换器 * * @author leaf * @date 2017/3/4 */ public class DefaultJavaParserTagConverterImpl implements JavaParserTagConverter<String> { @Override
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTagImpl.java // public class DocTagImpl extends DocTag<String> { // // private String value; // // public DocTagImpl(String tagName, String value) { // super(tagName); // this.value = value; // } // // @Override // public String getValues() { // return value; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/CommentUtils.java // public class CommentUtils { // // private static Pattern TAG_NAME_COMPILE = Pattern.compile("^@[\\w]+[\\t ]"); // // /** // * 获取注释的类型 // * // * @param comment 注释文本 // * @return @see @param @resp @return等 // */ // public static String getTagType(String comment) { // Matcher m = TAG_NAME_COMPILE.matcher(comment); // if (m.find()) { // return m.group().trim(); // } else { // return null; // } // } // // /** // * 解析基本的文本注释 // * // * @param comment 注释文本 // */ // public static String parseCommentText(String comment) { // List<String> comments = asCommentList(comment); // for (String s : comments) { // if (!s.startsWith("@")) { // return s; // } // } // return ""; // } // // /** // * 将注释转为多行文本 // * // * @param comment 注释文本 // */ // public static List<String> asCommentList(String comment) { // comment = comment.replaceAll("\\*", "").trim(); // String[] array = comment.split("\n"); // List<String> comments = new ArrayList(array.length); // int index = 0; // StringBuilder sb = new StringBuilder(); // for (; index < array.length; index++) { // String c = array[index].trim(); // // if (StringUtils.isBlank(c)) { // continue; // } // // String tagType = CommentUtils.getTagType(c); // if (StringUtils.isBlank(tagType)) { // sb.append(c); // sb.append("\n"); // } else { // break; // } // } // // if (sb.length() > 0) { // sb.deleteCharAt(sb.length() - 1); // comments.add(sb.toString()); // } // // for (int i = index; i < array.length; i++) { // String c = array[i].trim(); // if (StringUtils.isNotBlank(c)) { // comments.add(c); // } // } // return comments; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/DefaultJavaParserTagConverterImpl.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.DocTagImpl; import org.treeleafj.xdoc.utils.CommentUtils; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 基于JavaParser包的默认注释解析转换器 * * @author leaf * @date 2017/3/4 */ public class DefaultJavaParserTagConverterImpl implements JavaParserTagConverter<String> { @Override
public DocTag converter(String comment) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/DefaultJavaParserTagConverterImpl.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTagImpl.java // public class DocTagImpl extends DocTag<String> { // // private String value; // // public DocTagImpl(String tagName, String value) { // super(tagName); // this.value = value; // } // // @Override // public String getValues() { // return value; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/CommentUtils.java // public class CommentUtils { // // private static Pattern TAG_NAME_COMPILE = Pattern.compile("^@[\\w]+[\\t ]"); // // /** // * 获取注释的类型 // * // * @param comment 注释文本 // * @return @see @param @resp @return等 // */ // public static String getTagType(String comment) { // Matcher m = TAG_NAME_COMPILE.matcher(comment); // if (m.find()) { // return m.group().trim(); // } else { // return null; // } // } // // /** // * 解析基本的文本注释 // * // * @param comment 注释文本 // */ // public static String parseCommentText(String comment) { // List<String> comments = asCommentList(comment); // for (String s : comments) { // if (!s.startsWith("@")) { // return s; // } // } // return ""; // } // // /** // * 将注释转为多行文本 // * // * @param comment 注释文本 // */ // public static List<String> asCommentList(String comment) { // comment = comment.replaceAll("\\*", "").trim(); // String[] array = comment.split("\n"); // List<String> comments = new ArrayList(array.length); // int index = 0; // StringBuilder sb = new StringBuilder(); // for (; index < array.length; index++) { // String c = array[index].trim(); // // if (StringUtils.isBlank(c)) { // continue; // } // // String tagType = CommentUtils.getTagType(c); // if (StringUtils.isBlank(tagType)) { // sb.append(c); // sb.append("\n"); // } else { // break; // } // } // // if (sb.length() > 0) { // sb.deleteCharAt(sb.length() - 1); // comments.add(sb.toString()); // } // // for (int i = index; i < array.length; i++) { // String c = array[i].trim(); // if (StringUtils.isNotBlank(c)) { // comments.add(c); // } // } // return comments; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.DocTagImpl; import org.treeleafj.xdoc.utils.CommentUtils;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 基于JavaParser包的默认注释解析转换器 * * @author leaf * @date 2017/3/4 */ public class DefaultJavaParserTagConverterImpl implements JavaParserTagConverter<String> { @Override public DocTag converter(String comment) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTagImpl.java // public class DocTagImpl extends DocTag<String> { // // private String value; // // public DocTagImpl(String tagName, String value) { // super(tagName); // this.value = value; // } // // @Override // public String getValues() { // return value; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/CommentUtils.java // public class CommentUtils { // // private static Pattern TAG_NAME_COMPILE = Pattern.compile("^@[\\w]+[\\t ]"); // // /** // * 获取注释的类型 // * // * @param comment 注释文本 // * @return @see @param @resp @return等 // */ // public static String getTagType(String comment) { // Matcher m = TAG_NAME_COMPILE.matcher(comment); // if (m.find()) { // return m.group().trim(); // } else { // return null; // } // } // // /** // * 解析基本的文本注释 // * // * @param comment 注释文本 // */ // public static String parseCommentText(String comment) { // List<String> comments = asCommentList(comment); // for (String s : comments) { // if (!s.startsWith("@")) { // return s; // } // } // return ""; // } // // /** // * 将注释转为多行文本 // * // * @param comment 注释文本 // */ // public static List<String> asCommentList(String comment) { // comment = comment.replaceAll("\\*", "").trim(); // String[] array = comment.split("\n"); // List<String> comments = new ArrayList(array.length); // int index = 0; // StringBuilder sb = new StringBuilder(); // for (; index < array.length; index++) { // String c = array[index].trim(); // // if (StringUtils.isBlank(c)) { // continue; // } // // String tagType = CommentUtils.getTagType(c); // if (StringUtils.isBlank(tagType)) { // sb.append(c); // sb.append("\n"); // } else { // break; // } // } // // if (sb.length() > 0) { // sb.deleteCharAt(sb.length() - 1); // comments.add(sb.toString()); // } // // for (int i = index; i < array.length; i++) { // String c = array[i].trim(); // if (StringUtils.isNotBlank(c)) { // comments.add(c); // } // } // return comments; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/DefaultJavaParserTagConverterImpl.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.DocTagImpl; import org.treeleafj.xdoc.utils.CommentUtils; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 基于JavaParser包的默认注释解析转换器 * * @author leaf * @date 2017/3/4 */ public class DefaultJavaParserTagConverterImpl implements JavaParserTagConverter<String> { @Override public DocTag converter(String comment) {
String tagType = CommentUtils.getTagType(comment);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/DefaultJavaParserTagConverterImpl.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTagImpl.java // public class DocTagImpl extends DocTag<String> { // // private String value; // // public DocTagImpl(String tagName, String value) { // super(tagName); // this.value = value; // } // // @Override // public String getValues() { // return value; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/CommentUtils.java // public class CommentUtils { // // private static Pattern TAG_NAME_COMPILE = Pattern.compile("^@[\\w]+[\\t ]"); // // /** // * 获取注释的类型 // * // * @param comment 注释文本 // * @return @see @param @resp @return等 // */ // public static String getTagType(String comment) { // Matcher m = TAG_NAME_COMPILE.matcher(comment); // if (m.find()) { // return m.group().trim(); // } else { // return null; // } // } // // /** // * 解析基本的文本注释 // * // * @param comment 注释文本 // */ // public static String parseCommentText(String comment) { // List<String> comments = asCommentList(comment); // for (String s : comments) { // if (!s.startsWith("@")) { // return s; // } // } // return ""; // } // // /** // * 将注释转为多行文本 // * // * @param comment 注释文本 // */ // public static List<String> asCommentList(String comment) { // comment = comment.replaceAll("\\*", "").trim(); // String[] array = comment.split("\n"); // List<String> comments = new ArrayList(array.length); // int index = 0; // StringBuilder sb = new StringBuilder(); // for (; index < array.length; index++) { // String c = array[index].trim(); // // if (StringUtils.isBlank(c)) { // continue; // } // // String tagType = CommentUtils.getTagType(c); // if (StringUtils.isBlank(tagType)) { // sb.append(c); // sb.append("\n"); // } else { // break; // } // } // // if (sb.length() > 0) { // sb.deleteCharAt(sb.length() - 1); // comments.add(sb.toString()); // } // // for (int i = index; i < array.length; i++) { // String c = array[i].trim(); // if (StringUtils.isNotBlank(c)) { // comments.add(c); // } // } // return comments; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.DocTagImpl; import org.treeleafj.xdoc.utils.CommentUtils;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 基于JavaParser包的默认注释解析转换器 * * @author leaf * @date 2017/3/4 */ public class DefaultJavaParserTagConverterImpl implements JavaParserTagConverter<String> { @Override public DocTag converter(String comment) { String tagType = CommentUtils.getTagType(comment); String coment = comment.substring(tagType.length()).trim();
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTagImpl.java // public class DocTagImpl extends DocTag<String> { // // private String value; // // public DocTagImpl(String tagName, String value) { // super(tagName); // this.value = value; // } // // @Override // public String getValues() { // return value; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/CommentUtils.java // public class CommentUtils { // // private static Pattern TAG_NAME_COMPILE = Pattern.compile("^@[\\w]+[\\t ]"); // // /** // * 获取注释的类型 // * // * @param comment 注释文本 // * @return @see @param @resp @return等 // */ // public static String getTagType(String comment) { // Matcher m = TAG_NAME_COMPILE.matcher(comment); // if (m.find()) { // return m.group().trim(); // } else { // return null; // } // } // // /** // * 解析基本的文本注释 // * // * @param comment 注释文本 // */ // public static String parseCommentText(String comment) { // List<String> comments = asCommentList(comment); // for (String s : comments) { // if (!s.startsWith("@")) { // return s; // } // } // return ""; // } // // /** // * 将注释转为多行文本 // * // * @param comment 注释文本 // */ // public static List<String> asCommentList(String comment) { // comment = comment.replaceAll("\\*", "").trim(); // String[] array = comment.split("\n"); // List<String> comments = new ArrayList(array.length); // int index = 0; // StringBuilder sb = new StringBuilder(); // for (; index < array.length; index++) { // String c = array[index].trim(); // // if (StringUtils.isBlank(c)) { // continue; // } // // String tagType = CommentUtils.getTagType(c); // if (StringUtils.isBlank(tagType)) { // sb.append(c); // sb.append("\n"); // } else { // break; // } // } // // if (sb.length() > 0) { // sb.deleteCharAt(sb.length() - 1); // comments.add(sb.toString()); // } // // for (int i = index; i < array.length; i++) { // String c = array[i].trim(); // if (StringUtils.isNotBlank(c)) { // comments.add(c); // } // } // return comments; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/DefaultJavaParserTagConverterImpl.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.DocTagImpl; import org.treeleafj.xdoc.utils.CommentUtils; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 基于JavaParser包的默认注释解析转换器 * * @author leaf * @date 2017/3/4 */ public class DefaultJavaParserTagConverterImpl implements JavaParserTagConverter<String> { @Override public DocTag converter(String comment) { String tagType = CommentUtils.getTagType(comment); String coment = comment.substring(tagType.length()).trim();
return new DocTagImpl(tagType, coment);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpApiAction.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiAction.java // @Data // public class ApiAction { // // /** // * 展示用的标题 // */ // private String title; // // /** // * 接口方法名称 // */ // private String name; // // /** // * 接口方法 // */ // @JsonIgnore // private Method method; // // /** // * 接口的描述 // */ // private String comment; // // /** // * 方法上标注的注解 // */ // private List<DocTag> docTags; // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ObjectInfo.java // @Data // public class ObjectInfo { // // /** // * 源码在哪个类 // */ // private Class<?> type; // // /** // * 上面的注释 // */ // private String comment; // // /** // * 对象的属性 // */ // private List<FieldInfo> fieldInfos = new LinkedList<>(); // // }
import lombok.Data; import org.treeleafj.xdoc.model.ApiAction; import org.treeleafj.xdoc.model.ObjectInfo; import java.util.ArrayList; import java.util.List;
package org.treeleafj.xdoc.model.http; /** * Created by leaf on 2017/3/4. */ @Data public class HttpApiAction extends ApiAction { /** * 访问的uri地址 */ private List<String> uris; /** * 允许的访问方法:POST,GET,DELETE,PUT等, 如果没有,则无限制 */ private List<String> methods; /** * 入参 */ private List<HttpParam> params = new ArrayList<>(0); /** * 请求参数对象 */
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiAction.java // @Data // public class ApiAction { // // /** // * 展示用的标题 // */ // private String title; // // /** // * 接口方法名称 // */ // private String name; // // /** // * 接口方法 // */ // @JsonIgnore // private Method method; // // /** // * 接口的描述 // */ // private String comment; // // /** // * 方法上标注的注解 // */ // private List<DocTag> docTags; // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ObjectInfo.java // @Data // public class ObjectInfo { // // /** // * 源码在哪个类 // */ // private Class<?> type; // // /** // * 上面的注释 // */ // private String comment; // // /** // * 对象的属性 // */ // private List<FieldInfo> fieldInfos = new LinkedList<>(); // // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpApiAction.java import lombok.Data; import org.treeleafj.xdoc.model.ApiAction; import org.treeleafj.xdoc.model.ObjectInfo; import java.util.ArrayList; import java.util.List; package org.treeleafj.xdoc.model.http; /** * Created by leaf on 2017/3/4. */ @Data public class HttpApiAction extends ApiAction { /** * 访问的uri地址 */ private List<String> uris; /** * 允许的访问方法:POST,GET,DELETE,PUT等, 如果没有,则无限制 */ private List<String> methods; /** * 入参 */ private List<HttpParam> params = new ArrayList<>(0); /** * 请求参数对象 */
private List<ObjectInfo> paramObjs = new ArrayList<>(0);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/HtmlForamt.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiDoc.java // @Data // public class ApiDoc { // // /** // * 附带的属性 // */ // private Map<String, Object> properties = new HashMap<>(); // // /** // * 所有API模块 // */ // private List<ApiModule> apiModules; // // public ApiDoc(List<ApiModule> apiModules) { // this.apiModules = apiModules; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // }
import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.ApiDoc; import org.treeleafj.xdoc.utils.JsonUtils; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map;
package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/18 0018. */ public class HtmlForamt implements Format { @Override
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiDoc.java // @Data // public class ApiDoc { // // /** // * 附带的属性 // */ // private Map<String, Object> properties = new HashMap<>(); // // /** // * 所有API模块 // */ // private List<ApiModule> apiModules; // // public ApiDoc(List<ApiModule> apiModules) { // this.apiModules = apiModules; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/HtmlForamt.java import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.ApiDoc; import org.treeleafj.xdoc.utils.JsonUtils; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/18 0018. */ public class HtmlForamt implements Format { @Override
public String format(ApiDoc apiDoc) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/HtmlForamt.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiDoc.java // @Data // public class ApiDoc { // // /** // * 附带的属性 // */ // private Map<String, Object> properties = new HashMap<>(); // // /** // * 所有API模块 // */ // private List<ApiModule> apiModules; // // public ApiDoc(List<ApiModule> apiModules) { // this.apiModules = apiModules; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // }
import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.ApiDoc; import org.treeleafj.xdoc.utils.JsonUtils; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map;
package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/18 0018. */ public class HtmlForamt implements Format { @Override public String format(ApiDoc apiDoc) { InputStream in = HtmlForamt.class.getResourceAsStream("html.vm"); if (in != null) { try { String s = IOUtils.toString(in, "utf-8"); Map<String, Object> model = new HashMap<>(); model.put("title", StringUtils.defaultString((String) apiDoc.getProperties().get("title"), "接口文档")); model.put("apiModules", apiDoc.getApiModules());
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiDoc.java // @Data // public class ApiDoc { // // /** // * 附带的属性 // */ // private Map<String, Object> properties = new HashMap<>(); // // /** // * 所有API模块 // */ // private List<ApiModule> apiModules; // // public ApiDoc(List<ApiModule> apiModules) { // this.apiModules = apiModules; // } // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/HtmlForamt.java import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.ApiDoc; import org.treeleafj.xdoc.utils.JsonUtils; import java.io.IOException; import java.io.InputStream; import java.util.HashMap; import java.util.Map; package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/18 0018. */ public class HtmlForamt implements Format { @Override public String format(ApiDoc apiDoc) { InputStream in = HtmlForamt.class.getResourceAsStream("html.vm"); if (in != null) { try { String s = IOUtils.toString(in, "utf-8"); Map<String, Object> model = new HashMap<>(); model.put("title", StringUtils.defaultString((String) apiDoc.getProperties().get("title"), "接口文档")); model.put("apiModules", apiDoc.getApiModules());
return s.replace("_apis_json", JsonUtils.toJson(model));
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JavaFileUtils.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/FieldInfo.java // @Data // public class FieldInfo { // // private String name; // // private Class<?> type; // // private String simpleTypeName; // // private String comment; // // /** // * 是否必填,默认false // */ // private boolean require; // // private List<FieldInfo> fieldInfos; // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/JavaSourceFileManager.java // public class JavaSourceFileManager { // // private static final JavaSourceFileManager instance = new JavaSourceFileManager(); // // private static Map<String, String> classPath = new HashMap<>(); // // public static JavaSourceFileManager getInstance() { // return instance; // } // // // /** // * 递归获取指定目录下面所有的Java文件,包括子目录中的 // * // * @param file 文件目录 // * @return 所有java文件 // */ // public List<String> getAllJavaFiles(File file) { // if (!file.exists()) { // return new ArrayList(0); // } // // if (file.isFile()) { // if (file.getName().lastIndexOf(".java") > 0) { // List list = new ArrayList(1); // list.add(file.getAbsolutePath()); // return list; // } else { // return new ArrayList(0); // } // } // // List<String> list = new ArrayList(); // if (file.isDirectory()) { // File[] files = file.listFiles(); // if (files != null) { // for (File f : files) { // list.addAll(getAllJavaFiles(f)); // } // } // } // return list; // } // // /** // * 将指定类名与对应的类源码文件路径存放进来 // * // * @param name 类名称 // * @param path 类源码文件路径 // */ // public void put(String name, String path) { // classPath.put(name, path); // } // // /** // * 获取指定类名所对应的类源码文件路径 // * // * @param name 类名 // * @return 源码文件路径, 如果不存在则返回null // */ // public String getPath(String name) { // return classPath.get(name); // } // }
import com.github.javaparser.JavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.model.FieldInfo; import org.treeleafj.xdoc.resolver.JavaSourceFileManager; import java.beans.PropertyDescriptor; import java.io.File; import java.io.FileInputStream; import java.util.*;
package org.treeleafj.xdoc.utils; /** * Java文件工具 * * 提供解析源码中的类属性和注释等功能 * * @author leaf * @date 2017-03-03 16:52 */ public class JavaFileUtils { private static Logger logger = LoggerFactory.getLogger(JavaFileUtils.class); private static JavaParser javaParser = new JavaParser(); public static Map<String, String> analysisFieldComments(Class<?> classz) { final Map<String, String> commentMap = new HashMap(10); List<Class> classes = new LinkedList<>(); Class nowClass = classz; //获取所有的属性注释(包括父类的) while (true) { classes.add(0, nowClass); if (Object.class.equals(nowClass) || Object.class.equals(nowClass.getSuperclass())) { break; } nowClass = nowClass.getSuperclass(); } //反方向循环,子类属性注释覆盖父类属性 for (Class clz : classes) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/FieldInfo.java // @Data // public class FieldInfo { // // private String name; // // private Class<?> type; // // private String simpleTypeName; // // private String comment; // // /** // * 是否必填,默认false // */ // private boolean require; // // private List<FieldInfo> fieldInfos; // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/JavaSourceFileManager.java // public class JavaSourceFileManager { // // private static final JavaSourceFileManager instance = new JavaSourceFileManager(); // // private static Map<String, String> classPath = new HashMap<>(); // // public static JavaSourceFileManager getInstance() { // return instance; // } // // // /** // * 递归获取指定目录下面所有的Java文件,包括子目录中的 // * // * @param file 文件目录 // * @return 所有java文件 // */ // public List<String> getAllJavaFiles(File file) { // if (!file.exists()) { // return new ArrayList(0); // } // // if (file.isFile()) { // if (file.getName().lastIndexOf(".java") > 0) { // List list = new ArrayList(1); // list.add(file.getAbsolutePath()); // return list; // } else { // return new ArrayList(0); // } // } // // List<String> list = new ArrayList(); // if (file.isDirectory()) { // File[] files = file.listFiles(); // if (files != null) { // for (File f : files) { // list.addAll(getAllJavaFiles(f)); // } // } // } // return list; // } // // /** // * 将指定类名与对应的类源码文件路径存放进来 // * // * @param name 类名称 // * @param path 类源码文件路径 // */ // public void put(String name, String path) { // classPath.put(name, path); // } // // /** // * 获取指定类名所对应的类源码文件路径 // * // * @param name 类名 // * @return 源码文件路径, 如果不存在则返回null // */ // public String getPath(String name) { // return classPath.get(name); // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JavaFileUtils.java import com.github.javaparser.JavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.model.FieldInfo; import org.treeleafj.xdoc.resolver.JavaSourceFileManager; import java.beans.PropertyDescriptor; import java.io.File; import java.io.FileInputStream; import java.util.*; package org.treeleafj.xdoc.utils; /** * Java文件工具 * * 提供解析源码中的类属性和注释等功能 * * @author leaf * @date 2017-03-03 16:52 */ public class JavaFileUtils { private static Logger logger = LoggerFactory.getLogger(JavaFileUtils.class); private static JavaParser javaParser = new JavaParser(); public static Map<String, String> analysisFieldComments(Class<?> classz) { final Map<String, String> commentMap = new HashMap(10); List<Class> classes = new LinkedList<>(); Class nowClass = classz; //获取所有的属性注释(包括父类的) while (true) { classes.add(0, nowClass); if (Object.class.equals(nowClass) || Object.class.equals(nowClass.getSuperclass())) { break; } nowClass = nowClass.getSuperclass(); } //反方向循环,子类属性注释覆盖父类属性 for (Class clz : classes) {
String path = JavaSourceFileManager.getInstance().getPath(clz.getSimpleName());
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JavaFileUtils.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/FieldInfo.java // @Data // public class FieldInfo { // // private String name; // // private Class<?> type; // // private String simpleTypeName; // // private String comment; // // /** // * 是否必填,默认false // */ // private boolean require; // // private List<FieldInfo> fieldInfos; // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/JavaSourceFileManager.java // public class JavaSourceFileManager { // // private static final JavaSourceFileManager instance = new JavaSourceFileManager(); // // private static Map<String, String> classPath = new HashMap<>(); // // public static JavaSourceFileManager getInstance() { // return instance; // } // // // /** // * 递归获取指定目录下面所有的Java文件,包括子目录中的 // * // * @param file 文件目录 // * @return 所有java文件 // */ // public List<String> getAllJavaFiles(File file) { // if (!file.exists()) { // return new ArrayList(0); // } // // if (file.isFile()) { // if (file.getName().lastIndexOf(".java") > 0) { // List list = new ArrayList(1); // list.add(file.getAbsolutePath()); // return list; // } else { // return new ArrayList(0); // } // } // // List<String> list = new ArrayList(); // if (file.isDirectory()) { // File[] files = file.listFiles(); // if (files != null) { // for (File f : files) { // list.addAll(getAllJavaFiles(f)); // } // } // } // return list; // } // // /** // * 将指定类名与对应的类源码文件路径存放进来 // * // * @param name 类名称 // * @param path 类源码文件路径 // */ // public void put(String name, String path) { // classPath.put(name, path); // } // // /** // * 获取指定类名所对应的类源码文件路径 // * // * @param name 类名 // * @return 源码文件路径, 如果不存在则返回null // */ // public String getPath(String name) { // return classPath.get(name); // } // }
import com.github.javaparser.JavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.model.FieldInfo; import org.treeleafj.xdoc.resolver.JavaSourceFileManager; import java.beans.PropertyDescriptor; import java.io.File; import java.io.FileInputStream; import java.util.*;
} try (FileInputStream in = new FileInputStream(path)) { CompilationUnit cu = javaParser.parse(in).getResult().get(); new VoidVisitorAdapter<Void>() { @Override public void visit(FieldDeclaration n, Void arg) { String name = n.getVariable(0).getName().asString(); String comment = ""; if (n.getComment().isPresent()) { comment = n.getComment().get().getContent(); } if (name.contains("=")) { name = name.substring(0, name.indexOf("=")).trim(); } commentMap.put(name, CommentUtils.parseCommentText(comment)); } }.visit(cu, null); } catch (Exception e) { logger.warn("读取java原文件失败:{}", path, e.getMessage(), e); } } return commentMap; }
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/FieldInfo.java // @Data // public class FieldInfo { // // private String name; // // private Class<?> type; // // private String simpleTypeName; // // private String comment; // // /** // * 是否必填,默认false // */ // private boolean require; // // private List<FieldInfo> fieldInfos; // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/JavaSourceFileManager.java // public class JavaSourceFileManager { // // private static final JavaSourceFileManager instance = new JavaSourceFileManager(); // // private static Map<String, String> classPath = new HashMap<>(); // // public static JavaSourceFileManager getInstance() { // return instance; // } // // // /** // * 递归获取指定目录下面所有的Java文件,包括子目录中的 // * // * @param file 文件目录 // * @return 所有java文件 // */ // public List<String> getAllJavaFiles(File file) { // if (!file.exists()) { // return new ArrayList(0); // } // // if (file.isFile()) { // if (file.getName().lastIndexOf(".java") > 0) { // List list = new ArrayList(1); // list.add(file.getAbsolutePath()); // return list; // } else { // return new ArrayList(0); // } // } // // List<String> list = new ArrayList(); // if (file.isDirectory()) { // File[] files = file.listFiles(); // if (files != null) { // for (File f : files) { // list.addAll(getAllJavaFiles(f)); // } // } // } // return list; // } // // /** // * 将指定类名与对应的类源码文件路径存放进来 // * // * @param name 类名称 // * @param path 类源码文件路径 // */ // public void put(String name, String path) { // classPath.put(name, path); // } // // /** // * 获取指定类名所对应的类源码文件路径 // * // * @param name 类名 // * @return 源码文件路径, 如果不存在则返回null // */ // public String getPath(String name) { // return classPath.get(name); // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JavaFileUtils.java import com.github.javaparser.JavaParser; import com.github.javaparser.ast.CompilationUnit; import com.github.javaparser.ast.body.FieldDeclaration; import com.github.javaparser.ast.visitor.VoidVisitorAdapter; import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.model.FieldInfo; import org.treeleafj.xdoc.resolver.JavaSourceFileManager; import java.beans.PropertyDescriptor; import java.io.File; import java.io.FileInputStream; import java.util.*; } try (FileInputStream in = new FileInputStream(path)) { CompilationUnit cu = javaParser.parse(in).getResult().get(); new VoidVisitorAdapter<Void>() { @Override public void visit(FieldDeclaration n, Void arg) { String name = n.getVariable(0).getName().asString(); String comment = ""; if (n.getComment().isPresent()) { comment = n.getComment().get().getContent(); } if (name.contains("=")) { name = name.substring(0, name.indexOf("=")).trim(); } commentMap.put(name, CommentUtils.parseCommentText(comment)); } }.visit(cu, null); } catch (Exception e) { logger.warn("读取java原文件失败:{}", path, e.getMessage(), e); } } return commentMap; }
public static List<FieldInfo> analysisFields(Class classz, Map<String, String> commentMap) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/MarkdownFormat.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpApiAction.java // @Data // public class HttpApiAction extends ApiAction { // // /** // * 访问的uri地址 // */ // private List<String> uris; // // /** // * 允许的访问方法:POST,GET,DELETE,PUT等, 如果没有,则无限制 // */ // private List<String> methods; // // /** // * 入参 // */ // private List<HttpParam> params = new ArrayList<>(0); // // /** // * 请求参数对象 // */ // private List<ObjectInfo> paramObjs = new ArrayList<>(0); // // /** // * 返回对象 // */ // private ObjectInfo returnObj; // // /** // * 出参 // */ // private List<HttpParam> respParam = new ArrayList<>(0); // // /** // * 返回描述 // */ // private String returnDesc; // // /** // * 返回的数据 // */ // private String respbody; // // /** // * 是否返回json // */ // private boolean json; // // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpParam.java // @Data // public class HttpParam { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // }
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.*; import org.treeleafj.xdoc.model.http.HttpApiAction; import org.treeleafj.xdoc.model.http.HttpParam; import org.treeleafj.xdoc.utils.JsonUtils; import java.util.HashSet; import java.util.Map; import java.util.Set;
package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/4. */ public class MarkdownFormat implements Format { private Logger log = LoggerFactory.getLogger(getClass()); private VelocityTemplater templater = new VelocityTemplater("org/treeleafj/xdoc/format/http/markdown.vm"); @Override public String format(ApiDoc apiDoc) { StringBuilder sb = new StringBuilder(); for (ApiModule apiModule : apiDoc.getApiModules()) { sb.append(format(apiModule)).append("\n\n"); } return sb.toString(); } private String format(ApiModule apiModule) { for (ApiAction apiAction : apiModule.getApiActions()) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpApiAction.java // @Data // public class HttpApiAction extends ApiAction { // // /** // * 访问的uri地址 // */ // private List<String> uris; // // /** // * 允许的访问方法:POST,GET,DELETE,PUT等, 如果没有,则无限制 // */ // private List<String> methods; // // /** // * 入参 // */ // private List<HttpParam> params = new ArrayList<>(0); // // /** // * 请求参数对象 // */ // private List<ObjectInfo> paramObjs = new ArrayList<>(0); // // /** // * 返回对象 // */ // private ObjectInfo returnObj; // // /** // * 出参 // */ // private List<HttpParam> respParam = new ArrayList<>(0); // // /** // * 返回描述 // */ // private String returnDesc; // // /** // * 返回的数据 // */ // private String respbody; // // /** // * 是否返回json // */ // private boolean json; // // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpParam.java // @Data // public class HttpParam { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/MarkdownFormat.java import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.*; import org.treeleafj.xdoc.model.http.HttpApiAction; import org.treeleafj.xdoc.model.http.HttpParam; import org.treeleafj.xdoc.utils.JsonUtils; import java.util.HashSet; import java.util.Map; import java.util.Set; package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/4. */ public class MarkdownFormat implements Format { private Logger log = LoggerFactory.getLogger(getClass()); private VelocityTemplater templater = new VelocityTemplater("org/treeleafj/xdoc/format/http/markdown.vm"); @Override public String format(ApiDoc apiDoc) { StringBuilder sb = new StringBuilder(); for (ApiModule apiModule : apiDoc.getApiModules()) { sb.append(format(apiModule)).append("\n\n"); } return sb.toString(); } private String format(ApiModule apiModule) { for (ApiAction apiAction : apiModule.getApiActions()) {
HttpApiAction saa = (HttpApiAction) apiAction;
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/MarkdownFormat.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpApiAction.java // @Data // public class HttpApiAction extends ApiAction { // // /** // * 访问的uri地址 // */ // private List<String> uris; // // /** // * 允许的访问方法:POST,GET,DELETE,PUT等, 如果没有,则无限制 // */ // private List<String> methods; // // /** // * 入参 // */ // private List<HttpParam> params = new ArrayList<>(0); // // /** // * 请求参数对象 // */ // private List<ObjectInfo> paramObjs = new ArrayList<>(0); // // /** // * 返回对象 // */ // private ObjectInfo returnObj; // // /** // * 出参 // */ // private List<HttpParam> respParam = new ArrayList<>(0); // // /** // * 返回描述 // */ // private String returnDesc; // // /** // * 返回的数据 // */ // private String respbody; // // /** // * 是否返回json // */ // private boolean json; // // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpParam.java // @Data // public class HttpParam { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // }
import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.*; import org.treeleafj.xdoc.model.http.HttpApiAction; import org.treeleafj.xdoc.model.http.HttpParam; import org.treeleafj.xdoc.utils.JsonUtils; import java.util.HashSet; import java.util.Map; import java.util.Set;
package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/4. */ public class MarkdownFormat implements Format { private Logger log = LoggerFactory.getLogger(getClass()); private VelocityTemplater templater = new VelocityTemplater("org/treeleafj/xdoc/format/http/markdown.vm"); @Override public String format(ApiDoc apiDoc) { StringBuilder sb = new StringBuilder(); for (ApiModule apiModule : apiDoc.getApiModules()) { sb.append(format(apiModule)).append("\n\n"); } return sb.toString(); } private String format(ApiModule apiModule) { for (ApiAction apiAction : apiModule.getApiActions()) { HttpApiAction saa = (HttpApiAction) apiAction; if (saa.isJson() && StringUtils.isNotBlank(saa.getRespbody())) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/Format.java // public interface Format { // // String format(ApiDoc apiDoc); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpApiAction.java // @Data // public class HttpApiAction extends ApiAction { // // /** // * 访问的uri地址 // */ // private List<String> uris; // // /** // * 允许的访问方法:POST,GET,DELETE,PUT等, 如果没有,则无限制 // */ // private List<String> methods; // // /** // * 入参 // */ // private List<HttpParam> params = new ArrayList<>(0); // // /** // * 请求参数对象 // */ // private List<ObjectInfo> paramObjs = new ArrayList<>(0); // // /** // * 返回对象 // */ // private ObjectInfo returnObj; // // /** // * 出参 // */ // private List<HttpParam> respParam = new ArrayList<>(0); // // /** // * 返回描述 // */ // private String returnDesc; // // /** // * 返回的数据 // */ // private String respbody; // // /** // * 是否返回json // */ // private boolean json; // // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/http/HttpParam.java // @Data // public class HttpParam { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/utils/JsonUtils.java // public class JsonUtils { // // private static ObjectMapper objectMapper = new ObjectMapper(); // // static { // objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL); // objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")); // } // // /** // * 将一个对象转为json字符窜 // */ // public static String toJson(Object obj) { // try { // return objectMapper.writeValueAsString(obj); // } catch (JsonProcessingException e) { // throw new RuntimeException(e); // } // } // // // /** // * 格式化json字符串 // * // * @param jsonStr 未格式化前的JSON窜 // * @return 格式化好的JSON窜 // */ // public static String formatJson(String jsonStr) { // if (StringUtils.isBlank(jsonStr)) { // return StringUtils.EMPTY; // } // StringBuilder sb = new StringBuilder(); // char last; // char current = '\0'; // int indent = 0; // for (int i = 0; i < jsonStr.length(); i++) { // last = current; // current = jsonStr.charAt(i); // switch (current) { // case '{': // case '[': // sb.append(current); // sb.append('\n'); // indent++; // addIndentBlank(sb, indent); // break; // case '}': // case ']': // sb.append('\n'); // indent--; // addIndentBlank(sb, indent); // sb.append(current); // break; // case ',': // sb.append(current); // if (last != '\\') { // sb.append('\n'); // addIndentBlank(sb, indent); // } // break; // default: // sb.append(current); // } // } // // return sb.toString(); // } // // /** // * 添加space // * // * @param sb 要追加空格的字符串 // * @param indent 追加的空格数 // */ // private static void addIndentBlank(StringBuilder sb, int indent) { // for (int i = 0; i < indent; i++) { // sb.append('\t'); // } // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/format/http/MarkdownFormat.java import org.apache.commons.beanutils.PropertyUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.format.Format; import org.treeleafj.xdoc.model.*; import org.treeleafj.xdoc.model.http.HttpApiAction; import org.treeleafj.xdoc.model.http.HttpParam; import org.treeleafj.xdoc.utils.JsonUtils; import java.util.HashSet; import java.util.Map; import java.util.Set; package org.treeleafj.xdoc.format.http; /** * Created by leaf on 2017/3/4. */ public class MarkdownFormat implements Format { private Logger log = LoggerFactory.getLogger(getClass()); private VelocityTemplater templater = new VelocityTemplater("org/treeleafj/xdoc/format/http/markdown.vm"); @Override public String format(ApiDoc apiDoc) { StringBuilder sb = new StringBuilder(); for (ApiModule apiModule : apiDoc.getApiModules()) { sb.append(format(apiModule)).append("\n\n"); } return sb.toString(); } private String format(ApiModule apiModule) { for (ApiAction apiAction : apiModule.getApiActions()) { HttpApiAction saa = (HttpApiAction) apiAction; if (saa.isJson() && StringUtils.isNotBlank(saa.getRespbody())) {
saa.setRespbody(JsonUtils.formatJson(saa.getRespbody()));
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiAction.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // }
import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.treeleafj.xdoc.tag.DocTag; import java.lang.reflect.Method; import java.util.List;
package org.treeleafj.xdoc.model; /** * 接口信息,一个接口类里面会有多个接口,每个接口都抽象成ApiAction * * @author leaf * @date 2017-03-03 11:09 */ @Data public class ApiAction { /** * 展示用的标题 */ private String title; /** * 接口方法名称 */ private String name; /** * 接口方法 */ @JsonIgnore private Method method; /** * 接口的描述 */ private String comment; /** * 方法上标注的注解 */
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/model/ApiAction.java import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import org.treeleafj.xdoc.tag.DocTag; import java.lang.reflect.Method; import java.util.List; package org.treeleafj.xdoc.model; /** * 接口信息,一个接口类里面会有多个接口,每个接口都抽象成ApiAction * * @author leaf * @date 2017-03-03 11:09 */ @Data public class ApiAction { /** * 展示用的标题 */ private String title; /** * 接口方法名称 */ private String name; /** * 接口方法 */ @JsonIgnore private Method method; /** * 接口的描述 */ private String comment; /** * 方法上标注的注解 */
private List<DocTag> docTags;
treeleafj/xDoc
samples/sample-jfinal/src/main/java/org/treeleafj/xdoc/test/controller/AccountController.java
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/Account.java // @Data // public class Account { // // /** // * 账户ID,跟用户ID一致 // */ // private String id; // // /** // * 用户余额 // */ // private Double balance; // // /** // * 用户积分 // */ // private Integer score; // }
import com.jfinal.core.Controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.test.vo.Account; import java.util.UUID;
package org.treeleafj.xdoc.test.controller; /** * 用户账户模块 * * @author leaf * @date 2017-03-10 10:43 */ public class AccountController extends Controller { private Logger log = LoggerFactory.getLogger(AccountController.class); /** * 获取当前登录用户的账户资产信息,用户不存在会返回code为9999的错误信息,见:https://github.com/treeleafj/xDoc * * @param type 账户类型(1-普通账户)|必填 * @param balance 重写@paramObj中AccountEx的balance的注释 * @paramObj AccountEx * @return 用户的资产 * @title 查询用户资产 * @resp balance 账户余额|double */ public void info() { String type = this.get("type");
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/Account.java // @Data // public class Account { // // /** // * 账户ID,跟用户ID一致 // */ // private String id; // // /** // * 用户余额 // */ // private Double balance; // // /** // * 用户积分 // */ // private Integer score; // } // Path: samples/sample-jfinal/src/main/java/org/treeleafj/xdoc/test/controller/AccountController.java import com.jfinal.core.Controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.test.vo.Account; import java.util.UUID; package org.treeleafj.xdoc.test.controller; /** * 用户账户模块 * * @author leaf * @date 2017-03-10 10:43 */ public class AccountController extends Controller { private Logger log = LoggerFactory.getLogger(AccountController.class); /** * 获取当前登录用户的账户资产信息,用户不存在会返回code为9999的错误信息,见:https://github.com/treeleafj/xDoc * * @param type 账户类型(1-普通账户)|必填 * @param balance 重写@paramObj中AccountEx的balance的注释 * @paramObj AccountEx * @return 用户的资产 * @title 查询用户资产 * @resp balance 账户余额|double */ public void info() { String type = this.get("type");
Account account = new Account();
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/RespTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java // @Data // public class RespTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // // public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // String s = paramName + " " + paramDesc; // if (StringUtils.isNotBlank(paramType)) { // s += " " + paramType; // } // s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH); // return s; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.tag.RespTagImpl;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@resp的转换器 * @author leaf * @date 2017/3/12 0012 */ public class RespTagConverter extends ParamTagConverter { @Override
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java // @Data // public class RespTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // // public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // String s = paramName + " " + paramDesc; // if (StringUtils.isNotBlank(paramType)) { // s += " " + paramType; // } // s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH); // return s; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/RespTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.tag.RespTagImpl; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@resp的转换器 * @author leaf * @date 2017/3/12 0012 */ public class RespTagConverter extends ParamTagConverter { @Override
public DocTag converter(String comment) {
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/RespTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java // @Data // public class RespTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // // public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // String s = paramName + " " + paramDesc; // if (StringUtils.isNotBlank(paramType)) { // s += " " + paramType; // } // s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH); // return s; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.tag.RespTagImpl;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@resp的转换器 * @author leaf * @date 2017/3/12 0012 */ public class RespTagConverter extends ParamTagConverter { @Override public DocTag converter(String comment) {
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java // @Data // public class RespTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // // public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // String s = paramName + " " + paramDesc; // if (StringUtils.isNotBlank(paramType)) { // s += " " + paramType; // } // s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH); // return s; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/RespTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.tag.RespTagImpl; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@resp的转换器 * @author leaf * @date 2017/3/12 0012 */ public class RespTagConverter extends ParamTagConverter { @Override public DocTag converter(String comment) {
ParamTagImpl paramTag = (ParamTagImpl) super.converter(comment);
treeleafj/xDoc
xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/RespTagConverter.java
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java // @Data // public class RespTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // // public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // String s = paramName + " " + paramDesc; // if (StringUtils.isNotBlank(paramType)) { // s += " " + paramType; // } // s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH); // return s; // } // }
import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.tag.RespTagImpl;
package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@resp的转换器 * @author leaf * @date 2017/3/12 0012 */ public class RespTagConverter extends ParamTagConverter { @Override public DocTag converter(String comment) { ParamTagImpl paramTag = (ParamTagImpl) super.converter(comment);
// Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/DocTag.java // public abstract class DocTag<T> { // // /** // * 标签名称 // */ // @Getter // private String tagName; // // public DocTag(String tagName) { // this.tagName = tagName; // } // // public abstract T getValues(); // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/ParamTagImpl.java // @Data // public class ParamTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 参数类型 // */ // private String paramType; // // public ParamTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // return paramName + " " + this.paramDesc; // } // // } // // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/tag/RespTagImpl.java // @Data // public class RespTagImpl extends DocTag<String> { // // /** // * 参数名 // */ // private String paramName; // // /** // * 参数描述 // */ // private String paramDesc; // // /** // * 是否必填,默认false // */ // private boolean require; // // /** // * 类型 // */ // private String paramType; // // public RespTagImpl(String tagName, String paramName, String paramDesc, String paramType, boolean require) { // super(tagName); // this.paramName = paramName; // this.paramDesc = paramDesc; // this.paramType = paramType; // this.require = require; // } // // @Override // public String getValues() { // String s = paramName + " " + paramDesc; // if (StringUtils.isNotBlank(paramType)) { // s += " " + paramType; // } // s += " " + (require ? Constant.YES_ZH : Constant.NOT_ZH); // return s; // } // } // Path: xDoc-core/src/main/java/org/treeleafj/xdoc/resolver/javaparser/converter/RespTagConverter.java import org.treeleafj.xdoc.tag.DocTag; import org.treeleafj.xdoc.tag.ParamTagImpl; import org.treeleafj.xdoc.tag.RespTagImpl; package org.treeleafj.xdoc.resolver.javaparser.converter; /** * 针对@resp的转换器 * @author leaf * @date 2017/3/12 0012 */ public class RespTagConverter extends ParamTagConverter { @Override public DocTag converter(String comment) { ParamTagImpl paramTag = (ParamTagImpl) super.converter(comment);
RespTagImpl respTag = new RespTagImpl(paramTag.getTagName(), paramTag.getParamName(), paramTag.getParamDesc(),
treeleafj/xDoc
samples/sample-jfinal/src/main/java/org/treeleafj/xdoc/test/controller/UserController.java
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/User.java // public class User { // // /** // * 用户ID // */ // private String id; // // /** // * 用户名 // */ // private String username; // // /** // * 密码 // */ // private String password; // // public String getId() { // return id; // } // // public User setId(String id) { // this.id = id; // return this; // } // // public String getUsername() { // return username; // } // // public User setUsername(String username) { // this.username = username; // return this; // } // // public String getPassword() { // return password; // } // // public User setPassword(String password) { // this.password = password; // return this; // } // }
import com.jfinal.core.Controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.test.vo.User; import java.util.HashMap; import java.util.Map; import java.util.UUID;
package org.treeleafj.xdoc.test.controller; /** * 用户模块 * * @author leaf * @date 2017-03-03 10:11 */ public class UserController extends Controller { private Logger logger = LoggerFactory.getLogger(this.getClass()); /** * 登录 * * @param :username 用户名|必填 * @param :password 密码 * @return 当前登录用户的基本信息 * @resp code 返回码(0000表示登录成功,其它表示失败)|string|必填 * @resp msg 登录信息|string * @resp username 登录成功后返回的用户名|string */ public void login() { String username = this.get("username"); String password = this.get("password"); logger.info("username={}, passowrd={}", username, password); Map<String, String> model = new HashMap<>(); model.put("code", "0000"); model.put("msg", "登录成功"); model.put("username", username); this.renderJson(model); } /** * 用户注册 * * @param :username 用户名|必填 * @param :password 密码 * @return 注册后生成的用户的基本信息 * @respbody {"id":"123","password":"123456","username":"admin"} * @title 注册 * @see User * @resp score 分数 */ public void register() {
// Path: samples/sample-base/src/main/java/org/treeleafj/xdoc/test/vo/User.java // public class User { // // /** // * 用户ID // */ // private String id; // // /** // * 用户名 // */ // private String username; // // /** // * 密码 // */ // private String password; // // public String getId() { // return id; // } // // public User setId(String id) { // this.id = id; // return this; // } // // public String getUsername() { // return username; // } // // public User setUsername(String username) { // this.username = username; // return this; // } // // public String getPassword() { // return password; // } // // public User setPassword(String password) { // this.password = password; // return this; // } // } // Path: samples/sample-jfinal/src/main/java/org/treeleafj/xdoc/test/controller/UserController.java import com.jfinal.core.Controller; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.treeleafj.xdoc.test.vo.User; import java.util.HashMap; import java.util.Map; import java.util.UUID; package org.treeleafj.xdoc.test.controller; /** * 用户模块 * * @author leaf * @date 2017-03-03 10:11 */ public class UserController extends Controller { private Logger logger = LoggerFactory.getLogger(this.getClass()); /** * 登录 * * @param :username 用户名|必填 * @param :password 密码 * @return 当前登录用户的基本信息 * @resp code 返回码(0000表示登录成功,其它表示失败)|string|必填 * @resp msg 登录信息|string * @resp username 登录成功后返回的用户名|string */ public void login() { String username = this.get("username"); String password = this.get("password"); logger.info("username={}, passowrd={}", username, password); Map<String, String> model = new HashMap<>(); model.put("code", "0000"); model.put("msg", "登录成功"); model.put("username", username); this.renderJson(model); } /** * 用户注册 * * @param :username 用户名|必填 * @param :password 密码 * @return 注册后生成的用户的基本信息 * @respbody {"id":"123","password":"123456","username":"admin"} * @title 注册 * @see User * @resp score 分数 */ public void register() {
User user = getModel(User.class);
danimahardhika/wallpaperboard
library/src/main/java/com/dm/wallpaper/board/activities/WallpaperBoardSplashActivity.java
// Path: library/src/main/java/com/dm/wallpaper/board/activities/callbacks/SplashScreenCallback.java // public interface SplashScreenCallback { // // @NonNull SplashScreenConfiguration onInit(); // } // // Path: library/src/main/java/com/dm/wallpaper/board/activities/configurations/SplashScreenConfiguration.java // public class SplashScreenConfiguration { // // @NonNull private Class<?> mMainActivity; // @ColorInt private int mBottomTextColor; // private String mBottomText; // @FontSize private int mBottomTextSize; // @FontStyle private int mBottomTextFont; // // public SplashScreenConfiguration(@NonNull Class<?> mainActivity) { // mMainActivity = mainActivity; // mBottomTextColor = -1; // mBottomTextFont = FontStyle.REGULAR; // mBottomTextSize = FontSize.REGULAR; // } // // public SplashScreenConfiguration setBottomText(String text) { // mBottomText = text; // return this; // } // // public SplashScreenConfiguration setBottomTextColor(@ColorInt int color) { // mBottomTextColor = color; // return this; // } // // public SplashScreenConfiguration setBottomTextSize(@FontSize int fontSize) { // mBottomTextSize = fontSize; // return this; // } // // public SplashScreenConfiguration setBottomTextFont(@FontStyle int fontStyle) { // mBottomTextFont = fontStyle; // return this; // } // // public Class<?> getMainActivity() { // return mMainActivity; // } // // public String getBottomText() { // return mBottomText; // } // // public int getBottomTextColor() { // return mBottomTextColor; // } // // public float getBottomTextSize() { // switch (mBottomTextSize) { // case FontSize.SMALL: // return 14f; // case FontSize.LARGE: // return 16f; // case FontSize.REGULAR: // default: // return 15f; // } // } // // public Typeface getBottomTextFont(@NonNull Context context) { // switch (mBottomTextFont) { // case FontStyle.MEDIUM: // return TypefaceHelper.getMedium(context); // case FontStyle.BOLD: // return TypefaceHelper.getBold(context); // case FontStyle.LOGO: // return TypefaceHelper.getLogo(context); // case FontStyle.REGULAR: // default: // return TypefaceHelper.getRegular(context); // } // } // // @IntDef({FontSize.SMALL, FontSize.REGULAR, FontSize.LARGE}) // @Retention(RetentionPolicy.SOURCE) // public @interface FontSize { // int SMALL = 0; // int REGULAR = 1; // int LARGE = 2; // } // // @IntDef({FontStyle.REGULAR, FontStyle.MEDIUM, FontStyle.BOLD, FontStyle.LOGO}) // @Retention(RetentionPolicy.SOURCE) // public @interface FontStyle { // int REGULAR = 0; // int MEDIUM = 1; // int BOLD = 2; // int LOGO = 3; // } // }
import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.util.TypedValue; import android.widget.TextView; import com.danimahardhika.android.helpers.core.ColorHelper; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.activities.callbacks.SplashScreenCallback; import com.dm.wallpaper.board.activities.configurations.SplashScreenConfiguration; import com.danimahardhika.android.helpers.core.utils.LogUtil; import java.lang.ref.WeakReference; import java.util.concurrent.Executor; import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper;
package com.dm.wallpaper.board.activities; /* * Wallpaper Board * * Copyright (c) 2017 Dani Mahardhika * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public abstract class WallpaperBoardSplashActivity extends AppCompatActivity implements SplashScreenCallback { private AsyncTask mAsyncTask;
// Path: library/src/main/java/com/dm/wallpaper/board/activities/callbacks/SplashScreenCallback.java // public interface SplashScreenCallback { // // @NonNull SplashScreenConfiguration onInit(); // } // // Path: library/src/main/java/com/dm/wallpaper/board/activities/configurations/SplashScreenConfiguration.java // public class SplashScreenConfiguration { // // @NonNull private Class<?> mMainActivity; // @ColorInt private int mBottomTextColor; // private String mBottomText; // @FontSize private int mBottomTextSize; // @FontStyle private int mBottomTextFont; // // public SplashScreenConfiguration(@NonNull Class<?> mainActivity) { // mMainActivity = mainActivity; // mBottomTextColor = -1; // mBottomTextFont = FontStyle.REGULAR; // mBottomTextSize = FontSize.REGULAR; // } // // public SplashScreenConfiguration setBottomText(String text) { // mBottomText = text; // return this; // } // // public SplashScreenConfiguration setBottomTextColor(@ColorInt int color) { // mBottomTextColor = color; // return this; // } // // public SplashScreenConfiguration setBottomTextSize(@FontSize int fontSize) { // mBottomTextSize = fontSize; // return this; // } // // public SplashScreenConfiguration setBottomTextFont(@FontStyle int fontStyle) { // mBottomTextFont = fontStyle; // return this; // } // // public Class<?> getMainActivity() { // return mMainActivity; // } // // public String getBottomText() { // return mBottomText; // } // // public int getBottomTextColor() { // return mBottomTextColor; // } // // public float getBottomTextSize() { // switch (mBottomTextSize) { // case FontSize.SMALL: // return 14f; // case FontSize.LARGE: // return 16f; // case FontSize.REGULAR: // default: // return 15f; // } // } // // public Typeface getBottomTextFont(@NonNull Context context) { // switch (mBottomTextFont) { // case FontStyle.MEDIUM: // return TypefaceHelper.getMedium(context); // case FontStyle.BOLD: // return TypefaceHelper.getBold(context); // case FontStyle.LOGO: // return TypefaceHelper.getLogo(context); // case FontStyle.REGULAR: // default: // return TypefaceHelper.getRegular(context); // } // } // // @IntDef({FontSize.SMALL, FontSize.REGULAR, FontSize.LARGE}) // @Retention(RetentionPolicy.SOURCE) // public @interface FontSize { // int SMALL = 0; // int REGULAR = 1; // int LARGE = 2; // } // // @IntDef({FontStyle.REGULAR, FontStyle.MEDIUM, FontStyle.BOLD, FontStyle.LOGO}) // @Retention(RetentionPolicy.SOURCE) // public @interface FontStyle { // int REGULAR = 0; // int MEDIUM = 1; // int BOLD = 2; // int LOGO = 3; // } // } // Path: library/src/main/java/com/dm/wallpaper/board/activities/WallpaperBoardSplashActivity.java import android.app.Activity; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.content.ContextCompat; import android.support.v7.app.AppCompatActivity; import android.util.Log; import android.util.TypedValue; import android.widget.TextView; import com.danimahardhika.android.helpers.core.ColorHelper; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.activities.callbacks.SplashScreenCallback; import com.dm.wallpaper.board.activities.configurations.SplashScreenConfiguration; import com.danimahardhika.android.helpers.core.utils.LogUtil; import java.lang.ref.WeakReference; import java.util.concurrent.Executor; import uk.co.chrisjenx.calligraphy.CalligraphyContextWrapper; package com.dm.wallpaper.board.activities; /* * Wallpaper Board * * Copyright (c) 2017 Dani Mahardhika * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public abstract class WallpaperBoardSplashActivity extends AppCompatActivity implements SplashScreenCallback { private AsyncTask mAsyncTask;
private SplashScreenConfiguration mConfig;
danimahardhika/wallpaperboard
library/src/main/java/com/dm/wallpaper/board/utils/InAppBillingProcessor.java
// Path: library/src/main/java/com/dm/wallpaper/board/utils/listeners/InAppBillingListener.java // public interface InAppBillingListener { // // void onInAppBillingSelected(InAppBilling product); // void onInAppBillingConsume(String productId); // // }
import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.util.Log; import com.anjlab.android.iab.v3.BillingProcessor; import com.anjlab.android.iab.v3.Constants; import com.anjlab.android.iab.v3.TransactionDetails; import com.danimahardhika.android.helpers.core.utils.LogUtil; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.utils.listeners.InAppBillingListener; import java.lang.ref.WeakReference;
public void destroy() { if (mInAppBilling != null && mInAppBilling.get() != null) { if (mInAppBilling.get().getProcessor() != null) { mInAppBilling.get().getProcessor().release(); } mInAppBilling.clear(); } } public boolean handleActivityResult(int requestCode, int resultCode, Intent data) { return mInAppBilling.get().getProcessor().handleActivityResult(requestCode, resultCode, data); } public static InAppBillingProcessor get(@NonNull Context context) { if (mInAppBilling == null || mInAppBilling.get() == null) { mInAppBilling = new WeakReference<>(new InAppBillingProcessor(context)); } return mInAppBilling.get(); } @Override public void onProductPurchased(String productId, TransactionDetails details) { if (mInAppBilling == null || mInAppBilling.get() == null) { LogUtil.e("InAppBillingProcessor error: not initialized"); return; } try {
// Path: library/src/main/java/com/dm/wallpaper/board/utils/listeners/InAppBillingListener.java // public interface InAppBillingListener { // // void onInAppBillingSelected(InAppBilling product); // void onInAppBillingConsume(String productId); // // } // Path: library/src/main/java/com/dm/wallpaper/board/utils/InAppBillingProcessor.java import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; import android.util.Log; import com.anjlab.android.iab.v3.BillingProcessor; import com.anjlab.android.iab.v3.Constants; import com.anjlab.android.iab.v3.TransactionDetails; import com.danimahardhika.android.helpers.core.utils.LogUtil; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.utils.listeners.InAppBillingListener; import java.lang.ref.WeakReference; public void destroy() { if (mInAppBilling != null && mInAppBilling.get() != null) { if (mInAppBilling.get().getProcessor() != null) { mInAppBilling.get().getProcessor().release(); } mInAppBilling.clear(); } } public boolean handleActivityResult(int requestCode, int resultCode, Intent data) { return mInAppBilling.get().getProcessor().handleActivityResult(requestCode, resultCode, data); } public static InAppBillingProcessor get(@NonNull Context context) { if (mInAppBilling == null || mInAppBilling.get() == null) { mInAppBilling = new WeakReference<>(new InAppBillingProcessor(context)); } return mInAppBilling.get(); } @Override public void onProductPurchased(String productId, TransactionDetails details) { if (mInAppBilling == null || mInAppBilling.get() == null) { LogUtil.e("InAppBillingProcessor error: not initialized"); return; } try {
InAppBillingListener listener = (InAppBillingListener) mInAppBilling.get().mContext;
danimahardhika/wallpaperboard
library/src/main/java/com/dm/wallpaper/board/utils/Tooltip.java
// Path: library/src/main/java/com/dm/wallpaper/board/helpers/TypefaceHelper.java // public class TypefaceHelper { // // private static HashMap<String, WeakReference<Typeface>> mTypefaces = new HashMap<>(); // private static final String REGULAR = "regular"; // private static final String MEDIUM = "medium"; // private static final String BOLD = "bold"; // private static final String LOGO = "logo"; // // @Nullable // public static Typeface getRegular(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(REGULAR) || mTypefaces.get(REGULAR).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Regular.ttf"); // mTypefaces.put(REGULAR, new WeakReference<>(typeface)); // } // return mTypefaces.get(REGULAR).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getMedium(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(MEDIUM) || mTypefaces.get(MEDIUM).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Medium.ttf"); // mTypefaces.put(MEDIUM, new WeakReference<>(typeface)); // } // return mTypefaces.get(MEDIUM).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getBold(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(BOLD) || mTypefaces.get(BOLD).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Bold.ttf"); // mTypefaces.put(BOLD, new WeakReference<>(typeface)); // } // return mTypefaces.get(BOLD).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getLogo(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(LOGO) || mTypefaces.get(LOGO).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Logo.ttf"); // mTypefaces.put(LOGO, new WeakReference<>(typeface)); // } // return mTypefaces.get(LOGO).get(); // } catch (Exception e) { // return null; // } // } // }
import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.support.annotation.DrawableRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.v7.widget.AppCompatCheckBox; import android.support.v7.widget.ListPopupWindow; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.danimahardhika.android.helpers.core.ColorHelper; import com.danimahardhika.android.helpers.core.DrawableHelper; import com.danimahardhika.android.helpers.core.utils.LogUtil; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.helpers.TypefaceHelper;
return mCheckboxState; } public void show() { try { mPopupWindow.show(); } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); } } public void dismiss() { if (mPopupWindow.isShowing()) mPopupWindow.dismiss(); } private int getMeasuredWidth(@NonNull Context context) { DisplayMetrics metrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); int maxWidth = context.getResources().getDimensionPixelSize(R.dimen.tooltip_max_width); int minWidth = context.getResources().getDimensionPixelSize(R.dimen.tooltip_min_width); String longestText = mBuilder.mContent; if (mBuilder.mContent.length() < mBuilder.mDesc.length()) { longestText = mBuilder.mDesc; } int padding = context.getResources().getDimensionPixelSize(R.dimen.content_margin); TextView textView = new TextView(context); textView.setPadding(padding, 0, padding, 0);
// Path: library/src/main/java/com/dm/wallpaper/board/helpers/TypefaceHelper.java // public class TypefaceHelper { // // private static HashMap<String, WeakReference<Typeface>> mTypefaces = new HashMap<>(); // private static final String REGULAR = "regular"; // private static final String MEDIUM = "medium"; // private static final String BOLD = "bold"; // private static final String LOGO = "logo"; // // @Nullable // public static Typeface getRegular(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(REGULAR) || mTypefaces.get(REGULAR).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Regular.ttf"); // mTypefaces.put(REGULAR, new WeakReference<>(typeface)); // } // return mTypefaces.get(REGULAR).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getMedium(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(MEDIUM) || mTypefaces.get(MEDIUM).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Medium.ttf"); // mTypefaces.put(MEDIUM, new WeakReference<>(typeface)); // } // return mTypefaces.get(MEDIUM).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getBold(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(BOLD) || mTypefaces.get(BOLD).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Bold.ttf"); // mTypefaces.put(BOLD, new WeakReference<>(typeface)); // } // return mTypefaces.get(BOLD).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getLogo(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(LOGO) || mTypefaces.get(LOGO).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Logo.ttf"); // mTypefaces.put(LOGO, new WeakReference<>(typeface)); // } // return mTypefaces.get(LOGO).get(); // } catch (Exception e) { // return null; // } // } // } // Path: library/src/main/java/com/dm/wallpaper/board/utils/Tooltip.java import android.app.Activity; import android.content.Context; import android.graphics.Color; import android.graphics.PorterDuff; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.support.annotation.DrawableRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringRes; import android.support.v7.widget.AppCompatCheckBox; import android.support.v7.widget.ListPopupWindow; import android.util.DisplayMetrics; import android.util.Log; import android.util.TypedValue; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import com.danimahardhika.android.helpers.core.ColorHelper; import com.danimahardhika.android.helpers.core.DrawableHelper; import com.danimahardhika.android.helpers.core.utils.LogUtil; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.helpers.TypefaceHelper; return mCheckboxState; } public void show() { try { mPopupWindow.show(); } catch (Exception e) { LogUtil.e(Log.getStackTraceString(e)); } } public void dismiss() { if (mPopupWindow.isShowing()) mPopupWindow.dismiss(); } private int getMeasuredWidth(@NonNull Context context) { DisplayMetrics metrics = new DisplayMetrics(); ((Activity) context).getWindowManager().getDefaultDisplay().getMetrics(metrics); int maxWidth = context.getResources().getDimensionPixelSize(R.dimen.tooltip_max_width); int minWidth = context.getResources().getDimensionPixelSize(R.dimen.tooltip_min_width); String longestText = mBuilder.mContent; if (mBuilder.mContent.length() < mBuilder.mDesc.length()) { longestText = mBuilder.mDesc; } int padding = context.getResources().getDimensionPixelSize(R.dimen.content_margin); TextView textView = new TextView(context); textView.setPadding(padding, 0, padding, 0);
textView.setTypeface(TypefaceHelper.getRegular(context));
danimahardhika/wallpaperboard
library/src/main/java/com/dm/wallpaper/board/activities/configurations/SplashScreenConfiguration.java
// Path: library/src/main/java/com/dm/wallpaper/board/helpers/TypefaceHelper.java // public class TypefaceHelper { // // private static HashMap<String, WeakReference<Typeface>> mTypefaces = new HashMap<>(); // private static final String REGULAR = "regular"; // private static final String MEDIUM = "medium"; // private static final String BOLD = "bold"; // private static final String LOGO = "logo"; // // @Nullable // public static Typeface getRegular(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(REGULAR) || mTypefaces.get(REGULAR).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Regular.ttf"); // mTypefaces.put(REGULAR, new WeakReference<>(typeface)); // } // return mTypefaces.get(REGULAR).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getMedium(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(MEDIUM) || mTypefaces.get(MEDIUM).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Medium.ttf"); // mTypefaces.put(MEDIUM, new WeakReference<>(typeface)); // } // return mTypefaces.get(MEDIUM).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getBold(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(BOLD) || mTypefaces.get(BOLD).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Bold.ttf"); // mTypefaces.put(BOLD, new WeakReference<>(typeface)); // } // return mTypefaces.get(BOLD).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getLogo(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(LOGO) || mTypefaces.get(LOGO).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Logo.ttf"); // mTypefaces.put(LOGO, new WeakReference<>(typeface)); // } // return mTypefaces.get(LOGO).get(); // } catch (Exception e) { // return null; // } // } // }
import android.content.Context; import android.graphics.Typeface; import android.support.annotation.ColorInt; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import com.dm.wallpaper.board.helpers.TypefaceHelper; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy;
return this; } public Class<?> getMainActivity() { return mMainActivity; } public String getBottomText() { return mBottomText; } public int getBottomTextColor() { return mBottomTextColor; } public float getBottomTextSize() { switch (mBottomTextSize) { case FontSize.SMALL: return 14f; case FontSize.LARGE: return 16f; case FontSize.REGULAR: default: return 15f; } } public Typeface getBottomTextFont(@NonNull Context context) { switch (mBottomTextFont) { case FontStyle.MEDIUM:
// Path: library/src/main/java/com/dm/wallpaper/board/helpers/TypefaceHelper.java // public class TypefaceHelper { // // private static HashMap<String, WeakReference<Typeface>> mTypefaces = new HashMap<>(); // private static final String REGULAR = "regular"; // private static final String MEDIUM = "medium"; // private static final String BOLD = "bold"; // private static final String LOGO = "logo"; // // @Nullable // public static Typeface getRegular(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(REGULAR) || mTypefaces.get(REGULAR).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Regular.ttf"); // mTypefaces.put(REGULAR, new WeakReference<>(typeface)); // } // return mTypefaces.get(REGULAR).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getMedium(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(MEDIUM) || mTypefaces.get(MEDIUM).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Medium.ttf"); // mTypefaces.put(MEDIUM, new WeakReference<>(typeface)); // } // return mTypefaces.get(MEDIUM).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getBold(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(BOLD) || mTypefaces.get(BOLD).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Bold.ttf"); // mTypefaces.put(BOLD, new WeakReference<>(typeface)); // } // return mTypefaces.get(BOLD).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getLogo(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(LOGO) || mTypefaces.get(LOGO).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Logo.ttf"); // mTypefaces.put(LOGO, new WeakReference<>(typeface)); // } // return mTypefaces.get(LOGO).get(); // } catch (Exception e) { // return null; // } // } // } // Path: library/src/main/java/com/dm/wallpaper/board/activities/configurations/SplashScreenConfiguration.java import android.content.Context; import android.graphics.Typeface; import android.support.annotation.ColorInt; import android.support.annotation.IntDef; import android.support.annotation.NonNull; import com.dm.wallpaper.board.helpers.TypefaceHelper; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; return this; } public Class<?> getMainActivity() { return mMainActivity; } public String getBottomText() { return mBottomText; } public int getBottomTextColor() { return mBottomTextColor; } public float getBottomTextSize() { switch (mBottomTextSize) { case FontSize.SMALL: return 14f; case FontSize.LARGE: return 16f; case FontSize.REGULAR: default: return 15f; } } public Typeface getBottomTextFont(@NonNull Context context) { switch (mBottomTextFont) { case FontStyle.MEDIUM:
return TypefaceHelper.getMedium(context);
danimahardhika/wallpaperboard
library/src/main/java/com/dm/wallpaper/board/fragments/dialogs/RefreshDurationFragment.java
// Path: library/src/main/java/com/dm/wallpaper/board/helpers/TypefaceHelper.java // public class TypefaceHelper { // // private static HashMap<String, WeakReference<Typeface>> mTypefaces = new HashMap<>(); // private static final String REGULAR = "regular"; // private static final String MEDIUM = "medium"; // private static final String BOLD = "bold"; // private static final String LOGO = "logo"; // // @Nullable // public static Typeface getRegular(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(REGULAR) || mTypefaces.get(REGULAR).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Regular.ttf"); // mTypefaces.put(REGULAR, new WeakReference<>(typeface)); // } // return mTypefaces.get(REGULAR).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getMedium(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(MEDIUM) || mTypefaces.get(MEDIUM).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Medium.ttf"); // mTypefaces.put(MEDIUM, new WeakReference<>(typeface)); // } // return mTypefaces.get(MEDIUM).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getBold(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(BOLD) || mTypefaces.get(BOLD).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Bold.ttf"); // mTypefaces.put(BOLD, new WeakReference<>(typeface)); // } // return mTypefaces.get(BOLD).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getLogo(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(LOGO) || mTypefaces.get(LOGO).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Logo.ttf"); // mTypefaces.put(LOGO, new WeakReference<>(typeface)); // } // return mTypefaces.get(LOGO).get(); // } catch (Exception e) { // return null; // } // } // }
import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.widget.AppCompatRadioButton; import android.util.Log; import android.view.View; import android.widget.NumberPicker; import com.afollestad.materialdialogs.MaterialDialog; import com.danimahardhika.android.helpers.core.ColorHelper; import com.danimahardhika.android.helpers.core.DrawableHelper; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.R2; import com.dm.wallpaper.board.helpers.TypefaceHelper; import com.danimahardhika.android.helpers.core.utils.LogUtil; import com.dm.wallpaper.board.utils.listeners.RefreshDurationListener; import butterknife.BindView; import butterknife.ButterKnife;
RefreshDurationFragment fragment = new RefreshDurationFragment(); Bundle bundle = new Bundle(); bundle.putInt(ROTATE_TIME, rotateTime); bundle.putBoolean(MINUTE, isMinute); fragment.setArguments(bundle); return fragment; } public static void showRefreshDurationDialog(FragmentManager fm, int rotateTime, boolean isMinute) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } ft.add(newInstance(rotateTime, isMinute), TAG) .setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_FADE); try { ft.commit(); } catch (IllegalStateException e) { ft.commitAllowingStateLoss(); } } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()); builder.customView(R.layout.fragment_refresh_duration, true);
// Path: library/src/main/java/com/dm/wallpaper/board/helpers/TypefaceHelper.java // public class TypefaceHelper { // // private static HashMap<String, WeakReference<Typeface>> mTypefaces = new HashMap<>(); // private static final String REGULAR = "regular"; // private static final String MEDIUM = "medium"; // private static final String BOLD = "bold"; // private static final String LOGO = "logo"; // // @Nullable // public static Typeface getRegular(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(REGULAR) || mTypefaces.get(REGULAR).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Regular.ttf"); // mTypefaces.put(REGULAR, new WeakReference<>(typeface)); // } // return mTypefaces.get(REGULAR).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getMedium(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(MEDIUM) || mTypefaces.get(MEDIUM).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Medium.ttf"); // mTypefaces.put(MEDIUM, new WeakReference<>(typeface)); // } // return mTypefaces.get(MEDIUM).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getBold(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(BOLD) || mTypefaces.get(BOLD).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Bold.ttf"); // mTypefaces.put(BOLD, new WeakReference<>(typeface)); // } // return mTypefaces.get(BOLD).get(); // } catch (Exception e) { // return null; // } // } // // @Nullable // public static Typeface getLogo(@NonNull Context context) { // try { // if (!mTypefaces.containsKey(LOGO) || mTypefaces.get(LOGO).get() == null) { // Typeface typeface = Typeface.createFromAsset( // context.getAssets(), "fonts/Font-Logo.ttf"); // mTypefaces.put(LOGO, new WeakReference<>(typeface)); // } // return mTypefaces.get(LOGO).get(); // } catch (Exception e) { // return null; // } // } // } // Path: library/src/main/java/com/dm/wallpaper/board/fragments/dialogs/RefreshDurationFragment.java import android.app.Dialog; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.DialogFragment; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentTransaction; import android.support.v7.widget.AppCompatRadioButton; import android.util.Log; import android.view.View; import android.widget.NumberPicker; import com.afollestad.materialdialogs.MaterialDialog; import com.danimahardhika.android.helpers.core.ColorHelper; import com.danimahardhika.android.helpers.core.DrawableHelper; import com.dm.wallpaper.board.R; import com.dm.wallpaper.board.R2; import com.dm.wallpaper.board.helpers.TypefaceHelper; import com.danimahardhika.android.helpers.core.utils.LogUtil; import com.dm.wallpaper.board.utils.listeners.RefreshDurationListener; import butterknife.BindView; import butterknife.ButterKnife; RefreshDurationFragment fragment = new RefreshDurationFragment(); Bundle bundle = new Bundle(); bundle.putInt(ROTATE_TIME, rotateTime); bundle.putBoolean(MINUTE, isMinute); fragment.setArguments(bundle); return fragment; } public static void showRefreshDurationDialog(FragmentManager fm, int rotateTime, boolean isMinute) { FragmentTransaction ft = fm.beginTransaction(); Fragment prev = fm.findFragmentByTag(TAG); if (prev != null) { ft.remove(prev); } ft.add(newInstance(rotateTime, isMinute), TAG) .setTransitionStyle(FragmentTransaction.TRANSIT_FRAGMENT_FADE); try { ft.commit(); } catch (IllegalStateException e) { ft.commitAllowingStateLoss(); } } @NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) { MaterialDialog.Builder builder = new MaterialDialog.Builder(getActivity()); builder.customView(R.layout.fragment_refresh_duration, true);
builder.typeface(TypefaceHelper.getMedium(getActivity()), TypefaceHelper.getRegular(getActivity()));
danimahardhika/wallpaperboard
library/src/test/java/com/dm.wallpaper.board/ColorPaletteTest.java
// Path: library/src/main/java/com/dm/wallpaper/board/items/ColorPalette.java // public class ColorPalette { // // private List<Integer> mColors; // // public ColorPalette() { // mColors = new ArrayList<>(); // } // // public ColorPalette add(@ColorInt int color) { // if (color == 0) { // LogUtil.e("color: " +color+ " isn't valid, color ignored"); // return this; // } // if (!mColors.contains(color)) { // mColors.add(color); // return this; // } // LogUtil.e("ColorPalette: color already added"); // return this; // } // // @ColorInt // public int get(int index) { // if (index >= 0 && index < mColors.size()) { // return mColors.get(index); // } // LogUtil.e("ColorPalette: index out of bounds"); // return -1; // } // // @Nullable // public String getHex(int index) { // if (index >= 0 && index < mColors.size()) { // return String.format("#%06X", (0xFFFFFF & get(index))); // } // LogUtil.e("ColorPalette: index out of bounds"); // return null; // } // // public int size() { // return mColors.size(); // } // }
import android.graphics.Color; import com.dm.wallpaper.board.items.ColorPalette; import org.junit.Assert; import org.junit.Test;
package com.dm.wallpaper.board; /* * Wallpaper Board * * Copyright (c) 2017 Dani Mahardhika * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class ColorPaletteTest { @Test public void testColorPalette() {
// Path: library/src/main/java/com/dm/wallpaper/board/items/ColorPalette.java // public class ColorPalette { // // private List<Integer> mColors; // // public ColorPalette() { // mColors = new ArrayList<>(); // } // // public ColorPalette add(@ColorInt int color) { // if (color == 0) { // LogUtil.e("color: " +color+ " isn't valid, color ignored"); // return this; // } // if (!mColors.contains(color)) { // mColors.add(color); // return this; // } // LogUtil.e("ColorPalette: color already added"); // return this; // } // // @ColorInt // public int get(int index) { // if (index >= 0 && index < mColors.size()) { // return mColors.get(index); // } // LogUtil.e("ColorPalette: index out of bounds"); // return -1; // } // // @Nullable // public String getHex(int index) { // if (index >= 0 && index < mColors.size()) { // return String.format("#%06X", (0xFFFFFF & get(index))); // } // LogUtil.e("ColorPalette: index out of bounds"); // return null; // } // // public int size() { // return mColors.size(); // } // } // Path: library/src/test/java/com/dm.wallpaper.board/ColorPaletteTest.java import android.graphics.Color; import com.dm.wallpaper.board.items.ColorPalette; import org.junit.Assert; import org.junit.Test; package com.dm.wallpaper.board; /* * Wallpaper Board * * Copyright (c) 2017 Dani Mahardhika * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class ColorPaletteTest { @Test public void testColorPalette() {
ColorPalette palette = new ColorPalette();
danimahardhika/wallpaperboard
library/src/main/java/com/dm/wallpaper/board/tasks/WallpaperPaletteLoaderTask.java
// Path: library/src/main/java/com/dm/wallpaper/board/items/ColorPalette.java // public class ColorPalette { // // private List<Integer> mColors; // // public ColorPalette() { // mColors = new ArrayList<>(); // } // // public ColorPalette add(@ColorInt int color) { // if (color == 0) { // LogUtil.e("color: " +color+ " isn't valid, color ignored"); // return this; // } // if (!mColors.contains(color)) { // mColors.add(color); // return this; // } // LogUtil.e("ColorPalette: color already added"); // return this; // } // // @ColorInt // public int get(int index) { // if (index >= 0 && index < mColors.size()) { // return mColors.get(index); // } // LogUtil.e("ColorPalette: index out of bounds"); // return -1; // } // // @Nullable // public String getHex(int index) { // if (index >= 0 && index < mColors.size()) { // return String.format("#%06X", (0xFFFFFF & get(index))); // } // LogUtil.e("ColorPalette: index out of bounds"); // return null; // } // // public int size() { // return mColors.size(); // } // }
import android.graphics.Bitmap; import android.os.AsyncTask; import android.support.annotation.Nullable; import android.support.v7.graphics.Palette; import com.dm.wallpaper.board.items.ColorPalette; import com.danimahardhika.android.helpers.core.utils.LogUtil;
package com.dm.wallpaper.board.tasks; /* * Wallpaper Board * * Copyright (c) 2017 Dani Mahardhika * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class WallpaperPaletteLoaderTask { private Callback mCallback; private Bitmap mBitmap; private WallpaperPaletteLoaderTask(Bitmap bitmap) { mBitmap = bitmap; } public WallpaperPaletteLoaderTask callback(@Nullable Callback callback) { mCallback = callback; return this; } public AsyncTask start() { if (mBitmap == null) { LogUtil.e("PaletteLoader cancelled, bitmap is null"); return null; } try { return Palette.from(mBitmap).generate(palette -> { int dominant = palette.getDominantColor(0); int vibrant = palette.getVibrantColor(0); int vibrantLight = palette.getLightVibrantColor(0); int vibrantDark = palette.getDarkVibrantColor(0); int muted = palette.getMutedColor(0); int mutedLight = palette.getLightMutedColor(0); int mutedDark = palette.getDarkMutedColor(0);
// Path: library/src/main/java/com/dm/wallpaper/board/items/ColorPalette.java // public class ColorPalette { // // private List<Integer> mColors; // // public ColorPalette() { // mColors = new ArrayList<>(); // } // // public ColorPalette add(@ColorInt int color) { // if (color == 0) { // LogUtil.e("color: " +color+ " isn't valid, color ignored"); // return this; // } // if (!mColors.contains(color)) { // mColors.add(color); // return this; // } // LogUtil.e("ColorPalette: color already added"); // return this; // } // // @ColorInt // public int get(int index) { // if (index >= 0 && index < mColors.size()) { // return mColors.get(index); // } // LogUtil.e("ColorPalette: index out of bounds"); // return -1; // } // // @Nullable // public String getHex(int index) { // if (index >= 0 && index < mColors.size()) { // return String.format("#%06X", (0xFFFFFF & get(index))); // } // LogUtil.e("ColorPalette: index out of bounds"); // return null; // } // // public int size() { // return mColors.size(); // } // } // Path: library/src/main/java/com/dm/wallpaper/board/tasks/WallpaperPaletteLoaderTask.java import android.graphics.Bitmap; import android.os.AsyncTask; import android.support.annotation.Nullable; import android.support.v7.graphics.Palette; import com.dm.wallpaper.board.items.ColorPalette; import com.danimahardhika.android.helpers.core.utils.LogUtil; package com.dm.wallpaper.board.tasks; /* * Wallpaper Board * * Copyright (c) 2017 Dani Mahardhika * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ public class WallpaperPaletteLoaderTask { private Callback mCallback; private Bitmap mBitmap; private WallpaperPaletteLoaderTask(Bitmap bitmap) { mBitmap = bitmap; } public WallpaperPaletteLoaderTask callback(@Nullable Callback callback) { mCallback = callback; return this; } public AsyncTask start() { if (mBitmap == null) { LogUtil.e("PaletteLoader cancelled, bitmap is null"); return null; } try { return Palette.from(mBitmap).generate(palette -> { int dominant = palette.getDominantColor(0); int vibrant = palette.getVibrantColor(0); int vibrantLight = palette.getLightVibrantColor(0); int vibrantDark = palette.getDarkVibrantColor(0); int muted = palette.getMutedColor(0); int mutedLight = palette.getLightMutedColor(0); int mutedDark = palette.getDarkMutedColor(0);
ColorPalette colorPalette = new ColorPalette();
andreynovikov/Androzic
src/main/java/com/androzic/MapList.java
// Path: src/main/java/com/androzic/map/OnMapActionListener.java // public interface OnMapActionListener // { // void onOpenMap(); // void onMapDetails(BaseMap map); // void onMapSelectedAtPosition(BaseMap map); // void onMapSelected(BaseMap map); // }
import java.io.File; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.ListFragment; import android.support.v7.app.AppCompatActivity; import android.util.DisplayMetrics; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import com.androzic.map.BaseMap; import com.androzic.map.OnMapActionListener; import com.androzic.map.online.OnlineMap;
/* * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3). * Copyright (C) 2010-2014 Andrey Novikov <http://andreynovikov.info/> * * This file is part of Androzic application. * * Androzic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * Androzic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Androzic. If not, see <http://www.gnu.org/licenses/>. */ package com.androzic; public class MapList extends ListFragment { private final Handler handler = new Handler();
// Path: src/main/java/com/androzic/map/OnMapActionListener.java // public interface OnMapActionListener // { // void onOpenMap(); // void onMapDetails(BaseMap map); // void onMapSelectedAtPosition(BaseMap map); // void onMapSelected(BaseMap map); // } // Path: src/main/java/com/androzic/MapList.java import java.io.File; import java.util.Collections; import java.util.Comparator; import java.util.LinkedList; import java.util.List; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.SharedPreferences; import android.content.res.Resources; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.preference.PreferenceManager; import android.support.v4.app.ListFragment; import android.support.v7.app.AppCompatActivity; import android.util.DisplayMetrics; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.ProgressBar; import android.widget.TextView; import com.androzic.map.BaseMap; import com.androzic.map.OnMapActionListener; import com.androzic.map.online.OnlineMap; /* * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3). * Copyright (C) 2010-2014 Andrey Novikov <http://andreynovikov.info/> * * This file is part of Androzic application. * * Androzic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * Androzic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with Androzic. If not, see <http://www.gnu.org/licenses/>. */ package com.androzic; public class MapList extends ListFragment { private final Handler handler = new Handler();
private OnMapActionListener mapActionsCallback;
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/TimeLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import android.util.Log; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays times in increments of {@value #MINUTEINTERVAL} minutes. */ public class TimeLabeler extends Labeler { public static int MINUTEINTERVAL = 15; private final String mFormatString; public TimeLabeler(String formatString) { super(80, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/TimeLabeler.java import java.util.Calendar; import android.util.Log; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays times in increments of {@value #MINUTEINTERVAL} minutes. */ public class TimeLabeler extends Labeler { public static int MINUTEINTERVAL = 15; private final String mFormatString; public TimeLabeler(String formatString) { super(80, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/DayLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays days */ public class DayLabeler extends Labeler { private final String mFormatString; public DayLabeler(String formatString) { super(150, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/DayLabeler.java import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays days */ public class DayLabeler extends Labeler { private final String mFormatString; public DayLabeler(String formatString) { super(150, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import android.widget.TextView; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.timeview; /** * This is a simple implementation of a TimeView which is implemented * as a TextView. It is aware of whether or not it is the center view * in the ScrollLayout so that it can alter its appearance to indicate * that it is currently selected. */ public class TimeTextView extends TextView implements TimeView { protected long endTime, startTime; protected boolean isOutOfBounds = false; /** * constructor * @param context * @param isCenterView true if the element is the centered view in the ScrollLayout * @param textSize text size in dps */ public TimeTextView(Context context, boolean isCenterView, int textSize) { super(context); setupView(isCenterView, textSize); } /** * this method should be overwritten by inheriting classes to define its own look and feel * @param isCenterView true if the element is in the center of the scrollLayout * @param textSize textSize in dps */ protected void setupView(boolean isCenterView, int textSize) { setGravity(Gravity.CENTER); setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); if (isCenterView) { setTypeface(Typeface.DEFAULT_BOLD); setTextColor(0xFF333333); } else { setTextColor(0xFF666666); } }
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import android.widget.TextView; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.timeview; /** * This is a simple implementation of a TimeView which is implemented * as a TextView. It is aware of whether or not it is the center view * in the ScrollLayout so that it can alter its appearance to indicate * that it is currently selected. */ public class TimeTextView extends TextView implements TimeView { protected long endTime, startTime; protected boolean isOutOfBounds = false; /** * constructor * @param context * @param isCenterView true if the element is the centered view in the ScrollLayout * @param textSize text size in dps */ public TimeTextView(Context context, boolean isCenterView, int textSize) { super(context); setupView(isCenterView, textSize); } /** * this method should be overwritten by inheriting classes to define its own look and feel * @param isCenterView true if the element is in the center of the scrollLayout * @param textSize textSize in dps */ protected void setupView(boolean isCenterView, int textSize) { setGravity(Gravity.CENTER); setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); if (isCenterView) { setTypeface(Typeface.DEFAULT_BOLD); setTextColor(0xFF333333); } else { setTextColor(0xFF666666); } }
public void setVals(TimeObject to) {
andreynovikov/Androzic
src/main/java/com/androzic/route/RouteEdit.java
// Path: src/main/java/com/androzic/waypoint/OnWaypointActionListener.java // public interface OnWaypointActionListener // { // /** // * Position map so that waypoint is visible // */ // void onWaypointView(Waypoint waypoint); // /** // * Open waypoint information dialog // */ // void onWaypointShow(Waypoint waypoint); // void onWaypointDetails(Waypoint waypoint); // void onWaypointNavigate(Waypoint waypoint); // void onWaypointEdit(Waypoint waypoint); // void onWaypointShare(Waypoint waypoint); // void onWaypointRemove(Waypoint waypoint); // }
import android.widget.AdapterView; import android.widget.ArrayAdapter; import com.androzic.R; import com.androzic.data.Route; import com.androzic.data.Waypoint; import com.androzic.waypoint.OnWaypointActionListener; import com.mobeta.android.dslv.DragSortController; import com.mobeta.android.dslv.DragSortListView; import java.util.ArrayList; import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup;
/* * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3). * Copyright (C) 2010-2014 Andrey Novikov <http://andreynovikov.info/> * * This file is part of Androzic application. * * Androzic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Androzic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Androzic. If not, see <http://www.gnu.org/licenses/>. */ package com.androzic.route; public class RouteEdit extends DialogFragment {
// Path: src/main/java/com/androzic/waypoint/OnWaypointActionListener.java // public interface OnWaypointActionListener // { // /** // * Position map so that waypoint is visible // */ // void onWaypointView(Waypoint waypoint); // /** // * Open waypoint information dialog // */ // void onWaypointShow(Waypoint waypoint); // void onWaypointDetails(Waypoint waypoint); // void onWaypointNavigate(Waypoint waypoint); // void onWaypointEdit(Waypoint waypoint); // void onWaypointShare(Waypoint waypoint); // void onWaypointRemove(Waypoint waypoint); // } // Path: src/main/java/com/androzic/route/RouteEdit.java import android.widget.AdapterView; import android.widget.ArrayAdapter; import com.androzic.R; import com.androzic.data.Route; import com.androzic.data.Waypoint; import com.androzic.waypoint.OnWaypointActionListener; import com.mobeta.android.dslv.DragSortController; import com.mobeta.android.dslv.DragSortListView; import java.util.ArrayList; import java.util.List; import android.annotation.SuppressLint; import android.app.Activity; import android.os.Bundle; import android.support.v4.app.DialogFragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; /* * Androzic - android navigation client that uses OziExplorer maps (ozf2, ozfx3). * Copyright (C) 2010-2014 Andrey Novikov <http://andreynovikov.info/> * * This file is part of Androzic application. * * Androzic is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Androzic is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Androzic. If not, see <http://www.gnu.org/licenses/>. */ package com.androzic.route; public class RouteEdit extends DialogFragment {
private OnWaypointActionListener waypointActionsCallback;
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/WeekLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import java.util.Calendar; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A customized Labeler that displays weeks using a CustomTimeTextView */ public class WeekLabeler extends Labeler { private final String mFormatString; public WeekLabeler(String formatString) { super(120, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/WeekLabeler.java import java.util.Calendar; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A customized Labeler that displays weeks using a CustomTimeTextView */ public class WeekLabeler extends Labeler { private final String mFormatString; public WeekLabeler(String formatString) { super(120, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/WeekLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import java.util.Calendar; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A customized Labeler that displays weeks using a CustomTimeTextView */ public class WeekLabeler extends Labeler { private final String mFormatString; public WeekLabeler(String formatString) { super(120, 60); mFormatString = formatString; } @Override public TimeObject add(long time, int val) { return timeObjectfromCalendar(Util.addWeeks(time, val)); } /** * We implement this as custom code rather than a method in Util because there * is no format string that shows the week of the year as an integer, so we just * format the week directly rather than extracting it from a Calendar object. */ @Override protected TimeObject timeObjectfromCalendar(Calendar c) { int week = c.get(Calendar.WEEK_OF_YEAR); int day_of_week = c.get(Calendar.DAY_OF_WEEK)-1; // set calendar to first millisecond of the week c.add(Calendar.DAY_OF_MONTH,-day_of_week); c.set(Calendar.HOUR_OF_DAY,0);c.set(Calendar.MINUTE,0);c.set(Calendar.SECOND,0); c.set(Calendar.MILLISECOND, 0); long startTime = c.getTimeInMillis(); // set calendar to last millisecond of the week c.add(Calendar.DAY_OF_WEEK, 6); c.set(Calendar.HOUR_OF_DAY,23);c.set(Calendar.MINUTE,59);c.set(Calendar.SECOND,59); c.set(Calendar.MILLISECOND, 999); long endTime = c.getTimeInMillis(); return new TimeObject(String.format(mFormatString,week), startTime, endTime); } /** * create our customized TimeTextView and return it */
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/WeekLabeler.java import java.util.Calendar; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A customized Labeler that displays weeks using a CustomTimeTextView */ public class WeekLabeler extends Labeler { private final String mFormatString; public WeekLabeler(String formatString) { super(120, 60); mFormatString = formatString; } @Override public TimeObject add(long time, int val) { return timeObjectfromCalendar(Util.addWeeks(time, val)); } /** * We implement this as custom code rather than a method in Util because there * is no format string that shows the week of the year as an integer, so we just * format the week directly rather than extracting it from a Calendar object. */ @Override protected TimeObject timeObjectfromCalendar(Calendar c) { int week = c.get(Calendar.WEEK_OF_YEAR); int day_of_week = c.get(Calendar.DAY_OF_WEEK)-1; // set calendar to first millisecond of the week c.add(Calendar.DAY_OF_MONTH,-day_of_week); c.set(Calendar.HOUR_OF_DAY,0);c.set(Calendar.MINUTE,0);c.set(Calendar.SECOND,0); c.set(Calendar.MILLISECOND, 0); long startTime = c.getTimeInMillis(); // set calendar to last millisecond of the week c.add(Calendar.DAY_OF_WEEK, 6); c.set(Calendar.HOUR_OF_DAY,23);c.set(Calendar.MINUTE,59);c.set(Calendar.SECOND,59); c.set(Calendar.MILLISECOND, 999); long endTime = c.getTimeInMillis(); return new TimeObject(String.format(mFormatString,week), startTime, endTime); } /** * create our customized TimeTextView and return it */
public TimeView createView(Context context, boolean isCenterView) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/WeekLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import java.util.Calendar; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A customized Labeler that displays weeks using a CustomTimeTextView */ public class WeekLabeler extends Labeler { private final String mFormatString; public WeekLabeler(String formatString) { super(120, 60); mFormatString = formatString; } @Override public TimeObject add(long time, int val) { return timeObjectfromCalendar(Util.addWeeks(time, val)); } /** * We implement this as custom code rather than a method in Util because there * is no format string that shows the week of the year as an integer, so we just * format the week directly rather than extracting it from a Calendar object. */ @Override protected TimeObject timeObjectfromCalendar(Calendar c) { int week = c.get(Calendar.WEEK_OF_YEAR); int day_of_week = c.get(Calendar.DAY_OF_WEEK)-1; // set calendar to first millisecond of the week c.add(Calendar.DAY_OF_MONTH,-day_of_week); c.set(Calendar.HOUR_OF_DAY,0);c.set(Calendar.MINUTE,0);c.set(Calendar.SECOND,0); c.set(Calendar.MILLISECOND, 0); long startTime = c.getTimeInMillis(); // set calendar to last millisecond of the week c.add(Calendar.DAY_OF_WEEK, 6); c.set(Calendar.HOUR_OF_DAY,23);c.set(Calendar.MINUTE,59);c.set(Calendar.SECOND,59); c.set(Calendar.MILLISECOND, 999); long endTime = c.getTimeInMillis(); return new TimeObject(String.format(mFormatString,week), startTime, endTime); } /** * create our customized TimeTextView and return it */ public TimeView createView(Context context, boolean isCenterView) { return new CustomTimeTextView(context, isCenterView, 25); } /** * Here we define our Custom TimeTextView which will display the fonts in its very own way. */
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/WeekLabeler.java import java.util.Calendar; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * A customized Labeler that displays weeks using a CustomTimeTextView */ public class WeekLabeler extends Labeler { private final String mFormatString; public WeekLabeler(String formatString) { super(120, 60); mFormatString = formatString; } @Override public TimeObject add(long time, int val) { return timeObjectfromCalendar(Util.addWeeks(time, val)); } /** * We implement this as custom code rather than a method in Util because there * is no format string that shows the week of the year as an integer, so we just * format the week directly rather than extracting it from a Calendar object. */ @Override protected TimeObject timeObjectfromCalendar(Calendar c) { int week = c.get(Calendar.WEEK_OF_YEAR); int day_of_week = c.get(Calendar.DAY_OF_WEEK)-1; // set calendar to first millisecond of the week c.add(Calendar.DAY_OF_MONTH,-day_of_week); c.set(Calendar.HOUR_OF_DAY,0);c.set(Calendar.MINUTE,0);c.set(Calendar.SECOND,0); c.set(Calendar.MILLISECOND, 0); long startTime = c.getTimeInMillis(); // set calendar to last millisecond of the week c.add(Calendar.DAY_OF_WEEK, 6); c.set(Calendar.HOUR_OF_DAY,23);c.set(Calendar.MINUTE,59);c.set(Calendar.SECOND,59); c.set(Calendar.MILLISECOND, 999); long endTime = c.getTimeInMillis(); return new TimeObject(String.format(mFormatString,week), startTime, endTime); } /** * create our customized TimeTextView and return it */ public TimeView createView(Context context, boolean isCenterView) { return new CustomTimeTextView(context, isCenterView, 25); } /** * Here we define our Custom TimeTextView which will display the fonts in its very own way. */
private static class CustomTimeTextView extends TimeTextView {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MinuteLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays minutes */ public class MinuteLabeler extends Labeler { private final String mFormatString; public MinuteLabeler(String formatString) { super(45, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/MinuteLabeler.java import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays minutes */ public class MinuteLabeler extends Labeler { private final String mFormatString; public MinuteLabeler(String formatString) { super(45, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Labeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * This is an abstract class whose job is create TimeViews that can be used * to populate a ScrollLayout, and to generate TimeObjects from times that * can be used to populate the TimeViews. */ public abstract class Labeler { /** * The default width of views that this labeler generates, in dp */ private final int viewWidthDP; /** * The default height of views that this labeler generates, in dp */ private final int viewHeightDP; protected int minuteInterval=1; /** * @param viewWidthDB The default width of views labeled by this labeler in dp * @param viewHeightDB The default height of views labeled by this labeler in dp */ public Labeler(int viewWidthDP, int viewHeightDP) { this.viewWidthDP = viewWidthDP; this.viewHeightDP = viewHeightDP; } /** * Converts from a time to a TimeObject according to the rules of this labeler. * * @param time The time to display * @return the TimeObject representing "time" suitable for populating TimeViews * returned from {@link #createView(Context, boolean)} */
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Labeler.java import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * This is an abstract class whose job is create TimeViews that can be used * to populate a ScrollLayout, and to generate TimeObjects from times that * can be used to populate the TimeViews. */ public abstract class Labeler { /** * The default width of views that this labeler generates, in dp */ private final int viewWidthDP; /** * The default height of views that this labeler generates, in dp */ private final int viewHeightDP; protected int minuteInterval=1; /** * @param viewWidthDB The default width of views labeled by this labeler in dp * @param viewHeightDB The default height of views labeled by this labeler in dp */ public Labeler(int viewWidthDP, int viewHeightDP) { this.viewWidthDP = viewWidthDP; this.viewHeightDP = viewHeightDP; } /** * Converts from a time to a TimeObject according to the rules of this labeler. * * @param time The time to display * @return the TimeObject representing "time" suitable for populating TimeViews * returned from {@link #createView(Context, boolean)} */
public TimeObject getElem(long time) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Labeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * This is an abstract class whose job is create TimeViews that can be used * to populate a ScrollLayout, and to generate TimeObjects from times that * can be used to populate the TimeViews. */ public abstract class Labeler { /** * The default width of views that this labeler generates, in dp */ private final int viewWidthDP; /** * The default height of views that this labeler generates, in dp */ private final int viewHeightDP; protected int minuteInterval=1; /** * @param viewWidthDB The default width of views labeled by this labeler in dp * @param viewHeightDB The default height of views labeled by this labeler in dp */ public Labeler(int viewWidthDP, int viewHeightDP) { this.viewWidthDP = viewWidthDP; this.viewHeightDP = viewHeightDP; } /** * Converts from a time to a TimeObject according to the rules of this labeler. * * @param time The time to display * @return the TimeObject representing "time" suitable for populating TimeViews * returned from {@link #createView(Context, boolean)} */ public TimeObject getElem(long time) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); return timeObjectfromCalendar(c); } /** * Returns a new TimeView instance appropriate for population using TimeObjects * retrieved from {@link #getElem(long)}. * * @param context * @param isCenterView is true when the view is the central view * @return The new unpopulated TimeView object */
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Labeler.java import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * This is an abstract class whose job is create TimeViews that can be used * to populate a ScrollLayout, and to generate TimeObjects from times that * can be used to populate the TimeViews. */ public abstract class Labeler { /** * The default width of views that this labeler generates, in dp */ private final int viewWidthDP; /** * The default height of views that this labeler generates, in dp */ private final int viewHeightDP; protected int minuteInterval=1; /** * @param viewWidthDB The default width of views labeled by this labeler in dp * @param viewHeightDB The default height of views labeled by this labeler in dp */ public Labeler(int viewWidthDP, int viewHeightDP) { this.viewWidthDP = viewWidthDP; this.viewHeightDP = viewHeightDP; } /** * Converts from a time to a TimeObject according to the rules of this labeler. * * @param time The time to display * @return the TimeObject representing "time" suitable for populating TimeViews * returned from {@link #createView(Context, boolean)} */ public TimeObject getElem(long time) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); return timeObjectfromCalendar(c); } /** * Returns a new TimeView instance appropriate for population using TimeObjects * retrieved from {@link #getElem(long)}. * * @param context * @param isCenterView is true when the view is the central view * @return The new unpopulated TimeView object */
public TimeView createView(Context context, boolean isCenterView) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Labeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // }
import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView;
package com.googlecode.android.widgets.DateSlider.labeler; /** * This is an abstract class whose job is create TimeViews that can be used * to populate a ScrollLayout, and to generate TimeObjects from times that * can be used to populate the TimeViews. */ public abstract class Labeler { /** * The default width of views that this labeler generates, in dp */ private final int viewWidthDP; /** * The default height of views that this labeler generates, in dp */ private final int viewHeightDP; protected int minuteInterval=1; /** * @param viewWidthDB The default width of views labeled by this labeler in dp * @param viewHeightDB The default height of views labeled by this labeler in dp */ public Labeler(int viewWidthDP, int viewHeightDP) { this.viewWidthDP = viewWidthDP; this.viewHeightDP = viewHeightDP; } /** * Converts from a time to a TimeObject according to the rules of this labeler. * * @param time The time to display * @return the TimeObject representing "time" suitable for populating TimeViews * returned from {@link #createView(Context, boolean)} */ public TimeObject getElem(long time) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); return timeObjectfromCalendar(c); } /** * Returns a new TimeView instance appropriate for population using TimeObjects * retrieved from {@link #getElem(long)}. * * @param context * @param isCenterView is true when the view is the central view * @return The new unpopulated TimeView object */ public TimeView createView(Context context, boolean isCenterView) {
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeTextView.java // public class TimeTextView extends TextView implements TimeView { // protected long endTime, startTime; // protected boolean isOutOfBounds = false; // // /** // * constructor // * @param context // * @param isCenterView true if the element is the centered view in the ScrollLayout // * @param textSize text size in dps // */ // public TimeTextView(Context context, boolean isCenterView, int textSize) { // super(context); // setupView(isCenterView, textSize); // } // // /** // * this method should be overwritten by inheriting classes to define its own look and feel // * @param isCenterView true if the element is in the center of the scrollLayout // * @param textSize textSize in dps // */ // protected void setupView(boolean isCenterView, int textSize) { // setGravity(Gravity.CENTER); // setTextSize(TypedValue.COMPLEX_UNIT_DIP, textSize); // if (isCenterView) { // setTypeface(Typeface.DEFAULT_BOLD); // setTextColor(0xFF333333); // } else { // setTextColor(0xFF666666); // } // } // // // public void setVals(TimeObject to) { // setText(to.text); // this.startTime = to.startTime; // this.endTime = to.endTime; // } // // // public void setVals(TimeView other) { // setText(other.getTimeText()); // startTime = other.getStartTime(); // endTime = other.getEndTime(); // } // // public long getStartTime() { // return this.startTime; // } // // // public long getEndTime() { // return this.endTime; // } // // // public String getTimeText() { // return getText().toString(); // } // // public boolean isOutOfBounds() { // return isOutOfBounds; // } // // public void setOutOfBounds(boolean outOfBounds) { // if (outOfBounds && !isOutOfBounds) { // setTextColor(0x44666666); // } // else if (!outOfBounds && isOutOfBounds) { // setTextColor(0xFF666666); // } // isOutOfBounds = outOfBounds; // } // // } // // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeView.java // public interface TimeView { // /** // * Sets this TimeView to display the contents of the specified TimeObject. // * // * @param to The TimeObject to use to populate this TimeView // */ // public void setVals(TimeObject to); // /** // * Instructs this TimeView to copy its values from the specified TimeView, so // * it will assume the state of the other TimeView. // * // * @param other The TimeView to copy values from // */ // public void setVals(TimeView other); // // /** // * Get a string containing the textual representation of this TimeView's time // * @return // */ // public String getTimeText(); // /** // * Get the start time of this TimeView // * @return // */ // public long getStartTime(); // /** // * Get the end time of this TimeView // * @return // */ // public long getEndTime(); // // public boolean isOutOfBounds(); // public void setOutOfBounds(boolean outOfBounds); // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/Labeler.java import java.util.Calendar; import android.content.Context; import com.googlecode.android.widgets.DateSlider.TimeObject; import com.googlecode.android.widgets.DateSlider.timeview.TimeTextView; import com.googlecode.android.widgets.DateSlider.timeview.TimeView; package com.googlecode.android.widgets.DateSlider.labeler; /** * This is an abstract class whose job is create TimeViews that can be used * to populate a ScrollLayout, and to generate TimeObjects from times that * can be used to populate the TimeViews. */ public abstract class Labeler { /** * The default width of views that this labeler generates, in dp */ private final int viewWidthDP; /** * The default height of views that this labeler generates, in dp */ private final int viewHeightDP; protected int minuteInterval=1; /** * @param viewWidthDB The default width of views labeled by this labeler in dp * @param viewHeightDB The default height of views labeled by this labeler in dp */ public Labeler(int viewWidthDP, int viewHeightDP) { this.viewWidthDP = viewWidthDP; this.viewHeightDP = viewHeightDP; } /** * Converts from a time to a TimeObject according to the rules of this labeler. * * @param time The time to display * @return the TimeObject representing "time" suitable for populating TimeViews * returned from {@link #createView(Context, boolean)} */ public TimeObject getElem(long time) { Calendar c = Calendar.getInstance(); c.setTimeInMillis(time); return timeObjectfromCalendar(c); } /** * Returns a new TimeView instance appropriate for population using TimeObjects * retrieved from {@link #getElem(long)}. * * @param context * @param isCenterView is true when the view is the central view * @return The new unpopulated TimeView object */ public TimeView createView(Context context, boolean isCenterView) {
return new TimeTextView(context, isCenterView, 25);
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/labeler/HourLabeler.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject;
package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays hours */ public class HourLabeler extends Labeler { private final String mFormatString; public HourLabeler(String formatString) { super(90, 60); mFormatString = formatString; } @Override
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/labeler/HourLabeler.java import java.util.Calendar; import com.googlecode.android.widgets.DateSlider.TimeObject; package com.googlecode.android.widgets.DateSlider.labeler; /** * A Labeler that displays hours */ public class HourLabeler extends Labeler { private final String mFormatString; public HourLabeler(String formatString) { super(90, 60); mFormatString = formatString; } @Override
public TimeObject add(long time, int val) {
andreynovikov/Androzic
src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeLayoutView.java
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // }
import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import android.widget.LinearLayout; import android.widget.TextView; import com.googlecode.android.widgets.DateSlider.TimeObject;
* @param topTextSize text size of the top TextView in dps * @param bottomTextSize text size of the bottom TextView in dps * @param lineHeight LineHeight of the top TextView */ protected void setupView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { setOrientation(VERTICAL); topView = new TextView(context); topView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); topView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, topTextSize); bottomView = new TextView(context); bottomView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); bottomView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, bottomTextSize); topView.setLineSpacing(0, lineHeight); if (isCenterView) { isCenter = true; topView.setTypeface(Typeface.DEFAULT_BOLD); topView.setTextColor(0xFF333333); bottomView.setTypeface(Typeface.DEFAULT_BOLD); bottomView.setTextColor(0xFF444444); topView.setPadding(0, 5-(int)(topTextSize/15.0), 0, 0); } else { topView.setPadding(0, 5, 0, 0); topView.setTextColor(0xFF666666); bottomView.setTextColor(0xFF666666); } addView(topView);addView(bottomView); }
// Path: src/main/java/com/googlecode/android/widgets/DateSlider/TimeObject.java // public class TimeObject { // public final CharSequence text; // public final long startTime, endTime; // public TimeObject(final CharSequence text, final long startTime, final long endTime) { // this.text = text; // this.startTime = startTime; // this.endTime = endTime; // } // } // Path: src/main/java/com/googlecode/android/widgets/DateSlider/timeview/TimeLayoutView.java import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; import android.view.Gravity; import android.widget.LinearLayout; import android.widget.TextView; import com.googlecode.android.widgets.DateSlider.TimeObject; * @param topTextSize text size of the top TextView in dps * @param bottomTextSize text size of the bottom TextView in dps * @param lineHeight LineHeight of the top TextView */ protected void setupView(Context context, boolean isCenterView, int topTextSize, int bottomTextSize, float lineHeight) { setOrientation(VERTICAL); topView = new TextView(context); topView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.BOTTOM); topView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, topTextSize); bottomView = new TextView(context); bottomView.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.TOP); bottomView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, bottomTextSize); topView.setLineSpacing(0, lineHeight); if (isCenterView) { isCenter = true; topView.setTypeface(Typeface.DEFAULT_BOLD); topView.setTextColor(0xFF333333); bottomView.setTypeface(Typeface.DEFAULT_BOLD); bottomView.setTextColor(0xFF444444); topView.setPadding(0, 5-(int)(topTextSize/15.0), 0, 0); } else { topView.setPadding(0, 5, 0, 0); topView.setTextColor(0xFF666666); bottomView.setTextColor(0xFF666666); } addView(topView);addView(bottomView); }
public void setVals(TimeObject to) {