id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
sequence
docstring
stringlengths
3
16k
docstring_tokens
sequence
sha
stringlengths
40
40
url
stringlengths
105
339
3,200
ef-labs/vertx-jersey
vertx-jersey/src/main/java/com/englishtown/vertx/jersey/impl/DefaultJerseyOptions.java
DefaultJerseyOptions.getBaseUri
@Override public URI getBaseUri() { String basePath = config.getString(CONFIG_BASE_PATH, "/"); if (!basePath.endsWith("/")) { basePath += "/"; } return URI.create(basePath); }
java
@Override public URI getBaseUri() { String basePath = config.getString(CONFIG_BASE_PATH, "/"); if (!basePath.endsWith("/")) { basePath += "/"; } return URI.create(basePath); }
[ "@", "Override", "public", "URI", "getBaseUri", "(", ")", "{", "String", "basePath", "=", "config", ".", "getString", "(", "CONFIG_BASE_PATH", ",", "\"/\"", ")", ";", "if", "(", "!", "basePath", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "basePath", "+=", "\"/\"", ";", "}", "return", "URI", ".", "create", "(", "basePath", ")", ";", "}" ]
Returns the base URI used by Jersey @return base URI
[ "Returns", "the", "base", "URI", "used", "by", "Jersey" ]
733482a8a5afb1fb257c682b3767655e56f7a0fe
https://github.com/ef-labs/vertx-jersey/blob/733482a8a5afb1fb257c682b3767655e56f7a0fe/vertx-jersey/src/main/java/com/englishtown/vertx/jersey/impl/DefaultJerseyOptions.java#L257-L264
3,201
googlearchive/firebase-simple-login-java
src/main/java/com/firebase/simplelogin/SimpleLogin.java
SimpleLogin.checkAuthStatus
public void checkAuthStatus(SimpleLoginAuthenticatedHandler handler) { if(androidContext != null) { SharedPreferences sharedPreferences = androidContext.getSharedPreferences(Constants.FIREBASE_ANDROID_SHARED_PREFERENCE, Context.MODE_PRIVATE); String jsonTokenData = sharedPreferences.getString("jsonTokenData", null); if(jsonTokenData != null) { try { JSONObject jsonObject = new JSONObject(jsonTokenData); attemptAuthWithData(jsonObject, handler); } catch (JSONException e) { handler.authenticated(null, null); } } else { handler.authenticated(null, null); } } else { handler.authenticated(null, null); } }
java
public void checkAuthStatus(SimpleLoginAuthenticatedHandler handler) { if(androidContext != null) { SharedPreferences sharedPreferences = androidContext.getSharedPreferences(Constants.FIREBASE_ANDROID_SHARED_PREFERENCE, Context.MODE_PRIVATE); String jsonTokenData = sharedPreferences.getString("jsonTokenData", null); if(jsonTokenData != null) { try { JSONObject jsonObject = new JSONObject(jsonTokenData); attemptAuthWithData(jsonObject, handler); } catch (JSONException e) { handler.authenticated(null, null); } } else { handler.authenticated(null, null); } } else { handler.authenticated(null, null); } }
[ "public", "void", "checkAuthStatus", "(", "SimpleLoginAuthenticatedHandler", "handler", ")", "{", "if", "(", "androidContext", "!=", "null", ")", "{", "SharedPreferences", "sharedPreferences", "=", "androidContext", ".", "getSharedPreferences", "(", "Constants", ".", "FIREBASE_ANDROID_SHARED_PREFERENCE", ",", "Context", ".", "MODE_PRIVATE", ")", ";", "String", "jsonTokenData", "=", "sharedPreferences", ".", "getString", "(", "\"jsonTokenData\"", ",", "null", ")", ";", "if", "(", "jsonTokenData", "!=", "null", ")", "{", "try", "{", "JSONObject", "jsonObject", "=", "new", "JSONObject", "(", "jsonTokenData", ")", ";", "attemptAuthWithData", "(", "jsonObject", ",", "handler", ")", ";", "}", "catch", "(", "JSONException", "e", ")", "{", "handler", ".", "authenticated", "(", "null", ",", "null", ")", ";", "}", "}", "else", "{", "handler", ".", "authenticated", "(", "null", ",", "null", ")", ";", "}", "}", "else", "{", "handler", ".", "authenticated", "(", "null", ",", "null", ")", ";", "}", "}" ]
Check the authentication status. If there is a previously signed in user, it will reauthenticate that user. @param handler Handler for asynchronous events.
[ "Check", "the", "authentication", "status", ".", "If", "there", "is", "a", "previously", "signed", "in", "user", "it", "will", "reauthenticate", "that", "user", "." ]
40498ad173b5fa69c869ba0d29cec187271fda13
https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L164-L184
3,202
googlearchive/firebase-simple-login-java
src/main/java/com/firebase/simplelogin/SimpleLogin.java
SimpleLogin.loginAnonymously
public void loginAnonymously(final SimpleLoginAuthenticatedHandler completionHandler) { HashMap<String, String> data = new HashMap<String, String>(); makeRequest(Constants.FIREBASE_AUTH_ANONYMOUS_PATH, data, new RequestHandler() { public void handle(FirebaseSimpleLoginError error, JSONObject data) { if (error != null) { completionHandler.authenticated(error, null); } else { try { String token = data.has("token") ? data.getString("token") : null; if (token == null) { JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null; FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(errorDetails); completionHandler.authenticated(theError, null); } else { JSONObject userData = data.has("user") ? data.getJSONObject("user") : null; if (userData == null) { FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null); completionHandler.authenticated(theError, null); } else { attemptAuthWithToken(token, Provider.ANONYMOUS, userData, completionHandler); } } } catch (JSONException e) { e.printStackTrace(); FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null); completionHandler.authenticated(theError, null); } } } }); }
java
public void loginAnonymously(final SimpleLoginAuthenticatedHandler completionHandler) { HashMap<String, String> data = new HashMap<String, String>(); makeRequest(Constants.FIREBASE_AUTH_ANONYMOUS_PATH, data, new RequestHandler() { public void handle(FirebaseSimpleLoginError error, JSONObject data) { if (error != null) { completionHandler.authenticated(error, null); } else { try { String token = data.has("token") ? data.getString("token") : null; if (token == null) { JSONObject errorDetails = data.has("error") ? data.getJSONObject("error") : null; FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(errorDetails); completionHandler.authenticated(theError, null); } else { JSONObject userData = data.has("user") ? data.getJSONObject("user") : null; if (userData == null) { FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null); completionHandler.authenticated(theError, null); } else { attemptAuthWithToken(token, Provider.ANONYMOUS, userData, completionHandler); } } } catch (JSONException e) { e.printStackTrace(); FirebaseSimpleLoginError theError = FirebaseSimpleLoginError.errorFromResponse(null); completionHandler.authenticated(theError, null); } } } }); }
[ "public", "void", "loginAnonymously", "(", "final", "SimpleLoginAuthenticatedHandler", "completionHandler", ")", "{", "HashMap", "<", "String", ",", "String", ">", "data", "=", "new", "HashMap", "<", "String", ",", "String", ">", "(", ")", ";", "makeRequest", "(", "Constants", ".", "FIREBASE_AUTH_ANONYMOUS_PATH", ",", "data", ",", "new", "RequestHandler", "(", ")", "{", "public", "void", "handle", "(", "FirebaseSimpleLoginError", "error", ",", "JSONObject", "data", ")", "{", "if", "(", "error", "!=", "null", ")", "{", "completionHandler", ".", "authenticated", "(", "error", ",", "null", ")", ";", "}", "else", "{", "try", "{", "String", "token", "=", "data", ".", "has", "(", "\"token\"", ")", "?", "data", ".", "getString", "(", "\"token\"", ")", ":", "null", ";", "if", "(", "token", "==", "null", ")", "{", "JSONObject", "errorDetails", "=", "data", ".", "has", "(", "\"error\"", ")", "?", "data", ".", "getJSONObject", "(", "\"error\"", ")", ":", "null", ";", "FirebaseSimpleLoginError", "theError", "=", "FirebaseSimpleLoginError", ".", "errorFromResponse", "(", "errorDetails", ")", ";", "completionHandler", ".", "authenticated", "(", "theError", ",", "null", ")", ";", "}", "else", "{", "JSONObject", "userData", "=", "data", ".", "has", "(", "\"user\"", ")", "?", "data", ".", "getJSONObject", "(", "\"user\"", ")", ":", "null", ";", "if", "(", "userData", "==", "null", ")", "{", "FirebaseSimpleLoginError", "theError", "=", "FirebaseSimpleLoginError", ".", "errorFromResponse", "(", "null", ")", ";", "completionHandler", ".", "authenticated", "(", "theError", ",", "null", ")", ";", "}", "else", "{", "attemptAuthWithToken", "(", "token", ",", "Provider", ".", "ANONYMOUS", ",", "userData", ",", "completionHandler", ")", ";", "}", "}", "}", "catch", "(", "JSONException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "FirebaseSimpleLoginError", "theError", "=", "FirebaseSimpleLoginError", ".", "errorFromResponse", "(", "null", ")", ";", "completionHandler", ".", "authenticated", "(", "theError", ",", "null", ")", ";", "}", "}", "}", "}", ")", ";", "}" ]
Login anonymously. @param completionHandler Handler for asynchronous events.
[ "Login", "anonymously", "." ]
40498ad173b5fa69c869ba0d29cec187271fda13
https://github.com/googlearchive/firebase-simple-login-java/blob/40498ad173b5fa69c869ba0d29cec187271fda13/src/main/java/com/firebase/simplelogin/SimpleLogin.java#L225-L261
3,203
johnkil/Print
print/src/main/java/com/github/johnkil/print/PrintViewUtils.java
PrintViewUtils.initIcon
static PrintDrawable initIcon(Context context, AttributeSet attrs, boolean inEditMode) { PrintDrawable.Builder iconBuilder = new PrintDrawable.Builder(context); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PrintView); if (a.hasValue(R.styleable.PrintView_print_iconText)) { String iconText = a.getString(R.styleable.PrintView_print_iconText); iconBuilder.iconText(iconText); } if (a.hasValue(R.styleable.PrintView_print_iconCode)) { int iconCode = a.getInteger(R.styleable.PrintView_print_iconCode, 0); iconBuilder.iconCode(iconCode); } if (!inEditMode && a.hasValue(R.styleable.PrintView_print_iconFont)) { String iconFontPath = a.getString(R.styleable.PrintView_print_iconFont); iconBuilder.iconFont(TypefaceManager.load(context.getAssets(), iconFontPath)); } if (a.hasValue(R.styleable.PrintView_print_iconColor)) { ColorStateList iconColor = a.getColorStateList(R.styleable.PrintView_print_iconColor); iconBuilder.iconColor(iconColor); } int iconSize = a.getDimensionPixelSize(R.styleable.PrintView_print_iconSize, 0); iconBuilder.iconSize(TypedValue.COMPLEX_UNIT_PX, iconSize); iconBuilder.inEditMode(inEditMode); a.recycle(); } return iconBuilder.build(); }
java
static PrintDrawable initIcon(Context context, AttributeSet attrs, boolean inEditMode) { PrintDrawable.Builder iconBuilder = new PrintDrawable.Builder(context); if (attrs != null) { TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PrintView); if (a.hasValue(R.styleable.PrintView_print_iconText)) { String iconText = a.getString(R.styleable.PrintView_print_iconText); iconBuilder.iconText(iconText); } if (a.hasValue(R.styleable.PrintView_print_iconCode)) { int iconCode = a.getInteger(R.styleable.PrintView_print_iconCode, 0); iconBuilder.iconCode(iconCode); } if (!inEditMode && a.hasValue(R.styleable.PrintView_print_iconFont)) { String iconFontPath = a.getString(R.styleable.PrintView_print_iconFont); iconBuilder.iconFont(TypefaceManager.load(context.getAssets(), iconFontPath)); } if (a.hasValue(R.styleable.PrintView_print_iconColor)) { ColorStateList iconColor = a.getColorStateList(R.styleable.PrintView_print_iconColor); iconBuilder.iconColor(iconColor); } int iconSize = a.getDimensionPixelSize(R.styleable.PrintView_print_iconSize, 0); iconBuilder.iconSize(TypedValue.COMPLEX_UNIT_PX, iconSize); iconBuilder.inEditMode(inEditMode); a.recycle(); } return iconBuilder.build(); }
[ "static", "PrintDrawable", "initIcon", "(", "Context", "context", ",", "AttributeSet", "attrs", ",", "boolean", "inEditMode", ")", "{", "PrintDrawable", ".", "Builder", "iconBuilder", "=", "new", "PrintDrawable", ".", "Builder", "(", "context", ")", ";", "if", "(", "attrs", "!=", "null", ")", "{", "TypedArray", "a", "=", "context", ".", "obtainStyledAttributes", "(", "attrs", ",", "R", ".", "styleable", ".", "PrintView", ")", ";", "if", "(", "a", ".", "hasValue", "(", "R", ".", "styleable", ".", "PrintView_print_iconText", ")", ")", "{", "String", "iconText", "=", "a", ".", "getString", "(", "R", ".", "styleable", ".", "PrintView_print_iconText", ")", ";", "iconBuilder", ".", "iconText", "(", "iconText", ")", ";", "}", "if", "(", "a", ".", "hasValue", "(", "R", ".", "styleable", ".", "PrintView_print_iconCode", ")", ")", "{", "int", "iconCode", "=", "a", ".", "getInteger", "(", "R", ".", "styleable", ".", "PrintView_print_iconCode", ",", "0", ")", ";", "iconBuilder", ".", "iconCode", "(", "iconCode", ")", ";", "}", "if", "(", "!", "inEditMode", "&&", "a", ".", "hasValue", "(", "R", ".", "styleable", ".", "PrintView_print_iconFont", ")", ")", "{", "String", "iconFontPath", "=", "a", ".", "getString", "(", "R", ".", "styleable", ".", "PrintView_print_iconFont", ")", ";", "iconBuilder", ".", "iconFont", "(", "TypefaceManager", ".", "load", "(", "context", ".", "getAssets", "(", ")", ",", "iconFontPath", ")", ")", ";", "}", "if", "(", "a", ".", "hasValue", "(", "R", ".", "styleable", ".", "PrintView_print_iconColor", ")", ")", "{", "ColorStateList", "iconColor", "=", "a", ".", "getColorStateList", "(", "R", ".", "styleable", ".", "PrintView_print_iconColor", ")", ";", "iconBuilder", ".", "iconColor", "(", "iconColor", ")", ";", "}", "int", "iconSize", "=", "a", ".", "getDimensionPixelSize", "(", "R", ".", "styleable", ".", "PrintView_print_iconSize", ",", "0", ")", ";", "iconBuilder", ".", "iconSize", "(", "TypedValue", ".", "COMPLEX_UNIT_PX", ",", "iconSize", ")", ";", "iconBuilder", ".", "inEditMode", "(", "inEditMode", ")", ";", "a", ".", "recycle", "(", ")", ";", "}", "return", "iconBuilder", ".", "build", "(", ")", ";", "}" ]
Initialization of icon for print views. @param context The Context the view is running in, through which it can access the current theme, resources, etc. @param attrs The attributes of the XML tag that is inflating the view. @param inEditMode Indicates whether this View is currently in edit mode. @return The icon to display.
[ "Initialization", "of", "icon", "for", "print", "views", "." ]
535f3ca466289c491b8c29f41c32e72f0bb95127
https://github.com/johnkil/Print/blob/535f3ca466289c491b8c29f41c32e72f0bb95127/print/src/main/java/com/github/johnkil/print/PrintViewUtils.java#L36-L71
3,204
johnkil/Print
print/src/main/java/com/github/johnkil/print/PrintConfig.java
PrintConfig.initDefault
public static void initDefault(AssetManager assets, String defaultFontPath) { Typeface defaultFont = TypefaceManager.load(assets, defaultFontPath); initDefault(defaultFont); }
java
public static void initDefault(AssetManager assets, String defaultFontPath) { Typeface defaultFont = TypefaceManager.load(assets, defaultFontPath); initDefault(defaultFont); }
[ "public", "static", "void", "initDefault", "(", "AssetManager", "assets", ",", "String", "defaultFontPath", ")", "{", "Typeface", "defaultFont", "=", "TypefaceManager", ".", "load", "(", "assets", ",", "defaultFontPath", ")", ";", "initDefault", "(", "defaultFont", ")", ";", "}" ]
Define the default iconic font. @param assets The application's asset manager. @param defaultFontPath The file name of the font in the assets directory, e.g. "fonts/iconic-font.ttf". @see #initDefault(Typeface)
[ "Define", "the", "default", "iconic", "font", "." ]
535f3ca466289c491b8c29f41c32e72f0bb95127
https://github.com/johnkil/Print/blob/535f3ca466289c491b8c29f41c32e72f0bb95127/print/src/main/java/com/github/johnkil/print/PrintConfig.java#L34-L37
3,205
johnkil/Print
print/src/main/java/com/github/johnkil/print/TypefaceManager.java
TypefaceManager.load
static Typeface load(AssetManager assets, String path) { synchronized (sTypefaces) { Typeface typeface; if (sTypefaces.containsKey(path)) { typeface = sTypefaces.get(path); } else { typeface = Typeface.createFromAsset(assets, path); sTypefaces.put(path, typeface); } return typeface; } }
java
static Typeface load(AssetManager assets, String path) { synchronized (sTypefaces) { Typeface typeface; if (sTypefaces.containsKey(path)) { typeface = sTypefaces.get(path); } else { typeface = Typeface.createFromAsset(assets, path); sTypefaces.put(path, typeface); } return typeface; } }
[ "static", "Typeface", "load", "(", "AssetManager", "assets", ",", "String", "path", ")", "{", "synchronized", "(", "sTypefaces", ")", "{", "Typeface", "typeface", ";", "if", "(", "sTypefaces", ".", "containsKey", "(", "path", ")", ")", "{", "typeface", "=", "sTypefaces", ".", "get", "(", "path", ")", ";", "}", "else", "{", "typeface", "=", "Typeface", ".", "createFromAsset", "(", "assets", ",", "path", ")", ";", "sTypefaces", ".", "put", "(", "path", ",", "typeface", ")", ";", "}", "return", "typeface", ";", "}", "}" ]
Load a typeface from the specified font data. @param assets The application's asset manager. @param path The file name of the font data in the assets directory.
[ "Load", "a", "typeface", "from", "the", "specified", "font", "data", "." ]
535f3ca466289c491b8c29f41c32e72f0bb95127
https://github.com/johnkil/Print/blob/535f3ca466289c491b8c29f41c32e72f0bb95127/print/src/main/java/com/github/johnkil/print/TypefaceManager.java#L42-L53
3,206
redfish4ktc/maven-soapui-extension-plugin
src/main/java/org/ktc/soapui/maven/extension/MockAsWarMojo.java
MockAsWarMojo.buildSoapuiGuiEnvironment
private void buildSoapuiGuiEnvironment() throws DependencyResolutionException, IOException { getLog().info("Building a SoapUI Gui environment"); String version = ProjectInfo.getVersion(); // use our plugin to be sure we do not have missing dependencies (at least for versions prior to 4.5.2) File soapuiLibDirectory = getBuiltSoapuiGuiLibDirectory(); resolveAndCopyDependencies(new DefaultArtifact("com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:" + version), soapuiLibDirectory); // Needed, otherwise the generator mess up File soapuiBinDirectory = getBuiltSoapuiGuiBinDirectory(); copySoapuiJar(soapuiLibDirectory, soapuiBinDirectory); System.setProperty("soapui.home", soapuiBinDirectory.getAbsolutePath()); getLog().info("SoapUI Gui environment built"); // TODO check to set this java property if setting headless does not work: // uncomment to disable browser component // -Dsoapui.jxbrowser.disable="true" }
java
private void buildSoapuiGuiEnvironment() throws DependencyResolutionException, IOException { getLog().info("Building a SoapUI Gui environment"); String version = ProjectInfo.getVersion(); // use our plugin to be sure we do not have missing dependencies (at least for versions prior to 4.5.2) File soapuiLibDirectory = getBuiltSoapuiGuiLibDirectory(); resolveAndCopyDependencies(new DefaultArtifact("com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:" + version), soapuiLibDirectory); // Needed, otherwise the generator mess up File soapuiBinDirectory = getBuiltSoapuiGuiBinDirectory(); copySoapuiJar(soapuiLibDirectory, soapuiBinDirectory); System.setProperty("soapui.home", soapuiBinDirectory.getAbsolutePath()); getLog().info("SoapUI Gui environment built"); // TODO check to set this java property if setting headless does not work: // uncomment to disable browser component // -Dsoapui.jxbrowser.disable="true" }
[ "private", "void", "buildSoapuiGuiEnvironment", "(", ")", "throws", "DependencyResolutionException", ",", "IOException", "{", "getLog", "(", ")", ".", "info", "(", "\"Building a SoapUI Gui environment\"", ")", ";", "String", "version", "=", "ProjectInfo", ".", "getVersion", "(", ")", ";", "// use our plugin to be sure we do not have missing dependencies (at least for versions prior to 4.5.2) ", "File", "soapuiLibDirectory", "=", "getBuiltSoapuiGuiLibDirectory", "(", ")", ";", "resolveAndCopyDependencies", "(", "new", "DefaultArtifact", "(", "\"com.github.redfish4ktc.soapui:maven-soapui-extension-plugin:\"", "+", "version", ")", ",", "soapuiLibDirectory", ")", ";", "// Needed, otherwise the generator mess up", "File", "soapuiBinDirectory", "=", "getBuiltSoapuiGuiBinDirectory", "(", ")", ";", "copySoapuiJar", "(", "soapuiLibDirectory", ",", "soapuiBinDirectory", ")", ";", "System", ".", "setProperty", "(", "\"soapui.home\"", ",", "soapuiBinDirectory", ".", "getAbsolutePath", "(", ")", ")", ";", "getLog", "(", ")", ".", "info", "(", "\"SoapUI Gui environment built\"", ")", ";", "// TODO check to set this java property if setting headless does not work:", "// uncomment to disable browser component", "// -Dsoapui.jxbrowser.disable=\"true\"", "}" ]
if the soapui.home property if already set, we should restore the initial value after the call of this mojo
[ "if", "the", "soapui", ".", "home", "property", "if", "already", "set", "we", "should", "restore", "the", "initial", "value", "after", "the", "call", "of", "this", "mojo" ]
556f0e6b2bd1db82feae0e3523a1eb0873fafebd
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/556f0e6b2bd1db82feae0e3523a1eb0873fafebd/src/main/java/org/ktc/soapui/maven/extension/MockAsWarMojo.java#L131-L149
3,207
redfish4ktc/maven-soapui-extension-plugin
src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIExtensionMockAsWarGenerator.java
SoapUIExtensionMockAsWarGenerator.runRunner
@Override protected boolean runRunner() throws Exception { WsdlProject project = (WsdlProject) ProjectFactoryRegistry.getProjectFactory("wsdl").createNew( getProjectFile(), getProjectPassword()); String pFile = getProjectFile(); project.getSettings().setString(ProjectSettings.SHADOW_PASSWORD, null); File tmpProjectFile = new File(System.getProperty("java.io.tmpdir")); tmpProjectFile = new File(tmpProjectFile, project.getName() + "-project.xml"); project.beforeSave(); project.saveIn(tmpProjectFile); pFile = tmpProjectFile.getAbsolutePath(); String endpoint = (StringUtils.hasContent(this.getLocalEndpoint())) ? this.getLocalEndpoint() : project .getName(); this.log.info("Creating WAR file with endpoint [" + endpoint + "]"); // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension(pFile, getSettingsFile(), getOutputFolder(), this.getWarFile(), this.isIncludeLibraries(), this.isIncludeActions(), this.isIncludeListeners(), endpoint, this.isEnableWebUI()); mockAsWar.createMockAsWarArchive(); this.log.info("WAR Generation complete"); return true; }
java
@Override protected boolean runRunner() throws Exception { WsdlProject project = (WsdlProject) ProjectFactoryRegistry.getProjectFactory("wsdl").createNew( getProjectFile(), getProjectPassword()); String pFile = getProjectFile(); project.getSettings().setString(ProjectSettings.SHADOW_PASSWORD, null); File tmpProjectFile = new File(System.getProperty("java.io.tmpdir")); tmpProjectFile = new File(tmpProjectFile, project.getName() + "-project.xml"); project.beforeSave(); project.saveIn(tmpProjectFile); pFile = tmpProjectFile.getAbsolutePath(); String endpoint = (StringUtils.hasContent(this.getLocalEndpoint())) ? this.getLocalEndpoint() : project .getName(); this.log.info("Creating WAR file with endpoint [" + endpoint + "]"); // TODO the temporary file should be removed at the end of the process MockAsWarExtension mockAsWar = new MockAsWarExtension(pFile, getSettingsFile(), getOutputFolder(), this.getWarFile(), this.isIncludeLibraries(), this.isIncludeActions(), this.isIncludeListeners(), endpoint, this.isEnableWebUI()); mockAsWar.createMockAsWarArchive(); this.log.info("WAR Generation complete"); return true; }
[ "@", "Override", "protected", "boolean", "runRunner", "(", ")", "throws", "Exception", "{", "WsdlProject", "project", "=", "(", "WsdlProject", ")", "ProjectFactoryRegistry", ".", "getProjectFactory", "(", "\"wsdl\"", ")", ".", "createNew", "(", "getProjectFile", "(", ")", ",", "getProjectPassword", "(", ")", ")", ";", "String", "pFile", "=", "getProjectFile", "(", ")", ";", "project", ".", "getSettings", "(", ")", ".", "setString", "(", "ProjectSettings", ".", "SHADOW_PASSWORD", ",", "null", ")", ";", "File", "tmpProjectFile", "=", "new", "File", "(", "System", ".", "getProperty", "(", "\"java.io.tmpdir\"", ")", ")", ";", "tmpProjectFile", "=", "new", "File", "(", "tmpProjectFile", ",", "project", ".", "getName", "(", ")", "+", "\"-project.xml\"", ")", ";", "project", ".", "beforeSave", "(", ")", ";", "project", ".", "saveIn", "(", "tmpProjectFile", ")", ";", "pFile", "=", "tmpProjectFile", ".", "getAbsolutePath", "(", ")", ";", "String", "endpoint", "=", "(", "StringUtils", ".", "hasContent", "(", "this", ".", "getLocalEndpoint", "(", ")", ")", ")", "?", "this", ".", "getLocalEndpoint", "(", ")", ":", "project", ".", "getName", "(", ")", ";", "this", ".", "log", ".", "info", "(", "\"Creating WAR file with endpoint [\"", "+", "endpoint", "+", "\"]\"", ")", ";", "// TODO the temporary file should be removed at the end of the process", "MockAsWarExtension", "mockAsWar", "=", "new", "MockAsWarExtension", "(", "pFile", ",", "getSettingsFile", "(", ")", ",", "getOutputFolder", "(", ")", ",", "this", ".", "getWarFile", "(", ")", ",", "this", ".", "isIncludeLibraries", "(", ")", ",", "this", ".", "isIncludeActions", "(", ")", ",", "this", ".", "isIncludeListeners", "(", ")", ",", "endpoint", ",", "this", ".", "isEnableWebUI", "(", ")", ")", ";", "mockAsWar", ".", "createMockAsWarArchive", "(", ")", ";", "this", ".", "log", ".", "info", "(", "\"WAR Generation complete\"", ")", ";", "return", "true", ";", "}" ]
we should provide a PR to let us inject implementation of the MockAsWar
[ "we", "should", "provide", "a", "PR", "to", "let", "us", "inject", "implementation", "of", "the", "MockAsWar" ]
556f0e6b2bd1db82feae0e3523a1eb0873fafebd
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/556f0e6b2bd1db82feae0e3523a1eb0873fafebd/src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIExtensionMockAsWarGenerator.java#L40-L70
3,208
redfish4ktc/maven-soapui-extension-plugin
src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIProExtensionMockServiceRunner.java
SoapUIProExtensionMockServiceRunner.getAbsoluteOutputFolder
@Override public String getAbsoluteOutputFolder(ModelItem modelItem) { // use getter instead of calling the ouputFolder field directly String folder = PropertyExpander.expandProperties(modelItem, getOutputFolder()); if (StringUtils.isNullOrEmpty(folder)) { folder = PathUtils.getExpandedResourceRoot(modelItem); } else if (PathUtils.isRelativePath(folder)) { folder = PathUtils.resolveResourcePath(folder, modelItem); } return folder; }
java
@Override public String getAbsoluteOutputFolder(ModelItem modelItem) { // use getter instead of calling the ouputFolder field directly String folder = PropertyExpander.expandProperties(modelItem, getOutputFolder()); if (StringUtils.isNullOrEmpty(folder)) { folder = PathUtils.getExpandedResourceRoot(modelItem); } else if (PathUtils.isRelativePath(folder)) { folder = PathUtils.resolveResourcePath(folder, modelItem); } return folder; }
[ "@", "Override", "public", "String", "getAbsoluteOutputFolder", "(", "ModelItem", "modelItem", ")", "{", "// use getter instead of calling the ouputFolder field directly", "String", "folder", "=", "PropertyExpander", ".", "expandProperties", "(", "modelItem", ",", "getOutputFolder", "(", ")", ")", ";", "if", "(", "StringUtils", ".", "isNullOrEmpty", "(", "folder", ")", ")", "{", "folder", "=", "PathUtils", ".", "getExpandedResourceRoot", "(", "modelItem", ")", ";", "}", "else", "if", "(", "PathUtils", ".", "isRelativePath", "(", "folder", ")", ")", "{", "folder", "=", "PathUtils", ".", "resolveResourcePath", "(", "folder", ",", "modelItem", ")", ";", "}", "return", "folder", ";", "}" ]
then not used by this method
[ "then", "not", "used", "by", "this", "method" ]
556f0e6b2bd1db82feae0e3523a1eb0873fafebd
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/556f0e6b2bd1db82feae0e3523a1eb0873fafebd/src/main/java/org/ktc/soapui/maven/extension/impl/runner/SoapUIProExtensionMockServiceRunner.java#L48-L60
3,209
redfish4ktc/maven-soapui-extension-plugin
src/main/java/org/ktc/soapui/maven/extension/impl/report/ReportCollectorFactory.java
ReportCollectorFactory.newReportCollector
public static JUnitSecurityReportCollector newReportCollector() { String className = System.getProperty("soapui.junit.reportCollector", null); if (StringUtils.isNotBlank(className)) { try { return (JUnitSecurityReportCollector) Class.forName(className).getConstructor().newInstance(); } catch (Exception e) { log.warn("Failed to create JUnitReportCollector class [" + className + "] so use the default one;" + " error cause: " + e.toString()); } } return new JUnitSecurityReportCollector(); }
java
public static JUnitSecurityReportCollector newReportCollector() { String className = System.getProperty("soapui.junit.reportCollector", null); if (StringUtils.isNotBlank(className)) { try { return (JUnitSecurityReportCollector) Class.forName(className).getConstructor().newInstance(); } catch (Exception e) { log.warn("Failed to create JUnitReportCollector class [" + className + "] so use the default one;" + " error cause: " + e.toString()); } } return new JUnitSecurityReportCollector(); }
[ "public", "static", "JUnitSecurityReportCollector", "newReportCollector", "(", ")", "{", "String", "className", "=", "System", ".", "getProperty", "(", "\"soapui.junit.reportCollector\"", ",", "null", ")", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "className", ")", ")", "{", "try", "{", "return", "(", "JUnitSecurityReportCollector", ")", "Class", ".", "forName", "(", "className", ")", ".", "getConstructor", "(", ")", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "log", ".", "warn", "(", "\"Failed to create JUnitReportCollector class [\"", "+", "className", "+", "\"] so use the default one;\"", "+", "\" error cause: \"", "+", "e", ".", "toString", "(", ")", ")", ";", "}", "}", "return", "new", "JUnitSecurityReportCollector", "(", ")", ";", "}" ]
currently do not use it as SmartBear JUnitSecurityReportCollector have no constuctor with int argument
[ "currently", "do", "not", "use", "it", "as", "SmartBear", "JUnitSecurityReportCollector", "have", "no", "constuctor", "with", "int", "argument" ]
556f0e6b2bd1db82feae0e3523a1eb0873fafebd
https://github.com/redfish4ktc/maven-soapui-extension-plugin/blob/556f0e6b2bd1db82feae0e3523a1eb0873fafebd/src/main/java/org/ktc/soapui/maven/extension/impl/report/ReportCollectorFactory.java#L29-L40
3,210
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java
ProgressFragment.onViewCreated
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureContent(); }
java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureContent(); }
[ "@", "Override", "public", "void", "onViewCreated", "(", "View", "view", ",", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onViewCreated", "(", "view", ",", "savedInstanceState", ")", ";", "ensureContent", "(", ")", ";", "}" ]
Attach to view once the view hierarchy has been created.
[ "Attach", "to", "view", "once", "the", "view", "hierarchy", "has", "been", "created", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java#L68-L72
3,211
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java
ProgressFragment.onDestroyView
@Override public void onDestroyView() { mContentShown = false; mIsContentEmpty = false; mProgressContainer = mContentContainer = mContentView = mEmptyView = null; super.onDestroyView(); }
java
@Override public void onDestroyView() { mContentShown = false; mIsContentEmpty = false; mProgressContainer = mContentContainer = mContentView = mEmptyView = null; super.onDestroyView(); }
[ "@", "Override", "public", "void", "onDestroyView", "(", ")", "{", "mContentShown", "=", "false", ";", "mIsContentEmpty", "=", "false", ";", "mProgressContainer", "=", "mContentContainer", "=", "mContentView", "=", "mEmptyView", "=", "null", ";", "super", ".", "onDestroyView", "(", ")", ";", "}" ]
Detach from view.
[ "Detach", "from", "view", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java#L77-L83
3,212
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java
ProgressFragment.setContentView
public void setContentView(int layoutResId) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View contentView = layoutInflater.inflate(layoutResId, null); setContentView(contentView); }
java
public void setContentView(int layoutResId) { LayoutInflater layoutInflater = LayoutInflater.from(getActivity()); View contentView = layoutInflater.inflate(layoutResId, null); setContentView(contentView); }
[ "public", "void", "setContentView", "(", "int", "layoutResId", ")", "{", "LayoutInflater", "layoutInflater", "=", "LayoutInflater", ".", "from", "(", "getActivity", "(", ")", ")", ";", "View", "contentView", "=", "layoutInflater", ".", "inflate", "(", "layoutResId", ",", "null", ")", ";", "setContentView", "(", "contentView", ")", ";", "}" ]
Set the content content from a layout resource. @param layoutResId Resource ID to be inflated. @see #setContentView(android.view.View) @see #getContentView()
[ "Set", "the", "content", "content", "from", "a", "layout", "resource", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java#L103-L107
3,213
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java
ProgressFragment.setContentView
public void setContentView(View view) { ensureContent(); if (view == null) { throw new IllegalArgumentException("Content view can't be null"); } if (mContentContainer instanceof ViewGroup) { ViewGroup contentContainer = (ViewGroup) mContentContainer; if (mContentView == null) { contentContainer.addView(view); } else { int index = contentContainer.indexOfChild(mContentView); // replace content view contentContainer.removeView(mContentView); contentContainer.addView(view, index); } mContentView = view; } else { throw new IllegalStateException("Can't be used with a custom content view"); } }
java
public void setContentView(View view) { ensureContent(); if (view == null) { throw new IllegalArgumentException("Content view can't be null"); } if (mContentContainer instanceof ViewGroup) { ViewGroup contentContainer = (ViewGroup) mContentContainer; if (mContentView == null) { contentContainer.addView(view); } else { int index = contentContainer.indexOfChild(mContentView); // replace content view contentContainer.removeView(mContentView); contentContainer.addView(view, index); } mContentView = view; } else { throw new IllegalStateException("Can't be used with a custom content view"); } }
[ "public", "void", "setContentView", "(", "View", "view", ")", "{", "ensureContent", "(", ")", ";", "if", "(", "view", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Content view can't be null\"", ")", ";", "}", "if", "(", "mContentContainer", "instanceof", "ViewGroup", ")", "{", "ViewGroup", "contentContainer", "=", "(", "ViewGroup", ")", "mContentContainer", ";", "if", "(", "mContentView", "==", "null", ")", "{", "contentContainer", ".", "addView", "(", "view", ")", ";", "}", "else", "{", "int", "index", "=", "contentContainer", ".", "indexOfChild", "(", "mContentView", ")", ";", "// replace content view", "contentContainer", ".", "removeView", "(", "mContentView", ")", ";", "contentContainer", ".", "addView", "(", "view", ",", "index", ")", ";", "}", "mContentView", "=", "view", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Can't be used with a custom content view\"", ")", ";", "}", "}" ]
Set the content view to an explicit view. If the content view was installed earlier, the content will be replaced with a new view. @param view The desired content to display. Value can't be null. @see #setContentView(int) @see #getContentView()
[ "Set", "the", "content", "view", "to", "an", "explicit", "view", ".", "If", "the", "content", "view", "was", "installed", "earlier", "the", "content", "will", "be", "replaced", "with", "a", "new", "view", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java#L117-L136
3,214
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java
ProgressFragment.setContentShown
private void setContentShown(boolean shown, boolean animate) { ensureContent(); if (mContentShown == shown) { return; } mContentShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mContentContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mContentContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mContentContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mContentContainer.setVisibility(View.GONE); } }
java
private void setContentShown(boolean shown, boolean animate) { ensureContent(); if (mContentShown == shown) { return; } mContentShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); mContentContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mContentContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in)); mContentContainer.startAnimation(AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mContentContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mContentContainer.setVisibility(View.GONE); } }
[ "private", "void", "setContentShown", "(", "boolean", "shown", ",", "boolean", "animate", ")", "{", "ensureContent", "(", ")", ";", "if", "(", "mContentShown", "==", "shown", ")", "{", "return", ";", "}", "mContentShown", "=", "shown", ";", "if", "(", "shown", ")", "{", "if", "(", "animate", ")", "{", "mProgressContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_out", ")", ")", ";", "mContentContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_in", ")", ")", ";", "}", "else", "{", "mProgressContainer", ".", "clearAnimation", "(", ")", ";", "mContentContainer", ".", "clearAnimation", "(", ")", ";", "}", "mProgressContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "mContentContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "if", "(", "animate", ")", "{", "mProgressContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_in", ")", ")", ";", "mContentContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_out", ")", ")", ";", "}", "else", "{", "mProgressContainer", ".", "clearAnimation", "(", ")", ";", "mContentContainer", ".", "clearAnimation", "(", ")", ";", "}", "mProgressContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "mContentContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "}", "}" ]
Control whether the content is being displayed. You can make it not displayed if you are waiting for the initial data to show in it. During this time an indeterminant progress indicator will be shown instead. @param shown If true, the content view is shown; if false, the progress indicator. The initial value is true. @param animate If true, an animation will be used to transition to the new state.
[ "Control", "whether", "the", "content", "is", "being", "displayed", ".", "You", "can", "make", "it", "not", "displayed", "if", "you", "are", "waiting", "for", "the", "initial", "data", "to", "show", "in", "it", ".", "During", "this", "time", "an", "indeterminant", "progress", "indicator", "will", "be", "shown", "instead", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java#L202-L229
3,215
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java
ProgressFragment.ensureContent
private void ensureContent() { if (mContentContainer != null && mProgressContainer != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } mProgressContainer = root.findViewById(R.id.progress_container); if (mProgressContainer == null) { throw new RuntimeException("Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'"); } mContentContainer = root.findViewById(R.id.content_container); if (mContentContainer == null) { throw new RuntimeException("Your content must have a ViewGroup whose id attribute is 'R.id.content_container'"); } mEmptyView = root.findViewById(android.R.id.empty); if (mEmptyView != null) { mEmptyView.setVisibility(View.GONE); } mContentShown = true; // We are starting without a content, so assume we won't // have our data right away and start with the progress indicator. if (mContentView == null) { setContentShown(false, false); } }
java
private void ensureContent() { if (mContentContainer != null && mProgressContainer != null) { return; } View root = getView(); if (root == null) { throw new IllegalStateException("Content view not yet created"); } mProgressContainer = root.findViewById(R.id.progress_container); if (mProgressContainer == null) { throw new RuntimeException("Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'"); } mContentContainer = root.findViewById(R.id.content_container); if (mContentContainer == null) { throw new RuntimeException("Your content must have a ViewGroup whose id attribute is 'R.id.content_container'"); } mEmptyView = root.findViewById(android.R.id.empty); if (mEmptyView != null) { mEmptyView.setVisibility(View.GONE); } mContentShown = true; // We are starting without a content, so assume we won't // have our data right away and start with the progress indicator. if (mContentView == null) { setContentShown(false, false); } }
[ "private", "void", "ensureContent", "(", ")", "{", "if", "(", "mContentContainer", "!=", "null", "&&", "mProgressContainer", "!=", "null", ")", "{", "return", ";", "}", "View", "root", "=", "getView", "(", ")", ";", "if", "(", "root", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Content view not yet created\"", ")", ";", "}", "mProgressContainer", "=", "root", ".", "findViewById", "(", "R", ".", "id", ".", "progress_container", ")", ";", "if", "(", "mProgressContainer", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Your content must have a ViewGroup whose id attribute is 'R.id.progress_container'\"", ")", ";", "}", "mContentContainer", "=", "root", ".", "findViewById", "(", "R", ".", "id", ".", "content_container", ")", ";", "if", "(", "mContentContainer", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"Your content must have a ViewGroup whose id attribute is 'R.id.content_container'\"", ")", ";", "}", "mEmptyView", "=", "root", ".", "findViewById", "(", "android", ".", "R", ".", "id", ".", "empty", ")", ";", "if", "(", "mEmptyView", "!=", "null", ")", "{", "mEmptyView", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "}", "mContentShown", "=", "true", ";", "// We are starting without a content, so assume we won't", "// have our data right away and start with the progress indicator.", "if", "(", "mContentView", "==", "null", ")", "{", "setContentShown", "(", "false", ",", "false", ")", ";", "}", "}" ]
Initialization views.
[ "Initialization", "views", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressFragment.java#L267-L293
3,216
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java
ProgressGridFragment.onViewCreated
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureList(); }
java
@Override public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); ensureList(); }
[ "@", "Override", "public", "void", "onViewCreated", "(", "View", "view", ",", "Bundle", "savedInstanceState", ")", "{", "super", ".", "onViewCreated", "(", "view", ",", "savedInstanceState", ")", ";", "ensureList", "(", ")", ";", "}" ]
Attach to grid view once the view hierarchy has been created.
[ "Attach", "to", "grid", "view", "once", "the", "view", "hierarchy", "has", "been", "created", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java#L85-L89
3,217
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java
ProgressGridFragment.onDestroyView
@Override public void onDestroyView() { mHandler.removeCallbacks(mRequestFocus); mGridView = null; mGridShown = false; mEmptyView = mProgressContainer = mGridContainer = null; mStandardEmptyView = null; super.onDestroyView(); }
java
@Override public void onDestroyView() { mHandler.removeCallbacks(mRequestFocus); mGridView = null; mGridShown = false; mEmptyView = mProgressContainer = mGridContainer = null; mStandardEmptyView = null; super.onDestroyView(); }
[ "@", "Override", "public", "void", "onDestroyView", "(", ")", "{", "mHandler", ".", "removeCallbacks", "(", "mRequestFocus", ")", ";", "mGridView", "=", "null", ";", "mGridShown", "=", "false", ";", "mEmptyView", "=", "mProgressContainer", "=", "mGridContainer", "=", "null", ";", "mStandardEmptyView", "=", "null", ";", "super", ".", "onDestroyView", "(", ")", ";", "}" ]
Detach from grid view.
[ "Detach", "from", "grid", "view", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java#L94-L102
3,218
johnkil/Android-ProgressFragment
progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java
ProgressGridFragment.setGridShown
private void setGridShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mGridShown == shown) { return; } mGridShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); mGridContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mGridContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); mGridContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mGridContainer.setVisibility(View.GONE); } }
java
private void setGridShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mGridShown == shown) { return; } mGridShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); mGridContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mGridContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); mGridContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mGridContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mGridContainer.setVisibility(View.GONE); } }
[ "private", "void", "setGridShown", "(", "boolean", "shown", ",", "boolean", "animate", ")", "{", "ensureList", "(", ")", ";", "if", "(", "mProgressContainer", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Can't be used with a custom content view\"", ")", ";", "}", "if", "(", "mGridShown", "==", "shown", ")", "{", "return", ";", "}", "mGridShown", "=", "shown", ";", "if", "(", "shown", ")", "{", "if", "(", "animate", ")", "{", "mProgressContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_out", ")", ")", ";", "mGridContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_in", ")", ")", ";", "}", "else", "{", "mProgressContainer", ".", "clearAnimation", "(", ")", ";", "mGridContainer", ".", "clearAnimation", "(", ")", ";", "}", "mProgressContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "mGridContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "if", "(", "animate", ")", "{", "mProgressContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_in", ")", ")", ";", "mGridContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_out", ")", ")", ";", "}", "else", "{", "mProgressContainer", ".", "clearAnimation", "(", ")", ";", "mGridContainer", ".", "clearAnimation", "(", ")", ";", "}", "mProgressContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "mGridContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "}", "}" ]
Control whether the grid is being displayed. You can make it not displayed if you are waiting for the initial data to show in it. During this time an indeterminant progress indicator will be shown instead. @param shown If true, the grid view is shown; if false, the progress indicator. The initial value is true. @param animate If true, an animation will be used to transition to the new state.
[ "Control", "whether", "the", "grid", "is", "being", "displayed", ".", "You", "can", "make", "it", "not", "displayed", "if", "you", "are", "waiting", "for", "the", "initial", "data", "to", "show", "in", "it", ".", "During", "this", "time", "an", "indeterminant", "progress", "indicator", "will", "be", "shown", "instead", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/progressfragment-native/src/com/devspark/progressfragment/ProgressGridFragment.java#L221-L255
3,219
johnkil/Android-ProgressFragment
sherlockprogressfragment/src/com/devspark/progressfragment/SherlockProgressListFragment.java
SherlockProgressListFragment.setListShown
private void setListShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mListShown == shown) { return; } mListShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); mListContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mListContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); mListContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mListContainer.setVisibility(View.GONE); } }
java
private void setListShown(boolean shown, boolean animate) { ensureList(); if (mProgressContainer == null) { throw new IllegalStateException("Can't be used with a custom content view"); } if (mListShown == shown) { return; } mListShown = shown; if (shown) { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); mListContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.GONE); mListContainer.setVisibility(View.VISIBLE); } else { if (animate) { mProgressContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_in)); mListContainer.startAnimation(AnimationUtils.loadAnimation( getActivity(), android.R.anim.fade_out)); } else { mProgressContainer.clearAnimation(); mListContainer.clearAnimation(); } mProgressContainer.setVisibility(View.VISIBLE); mListContainer.setVisibility(View.GONE); } }
[ "private", "void", "setListShown", "(", "boolean", "shown", ",", "boolean", "animate", ")", "{", "ensureList", "(", ")", ";", "if", "(", "mProgressContainer", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Can't be used with a custom content view\"", ")", ";", "}", "if", "(", "mListShown", "==", "shown", ")", "{", "return", ";", "}", "mListShown", "=", "shown", ";", "if", "(", "shown", ")", "{", "if", "(", "animate", ")", "{", "mProgressContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_out", ")", ")", ";", "mListContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_in", ")", ")", ";", "}", "else", "{", "mProgressContainer", ".", "clearAnimation", "(", ")", ";", "mListContainer", ".", "clearAnimation", "(", ")", ";", "}", "mProgressContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "mListContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "}", "else", "{", "if", "(", "animate", ")", "{", "mProgressContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_in", ")", ")", ";", "mListContainer", ".", "startAnimation", "(", "AnimationUtils", ".", "loadAnimation", "(", "getActivity", "(", ")", ",", "android", ".", "R", ".", "anim", ".", "fade_out", ")", ")", ";", "}", "else", "{", "mProgressContainer", ".", "clearAnimation", "(", ")", ";", "mListContainer", ".", "clearAnimation", "(", ")", ";", "}", "mProgressContainer", ".", "setVisibility", "(", "View", ".", "VISIBLE", ")", ";", "mListContainer", ".", "setVisibility", "(", "View", ".", "GONE", ")", ";", "}", "}" ]
Control whether the list is being displayed. You can make it not displayed if you are waiting for the initial data to show in it. During this time an indeterminant progress indicator will be shown instead. @param shown If true, the list view is shown; if false, the progress indicator. The initial value is true. @param animate If true, an animation will be used to transition to the new state.
[ "Control", "whether", "the", "list", "is", "being", "displayed", ".", "You", "can", "make", "it", "not", "displayed", "if", "you", "are", "waiting", "for", "the", "initial", "data", "to", "show", "in", "it", ".", "During", "this", "time", "an", "indeterminant", "progress", "indicator", "will", "be", "shown", "instead", "." ]
f4b3b969f36f3ac9598c662722630f9ffb151bd6
https://github.com/johnkil/Android-ProgressFragment/blob/f4b3b969f36f3ac9598c662722630f9ffb151bd6/sherlockprogressfragment/src/com/devspark/progressfragment/SherlockProgressListFragment.java#L223-L257
3,220
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/ExtraUtil.java
ExtraUtil.getExtra
public static <T> T getExtra(Bundle extras, String name, boolean nullable) { T value = null; if (extras != null && extras.containsKey(name)) { value = (T)extras.get(name); } if (!nullable && value == null) { throw new TransfuseInjectionException("Unable to access Extra " + name); } return value; }
java
public static <T> T getExtra(Bundle extras, String name, boolean nullable) { T value = null; if (extras != null && extras.containsKey(name)) { value = (T)extras.get(name); } if (!nullable && value == null) { throw new TransfuseInjectionException("Unable to access Extra " + name); } return value; }
[ "public", "static", "<", "T", ">", "T", "getExtra", "(", "Bundle", "extras", ",", "String", "name", ",", "boolean", "nullable", ")", "{", "T", "value", "=", "null", ";", "if", "(", "extras", "!=", "null", "&&", "extras", ".", "containsKey", "(", "name", ")", ")", "{", "value", "=", "(", "T", ")", "extras", ".", "get", "(", "name", ")", ";", "}", "if", "(", "!", "nullable", "&&", "value", "==", "null", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"Unable to access Extra \"", "+", "name", ")", ";", "}", "return", "value", ";", "}" ]
Returns the extras in the given bundle by name. If no extra is found and the extra is considered not nullable, this method will throw a TransfuseInjectionException. If no extra is found and the extra is considered nullable, this method will, of course, return null. @throws TransfuseInjectionException @param extras bundle @param name name of the extra to access @param nullable nullability of the extra @return extra value
[ "Returns", "the", "extras", "in", "the", "given", "bundle", "by", "name", ".", "If", "no", "extra", "is", "found", "and", "the", "extra", "is", "considered", "not", "nullable", "this", "method", "will", "throw", "a", "TransfuseInjectionException", ".", "If", "no", "extra", "is", "found", "and", "the", "extra", "is", "considered", "nullable", "this", "method", "will", "of", "course", "return", "null", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/ExtraUtil.java#L44-L53
3,221
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notNull
public static void notNull(final Object object, final String objectName) { if (object == null) { throw new IllegalArgumentException("expecting non-null value for " + maskNullArgument(objectName)); } }
java
public static void notNull(final Object object, final String objectName) { if (object == null) { throw new IllegalArgumentException("expecting non-null value for " + maskNullArgument(objectName)); } }
[ "public", "static", "void", "notNull", "(", "final", "Object", "object", ",", "final", "String", "objectName", ")", "{", "if", "(", "object", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting non-null value for \"", "+", "maskNullArgument", "(", "objectName", ")", ")", ";", "}", "}" ]
Throw a null pointer exception if object is null @param object the object to test @param objectName the name of the object @throws IllegalArgumentException if the passed object is null
[ "Throw", "a", "null", "pointer", "exception", "if", "object", "is", "null" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L37-L41
3,222
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.sameSize
public static void sameSize(final Collection<?> collection1, final Collection<?> collection2, final String collection1Name, final String collection2Name) { notNull(collection1, collection1Name); notNull(collection2, collection2Name); if (collection1.size() != collection2.size()) { throw new IllegalArgumentException("expecting " + maskNullArgument(collection1Name) + " to have the same size as " + maskNullArgument(collection2Name)); } }
java
public static void sameSize(final Collection<?> collection1, final Collection<?> collection2, final String collection1Name, final String collection2Name) { notNull(collection1, collection1Name); notNull(collection2, collection2Name); if (collection1.size() != collection2.size()) { throw new IllegalArgumentException("expecting " + maskNullArgument(collection1Name) + " to have the same size as " + maskNullArgument(collection2Name)); } }
[ "public", "static", "void", "sameSize", "(", "final", "Collection", "<", "?", ">", "collection1", ",", "final", "Collection", "<", "?", ">", "collection2", ",", "final", "String", "collection1Name", ",", "final", "String", "collection2Name", ")", "{", "notNull", "(", "collection1", ",", "collection1Name", ")", ";", "notNull", "(", "collection2", ",", "collection2Name", ")", ";", "if", "(", "collection1", ".", "size", "(", ")", "!=", "collection2", ".", "size", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting \"", "+", "maskNullArgument", "(", "collection1Name", ")", "+", "\" to have the same size as \"", "+", "maskNullArgument", "(", "collection2Name", ")", ")", ";", "}", "}" ]
Checks that the collections have the same number of elements, otherwise throws an exception @param collection1 the first collection @param collection2 the second collection @param collection1Name the name of the first collection @param collection2Name the name of the second collection @throws IllegalArgumentException if collection1 or collection2 are null or if the collections don't agree on the number of elements
[ "Checks", "that", "the", "collections", "have", "the", "same", "number", "of", "elements", "otherwise", "throws", "an", "exception" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L51-L58
3,223
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.atSize
public static void atSize(final Collection<?> collection, final int size, final String collectionName) { notNull(collection, collectionName); notNegative(size, "size"); if (collection.size() != size) { throw new IllegalArgumentException("expecting " + maskNullArgument(collectionName) + " to be of size " + size + "."); } }
java
public static void atSize(final Collection<?> collection, final int size, final String collectionName) { notNull(collection, collectionName); notNegative(size, "size"); if (collection.size() != size) { throw new IllegalArgumentException("expecting " + maskNullArgument(collectionName) + " to be of size " + size + "."); } }
[ "public", "static", "void", "atSize", "(", "final", "Collection", "<", "?", ">", "collection", ",", "final", "int", "size", ",", "final", "String", "collectionName", ")", "{", "notNull", "(", "collection", ",", "collectionName", ")", ";", "notNegative", "(", "size", ",", "\"size\"", ")", ";", "if", "(", "collection", ".", "size", "(", ")", "!=", "size", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting \"", "+", "maskNullArgument", "(", "collectionName", ")", "+", "\" to be of size \"", "+", "size", "+", "\".\"", ")", ";", "}", "}" ]
Checks that a collection is of a given size @param collection the collection to check @param size the size of the collection @param collectionName the name of the collection @throws IllegalArgumentException if collection is null or if the collection size is not as expected
[ "Checks", "that", "a", "collection", "is", "of", "a", "given", "size" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L67-L74
3,224
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notEmpty
public static void notEmpty(final Collection<?> collection, final String collectionName) { notNull(collection, collectionName); if (collection.isEmpty()) { throw new IllegalArgumentException("expecting " + maskNullArgument(collectionName) + " to contain 1 or more elements"); } }
java
public static void notEmpty(final Collection<?> collection, final String collectionName) { notNull(collection, collectionName); if (collection.isEmpty()) { throw new IllegalArgumentException("expecting " + maskNullArgument(collectionName) + " to contain 1 or more elements"); } }
[ "public", "static", "void", "notEmpty", "(", "final", "Collection", "<", "?", ">", "collection", ",", "final", "String", "collectionName", ")", "{", "notNull", "(", "collection", ",", "collectionName", ")", ";", "if", "(", "collection", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting \"", "+", "maskNullArgument", "(", "collectionName", ")", "+", "\" to contain 1 or more elements\"", ")", ";", "}", "}" ]
Check that a collection is not empty @param collection the collection to check @param collectionName the name of the collection @throws IllegalArgumentException if collection is null or if the collection is empty
[ "Check", "that", "a", "collection", "is", "not", "empty" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L82-L88
3,225
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notEmpty
public static void notEmpty(final Object[] array, final String arrayName) { notNull(array, arrayName); if (array.length == 0) { throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to contain 1 or more elements"); } }
java
public static void notEmpty(final Object[] array, final String arrayName) { notNull(array, arrayName); if (array.length == 0) { throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to contain 1 or more elements"); } }
[ "public", "static", "void", "notEmpty", "(", "final", "Object", "[", "]", "array", ",", "final", "String", "arrayName", ")", "{", "notNull", "(", "array", ",", "arrayName", ")", ";", "if", "(", "array", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting \"", "+", "maskNullArgument", "(", "arrayName", ")", "+", "\" to contain 1 or more elements\"", ")", ";", "}", "}" ]
Check that an array is not empty @param array the array to check @param arrayName the name of the array @throws IllegalArgumentException if array is null or if the array is empty
[ "Check", "that", "an", "array", "is", "not", "empty" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L96-L102
3,226
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.sameLength
public static void sameLength(final Object[] array1, final Object[] array2, final String array1Name, final String array2Name) { notNull(array1, array1Name); notNull(array2, array2Name); if (array1.length != array2.length) { throw new IllegalArgumentException("expecting " + maskNullArgument(array1Name) + " to have the same length as " + maskNullArgument(array2Name)); } }
java
public static void sameLength(final Object[] array1, final Object[] array2, final String array1Name, final String array2Name) { notNull(array1, array1Name); notNull(array2, array2Name); if (array1.length != array2.length) { throw new IllegalArgumentException("expecting " + maskNullArgument(array1Name) + " to have the same length as " + maskNullArgument(array2Name)); } }
[ "public", "static", "void", "sameLength", "(", "final", "Object", "[", "]", "array1", ",", "final", "Object", "[", "]", "array2", ",", "final", "String", "array1Name", ",", "final", "String", "array2Name", ")", "{", "notNull", "(", "array1", ",", "array1Name", ")", ";", "notNull", "(", "array2", ",", "array2Name", ")", ";", "if", "(", "array1", ".", "length", "!=", "array2", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting \"", "+", "maskNullArgument", "(", "array1Name", ")", "+", "\" to have the same length as \"", "+", "maskNullArgument", "(", "array2Name", ")", ")", ";", "}", "}" ]
Checks that the arrays have the same number of elements, otherwise throws and exception @param array1 the first array @param array2 the second array @param array1Name the name of the first array @param array2Name the name of the second array @throws IllegalArgumentException if array1 or array2 are null or if the arrays don't agree on the number of elements
[ "Checks", "that", "the", "arrays", "have", "the", "same", "number", "of", "elements", "otherwise", "throws", "and", "exception" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L112-L119
3,227
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.atLength
public static void atLength(final Object[] array, final int length, final String arrayName) { notNull(array, arrayName); notNegative(length, "length"); if (array.length != length) { throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to be of length " + length + "."); } }
java
public static void atLength(final Object[] array, final int length, final String arrayName) { notNull(array, arrayName); notNegative(length, "length"); if (array.length != length) { throw new IllegalArgumentException("expecting " + maskNullArgument(arrayName) + " to be of length " + length + "."); } }
[ "public", "static", "void", "atLength", "(", "final", "Object", "[", "]", "array", ",", "final", "int", "length", ",", "final", "String", "arrayName", ")", "{", "notNull", "(", "array", ",", "arrayName", ")", ";", "notNegative", "(", "length", ",", "\"length\"", ")", ";", "if", "(", "array", ".", "length", "!=", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"expecting \"", "+", "maskNullArgument", "(", "arrayName", ")", "+", "\" to be of length \"", "+", "length", "+", "\".\"", ")", ";", "}", "}" ]
Checks that an array is of a given length @param array the array @param length the desired length of the array @param arrayName the name of the array @throws IllegalArgumentException if the array is null or if the array's length is not as expected
[ "Checks", "that", "an", "array", "is", "of", "a", "given", "length" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L128-L135
3,228
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.inBounds
public static void inBounds(final Integer input, final Integer min, final Integer max, final String inputName) { notNull(input, inputName); if ((min != null) && (input < min)) { throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be less than " + min.toString()); } if ((max != null) && (input > max)) { throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be greater than " + max.toString()); } }
java
public static void inBounds(final Integer input, final Integer min, final Integer max, final String inputName) { notNull(input, inputName); if ((min != null) && (input < min)) { throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be less than " + min.toString()); } if ((max != null) && (input > max)) { throw new IndexOutOfBoundsException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be greater than " + max.toString()); } }
[ "public", "static", "void", "inBounds", "(", "final", "Integer", "input", ",", "final", "Integer", "min", ",", "final", "Integer", "max", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "inputName", ")", ";", "if", "(", "(", "min", "!=", "null", ")", "&&", "(", "input", "<", "min", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"a value of \"", "+", "input", ".", "toString", "(", ")", "+", "\" was unexpected for \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\", it is expected to be less than \"", "+", "min", ".", "toString", "(", ")", ")", ";", "}", "if", "(", "(", "max", "!=", "null", ")", "&&", "(", "input", ">", "max", ")", ")", "{", "throw", "new", "IndexOutOfBoundsException", "(", "\"a value of \"", "+", "input", ".", "toString", "(", ")", "+", "\" was unexpected for \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\", it is expected to be greater than \"", "+", "max", ".", "toString", "(", ")", ")", ";", "}", "}" ]
Checks that the input value is within the bounds of a maximum or minimum value @param input the input to check @param min the minimum value of the input (if null, input is not bound by minimum value) @param max the maximum value of the input (if null, input is not bound by maximum value) @param inputName the name of the input to report in error @throws IllegalArgumentException if input is null or if the input is less than min or greater than max
[ "Checks", "that", "the", "input", "value", "is", "within", "the", "bounds", "of", "a", "maximum", "or", "minimum", "value" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L145-L155
3,229
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notNegative
public static void notNegative(final Integer input, final String inputName) { notNull(input, inputName); if (input < 0) { throw new IllegalArgumentException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be positive"); } }
java
public static void notNegative(final Integer input, final String inputName) { notNull(input, inputName); if (input < 0) { throw new IllegalArgumentException("a value of " + input.toString() + " was unexpected for " + maskNullArgument(inputName) + ", it is expected to be positive"); } }
[ "public", "static", "void", "notNegative", "(", "final", "Integer", "input", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "inputName", ")", ";", "if", "(", "input", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"a value of \"", "+", "input", ".", "toString", "(", ")", "+", "\" was unexpected for \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\", it is expected to be positive\"", ")", ";", "}", "}" ]
Checks that the input value is non-negative @param input the input to check @param inputName the name of the input @throws IllegalArgumentException if input is null or if the input is less than zero
[ "Checks", "that", "the", "input", "value", "is", "non", "-", "negative" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L163-L169
3,230
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notZero
public static void notZero(final Integer input, final String inputName) { notNull(input, inputName); if (input == 0) { throw new IllegalArgumentException("a zero value for was unexpected for " + maskNullArgument(inputName) + ", it is expected to be non zero"); } }
java
public static void notZero(final Integer input, final String inputName) { notNull(input, inputName); if (input == 0) { throw new IllegalArgumentException("a zero value for was unexpected for " + maskNullArgument(inputName) + ", it is expected to be non zero"); } }
[ "public", "static", "void", "notZero", "(", "final", "Integer", "input", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "inputName", ")", ";", "if", "(", "input", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"a zero value for was unexpected for \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\", it is expected to be non zero\"", ")", ";", "}", "}" ]
Checks that the input value is non-zero @param input the input to check @param inputName the name of the input @throws IllegalArgumentException if input is null or if the input is zero
[ "Checks", "that", "the", "input", "value", "is", "non", "-", "zero" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L177-L183
3,231
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.notBlank
public static void notBlank(final String input, final String inputName) { notNull(input, inputName); if (StringUtils.isBlank(input)) { throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to be a non blank value."); } }
java
public static void notBlank(final String input, final String inputName) { notNull(input, inputName); if (StringUtils.isBlank(input)) { throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to be a non blank value."); } }
[ "public", "static", "void", "notBlank", "(", "final", "String", "input", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "inputName", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "input", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expecting \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\" to be a non blank value.\"", ")", ";", "}", "}" ]
Checks that an input string is non blank @param input the input @param inputName the name of the input @throws IllegalArgumentException if input is null or if the input is blank
[ "Checks", "that", "an", "input", "string", "is", "non", "blank" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L191-L197
3,232
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java
Contract.instanceOf
public static void instanceOf(final Object input, Class<?> classType, final String inputName) { notNull(input, "input"); notNull(classType, "classType"); if (!classType.isInstance(input)) { throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to an instance of " + classType.getName() + "."); } }
java
public static void instanceOf(final Object input, Class<?> classType, final String inputName) { notNull(input, "input"); notNull(classType, "classType"); if (!classType.isInstance(input)) { throw new IllegalArgumentException("Expecting " + maskNullArgument(inputName) + " to an instance of " + classType.getName() + "."); } }
[ "public", "static", "void", "instanceOf", "(", "final", "Object", "input", ",", "Class", "<", "?", ">", "classType", ",", "final", "String", "inputName", ")", "{", "notNull", "(", "input", ",", "\"input\"", ")", ";", "notNull", "(", "classType", ",", "\"classType\"", ")", ";", "if", "(", "!", "classType", ".", "isInstance", "(", "input", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Expecting \"", "+", "maskNullArgument", "(", "inputName", ")", "+", "\" to an instance of \"", "+", "classType", ".", "getName", "(", ")", "+", "\".\"", ")", ";", "}", "}" ]
Check that an input of a given class @param input the input @param classType the class to check for @param inputName the name of the input
[ "Check", "that", "an", "input", "of", "a", "given", "class" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/util/Contract.java#L205-L212
3,233
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java
ASTClassFactory.getParameters
public ImmutableList<ASTParameter> getParameters(Method method) { return getParameters(method.getParameterTypes(), method.getGenericParameterTypes(), method.getParameterAnnotations()); }
java
public ImmutableList<ASTParameter> getParameters(Method method) { return getParameters(method.getParameterTypes(), method.getGenericParameterTypes(), method.getParameterAnnotations()); }
[ "public", "ImmutableList", "<", "ASTParameter", ">", "getParameters", "(", "Method", "method", ")", "{", "return", "getParameters", "(", "method", ".", "getParameterTypes", "(", ")", ",", "method", ".", "getGenericParameterTypes", "(", ")", ",", "method", ".", "getParameterAnnotations", "(", ")", ")", ";", "}" ]
Builds the parameters for a given method @param method @return AST parameters
[ "Builds", "the", "parameters", "for", "a", "given", "method" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L164-L166
3,234
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java
ASTClassFactory.getMethod
public ASTMethod getMethod(Method method) { ImmutableList<ASTParameter> astParameters = getParameters(method); ASTAccessModifier modifier = ASTAccessModifier.getModifier(method.getModifiers()); ImmutableSet<ASTType> throwsTypes = getTypes(method.getExceptionTypes()); return new ASTClassMethod(method, getType(method.getReturnType(), method.getGenericReturnType()), astParameters, modifier, getAnnotations(method), throwsTypes); }
java
public ASTMethod getMethod(Method method) { ImmutableList<ASTParameter> astParameters = getParameters(method); ASTAccessModifier modifier = ASTAccessModifier.getModifier(method.getModifiers()); ImmutableSet<ASTType> throwsTypes = getTypes(method.getExceptionTypes()); return new ASTClassMethod(method, getType(method.getReturnType(), method.getGenericReturnType()), astParameters, modifier, getAnnotations(method), throwsTypes); }
[ "public", "ASTMethod", "getMethod", "(", "Method", "method", ")", "{", "ImmutableList", "<", "ASTParameter", ">", "astParameters", "=", "getParameters", "(", "method", ")", ";", "ASTAccessModifier", "modifier", "=", "ASTAccessModifier", ".", "getModifier", "(", "method", ".", "getModifiers", "(", ")", ")", ";", "ImmutableSet", "<", "ASTType", ">", "throwsTypes", "=", "getTypes", "(", "method", ".", "getExceptionTypes", "(", ")", ")", ";", "return", "new", "ASTClassMethod", "(", "method", ",", "getType", "(", "method", ".", "getReturnType", "(", ")", ",", "method", ".", "getGenericReturnType", "(", ")", ")", ",", "astParameters", ",", "modifier", ",", "getAnnotations", "(", "method", ")", ",", "throwsTypes", ")", ";", "}" ]
Builds an AST Method fromm the given input method. @param method @return AST Method
[ "Builds", "an", "AST", "Method", "fromm", "the", "given", "input", "method", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L211-L218
3,235
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java
ASTClassFactory.getField
public ASTField getField(Field field) { ASTAccessModifier modifier = ASTAccessModifier.getModifier(field.getModifiers()); return new ASTClassField(field, getType(field.getType(), field.getGenericType()), modifier, getAnnotations(field)); }
java
public ASTField getField(Field field) { ASTAccessModifier modifier = ASTAccessModifier.getModifier(field.getModifiers()); return new ASTClassField(field, getType(field.getType(), field.getGenericType()), modifier, getAnnotations(field)); }
[ "public", "ASTField", "getField", "(", "Field", "field", ")", "{", "ASTAccessModifier", "modifier", "=", "ASTAccessModifier", ".", "getModifier", "(", "field", ".", "getModifiers", "(", ")", ")", ";", "return", "new", "ASTClassField", "(", "field", ",", "getType", "(", "field", ".", "getType", "(", ")", ",", "field", ".", "getGenericType", "(", ")", ")", ",", "modifier", ",", "getAnnotations", "(", "field", ")", ")", ";", "}" ]
Builds an AST Field from the given field @param field @return AST Field
[ "Builds", "an", "AST", "Field", "from", "the", "given", "field" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L236-L240
3,236
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java
ASTClassFactory.getConstructor
public ASTConstructor getConstructor(Constructor constructor, boolean isEnum, boolean isInnerClass) { ASTAccessModifier modifier = ASTAccessModifier.getModifier(constructor.getModifiers()); Annotation[][] parameterAnnotations = constructor.getParameterAnnotations(); if(constructor.getDeclaringClass().getEnclosingClass() != null && !Modifier.isStatic(constructor.getDeclaringClass().getModifiers())){ // An inner class constructor contains a hidden non-annotated prameter Annotation[][] paddedParameterAnnotations = new Annotation[parameterAnnotations.length + 1][]; paddedParameterAnnotations[0] = new Annotation[0]; System.arraycopy(parameterAnnotations, 0, paddedParameterAnnotations, 1, parameterAnnotations.length); parameterAnnotations = paddedParameterAnnotations; } ImmutableList<ASTParameter> constructorParameters = getParameters(constructor.getParameterTypes(), constructor.getGenericParameterTypes(), parameterAnnotations); if(isEnum) { constructorParameters = constructorParameters.subList(2, constructorParameters.size()); } if(isInnerClass){ constructorParameters = constructorParameters.subList(1, constructorParameters.size()); } ImmutableSet<ASTType> throwsTypes = getTypes(constructor.getExceptionTypes()); return new ASTClassConstructor(getAnnotations(constructor), constructor, constructorParameters, modifier, throwsTypes); }
java
public ASTConstructor getConstructor(Constructor constructor, boolean isEnum, boolean isInnerClass) { ASTAccessModifier modifier = ASTAccessModifier.getModifier(constructor.getModifiers()); Annotation[][] parameterAnnotations = constructor.getParameterAnnotations(); if(constructor.getDeclaringClass().getEnclosingClass() != null && !Modifier.isStatic(constructor.getDeclaringClass().getModifiers())){ // An inner class constructor contains a hidden non-annotated prameter Annotation[][] paddedParameterAnnotations = new Annotation[parameterAnnotations.length + 1][]; paddedParameterAnnotations[0] = new Annotation[0]; System.arraycopy(parameterAnnotations, 0, paddedParameterAnnotations, 1, parameterAnnotations.length); parameterAnnotations = paddedParameterAnnotations; } ImmutableList<ASTParameter> constructorParameters = getParameters(constructor.getParameterTypes(), constructor.getGenericParameterTypes(), parameterAnnotations); if(isEnum) { constructorParameters = constructorParameters.subList(2, constructorParameters.size()); } if(isInnerClass){ constructorParameters = constructorParameters.subList(1, constructorParameters.size()); } ImmutableSet<ASTType> throwsTypes = getTypes(constructor.getExceptionTypes()); return new ASTClassConstructor(getAnnotations(constructor), constructor, constructorParameters, modifier, throwsTypes); }
[ "public", "ASTConstructor", "getConstructor", "(", "Constructor", "constructor", ",", "boolean", "isEnum", ",", "boolean", "isInnerClass", ")", "{", "ASTAccessModifier", "modifier", "=", "ASTAccessModifier", ".", "getModifier", "(", "constructor", ".", "getModifiers", "(", ")", ")", ";", "Annotation", "[", "]", "[", "]", "parameterAnnotations", "=", "constructor", ".", "getParameterAnnotations", "(", ")", ";", "if", "(", "constructor", ".", "getDeclaringClass", "(", ")", ".", "getEnclosingClass", "(", ")", "!=", "null", "&&", "!", "Modifier", ".", "isStatic", "(", "constructor", ".", "getDeclaringClass", "(", ")", ".", "getModifiers", "(", ")", ")", ")", "{", "// An inner class constructor contains a hidden non-annotated prameter", "Annotation", "[", "]", "[", "]", "paddedParameterAnnotations", "=", "new", "Annotation", "[", "parameterAnnotations", ".", "length", "+", "1", "]", "[", "", "]", ";", "paddedParameterAnnotations", "[", "0", "]", "=", "new", "Annotation", "[", "0", "]", ";", "System", ".", "arraycopy", "(", "parameterAnnotations", ",", "0", ",", "paddedParameterAnnotations", ",", "1", ",", "parameterAnnotations", ".", "length", ")", ";", "parameterAnnotations", "=", "paddedParameterAnnotations", ";", "}", "ImmutableList", "<", "ASTParameter", ">", "constructorParameters", "=", "getParameters", "(", "constructor", ".", "getParameterTypes", "(", ")", ",", "constructor", ".", "getGenericParameterTypes", "(", ")", ",", "parameterAnnotations", ")", ";", "if", "(", "isEnum", ")", "{", "constructorParameters", "=", "constructorParameters", ".", "subList", "(", "2", ",", "constructorParameters", ".", "size", "(", ")", ")", ";", "}", "if", "(", "isInnerClass", ")", "{", "constructorParameters", "=", "constructorParameters", ".", "subList", "(", "1", ",", "constructorParameters", ".", "size", "(", ")", ")", ";", "}", "ImmutableSet", "<", "ASTType", ">", "throwsTypes", "=", "getTypes", "(", "constructor", ".", "getExceptionTypes", "(", ")", ")", ";", "return", "new", "ASTClassConstructor", "(", "getAnnotations", "(", "constructor", ")", ",", "constructor", ",", "constructorParameters", ",", "modifier", ",", "throwsTypes", ")", ";", "}" ]
Build an AST Constructor from the given constructor @param constructor @return AST Constructor
[ "Build", "an", "AST", "Constructor", "from", "the", "given", "constructor" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L248-L273
3,237
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java
ASTClassFactory.getAnnotations
private ImmutableSet<ASTAnnotation> getAnnotations(Annotation[] annotations) { ImmutableSet.Builder<ASTAnnotation> astAnnotationBuilder = ImmutableSet.builder(); for (Annotation annotation : annotations) { astAnnotationBuilder.add(getAnnotation(annotation)); } return astAnnotationBuilder.build(); }
java
private ImmutableSet<ASTAnnotation> getAnnotations(Annotation[] annotations) { ImmutableSet.Builder<ASTAnnotation> astAnnotationBuilder = ImmutableSet.builder(); for (Annotation annotation : annotations) { astAnnotationBuilder.add(getAnnotation(annotation)); } return astAnnotationBuilder.build(); }
[ "private", "ImmutableSet", "<", "ASTAnnotation", ">", "getAnnotations", "(", "Annotation", "[", "]", "annotations", ")", "{", "ImmutableSet", ".", "Builder", "<", "ASTAnnotation", ">", "astAnnotationBuilder", "=", "ImmutableSet", ".", "builder", "(", ")", ";", "for", "(", "Annotation", "annotation", ":", "annotations", ")", "{", "astAnnotationBuilder", ".", "add", "(", "getAnnotation", "(", "annotation", ")", ")", ";", "}", "return", "astAnnotationBuilder", ".", "build", "(", ")", ";", "}" ]
Build the AST Annotations from the given input annotation array. @param annotations @return List of AST Annotations
[ "Build", "the", "AST", "Annotations", "from", "the", "given", "input", "annotation", "array", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/classes/ASTClassFactory.java#L285-L294
3,238
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/transaction/TransactionProcessorPool.java
TransactionProcessorPool.execute
public void execute() { ExecutorService executorService = MoreExecutors.sameThreadExecutor(); for (Transaction<V, R> transaction : transactions) { if (!transaction.isComplete()) { executorService.execute(transaction); } } try { executorService.shutdown(); executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new TransfuseTransactionException("Pool executor interrupted", e); } }
java
public void execute() { ExecutorService executorService = MoreExecutors.sameThreadExecutor(); for (Transaction<V, R> transaction : transactions) { if (!transaction.isComplete()) { executorService.execute(transaction); } } try { executorService.shutdown(); executorService.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { throw new TransfuseTransactionException("Pool executor interrupted", e); } }
[ "public", "void", "execute", "(", ")", "{", "ExecutorService", "executorService", "=", "MoreExecutors", ".", "sameThreadExecutor", "(", ")", ";", "for", "(", "Transaction", "<", "V", ",", "R", ">", "transaction", ":", "transactions", ")", "{", "if", "(", "!", "transaction", ".", "isComplete", "(", ")", ")", "{", "executorService", ".", "execute", "(", "transaction", ")", ";", "}", "}", "try", "{", "executorService", ".", "shutdown", "(", ")", ";", "executorService", ".", "awaitTermination", "(", "Long", ".", "MAX_VALUE", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "TransfuseTransactionException", "(", "\"Pool executor interrupted\"", ",", "e", ")", ";", "}", "}" ]
Executes the submitted work and if all transactions complete, executes the aggregate on the aggregateWorker.
[ "Executes", "the", "submitted", "work", "and", "if", "all", "transactions", "complete", "executes", "the", "aggregate", "on", "the", "aggregateWorker", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/transaction/TransactionProcessorPool.java#L54-L70
3,239
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/transaction/TransactionProcessorPool.java
TransactionProcessorPool.isComplete
public boolean isComplete() { for (Transaction<V, R> transaction : transactions) { if (!transaction.isComplete()) { return false; } } return true; }
java
public boolean isComplete() { for (Transaction<V, R> transaction : transactions) { if (!transaction.isComplete()) { return false; } } return true; }
[ "public", "boolean", "isComplete", "(", ")", "{", "for", "(", "Transaction", "<", "V", ",", "R", ">", "transaction", ":", "transactions", ")", "{", "if", "(", "!", "transaction", ".", "isComplete", "(", ")", ")", "{", "return", "false", ";", "}", "}", "return", "true", ";", "}" ]
Returns the completion status of the set of transactions. Will only return complete = true if all the transactions have completed successfully. @return transaction completion status
[ "Returns", "the", "completion", "status", "of", "the", "set", "of", "transactions", ".", "Will", "only", "return", "complete", "=", "true", "if", "all", "the", "transactions", "have", "completed", "successfully", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/transaction/TransactionProcessorPool.java#L90-L97
3,240
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/Components.java
Components.get
public static<T> Class<T> get(Class<?> type) { return (Class<T>) REPOSITORY.get(type); }
java
public static<T> Class<T> get(Class<?> type) { return (Class<T>) REPOSITORY.get(type); }
[ "public", "static", "<", "T", ">", "Class", "<", "T", ">", "get", "(", "Class", "<", "?", ">", "type", ")", "{", "return", "(", "Class", "<", "T", ">", ")", "REPOSITORY", ".", "get", "(", "type", ")", ";", "}" ]
Provides the corresponding generated Android Component class for the input Transfuse Component class. @throws `org.androidtransfuse.util.TransfuseRuntimeException` if there was an error looking up the wrapped Transfuse$$Components class. @param type Transfuse Component class @param <T> @return class Android Component class
[ "Provides", "the", "corresponding", "generated", "Android", "Component", "class", "for", "the", "input", "Transfuse", "Component", "class", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/Components.java#L62-L64
3,241
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java
InjectionUtil.getField
public static <T> T getField(Class<T> returnType, Class<?> targetClass, Object target, String field) { try { Field declaredField = targetClass.getDeclaredField(field); return AccessController.doPrivileged( new GetFieldPrivilegedAction<T>(declaredField, target)); } catch (NoSuchFieldException e) { throw new TransfuseInjectionException( "NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
java
public static <T> T getField(Class<T> returnType, Class<?> targetClass, Object target, String field) { try { Field declaredField = targetClass.getDeclaredField(field); return AccessController.doPrivileged( new GetFieldPrivilegedAction<T>(declaredField, target)); } catch (NoSuchFieldException e) { throw new TransfuseInjectionException( "NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
[ "public", "static", "<", "T", ">", "T", "getField", "(", "Class", "<", "T", ">", "returnType", ",", "Class", "<", "?", ">", "targetClass", ",", "Object", "target", ",", "String", "field", ")", "{", "try", "{", "Field", "declaredField", "=", "targetClass", ".", "getDeclaredField", "(", "field", ")", ";", "return", "AccessController", ".", "doPrivileged", "(", "new", "GetFieldPrivilegedAction", "<", "T", ">", "(", "declaredField", ",", "target", ")", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"NoSuchFieldException Exception during field injection: \"", "+", "field", "+", "\" in \"", "+", "target", ".", "getClass", "(", ")", ",", "e", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"PrivilegedActionException Exception during field injection\"", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"Exception during field injection\"", ",", "e", ")", ";", "}", "}" ]
Returns the value of a field. @param returnType type of the field @param targetClass class represented by the target parameter @param target object containing the field @param field name of the field @param <T> type parameter @return field value
[ "Returns", "the", "value", "of", "a", "field", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java#L52-L67
3,242
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java
InjectionUtil.setField
public static void setField(Class<?> targetClass, Object target, String field, Object value) { try { Field classField = targetClass.getDeclaredField(field); AccessController.doPrivileged( new SetFieldPrivilegedAction(classField, target, value)); } catch (NoSuchFieldException e) { throw new TransfuseInjectionException( "NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
java
public static void setField(Class<?> targetClass, Object target, String field, Object value) { try { Field classField = targetClass.getDeclaredField(field); AccessController.doPrivileged( new SetFieldPrivilegedAction(classField, target, value)); } catch (NoSuchFieldException e) { throw new TransfuseInjectionException( "NoSuchFieldException Exception during field injection: " + field + " in " + target.getClass(), e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
[ "public", "static", "void", "setField", "(", "Class", "<", "?", ">", "targetClass", ",", "Object", "target", ",", "String", "field", ",", "Object", "value", ")", "{", "try", "{", "Field", "classField", "=", "targetClass", ".", "getDeclaredField", "(", "field", ")", ";", "AccessController", ".", "doPrivileged", "(", "new", "SetFieldPrivilegedAction", "(", "classField", ",", "target", ",", "value", ")", ")", ";", "}", "catch", "(", "NoSuchFieldException", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"NoSuchFieldException Exception during field injection: \"", "+", "field", "+", "\" in \"", "+", "target", ".", "getClass", "(", ")", ",", "e", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"PrivilegedActionException Exception during field injection\"", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"Exception during field injection\"", ",", "e", ")", ";", "}", "}" ]
Updates field with the given value. @param targetClass class representing the object containing the field. @param target object containing the field to update @param field name of the field @param value object to update the field to
[ "Updates", "field", "with", "the", "given", "value", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java#L96-L111
3,243
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java
InjectionUtil.callMethod
public static <T> T callMethod(Class<T> retClass, Class<?> targetClass, Object target, String method, Class[] argClasses, Object[] args) { try { Method classMethod = targetClass.getDeclaredMethod(method, argClasses); return AccessController.doPrivileged( new SetMethodPrivilegedAction<T>(classMethod, target, args)); } catch (NoSuchMethodException e) { throw new TransfuseInjectionException("Exception during method injection: NoSuchFieldException", e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
java
public static <T> T callMethod(Class<T> retClass, Class<?> targetClass, Object target, String method, Class[] argClasses, Object[] args) { try { Method classMethod = targetClass.getDeclaredMethod(method, argClasses); return AccessController.doPrivileged( new SetMethodPrivilegedAction<T>(classMethod, target, args)); } catch (NoSuchMethodException e) { throw new TransfuseInjectionException("Exception during method injection: NoSuchFieldException", e); } catch (PrivilegedActionException e) { throw new TransfuseInjectionException("PrivilegedActionException Exception during field injection", e); } catch (Exception e) { throw new TransfuseInjectionException("Exception during field injection", e); } }
[ "public", "static", "<", "T", ">", "T", "callMethod", "(", "Class", "<", "T", ">", "retClass", ",", "Class", "<", "?", ">", "targetClass", ",", "Object", "target", ",", "String", "method", ",", "Class", "[", "]", "argClasses", ",", "Object", "[", "]", "args", ")", "{", "try", "{", "Method", "classMethod", "=", "targetClass", ".", "getDeclaredMethod", "(", "method", ",", "argClasses", ")", ";", "return", "AccessController", ".", "doPrivileged", "(", "new", "SetMethodPrivilegedAction", "<", "T", ">", "(", "classMethod", ",", "target", ",", "args", ")", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"Exception during method injection: NoSuchFieldException\"", ",", "e", ")", ";", "}", "catch", "(", "PrivilegedActionException", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"PrivilegedActionException Exception during field injection\"", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"Exception during field injection\"", ",", "e", ")", ";", "}", "}" ]
Calls a method with the provided arguments as parameters. @param retClass the method return value @param targetClass the instance class @param target the instance containing the method @param method the method name @param argClasses types of the method arguments @param args method arguments used during invocation @param <T> relating type parameter @return method return value
[ "Calls", "a", "method", "with", "the", "provided", "arguments", "as", "parameters", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/InjectionUtil.java#L144-L158
3,244
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java
ASTElementFactory.getType
public synchronized ASTType getType(final TypeElement typeElement) { return new LazyASTType(buildPackageClass(typeElement), typeElement) { @Override public ASTType lazyLoad() { if (!typeCache.containsKey(typeElement)) { typeCache.put(typeElement, buildType(typeElement)); } return typeCache.get(typeElement); } }; }
java
public synchronized ASTType getType(final TypeElement typeElement) { return new LazyASTType(buildPackageClass(typeElement), typeElement) { @Override public ASTType lazyLoad() { if (!typeCache.containsKey(typeElement)) { typeCache.put(typeElement, buildType(typeElement)); } return typeCache.get(typeElement); } }; }
[ "public", "synchronized", "ASTType", "getType", "(", "final", "TypeElement", "typeElement", ")", "{", "return", "new", "LazyASTType", "(", "buildPackageClass", "(", "typeElement", ")", ",", "typeElement", ")", "{", "@", "Override", "public", "ASTType", "lazyLoad", "(", ")", "{", "if", "(", "!", "typeCache", ".", "containsKey", "(", "typeElement", ")", ")", "{", "typeCache", ".", "put", "(", "typeElement", ",", "buildType", "(", "typeElement", ")", ")", ";", "}", "return", "typeCache", ".", "get", "(", "typeElement", ")", ";", "}", "}", ";", "}" ]
Build a ASTType from the provided TypeElement. @param typeElement required input Element @return ASTType constructed using teh input Element
[ "Build", "a", "ASTType", "from", "the", "provided", "TypeElement", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java#L80-L91
3,245
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java
ASTElementFactory.getField
public ASTField getField(VariableElement variableElement) { ASTAccessModifier modifier = buildAccessModifier(variableElement); return new ASTElementField(variableElement, astTypeBuilderVisitor, modifier, getAnnotations(variableElement)); }
java
public ASTField getField(VariableElement variableElement) { ASTAccessModifier modifier = buildAccessModifier(variableElement); return new ASTElementField(variableElement, astTypeBuilderVisitor, modifier, getAnnotations(variableElement)); }
[ "public", "ASTField", "getField", "(", "VariableElement", "variableElement", ")", "{", "ASTAccessModifier", "modifier", "=", "buildAccessModifier", "(", "variableElement", ")", ";", "return", "new", "ASTElementField", "(", "variableElement", ",", "astTypeBuilderVisitor", ",", "modifier", ",", "getAnnotations", "(", "variableElement", ")", ")", ";", "}" ]
Build a ASTElementField from the given VariableElement @param variableElement required input Element @return ASTElementField
[ "Build", "a", "ASTElementField", "from", "the", "given", "VariableElement" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java#L186-L190
3,246
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java
ASTElementFactory.getMethod
public ASTMethod getMethod(ExecutableElement executableElement) { ImmutableList<ASTParameter> parameters = getParameters(executableElement.getParameters()); ASTAccessModifier modifier = buildAccessModifier(executableElement); ImmutableSet<ASTType> throwsTypes = buildASTElementTypes(executableElement.getThrownTypes()); return new ASTElementMethod(executableElement, astTypeBuilderVisitor, parameters, modifier, getAnnotations(executableElement), throwsTypes); }
java
public ASTMethod getMethod(ExecutableElement executableElement) { ImmutableList<ASTParameter> parameters = getParameters(executableElement.getParameters()); ASTAccessModifier modifier = buildAccessModifier(executableElement); ImmutableSet<ASTType> throwsTypes = buildASTElementTypes(executableElement.getThrownTypes()); return new ASTElementMethod(executableElement, astTypeBuilderVisitor, parameters, modifier, getAnnotations(executableElement), throwsTypes); }
[ "public", "ASTMethod", "getMethod", "(", "ExecutableElement", "executableElement", ")", "{", "ImmutableList", "<", "ASTParameter", ">", "parameters", "=", "getParameters", "(", "executableElement", ".", "getParameters", "(", ")", ")", ";", "ASTAccessModifier", "modifier", "=", "buildAccessModifier", "(", "executableElement", ")", ";", "ImmutableSet", "<", "ASTType", ">", "throwsTypes", "=", "buildASTElementTypes", "(", "executableElement", ".", "getThrownTypes", "(", ")", ")", ";", "return", "new", "ASTElementMethod", "(", "executableElement", ",", "astTypeBuilderVisitor", ",", "parameters", ",", "modifier", ",", "getAnnotations", "(", "executableElement", ")", ",", "throwsTypes", ")", ";", "}" ]
Build an ASTMethod from the provided ExecutableElement @param executableElement required input element @return ASTMethod
[ "Build", "an", "ASTMethod", "from", "the", "provided", "ExecutableElement" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java#L213-L220
3,247
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java
ASTElementFactory.getParameters
private ImmutableList<ASTParameter> getParameters(List<? extends VariableElement> variableElements) { ImmutableList.Builder<ASTParameter> astParameterBuilder = ImmutableList.builder(); for (VariableElement variables : variableElements) { astParameterBuilder.add(getParameter(variables)); } return astParameterBuilder.build(); }
java
private ImmutableList<ASTParameter> getParameters(List<? extends VariableElement> variableElements) { ImmutableList.Builder<ASTParameter> astParameterBuilder = ImmutableList.builder(); for (VariableElement variables : variableElements) { astParameterBuilder.add(getParameter(variables)); } return astParameterBuilder.build(); }
[ "private", "ImmutableList", "<", "ASTParameter", ">", "getParameters", "(", "List", "<", "?", "extends", "VariableElement", ">", "variableElements", ")", "{", "ImmutableList", ".", "Builder", "<", "ASTParameter", ">", "astParameterBuilder", "=", "ImmutableList", ".", "builder", "(", ")", ";", "for", "(", "VariableElement", "variables", ":", "variableElements", ")", "{", "astParameterBuilder", ".", "add", "(", "getParameter", "(", "variables", ")", ")", ";", "}", "return", "astParameterBuilder", ".", "build", "(", ")", ";", "}" ]
Build a list of ASTParameters corresponding tot he input VariableElement list elements @param variableElements required input element @return list of ASTParameters
[ "Build", "a", "list", "of", "ASTParameters", "corresponding", "tot", "he", "input", "VariableElement", "list", "elements" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java#L234-L242
3,248
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java
ASTElementFactory.getConstructor
public ASTConstructor getConstructor(ExecutableElement executableElement) { ImmutableList<ASTParameter> parameters = getParameters(executableElement.getParameters()); ASTAccessModifier modifier = buildAccessModifier(executableElement); ImmutableSet<ASTType> throwsTypes = buildASTElementTypes(executableElement.getThrownTypes()); return new ASTElementConstructor(executableElement, parameters, modifier, getAnnotations(executableElement), throwsTypes); }
java
public ASTConstructor getConstructor(ExecutableElement executableElement) { ImmutableList<ASTParameter> parameters = getParameters(executableElement.getParameters()); ASTAccessModifier modifier = buildAccessModifier(executableElement); ImmutableSet<ASTType> throwsTypes = buildASTElementTypes(executableElement.getThrownTypes()); return new ASTElementConstructor(executableElement, parameters, modifier, getAnnotations(executableElement), throwsTypes); }
[ "public", "ASTConstructor", "getConstructor", "(", "ExecutableElement", "executableElement", ")", "{", "ImmutableList", "<", "ASTParameter", ">", "parameters", "=", "getParameters", "(", "executableElement", ".", "getParameters", "(", ")", ")", ";", "ASTAccessModifier", "modifier", "=", "buildAccessModifier", "(", "executableElement", ")", ";", "ImmutableSet", "<", "ASTType", ">", "throwsTypes", "=", "buildASTElementTypes", "(", "executableElement", ".", "getThrownTypes", "(", ")", ")", ";", "return", "new", "ASTElementConstructor", "(", "executableElement", ",", "parameters", ",", "modifier", ",", "getAnnotations", "(", "executableElement", ")", ",", "throwsTypes", ")", ";", "}" ]
Build an ASTConstructor from the input ExecutableElement @param executableElement require input element @return ASTConstructor
[ "Build", "an", "ASTConstructor", "from", "the", "input", "ExecutableElement" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/element/ASTElementFactory.java#L260-L266
3,249
johncarl81/transfuse
transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java
InjectionPointFactory.buildInjectionPoint
public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) { ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor); constructorInjectionPoint.addThrows(astConstructor.getThrowsTypes()); List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>(); //bindingAnnotations for single parameter from method level if (astConstructor.getParameters().size() == 1) { methodAnnotations.addAll(astConstructor.getAnnotations()); } for (ASTParameter astParameter : astConstructor.getParameters()) { List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations); parameterAnnotations.addAll(astParameter.getAnnotations()); constructorInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); } return constructorInjectionPoint; }
java
public ConstructorInjectionPoint buildInjectionPoint(ASTType containingType, ASTConstructor astConstructor, AnalysisContext context) { ConstructorInjectionPoint constructorInjectionPoint = new ConstructorInjectionPoint(containingType, astConstructor); constructorInjectionPoint.addThrows(astConstructor.getThrowsTypes()); List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>(); //bindingAnnotations for single parameter from method level if (astConstructor.getParameters().size() == 1) { methodAnnotations.addAll(astConstructor.getAnnotations()); } for (ASTParameter astParameter : astConstructor.getParameters()) { List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations); parameterAnnotations.addAll(astParameter.getAnnotations()); constructorInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); } return constructorInjectionPoint; }
[ "public", "ConstructorInjectionPoint", "buildInjectionPoint", "(", "ASTType", "containingType", ",", "ASTConstructor", "astConstructor", ",", "AnalysisContext", "context", ")", "{", "ConstructorInjectionPoint", "constructorInjectionPoint", "=", "new", "ConstructorInjectionPoint", "(", "containingType", ",", "astConstructor", ")", ";", "constructorInjectionPoint", ".", "addThrows", "(", "astConstructor", ".", "getThrowsTypes", "(", ")", ")", ";", "List", "<", "ASTAnnotation", ">", "methodAnnotations", "=", "new", "ArrayList", "<", "ASTAnnotation", ">", "(", ")", ";", "//bindingAnnotations for single parameter from method level", "if", "(", "astConstructor", ".", "getParameters", "(", ")", ".", "size", "(", ")", "==", "1", ")", "{", "methodAnnotations", ".", "addAll", "(", "astConstructor", ".", "getAnnotations", "(", ")", ")", ";", "}", "for", "(", "ASTParameter", "astParameter", ":", "astConstructor", ".", "getParameters", "(", ")", ")", "{", "List", "<", "ASTAnnotation", ">", "parameterAnnotations", "=", "new", "ArrayList", "<", "ASTAnnotation", ">", "(", "methodAnnotations", ")", ";", "parameterAnnotations", ".", "addAll", "(", "astParameter", ".", "getAnnotations", "(", ")", ")", ";", "constructorInjectionPoint", ".", "addInjectionNode", "(", "buildInjectionNode", "(", "parameterAnnotations", ",", "astParameter", ",", "astParameter", ".", "getASTType", "(", ")", ",", "context", ")", ")", ";", "}", "return", "constructorInjectionPoint", ";", "}" ]
Build a Constructor InjectionPoint from the given ASTConstructor @param astConstructor required ASTConstructor @param context required AnalysisContext @return ConstructorInjectionPoint
[ "Build", "a", "Constructor", "InjectionPoint", "from", "the", "given", "ASTConstructor" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L70-L88
3,250
johncarl81/transfuse
transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java
InjectionPointFactory.buildInjectionPoint
public MethodInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTMethod astMethod, AnalysisContext context) { MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint(rootContainingType, containingType, astMethod); methodInjectionPoint.addThrows(astMethod.getThrowsTypes()); List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>(); //bindingAnnotations for single parameter from method level if (astMethod.getParameters().size() == 1) { methodAnnotations.addAll(astMethod.getAnnotations()); } for (ASTParameter astParameter : astMethod.getParameters()) { List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations); parameterAnnotations.addAll(astParameter.getAnnotations()); methodInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); } return methodInjectionPoint; }
java
public MethodInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTMethod astMethod, AnalysisContext context) { MethodInjectionPoint methodInjectionPoint = new MethodInjectionPoint(rootContainingType, containingType, astMethod); methodInjectionPoint.addThrows(astMethod.getThrowsTypes()); List<ASTAnnotation> methodAnnotations = new ArrayList<ASTAnnotation>(); //bindingAnnotations for single parameter from method level if (astMethod.getParameters().size() == 1) { methodAnnotations.addAll(astMethod.getAnnotations()); } for (ASTParameter astParameter : astMethod.getParameters()) { List<ASTAnnotation> parameterAnnotations = new ArrayList<ASTAnnotation>(methodAnnotations); parameterAnnotations.addAll(astParameter.getAnnotations()); methodInjectionPoint.addInjectionNode(buildInjectionNode(parameterAnnotations, astParameter, astParameter.getASTType(), context)); } return methodInjectionPoint; }
[ "public", "MethodInjectionPoint", "buildInjectionPoint", "(", "ASTType", "rootContainingType", ",", "ASTType", "containingType", ",", "ASTMethod", "astMethod", ",", "AnalysisContext", "context", ")", "{", "MethodInjectionPoint", "methodInjectionPoint", "=", "new", "MethodInjectionPoint", "(", "rootContainingType", ",", "containingType", ",", "astMethod", ")", ";", "methodInjectionPoint", ".", "addThrows", "(", "astMethod", ".", "getThrowsTypes", "(", ")", ")", ";", "List", "<", "ASTAnnotation", ">", "methodAnnotations", "=", "new", "ArrayList", "<", "ASTAnnotation", ">", "(", ")", ";", "//bindingAnnotations for single parameter from method level", "if", "(", "astMethod", ".", "getParameters", "(", ")", ".", "size", "(", ")", "==", "1", ")", "{", "methodAnnotations", ".", "addAll", "(", "astMethod", ".", "getAnnotations", "(", ")", ")", ";", "}", "for", "(", "ASTParameter", "astParameter", ":", "astMethod", ".", "getParameters", "(", ")", ")", "{", "List", "<", "ASTAnnotation", ">", "parameterAnnotations", "=", "new", "ArrayList", "<", "ASTAnnotation", ">", "(", "methodAnnotations", ")", ";", "parameterAnnotations", ".", "addAll", "(", "astParameter", ".", "getAnnotations", "(", ")", ")", ";", "methodInjectionPoint", ".", "addInjectionNode", "(", "buildInjectionNode", "(", "parameterAnnotations", ",", "astParameter", ",", "astParameter", ".", "getASTType", "(", ")", ",", "context", ")", ")", ";", "}", "return", "methodInjectionPoint", ";", "}" ]
Build a Method Injection Point from the given ASTMethod @param containingType @param astMethod required ASTMethod @param context analysis context @return MethodInjectionPoint
[ "Build", "a", "Method", "Injection", "Point", "from", "the", "given", "ASTMethod" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L98-L116
3,251
johncarl81/transfuse
transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java
InjectionPointFactory.buildInjectionPoint
public FieldInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTField astField, AnalysisContext context) { return new FieldInjectionPoint(rootContainingType, containingType, astField, buildInjectionNode(astField.getAnnotations(), astField, astField.getASTType(), context)); }
java
public FieldInjectionPoint buildInjectionPoint(ASTType rootContainingType, ASTType containingType, ASTField astField, AnalysisContext context) { return new FieldInjectionPoint(rootContainingType, containingType, astField, buildInjectionNode(astField.getAnnotations(), astField, astField.getASTType(), context)); }
[ "public", "FieldInjectionPoint", "buildInjectionPoint", "(", "ASTType", "rootContainingType", ",", "ASTType", "containingType", ",", "ASTField", "astField", ",", "AnalysisContext", "context", ")", "{", "return", "new", "FieldInjectionPoint", "(", "rootContainingType", ",", "containingType", ",", "astField", ",", "buildInjectionNode", "(", "astField", ".", "getAnnotations", "(", ")", ",", "astField", ",", "astField", ".", "getASTType", "(", ")", ",", "context", ")", ")", ";", "}" ]
Build a Field InjectionPoint from the given ASTField @param containingType @param astField required ASTField @param context analysis context @return FieldInjectionPoint
[ "Build", "a", "Field", "InjectionPoint", "from", "the", "given", "ASTField" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L126-L128
3,252
johncarl81/transfuse
transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java
InjectionPointFactory.buildInjectionNode
public InjectionNode buildInjectionNode(ASTType astType, AnalysisContext context) { return buildInjectionNode(Collections.EMPTY_LIST, astType, astType, context); }
java
public InjectionNode buildInjectionNode(ASTType astType, AnalysisContext context) { return buildInjectionNode(Collections.EMPTY_LIST, astType, astType, context); }
[ "public", "InjectionNode", "buildInjectionNode", "(", "ASTType", "astType", ",", "AnalysisContext", "context", ")", "{", "return", "buildInjectionNode", "(", "Collections", ".", "EMPTY_LIST", ",", "astType", ",", "astType", ",", "context", ")", ";", "}" ]
Build a InjectionPoint directly from the given ASTType @param astType required type @param context analysis context @return Injection Node
[ "Build", "a", "InjectionPoint", "directly", "from", "the", "given", "ASTType" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-core/src/main/java/org/androidtransfuse/analysis/InjectionPointFactory.java#L137-L139
3,253
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/event/EventManager.java
EventManager.register
public <T> void register(Class<T> event, EventObserver<T> observer){ if(event == null){ throw new IllegalArgumentException("Null Event type passed to register"); } if(observer == null){ throw new IllegalArgumentException("Null observer passed to register"); } nullSafeGet(event).add(observer); }
java
public <T> void register(Class<T> event, EventObserver<T> observer){ if(event == null){ throw new IllegalArgumentException("Null Event type passed to register"); } if(observer == null){ throw new IllegalArgumentException("Null observer passed to register"); } nullSafeGet(event).add(observer); }
[ "public", "<", "T", ">", "void", "register", "(", "Class", "<", "T", ">", "event", ",", "EventObserver", "<", "T", ">", "observer", ")", "{", "if", "(", "event", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null Event type passed to register\"", ")", ";", "}", "if", "(", "observer", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Null observer passed to register\"", ")", ";", "}", "nullSafeGet", "(", "event", ")", ".", "add", "(", "observer", ")", ";", "}" ]
Register the given observer to be triggered if the given event type is triggered. @param event type @param observer event observer @param <T> relating type
[ "Register", "the", "given", "observer", "to", "be", "triggered", "if", "the", "given", "event", "type", "is", "triggered", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/event/EventManager.java#L101-L109
3,254
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/event/EventManager.java
EventManager.trigger
public void trigger(Object event){ Set<Class> eventTypes = getAllInheritedClasses(event.getClass()); for (Class eventType : eventTypes) { if(observers.containsKey(eventType)){ for (EventObserver eventObserver : observers.get(eventType)) { executionQueue.get().add(new EventExecution(event, eventObserver)); } } } triggerQueue(); }
java
public void trigger(Object event){ Set<Class> eventTypes = getAllInheritedClasses(event.getClass()); for (Class eventType : eventTypes) { if(observers.containsKey(eventType)){ for (EventObserver eventObserver : observers.get(eventType)) { executionQueue.get().add(new EventExecution(event, eventObserver)); } } } triggerQueue(); }
[ "public", "void", "trigger", "(", "Object", "event", ")", "{", "Set", "<", "Class", ">", "eventTypes", "=", "getAllInheritedClasses", "(", "event", ".", "getClass", "(", ")", ")", ";", "for", "(", "Class", "eventType", ":", "eventTypes", ")", "{", "if", "(", "observers", ".", "containsKey", "(", "eventType", ")", ")", "{", "for", "(", "EventObserver", "eventObserver", ":", "observers", ".", "get", "(", "eventType", ")", ")", "{", "executionQueue", ".", "get", "(", ")", ".", "add", "(", "new", "EventExecution", "(", "event", ",", "eventObserver", ")", ")", ";", "}", "}", "}", "triggerQueue", "(", ")", ";", "}" ]
Triggers an event through the EventManager. This will call the registered EventObservers with the provided event. @param event object
[ "Triggers", "an", "event", "through", "the", "EventManager", ".", "This", "will", "call", "the", "registered", "EventObservers", "with", "the", "provided", "event", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/event/EventManager.java#L129-L142
3,255
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/event/EventManager.java
EventManager.unregister
public void unregister(EventObserver<?> observer){ for (Map.Entry<Class, Set<EventObserver>> entry : observers.entrySet()) { entry.getValue().remove(observer); } }
java
public void unregister(EventObserver<?> observer){ for (Map.Entry<Class, Set<EventObserver>> entry : observers.entrySet()) { entry.getValue().remove(observer); } }
[ "public", "void", "unregister", "(", "EventObserver", "<", "?", ">", "observer", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Class", ",", "Set", "<", "EventObserver", ">", ">", "entry", ":", "observers", ".", "entrySet", "(", ")", ")", "{", "entry", ".", "getValue", "(", ")", ".", "remove", "(", "observer", ")", ";", "}", "}" ]
Unregisters an EventObserver by equality. @param observer Event Observer
[ "Unregisters", "an", "EventObserver", "by", "equality", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/event/EventManager.java#L190-L195
3,256
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java
IntentFactory.start
public void start(IntentFactoryStrategy parameters) { Intent intent = buildIntent(parameters); parameters.start(context, intent); }
java
public void start(IntentFactoryStrategy parameters) { Intent intent = buildIntent(parameters); parameters.start(context, intent); }
[ "public", "void", "start", "(", "IntentFactoryStrategy", "parameters", ")", "{", "Intent", "intent", "=", "buildIntent", "(", "parameters", ")", ";", "parameters", ".", "start", "(", "context", ",", "intent", ")", ";", "}" ]
Start the appropriate target Context specified by the input Strategy. @param parameters Strategy instance
[ "Start", "the", "appropriate", "target", "Context", "specified", "by", "the", "input", "Strategy", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java#L80-L85
3,257
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java
IntentFactory.buildIntent
public Intent buildIntent(IntentFactoryStrategy parameters) { android.content.Intent intent = intentMockFactory.buildIntent(context, parameters.getTargetContext()); intent.setFlags(parameters.getFlags()); for (String category : parameters.getCategories()){ intent.addCategory(category); } intent.putExtras(parameters.getExtras()); return intent; }
java
public Intent buildIntent(IntentFactoryStrategy parameters) { android.content.Intent intent = intentMockFactory.buildIntent(context, parameters.getTargetContext()); intent.setFlags(parameters.getFlags()); for (String category : parameters.getCategories()){ intent.addCategory(category); } intent.putExtras(parameters.getExtras()); return intent; }
[ "public", "Intent", "buildIntent", "(", "IntentFactoryStrategy", "parameters", ")", "{", "android", ".", "content", ".", "Intent", "intent", "=", "intentMockFactory", ".", "buildIntent", "(", "context", ",", "parameters", ".", "getTargetContext", "(", ")", ")", ";", "intent", ".", "setFlags", "(", "parameters", ".", "getFlags", "(", ")", ")", ";", "for", "(", "String", "category", ":", "parameters", ".", "getCategories", "(", ")", ")", "{", "intent", ".", "addCategory", "(", "category", ")", ";", "}", "intent", ".", "putExtras", "(", "parameters", ".", "getExtras", "(", ")", ")", ";", "return", "intent", ";", "}" ]
Build an Intent specified by the given input Strategy. @param parameters Strategy instance @return Intent
[ "Build", "an", "Intent", "specified", "by", "the", "given", "input", "Strategy", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java#L93-L103
3,258
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java
IntentFactory.buildPendingIntent
public PendingIntent buildPendingIntent(int requestCode, int flags, IntentFactoryStrategy parameters){ return PendingIntent.getActivity(context, requestCode, buildIntent(parameters), flags); }
java
public PendingIntent buildPendingIntent(int requestCode, int flags, IntentFactoryStrategy parameters){ return PendingIntent.getActivity(context, requestCode, buildIntent(parameters), flags); }
[ "public", "PendingIntent", "buildPendingIntent", "(", "int", "requestCode", ",", "int", "flags", ",", "IntentFactoryStrategy", "parameters", ")", "{", "return", "PendingIntent", ".", "getActivity", "(", "context", ",", "requestCode", ",", "buildIntent", "(", "parameters", ")", ",", "flags", ")", ";", "}" ]
Build a PendingIntent specified by the given input Strategy. @param requestCode request code for the sender @param flags intent flags @param parameters Strategy instance @return PendingIntent
[ "Build", "a", "PendingIntent", "specified", "by", "the", "given", "input", "Strategy", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/intentFactory/IntentFactory.java#L134-L136
3,259
johncarl81/transfuse
transfuse-support/src/main/java/org/androidtransfuse/adapter/ASTUtils.java
ASTUtils.inherits
public boolean inherits(ASTType astType, ASTType inheritable) { if (astType == null) { return false; } if(inheritable == null || inheritable.equals(OBJECT_TYPE)){ return true; } if (astType.equals(inheritable)) { return true; } for (ASTType typeInterfaces : astType.getInterfaces()) { if (inherits(typeInterfaces, inheritable)) { return true; } } return inherits(astType.getSuperClass(), inheritable); }
java
public boolean inherits(ASTType astType, ASTType inheritable) { if (astType == null) { return false; } if(inheritable == null || inheritable.equals(OBJECT_TYPE)){ return true; } if (astType.equals(inheritable)) { return true; } for (ASTType typeInterfaces : astType.getInterfaces()) { if (inherits(typeInterfaces, inheritable)) { return true; } } return inherits(astType.getSuperClass(), inheritable); }
[ "public", "boolean", "inherits", "(", "ASTType", "astType", ",", "ASTType", "inheritable", ")", "{", "if", "(", "astType", "==", "null", ")", "{", "return", "false", ";", "}", "if", "(", "inheritable", "==", "null", "||", "inheritable", ".", "equals", "(", "OBJECT_TYPE", ")", ")", "{", "return", "true", ";", "}", "if", "(", "astType", ".", "equals", "(", "inheritable", ")", ")", "{", "return", "true", ";", "}", "for", "(", "ASTType", "typeInterfaces", ":", "astType", ".", "getInterfaces", "(", ")", ")", "{", "if", "(", "inherits", "(", "typeInterfaces", ",", "inheritable", ")", ")", "{", "return", "true", ";", "}", "}", "return", "inherits", "(", "astType", ".", "getSuperClass", "(", ")", ",", "inheritable", ")", ";", "}" ]
Determines if the given ASTType inherits or extends from the given inheritable ASTType @param astType target @param inheritable inheritance target @return true if the given astType target inherits from the inheritable type with the given rules.
[ "Determines", "if", "the", "given", "ASTType", "inherits", "or", "extends", "from", "the", "given", "inheritable", "ASTType" ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-support/src/main/java/org/androidtransfuse/adapter/ASTUtils.java#L50-L66
3,260
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/util/GeneratedCodeRepository.java
GeneratedCodeRepository.loadRepository
public final void loadRepository(ClassLoader classLoader, String repositoryPackage, String repositoryName){ try{ Class repositoryClass = classLoader.loadClass(repositoryPackage + "." + repositoryName); Repository<T> instance = (Repository<T>) repositoryClass.newInstance(); generatedMap.putAll(instance.get()); } catch (ClassNotFoundException e) { //nothing } catch (InstantiationException e) { throw new TransfuseRuntimeException("Unable to instantiate generated Repository", e); } catch (IllegalAccessException e) { throw new TransfuseRuntimeException("Unable to access generated Repository", e); } }
java
public final void loadRepository(ClassLoader classLoader, String repositoryPackage, String repositoryName){ try{ Class repositoryClass = classLoader.loadClass(repositoryPackage + "." + repositoryName); Repository<T> instance = (Repository<T>) repositoryClass.newInstance(); generatedMap.putAll(instance.get()); } catch (ClassNotFoundException e) { //nothing } catch (InstantiationException e) { throw new TransfuseRuntimeException("Unable to instantiate generated Repository", e); } catch (IllegalAccessException e) { throw new TransfuseRuntimeException("Unable to access generated Repository", e); } }
[ "public", "final", "void", "loadRepository", "(", "ClassLoader", "classLoader", ",", "String", "repositoryPackage", ",", "String", "repositoryName", ")", "{", "try", "{", "Class", "repositoryClass", "=", "classLoader", ".", "loadClass", "(", "repositoryPackage", "+", "\".\"", "+", "repositoryName", ")", ";", "Repository", "<", "T", ">", "instance", "=", "(", "Repository", "<", "T", ">", ")", "repositoryClass", ".", "newInstance", "(", ")", ";", "generatedMap", ".", "putAll", "(", "instance", ".", "get", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "//nothing", "}", "catch", "(", "InstantiationException", "e", ")", "{", "throw", "new", "TransfuseRuntimeException", "(", "\"Unable to instantiate generated Repository\"", ",", "e", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "throw", "new", "TransfuseRuntimeException", "(", "\"Unable to access generated Repository\"", ",", "e", ")", ";", "}", "}" ]
Update the repository class from the given classloader. If the given repository class cannot be instantiated then this method will throw a TransfuseRuntimeException. @throws TransfuseRuntimeException @param classLoader
[ "Update", "the", "repository", "class", "from", "the", "given", "classloader", ".", "If", "the", "given", "repository", "class", "cannot", "be", "instantiated", "then", "this", "method", "will", "throw", "a", "TransfuseRuntimeException", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/util/GeneratedCodeRepository.java#L67-L80
3,261
johncarl81/transfuse
transfuse/src/main/java/org/androidtransfuse/analysis/module/ModuleTransactionWorker.java
ModuleTransactionWorker.createConfigurationsForModuleType
private void createConfigurationsForModuleType(ImmutableList.Builder<ModuleConfiguration> configurations, ASTType module, ASTType scanTarget, Set<MethodSignature> scanned, Map<String, Set<MethodSignature>> packagePrivateScanned) { configureModuleAnnotations(configurations, module, scanTarget, scanTarget.getAnnotations()); configureModuleMethods(configurations, module, scanTarget, scanTarget.getMethods(), scanned, packagePrivateScanned); // Add scanned methods to allow for method overriding. for (ASTMethod astMethod : scanTarget.getMethods()) { MethodSignature signature = new MethodSignature(astMethod); if(astMethod.getAccessModifier() == ASTAccessModifier.PUBLIC || astMethod.getAccessModifier() == ASTAccessModifier.PROTECTED){ scanned.add(signature); } else if(astMethod.getAccessModifier() == ASTAccessModifier.PACKAGE_PRIVATE){ if(!packagePrivateScanned.containsKey(scanTarget.getPackageClass().getPackage())){ packagePrivateScanned.put(scanTarget.getPackageClass().getPackage(), new HashSet<MethodSignature>()); } packagePrivateScanned.get(scanTarget.getPackageClass().getPackage()).add(signature); } } // if super type is null, we are at the top of the inheritance hierarchy and we can unwind. if(scanTarget.getSuperClass() != null) { // recurse our way up the tree so we add the top most providers first and clobber them on the way down createConfigurationsForModuleType(configurations, module, scanTarget.getSuperClass(), scanned, packagePrivateScanned); } }
java
private void createConfigurationsForModuleType(ImmutableList.Builder<ModuleConfiguration> configurations, ASTType module, ASTType scanTarget, Set<MethodSignature> scanned, Map<String, Set<MethodSignature>> packagePrivateScanned) { configureModuleAnnotations(configurations, module, scanTarget, scanTarget.getAnnotations()); configureModuleMethods(configurations, module, scanTarget, scanTarget.getMethods(), scanned, packagePrivateScanned); // Add scanned methods to allow for method overriding. for (ASTMethod astMethod : scanTarget.getMethods()) { MethodSignature signature = new MethodSignature(astMethod); if(astMethod.getAccessModifier() == ASTAccessModifier.PUBLIC || astMethod.getAccessModifier() == ASTAccessModifier.PROTECTED){ scanned.add(signature); } else if(astMethod.getAccessModifier() == ASTAccessModifier.PACKAGE_PRIVATE){ if(!packagePrivateScanned.containsKey(scanTarget.getPackageClass().getPackage())){ packagePrivateScanned.put(scanTarget.getPackageClass().getPackage(), new HashSet<MethodSignature>()); } packagePrivateScanned.get(scanTarget.getPackageClass().getPackage()).add(signature); } } // if super type is null, we are at the top of the inheritance hierarchy and we can unwind. if(scanTarget.getSuperClass() != null) { // recurse our way up the tree so we add the top most providers first and clobber them on the way down createConfigurationsForModuleType(configurations, module, scanTarget.getSuperClass(), scanned, packagePrivateScanned); } }
[ "private", "void", "createConfigurationsForModuleType", "(", "ImmutableList", ".", "Builder", "<", "ModuleConfiguration", ">", "configurations", ",", "ASTType", "module", ",", "ASTType", "scanTarget", ",", "Set", "<", "MethodSignature", ">", "scanned", ",", "Map", "<", "String", ",", "Set", "<", "MethodSignature", ">", ">", "packagePrivateScanned", ")", "{", "configureModuleAnnotations", "(", "configurations", ",", "module", ",", "scanTarget", ",", "scanTarget", ".", "getAnnotations", "(", ")", ")", ";", "configureModuleMethods", "(", "configurations", ",", "module", ",", "scanTarget", ",", "scanTarget", ".", "getMethods", "(", ")", ",", "scanned", ",", "packagePrivateScanned", ")", ";", "// Add scanned methods to allow for method overriding.", "for", "(", "ASTMethod", "astMethod", ":", "scanTarget", ".", "getMethods", "(", ")", ")", "{", "MethodSignature", "signature", "=", "new", "MethodSignature", "(", "astMethod", ")", ";", "if", "(", "astMethod", ".", "getAccessModifier", "(", ")", "==", "ASTAccessModifier", ".", "PUBLIC", "||", "astMethod", ".", "getAccessModifier", "(", ")", "==", "ASTAccessModifier", ".", "PROTECTED", ")", "{", "scanned", ".", "add", "(", "signature", ")", ";", "}", "else", "if", "(", "astMethod", ".", "getAccessModifier", "(", ")", "==", "ASTAccessModifier", ".", "PACKAGE_PRIVATE", ")", "{", "if", "(", "!", "packagePrivateScanned", ".", "containsKey", "(", "scanTarget", ".", "getPackageClass", "(", ")", ".", "getPackage", "(", ")", ")", ")", "{", "packagePrivateScanned", ".", "put", "(", "scanTarget", ".", "getPackageClass", "(", ")", ".", "getPackage", "(", ")", ",", "new", "HashSet", "<", "MethodSignature", ">", "(", ")", ")", ";", "}", "packagePrivateScanned", ".", "get", "(", "scanTarget", ".", "getPackageClass", "(", ")", ".", "getPackage", "(", ")", ")", ".", "add", "(", "signature", ")", ";", "}", "}", "// if super type is null, we are at the top of the inheritance hierarchy and we can unwind.", "if", "(", "scanTarget", ".", "getSuperClass", "(", ")", "!=", "null", ")", "{", "// recurse our way up the tree so we add the top most providers first and clobber them on the way down", "createConfigurationsForModuleType", "(", "configurations", ",", "module", ",", "scanTarget", ".", "getSuperClass", "(", ")", ",", "scanned", ",", "packagePrivateScanned", ")", ";", "}", "}" ]
Recursive method that finds module methods and annotations on all parents of moduleAncestor and moduleAncestor, but creates configuration based on the module. This allows any class in the module hierarchy to contribute annotations or providers that can be overridden by subclasses. @param configurations the holder for annotation and method configurations @param module the module type we are configuring
[ "Recursive", "method", "that", "finds", "module", "methods", "and", "annotations", "on", "all", "parents", "of", "moduleAncestor", "and", "moduleAncestor", "but", "creates", "configuration", "based", "on", "the", "module", ".", "This", "allows", "any", "class", "in", "the", "module", "hierarchy", "to", "contribute", "annotations", "or", "providers", "that", "can", "be", "overridden", "by", "subclasses", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse/src/main/java/org/androidtransfuse/analysis/module/ModuleTransactionWorker.java#L124-L148
3,262
johncarl81/transfuse
transfuse-api/src/main/java/org/androidtransfuse/aop/MethodInterceptorChain.java
MethodInterceptorChain.invoke
public Object invoke(Object[] arguments) { try { return new MethodInterceptorIterator(arguments).proceed(); } catch (Throwable e) { throw new TransfuseInjectionException("Error while invoking Method Interceptor", e); } }
java
public Object invoke(Object[] arguments) { try { return new MethodInterceptorIterator(arguments).proceed(); } catch (Throwable e) { throw new TransfuseInjectionException("Error while invoking Method Interceptor", e); } }
[ "public", "Object", "invoke", "(", "Object", "[", "]", "arguments", ")", "{", "try", "{", "return", "new", "MethodInterceptorIterator", "(", "arguments", ")", ".", "proceed", "(", ")", ";", "}", "catch", "(", "Throwable", "e", ")", "{", "throw", "new", "TransfuseInjectionException", "(", "\"Error while invoking Method Interceptor\"", ",", "e", ")", ";", "}", "}" ]
Invoke the method interception chain. @param arguments provided to the wrapped method. @return value returned by interceptor chain.
[ "Invoke", "the", "method", "interception", "chain", "." ]
a5f837504797a6c4f8628f7e1dde09b8e6368c8b
https://github.com/johncarl81/transfuse/blob/a5f837504797a6c4f8628f7e1dde09b8e6368c8b/transfuse-api/src/main/java/org/androidtransfuse/aop/MethodInterceptorChain.java#L49-L55
3,263
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java
MaterialAutoComplete.setup
protected void setup(SuggestOracle suggestions) { if (itemBoxKeyDownHandler != null) { itemBoxKeyDownHandler.removeHandler(); } list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST); this.suggestions = suggestions; final ListItem item = new ListItem(); item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN); suggestBox = new SuggestBox(suggestions, itemBox); suggestBox.addSelectionHandler(selectionEvent -> { Suggestion selectedItem = selectionEvent.getSelectedItem(); itemBox.setValue(""); if (addItem(selectedItem)) { ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); } itemBox.setFocus(true); }); loadHandlers(); setLimit(this.limit); String autocompleteId = DOM.createUniqueId(); itemBox.getElement().setId(autocompleteId); item.add(suggestBox); item.add(label); list.add(item); panel.add(list); panel.getElement().setAttribute("onclick", "document.getElementById('" + autocompleteId + "').focus()"); panel.add(errorLabel); suggestBox.setFocus(true); }
java
protected void setup(SuggestOracle suggestions) { if (itemBoxKeyDownHandler != null) { itemBoxKeyDownHandler.removeHandler(); } list.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_LIST); this.suggestions = suggestions; final ListItem item = new ListItem(); item.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_INPUT_TOKEN); suggestBox = new SuggestBox(suggestions, itemBox); suggestBox.addSelectionHandler(selectionEvent -> { Suggestion selectedItem = selectionEvent.getSelectedItem(); itemBox.setValue(""); if (addItem(selectedItem)) { ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); } itemBox.setFocus(true); }); loadHandlers(); setLimit(this.limit); String autocompleteId = DOM.createUniqueId(); itemBox.getElement().setId(autocompleteId); item.add(suggestBox); item.add(label); list.add(item); panel.add(list); panel.getElement().setAttribute("onclick", "document.getElementById('" + autocompleteId + "').focus()"); panel.add(errorLabel); suggestBox.setFocus(true); }
[ "protected", "void", "setup", "(", "SuggestOracle", "suggestions", ")", "{", "if", "(", "itemBoxKeyDownHandler", "!=", "null", ")", "{", "itemBoxKeyDownHandler", ".", "removeHandler", "(", ")", ";", "}", "list", ".", "setStyleName", "(", "AddinsCssName", ".", "MULTIVALUESUGGESTBOX_LIST", ")", ";", "this", ".", "suggestions", "=", "suggestions", ";", "final", "ListItem", "item", "=", "new", "ListItem", "(", ")", ";", "item", ".", "setStyleName", "(", "AddinsCssName", ".", "MULTIVALUESUGGESTBOX_INPUT_TOKEN", ")", ";", "suggestBox", "=", "new", "SuggestBox", "(", "suggestions", ",", "itemBox", ")", ";", "suggestBox", ".", "addSelectionHandler", "(", "selectionEvent", "->", "{", "Suggestion", "selectedItem", "=", "selectionEvent", ".", "getSelectedItem", "(", ")", ";", "itemBox", ".", "setValue", "(", "\"\"", ")", ";", "if", "(", "addItem", "(", "selectedItem", ")", ")", "{", "ValueChangeEvent", ".", "fire", "(", "MaterialAutoComplete", ".", "this", ",", "getValue", "(", ")", ")", ";", "}", "itemBox", ".", "setFocus", "(", "true", ")", ";", "}", ")", ";", "loadHandlers", "(", ")", ";", "setLimit", "(", "this", ".", "limit", ")", ";", "String", "autocompleteId", "=", "DOM", ".", "createUniqueId", "(", ")", ";", "itemBox", ".", "getElement", "(", ")", ".", "setId", "(", "autocompleteId", ")", ";", "item", ".", "add", "(", "suggestBox", ")", ";", "item", ".", "add", "(", "label", ")", ";", "list", ".", "add", "(", "item", ")", ";", "panel", ".", "add", "(", "list", ")", ";", "panel", ".", "getElement", "(", ")", ".", "setAttribute", "(", "\"onclick\"", ",", "\"document.getElementById('\"", "+", "autocompleteId", "+", "\"').focus()\"", ")", ";", "panel", ".", "add", "(", "errorLabel", ")", ";", "suggestBox", ".", "setFocus", "(", "true", ")", ";", "}" ]
Generate and build the List Items to be set on Auto Complete box.
[ "Generate", "and", "build", "the", "List", "Items", "to", "be", "set", "on", "Auto", "Complete", "box", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java#L312-L349
3,264
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java
MaterialAutoComplete.addItem
protected boolean addItem(final Suggestion suggestion) { SelectionEvent.fire(MaterialAutoComplete.this, suggestion); if (getLimit() > 0) { if (suggestionMap.size() >= getLimit()) { return false; } } if (suggestionMap.containsKey(suggestion)) { return false; } final ListItem displayItem = new ListItem(); displayItem.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_TOKEN); if (getType() == AutocompleteType.TEXT) { suggestionMap.clear(); itemBox.setText(suggestion.getReplacementString()); } else { final MaterialChip chip = chipProvider.getChip(suggestion); if (chip == null) { return false; } registerHandler(chip.addClickHandler(event -> { if (chipProvider.isChipSelectable(suggestion)) { if (itemsHighlighted.contains(displayItem)) { chip.removeStyleName(selectedChipStyle); itemsHighlighted.remove(displayItem); } else { chip.addStyleName(selectedChipStyle); itemsHighlighted.add(displayItem); } } })); if (chip.getIcon() != null) { registerHandler(chip.getIcon().addClickHandler(event -> { if (chipProvider.isChipRemovable(suggestion)) { suggestionMap.remove(suggestion); list.remove(displayItem); itemsHighlighted.remove(displayItem); ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); suggestBox.showSuggestionList(); } })); } suggestionMap.put(suggestion, chip); displayItem.add(chip); list.insert(displayItem, list.getWidgetCount() - 1); } return true; }
java
protected boolean addItem(final Suggestion suggestion) { SelectionEvent.fire(MaterialAutoComplete.this, suggestion); if (getLimit() > 0) { if (suggestionMap.size() >= getLimit()) { return false; } } if (suggestionMap.containsKey(suggestion)) { return false; } final ListItem displayItem = new ListItem(); displayItem.setStyleName(AddinsCssName.MULTIVALUESUGGESTBOX_TOKEN); if (getType() == AutocompleteType.TEXT) { suggestionMap.clear(); itemBox.setText(suggestion.getReplacementString()); } else { final MaterialChip chip = chipProvider.getChip(suggestion); if (chip == null) { return false; } registerHandler(chip.addClickHandler(event -> { if (chipProvider.isChipSelectable(suggestion)) { if (itemsHighlighted.contains(displayItem)) { chip.removeStyleName(selectedChipStyle); itemsHighlighted.remove(displayItem); } else { chip.addStyleName(selectedChipStyle); itemsHighlighted.add(displayItem); } } })); if (chip.getIcon() != null) { registerHandler(chip.getIcon().addClickHandler(event -> { if (chipProvider.isChipRemovable(suggestion)) { suggestionMap.remove(suggestion); list.remove(displayItem); itemsHighlighted.remove(displayItem); ValueChangeEvent.fire(MaterialAutoComplete.this, getValue()); suggestBox.showSuggestionList(); } })); } suggestionMap.put(suggestion, chip); displayItem.add(chip); list.insert(displayItem, list.getWidgetCount() - 1); } return true; }
[ "protected", "boolean", "addItem", "(", "final", "Suggestion", "suggestion", ")", "{", "SelectionEvent", ".", "fire", "(", "MaterialAutoComplete", ".", "this", ",", "suggestion", ")", ";", "if", "(", "getLimit", "(", ")", ">", "0", ")", "{", "if", "(", "suggestionMap", ".", "size", "(", ")", ">=", "getLimit", "(", ")", ")", "{", "return", "false", ";", "}", "}", "if", "(", "suggestionMap", ".", "containsKey", "(", "suggestion", ")", ")", "{", "return", "false", ";", "}", "final", "ListItem", "displayItem", "=", "new", "ListItem", "(", ")", ";", "displayItem", ".", "setStyleName", "(", "AddinsCssName", ".", "MULTIVALUESUGGESTBOX_TOKEN", ")", ";", "if", "(", "getType", "(", ")", "==", "AutocompleteType", ".", "TEXT", ")", "{", "suggestionMap", ".", "clear", "(", ")", ";", "itemBox", ".", "setText", "(", "suggestion", ".", "getReplacementString", "(", ")", ")", ";", "}", "else", "{", "final", "MaterialChip", "chip", "=", "chipProvider", ".", "getChip", "(", "suggestion", ")", ";", "if", "(", "chip", "==", "null", ")", "{", "return", "false", ";", "}", "registerHandler", "(", "chip", ".", "addClickHandler", "(", "event", "->", "{", "if", "(", "chipProvider", ".", "isChipSelectable", "(", "suggestion", ")", ")", "{", "if", "(", "itemsHighlighted", ".", "contains", "(", "displayItem", ")", ")", "{", "chip", ".", "removeStyleName", "(", "selectedChipStyle", ")", ";", "itemsHighlighted", ".", "remove", "(", "displayItem", ")", ";", "}", "else", "{", "chip", ".", "addStyleName", "(", "selectedChipStyle", ")", ";", "itemsHighlighted", ".", "add", "(", "displayItem", ")", ";", "}", "}", "}", ")", ")", ";", "if", "(", "chip", ".", "getIcon", "(", ")", "!=", "null", ")", "{", "registerHandler", "(", "chip", ".", "getIcon", "(", ")", ".", "addClickHandler", "(", "event", "->", "{", "if", "(", "chipProvider", ".", "isChipRemovable", "(", "suggestion", ")", ")", "{", "suggestionMap", ".", "remove", "(", "suggestion", ")", ";", "list", ".", "remove", "(", "displayItem", ")", ";", "itemsHighlighted", ".", "remove", "(", "displayItem", ")", ";", "ValueChangeEvent", ".", "fire", "(", "MaterialAutoComplete", ".", "this", ",", "getValue", "(", ")", ")", ";", "suggestBox", ".", "showSuggestionList", "(", ")", ";", "}", "}", ")", ")", ";", "}", "suggestionMap", ".", "put", "(", "suggestion", ",", "chip", ")", ";", "displayItem", ".", "add", "(", "chip", ")", ";", "list", ".", "insert", "(", "displayItem", ",", "list", ".", "getWidgetCount", "(", ")", "-", "1", ")", ";", "}", "return", "true", ";", "}" ]
Adding the item value using Material Chips added on auto complete box
[ "Adding", "the", "item", "value", "using", "Material", "Chips", "added", "on", "auto", "complete", "box" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java#L368-L421
3,265
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java
MaterialAutoComplete.clear
public void clear() { itemBox.setValue(""); label.removeStyleName(CssName.ACTIVE); Collection<Widget> values = suggestionMap.values(); for (Widget widget : values) { Widget parent = widget.getParent(); if (parent instanceof ListItem) { parent.removeFromParent(); } } suggestionMap.clear(); clearStatusText(); }
java
public void clear() { itemBox.setValue(""); label.removeStyleName(CssName.ACTIVE); Collection<Widget> values = suggestionMap.values(); for (Widget widget : values) { Widget parent = widget.getParent(); if (parent instanceof ListItem) { parent.removeFromParent(); } } suggestionMap.clear(); clearStatusText(); }
[ "public", "void", "clear", "(", ")", "{", "itemBox", ".", "setValue", "(", "\"\"", ")", ";", "label", ".", "removeStyleName", "(", "CssName", ".", "ACTIVE", ")", ";", "Collection", "<", "Widget", ">", "values", "=", "suggestionMap", ".", "values", "(", ")", ";", "for", "(", "Widget", "widget", ":", "values", ")", "{", "Widget", "parent", "=", "widget", ".", "getParent", "(", ")", ";", "if", "(", "parent", "instanceof", "ListItem", ")", "{", "parent", ".", "removeFromParent", "(", ")", ";", "}", "}", "suggestionMap", ".", "clear", "(", ")", ";", "clearStatusText", "(", ")", ";", "}" ]
Clear the chip items on the autocomplete box
[ "Clear", "the", "chip", "items", "on", "the", "autocomplete", "box" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/autocomplete/MaterialAutoComplete.java#L433-L447
3,266
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/camera/MaterialCameraCapture.java
MaterialCameraCapture.nativeCaptureToDataURL
protected String nativeCaptureToDataURL(CanvasElement canvas, Element element, String mimeType) { VideoElement videoElement = (VideoElement) element; int width = videoElement.getVideoWidth(); int height = videoElement.getVideoHeight(); if (Double.isNaN(width) || Double.isNaN(height)) { width = videoElement.getClientWidth(); height = videoElement.getClientHeight(); } canvas.setWidth(width); canvas.setHeight(height); Context2d context = canvas.getContext2d(); context.drawImage(videoElement, 0, 0, width, height); return canvas.toDataUrl(mimeType); }
java
protected String nativeCaptureToDataURL(CanvasElement canvas, Element element, String mimeType) { VideoElement videoElement = (VideoElement) element; int width = videoElement.getVideoWidth(); int height = videoElement.getVideoHeight(); if (Double.isNaN(width) || Double.isNaN(height)) { width = videoElement.getClientWidth(); height = videoElement.getClientHeight(); } canvas.setWidth(width); canvas.setHeight(height); Context2d context = canvas.getContext2d(); context.drawImage(videoElement, 0, 0, width, height); return canvas.toDataUrl(mimeType); }
[ "protected", "String", "nativeCaptureToDataURL", "(", "CanvasElement", "canvas", ",", "Element", "element", ",", "String", "mimeType", ")", "{", "VideoElement", "videoElement", "=", "(", "VideoElement", ")", "element", ";", "int", "width", "=", "videoElement", ".", "getVideoWidth", "(", ")", ";", "int", "height", "=", "videoElement", ".", "getVideoHeight", "(", ")", ";", "if", "(", "Double", ".", "isNaN", "(", "width", ")", "||", "Double", ".", "isNaN", "(", "height", ")", ")", "{", "width", "=", "videoElement", ".", "getClientWidth", "(", ")", ";", "height", "=", "videoElement", ".", "getClientHeight", "(", ")", ";", "}", "canvas", ".", "setWidth", "(", "width", ")", ";", "canvas", ".", "setHeight", "(", "height", ")", ";", "Context2d", "context", "=", "canvas", ".", "getContext2d", "(", ")", ";", "context", ".", "drawImage", "(", "videoElement", ",", "0", ",", "0", ",", "width", ",", "height", ")", ";", "return", "canvas", ".", "toDataUrl", "(", "mimeType", ")", ";", "}" ]
Native call to capture the frame of the video stream.
[ "Native", "call", "to", "capture", "the", "frame", "of", "the", "video", "stream", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/camera/MaterialCameraCapture.java#L266-L279
3,267
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/camera/MaterialCameraCapture.java
MaterialCameraCapture.isSupported
public static boolean isSupported() { return Navigator.webkitGetUserMedia != null || Navigator.getUserMedia != null || Navigator.mozGetUserMedia != null || Navigator.msGetUserMedia != null; }
java
public static boolean isSupported() { return Navigator.webkitGetUserMedia != null || Navigator.getUserMedia != null || Navigator.mozGetUserMedia != null || Navigator.msGetUserMedia != null; }
[ "public", "static", "boolean", "isSupported", "(", ")", "{", "return", "Navigator", ".", "webkitGetUserMedia", "!=", "null", "||", "Navigator", ".", "getUserMedia", "!=", "null", "||", "Navigator", ".", "mozGetUserMedia", "!=", "null", "||", "Navigator", ".", "msGetUserMedia", "!=", "null", ";", "}" ]
Tests if the browser supports the Streams API. This should be called before creating any MaterialCameraCapture widgets to avoid errors on the browser. @return <code>true</code> if the browser supports this widget, <code>false</code> otherwise
[ "Tests", "if", "the", "browser", "supports", "the", "Streams", "API", ".", "This", "should", "be", "called", "before", "creating", "any", "MaterialCameraCapture", "widgets", "to", "avoid", "errors", "on", "the", "browser", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/camera/MaterialCameraCapture.java#L287-L292
3,268
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStep.java
MaterialStep.setLineDistanceWidth
public void setLineDistanceWidth(int lineDistanceWidth) { if (divLine.isAttached()) { divLine.setWidth(lineDistanceWidth + "px"); } else { divLine.addAttachHandler(event -> divLine.setWidth(lineDistanceWidth + "px")); } }
java
public void setLineDistanceWidth(int lineDistanceWidth) { if (divLine.isAttached()) { divLine.setWidth(lineDistanceWidth + "px"); } else { divLine.addAttachHandler(event -> divLine.setWidth(lineDistanceWidth + "px")); } }
[ "public", "void", "setLineDistanceWidth", "(", "int", "lineDistanceWidth", ")", "{", "if", "(", "divLine", ".", "isAttached", "(", ")", ")", "{", "divLine", ".", "setWidth", "(", "lineDistanceWidth", "+", "\"px\"", ")", ";", "}", "else", "{", "divLine", ".", "addAttachHandler", "(", "event", "->", "divLine", ".", "setWidth", "(", "lineDistanceWidth", "+", "\"px\"", ")", ")", ";", "}", "}" ]
Will set the distance width of the step line from another step.
[ "Will", "set", "the", "distance", "width", "of", "the", "step", "line", "from", "another", "step", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStep.java#L253-L259
3,269
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cropper/MaterialImageCropper.java
MaterialImageCropper.crop
public void crop(String url, Type type) { setUrl(url); bind(url, () -> crop(type)); }
java
public void crop(String url, Type type) { setUrl(url); bind(url, () -> crop(type)); }
[ "public", "void", "crop", "(", "String", "url", ",", "Type", "type", ")", "{", "setUrl", "(", "url", ")", ";", "bind", "(", "url", ",", "(", ")", "->", "crop", "(", "type", ")", ")", ";", "}" ]
Cropped the image with given URL and result type
[ "Cropped", "the", "image", "with", "given", "URL", "and", "result", "type" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cropper/MaterialImageCropper.java#L140-L143
3,270
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cropper/MaterialImageCropper.java
MaterialImageCropper.bind
public void bind(String url, Functions.Func callback) { cropper.croppie("bind", url).then((result, object) -> { callback.call(); return true; }); }
java
public void bind(String url, Functions.Func callback) { cropper.croppie("bind", url).then((result, object) -> { callback.call(); return true; }); }
[ "public", "void", "bind", "(", "String", "url", ",", "Functions", ".", "Func", "callback", ")", "{", "cropper", ".", "croppie", "(", "\"bind\"", ",", "url", ")", ".", "then", "(", "(", "result", ",", "object", ")", "->", "{", "callback", ".", "call", "(", ")", ";", "return", "true", ";", "}", ")", ";", "}" ]
Bind an image the cropper. Returns a promise to be resolved when the image has been loaded and the cropper has been initialized. @param url - URL to Image @param callback - Callback when the Promise has been resolved.
[ "Bind", "an", "image", "the", "cropper", ".", "Returns", "a", "promise", "to", "be", "resolved", "when", "the", "image", "has", "been", "loaded", "and", "the", "cropper", "has", "been", "initialized", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cropper/MaterialImageCropper.java#L151-L156
3,271
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java
MaterialPopupMenu.setPopupPosition
public void setPopupPosition(int popupX, int popupY) { // Will check if the popup is out of container this.popupX = popupX; this.popupY = popupY; setLeft(popupX); setTop(popupY); }
java
public void setPopupPosition(int popupX, int popupY) { // Will check if the popup is out of container this.popupX = popupX; this.popupY = popupY; setLeft(popupX); setTop(popupY); }
[ "public", "void", "setPopupPosition", "(", "int", "popupX", ",", "int", "popupY", ")", "{", "// Will check if the popup is out of container", "this", ".", "popupX", "=", "popupX", ";", "this", ".", "popupY", "=", "popupY", ";", "setLeft", "(", "popupX", ")", ";", "setTop", "(", "popupY", ")", ";", "}" ]
Set the popup position of the context menu @param popupX window x position @param popupY window y position
[ "Set", "the", "popup", "position", "of", "the", "context", "menu" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/popupmenu/MaterialPopupMenu.java#L163-L169
3,272
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/masonry/MaterialMasonry.java
MaterialMasonry.masonryRemove
protected void masonryRemove(Widget target) { this.target = target; if (target != sizerDiv) { super.remove(target); reload(); } }
java
protected void masonryRemove(Widget target) { this.target = target; if (target != sizerDiv) { super.remove(target); reload(); } }
[ "protected", "void", "masonryRemove", "(", "Widget", "target", ")", "{", "this", ".", "target", "=", "target", ";", "if", "(", "target", "!=", "sizerDiv", ")", "{", "super", ".", "remove", "(", "target", ")", ";", "reload", "(", ")", ";", "}", "}" ]
Remove the item with Masonry support
[ "Remove", "the", "item", "with", "Masonry", "support" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/masonry/MaterialMasonry.java#L164-L170
3,273
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java
MaterialRating.revalidateLayout
protected void revalidateLayout() { for (MaterialIcon icon : iconList) { icon.removeFromParent(); } iconList.clear(); // same mouse-out handler for all icons MouseOutHandler outHandler = event -> { if (!isEnabled() || !isEditable()) { return; } revalidateSelection(currentRating); }; for (int i = 0; i < maxRating; i++) { final int rating = i + 1; MaterialIcon icon = new MaterialIcon(unselectedRatingIcon); registerHandler(icon.addClickHandler(event -> { if (!isEnabled() || !isEditable()) { return; } setValue(rating, true); })); registerHandler(icon.addMouseOverHandler(event -> { if (!isEnabled() || !isEditable()) { return; } revalidateSelection(rating); })); registerHandler(icon.addMouseOutHandler(outHandler)); add(icon); iconList.add(icon); } revalidateSelection(currentRating); }
java
protected void revalidateLayout() { for (MaterialIcon icon : iconList) { icon.removeFromParent(); } iconList.clear(); // same mouse-out handler for all icons MouseOutHandler outHandler = event -> { if (!isEnabled() || !isEditable()) { return; } revalidateSelection(currentRating); }; for (int i = 0; i < maxRating; i++) { final int rating = i + 1; MaterialIcon icon = new MaterialIcon(unselectedRatingIcon); registerHandler(icon.addClickHandler(event -> { if (!isEnabled() || !isEditable()) { return; } setValue(rating, true); })); registerHandler(icon.addMouseOverHandler(event -> { if (!isEnabled() || !isEditable()) { return; } revalidateSelection(rating); })); registerHandler(icon.addMouseOutHandler(outHandler)); add(icon); iconList.add(icon); } revalidateSelection(currentRating); }
[ "protected", "void", "revalidateLayout", "(", ")", "{", "for", "(", "MaterialIcon", "icon", ":", "iconList", ")", "{", "icon", ".", "removeFromParent", "(", ")", ";", "}", "iconList", ".", "clear", "(", ")", ";", "// same mouse-out handler for all icons", "MouseOutHandler", "outHandler", "=", "event", "->", "{", "if", "(", "!", "isEnabled", "(", ")", "||", "!", "isEditable", "(", ")", ")", "{", "return", ";", "}", "revalidateSelection", "(", "currentRating", ")", ";", "}", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxRating", ";", "i", "++", ")", "{", "final", "int", "rating", "=", "i", "+", "1", ";", "MaterialIcon", "icon", "=", "new", "MaterialIcon", "(", "unselectedRatingIcon", ")", ";", "registerHandler", "(", "icon", ".", "addClickHandler", "(", "event", "->", "{", "if", "(", "!", "isEnabled", "(", ")", "||", "!", "isEditable", "(", ")", ")", "{", "return", ";", "}", "setValue", "(", "rating", ",", "true", ")", ";", "}", ")", ")", ";", "registerHandler", "(", "icon", ".", "addMouseOverHandler", "(", "event", "->", "{", "if", "(", "!", "isEnabled", "(", ")", "||", "!", "isEditable", "(", ")", ")", "{", "return", ";", "}", "revalidateSelection", "(", "rating", ")", ";", "}", ")", ")", ";", "registerHandler", "(", "icon", ".", "addMouseOutHandler", "(", "outHandler", ")", ")", ";", "add", "(", "icon", ")", ";", "iconList", ".", "add", "(", "icon", ")", ";", "}", "revalidateSelection", "(", "currentRating", ")", ";", "}" ]
Method called internally by the component to re-validate the number of icons when the maximum rating is changed.
[ "Method", "called", "internally", "by", "the", "component", "to", "re", "-", "validate", "the", "number", "of", "icons", "when", "the", "maximum", "rating", "is", "changed", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java#L216-L252
3,274
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java
MaterialRating.revalidateSelection
protected void revalidateSelection(int rating) { for (MaterialIcon icon : iconList) { icon.removeStyleName(AddinsCssName.MATERIAL_RATING_UNSELECTED); icon.removeStyleName(AddinsCssName.MATERIAL_RATING_SELECTED); } for (int i = 0; i < rating && i < iconList.size(); i++) { MaterialIcon icon = iconList.get(i); icon.setIconType(selectedRatingIcon); icon.addStyleName(AddinsCssName.MATERIAL_RATING_SELECTED); } for (int i = rating; i < iconList.size(); i++) { MaterialIcon icon = iconList.get(i); icon.setIconType(unselectedRatingIcon); icon.addStyleName(AddinsCssName.MATERIAL_RATING_UNSELECTED); } }
java
protected void revalidateSelection(int rating) { for (MaterialIcon icon : iconList) { icon.removeStyleName(AddinsCssName.MATERIAL_RATING_UNSELECTED); icon.removeStyleName(AddinsCssName.MATERIAL_RATING_SELECTED); } for (int i = 0; i < rating && i < iconList.size(); i++) { MaterialIcon icon = iconList.get(i); icon.setIconType(selectedRatingIcon); icon.addStyleName(AddinsCssName.MATERIAL_RATING_SELECTED); } for (int i = rating; i < iconList.size(); i++) { MaterialIcon icon = iconList.get(i); icon.setIconType(unselectedRatingIcon); icon.addStyleName(AddinsCssName.MATERIAL_RATING_UNSELECTED); } }
[ "protected", "void", "revalidateSelection", "(", "int", "rating", ")", "{", "for", "(", "MaterialIcon", "icon", ":", "iconList", ")", "{", "icon", ".", "removeStyleName", "(", "AddinsCssName", ".", "MATERIAL_RATING_UNSELECTED", ")", ";", "icon", ".", "removeStyleName", "(", "AddinsCssName", ".", "MATERIAL_RATING_SELECTED", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rating", "&&", "i", "<", "iconList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "MaterialIcon", "icon", "=", "iconList", ".", "get", "(", "i", ")", ";", "icon", ".", "setIconType", "(", "selectedRatingIcon", ")", ";", "icon", ".", "addStyleName", "(", "AddinsCssName", ".", "MATERIAL_RATING_SELECTED", ")", ";", "}", "for", "(", "int", "i", "=", "rating", ";", "i", "<", "iconList", ".", "size", "(", ")", ";", "i", "++", ")", "{", "MaterialIcon", "icon", "=", "iconList", ".", "get", "(", "i", ")", ";", "icon", ".", "setIconType", "(", "unselectedRatingIcon", ")", ";", "icon", ".", "addStyleName", "(", "AddinsCssName", ".", "MATERIAL_RATING_UNSELECTED", ")", ";", "}", "}" ]
Method called internally by the component to revalidade selections by the user, switching the icons accordingly.
[ "Method", "called", "internally", "by", "the", "component", "to", "revalidade", "selections", "by", "the", "user", "switching", "the", "icons", "accordingly", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/rating/MaterialRating.java#L258-L275
3,275
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/avatar/MaterialAvatar.java
MaterialAvatar.setDimension
public void setDimension(int width, int height) { setWidth(String.valueOf(width)); setHeight(String.valueOf(height)); reload(); }
java
public void setDimension(int width, int height) { setWidth(String.valueOf(width)); setHeight(String.valueOf(height)); reload(); }
[ "public", "void", "setDimension", "(", "int", "width", ",", "int", "height", ")", "{", "setWidth", "(", "String", ".", "valueOf", "(", "width", ")", ")", ";", "setHeight", "(", "String", ".", "valueOf", "(", "height", ")", ")", ";", "reload", "(", ")", ";", "}" ]
Allowing to set the dimension of the Avatar component. @param width - the width dimension of the avatar without any Unit suffix (e.i 100) @param height - the height dimension of the avatar without any Unit suffix (e.i 100)
[ "Allowing", "to", "set", "the", "dimension", "of", "the", "Avatar", "component", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/avatar/MaterialAvatar.java#L160-L164
3,276
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java
MaterialPathAnimator.animate
public static void animate(Widget source, final Widget target) { animate(source.getElement(), target.getElement()); }
java
public static void animate(Widget source, final Widget target) { animate(source.getElement(), target.getElement()); }
[ "public", "static", "void", "animate", "(", "Widget", "source", ",", "final", "Widget", "target", ")", "{", "animate", "(", "source", ".", "getElement", "(", ")", ",", "target", ".", "getElement", "(", ")", ")", ";", "}" ]
Helper method to apply the path animator. @param source Source widget to apply the Path Animator @param target Target widget to apply the Path Animator
[ "Helper", "method", "to", "apply", "the", "path", "animator", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L110-L112
3,277
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java
MaterialPathAnimator.reverseAnimate
public static void reverseAnimate(final Widget source, final Widget target) { reverseAnimate(source.getElement(), target.getElement()); }
java
public static void reverseAnimate(final Widget source, final Widget target) { reverseAnimate(source.getElement(), target.getElement()); }
[ "public", "static", "void", "reverseAnimate", "(", "final", "Widget", "source", ",", "final", "Widget", "target", ")", "{", "reverseAnimate", "(", "source", ".", "getElement", "(", ")", ",", "target", ".", "getElement", "(", ")", ")", ";", "}" ]
Helper method to reverse animate the source element to target element. @param source Source widget to apply the Path Animator @param target Target widget to apply the Path Animator
[ "Helper", "method", "to", "reverse", "animate", "the", "source", "element", "to", "target", "element", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L223-L225
3,278
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java
MaterialPathAnimator.reverseAnimate
public static void reverseAnimate(Widget source, Widget target, Functions.Func reverseCallback) { reverseAnimate(source.getElement(), target.getElement(), reverseCallback); }
java
public static void reverseAnimate(Widget source, Widget target, Functions.Func reverseCallback) { reverseAnimate(source.getElement(), target.getElement(), reverseCallback); }
[ "public", "static", "void", "reverseAnimate", "(", "Widget", "source", ",", "Widget", "target", ",", "Functions", ".", "Func", "reverseCallback", ")", "{", "reverseAnimate", "(", "source", ".", "getElement", "(", ")", ",", "target", ".", "getElement", "(", ")", ",", "reverseCallback", ")", ";", "}" ]
Helper method to reverse animate the source element to target element with reverse callback. @param source Source widget to apply the Path Animator @param target Target widget to apply the Path Animator @param reverseCallback The reverse callback method to be called when the path animator is applied
[ "Helper", "method", "to", "reverse", "animate", "the", "source", "element", "to", "target", "element", "with", "reverse", "callback", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L234-L236
3,279
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java
MaterialPathAnimator.reverseAnimate
public static void reverseAnimate(Element sourceElement, Element targetElement, Functions.Func reverseCallback) { MaterialPathAnimator animator = new MaterialPathAnimator(); animator.setSourceElement(sourceElement); animator.setTargetElement(targetElement); animator.setReverseCallback(reverseCallback); animator.reverseAnimate(); }
java
public static void reverseAnimate(Element sourceElement, Element targetElement, Functions.Func reverseCallback) { MaterialPathAnimator animator = new MaterialPathAnimator(); animator.setSourceElement(sourceElement); animator.setTargetElement(targetElement); animator.setReverseCallback(reverseCallback); animator.reverseAnimate(); }
[ "public", "static", "void", "reverseAnimate", "(", "Element", "sourceElement", ",", "Element", "targetElement", ",", "Functions", ".", "Func", "reverseCallback", ")", "{", "MaterialPathAnimator", "animator", "=", "new", "MaterialPathAnimator", "(", ")", ";", "animator", ".", "setSourceElement", "(", "sourceElement", ")", ";", "animator", ".", "setTargetElement", "(", "targetElement", ")", ";", "animator", ".", "setReverseCallback", "(", "reverseCallback", ")", ";", "animator", ".", "reverseAnimate", "(", ")", ";", "}" ]
Helper method to reverse animate the source element to target element with reverse callback @param sourceElement Source element to apply the Path Animator @param targetElement Target element to apply the Path Animator @param reverseCallback The reverse callback method to be called when the path animator is applied
[ "Helper", "method", "to", "reverse", "animate", "the", "source", "element", "to", "target", "element", "with", "reverse", "callback" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/pathanimator/MaterialPathAnimator.java#L245-L251
3,280
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/countup/MaterialCountUp.java
MaterialCountUp.setValue
public void setValue(Double value, boolean fireEvents, boolean autoStart) { super.setValue(value, fireEvents); setEndValue(value); if (autoStart) { start(); } }
java
public void setValue(Double value, boolean fireEvents, boolean autoStart) { super.setValue(value, fireEvents); setEndValue(value); if (autoStart) { start(); } }
[ "public", "void", "setValue", "(", "Double", "value", ",", "boolean", "fireEvents", ",", "boolean", "autoStart", ")", "{", "super", ".", "setValue", "(", "value", ",", "fireEvents", ")", ";", "setEndValue", "(", "value", ")", ";", "if", "(", "autoStart", ")", "{", "start", "(", ")", ";", "}", "}" ]
Provide a better control whether you want to automatically start the counting of the new value. By Default it will start counting with the given value.
[ "Provide", "a", "better", "control", "whether", "you", "want", "to", "automatically", "start", "the", "counting", "of", "the", "new", "value", ".", "By", "Default", "it", "will", "start", "counting", "with", "the", "given", "value", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/countup/MaterialCountUp.java#L136-L143
3,281
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/window/MaterialWindow.java
MaterialWindow.open
public void open() { if (!isAttached()) { RootPanel.get().add(this); } windowCount++; if(windowOverlay != null && !windowOverlay.isAttached()) { RootPanel.get().add(windowOverlay); } if (fullsceenOnMobile && Window.matchMedia(Resolution.ALL_MOBILE.asMediaQuery())) { setMaximize(true); } if (openAnimation == null) { getOpenMixin().setOn(true); OpenEvent.fire(this, true); } else { setOpacity(0); Scheduler.get().scheduleDeferred(() -> { getOpenMixin().setOn(true); openAnimation.animate(this, () -> OpenEvent.fire(this, true)); }); } }
java
public void open() { if (!isAttached()) { RootPanel.get().add(this); } windowCount++; if(windowOverlay != null && !windowOverlay.isAttached()) { RootPanel.get().add(windowOverlay); } if (fullsceenOnMobile && Window.matchMedia(Resolution.ALL_MOBILE.asMediaQuery())) { setMaximize(true); } if (openAnimation == null) { getOpenMixin().setOn(true); OpenEvent.fire(this, true); } else { setOpacity(0); Scheduler.get().scheduleDeferred(() -> { getOpenMixin().setOn(true); openAnimation.animate(this, () -> OpenEvent.fire(this, true)); }); } }
[ "public", "void", "open", "(", ")", "{", "if", "(", "!", "isAttached", "(", ")", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "add", "(", "this", ")", ";", "}", "windowCount", "++", ";", "if", "(", "windowOverlay", "!=", "null", "&&", "!", "windowOverlay", ".", "isAttached", "(", ")", ")", "{", "RootPanel", ".", "get", "(", ")", ".", "add", "(", "windowOverlay", ")", ";", "}", "if", "(", "fullsceenOnMobile", "&&", "Window", ".", "matchMedia", "(", "Resolution", ".", "ALL_MOBILE", ".", "asMediaQuery", "(", ")", ")", ")", "{", "setMaximize", "(", "true", ")", ";", "}", "if", "(", "openAnimation", "==", "null", ")", "{", "getOpenMixin", "(", ")", ".", "setOn", "(", "true", ")", ";", "OpenEvent", ".", "fire", "(", "this", ",", "true", ")", ";", "}", "else", "{", "setOpacity", "(", "0", ")", ";", "Scheduler", ".", "get", "(", ")", ".", "scheduleDeferred", "(", "(", ")", "->", "{", "getOpenMixin", "(", ")", ".", "setOn", "(", "true", ")", ";", "openAnimation", ".", "animate", "(", "this", ",", "(", ")", "->", "OpenEvent", ".", "fire", "(", "this", ",", "true", ")", ")", ";", "}", ")", ";", "}", "}" ]
Open the window.
[ "Open", "the", "window", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/window/MaterialWindow.java#L267-L290
3,282
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/window/MaterialWindow.java
MaterialWindow.close
public void close() { // Turn back the cursor to POINTER RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.DEFAULT); windowCount--; if (closeAnimation == null) { getOpenMixin().setOn(false); if(windowOverlay != null && windowOverlay.isAttached() && windowCount < 1) { windowOverlay.removeFromParent(); } CloseEvent.fire(this, false); } else { closeAnimation.animate(this, () -> { getOpenMixin().setOn(false); if(windowOverlay != null && windowOverlay.isAttached() && windowCount < 1) { windowOverlay.removeFromParent(); } CloseEvent.fire(this, false); }); } }
java
public void close() { // Turn back the cursor to POINTER RootPanel.get().getElement().getStyle().setCursor(Style.Cursor.DEFAULT); windowCount--; if (closeAnimation == null) { getOpenMixin().setOn(false); if(windowOverlay != null && windowOverlay.isAttached() && windowCount < 1) { windowOverlay.removeFromParent(); } CloseEvent.fire(this, false); } else { closeAnimation.animate(this, () -> { getOpenMixin().setOn(false); if(windowOverlay != null && windowOverlay.isAttached() && windowCount < 1) { windowOverlay.removeFromParent(); } CloseEvent.fire(this, false); }); } }
[ "public", "void", "close", "(", ")", "{", "// Turn back the cursor to POINTER", "RootPanel", ".", "get", "(", ")", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setCursor", "(", "Style", ".", "Cursor", ".", "DEFAULT", ")", ";", "windowCount", "--", ";", "if", "(", "closeAnimation", "==", "null", ")", "{", "getOpenMixin", "(", ")", ".", "setOn", "(", "false", ")", ";", "if", "(", "windowOverlay", "!=", "null", "&&", "windowOverlay", ".", "isAttached", "(", ")", "&&", "windowCount", "<", "1", ")", "{", "windowOverlay", ".", "removeFromParent", "(", ")", ";", "}", "CloseEvent", ".", "fire", "(", "this", ",", "false", ")", ";", "}", "else", "{", "closeAnimation", ".", "animate", "(", "this", ",", "(", ")", "->", "{", "getOpenMixin", "(", ")", ".", "setOn", "(", "false", ")", ";", "if", "(", "windowOverlay", "!=", "null", "&&", "windowOverlay", ".", "isAttached", "(", ")", "&&", "windowCount", "<", "1", ")", "{", "windowOverlay", ".", "removeFromParent", "(", ")", ";", "}", "CloseEvent", ".", "fire", "(", "this", ",", "false", ")", ";", "}", ")", ";", "}", "}" ]
Close the window.
[ "Close", "the", "window", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/window/MaterialWindow.java#L295-L315
3,283
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/tree/MaterialTree.java
MaterialTree.expandItems
protected void expandItems(MaterialTreeItem item) { item.expand(); item.setHide(true); item.getTreeItems().forEach(this::expandItems); }
java
protected void expandItems(MaterialTreeItem item) { item.expand(); item.setHide(true); item.getTreeItems().forEach(this::expandItems); }
[ "protected", "void", "expandItems", "(", "MaterialTreeItem", "item", ")", "{", "item", ".", "expand", "(", ")", ";", "item", ".", "setHide", "(", "true", ")", ";", "item", ".", "getTreeItems", "(", ")", ".", "forEach", "(", "this", "::", "expandItems", ")", ";", "}" ]
Recursive function to expand each tree item.
[ "Recursive", "function", "to", "expand", "each", "tree", "item", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/tree/MaterialTree.java#L156-L160
3,284
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/tree/MaterialTree.java
MaterialTree.deselectSelectedItem
public void deselectSelectedItem() { // Check whether tree has selected item if (selectedItem != null) { clearSelectedStyles(selectedItem); setSelectedItem(null); SelectionEvent.fire(this, null); } }
java
public void deselectSelectedItem() { // Check whether tree has selected item if (selectedItem != null) { clearSelectedStyles(selectedItem); setSelectedItem(null); SelectionEvent.fire(this, null); } }
[ "public", "void", "deselectSelectedItem", "(", ")", "{", "// Check whether tree has selected item", "if", "(", "selectedItem", "!=", "null", ")", "{", "clearSelectedStyles", "(", "selectedItem", ")", ";", "setSelectedItem", "(", "null", ")", ";", "SelectionEvent", ".", "fire", "(", "this", ",", "null", ")", ";", "}", "}" ]
Deselect selected tree item
[ "Deselect", "selected", "tree", "item" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/tree/MaterialTree.java#L176-L183
3,285
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/tree/MaterialTree.java
MaterialTree.collapseItems
protected void collapseItems(MaterialTreeItem item) { item.collapse(); item.setHide(false); item.getTreeItems().forEach(this::collapseItems); }
java
protected void collapseItems(MaterialTreeItem item) { item.collapse(); item.setHide(false); item.getTreeItems().forEach(this::collapseItems); }
[ "protected", "void", "collapseItems", "(", "MaterialTreeItem", "item", ")", "{", "item", ".", "collapse", "(", ")", ";", "item", ".", "setHide", "(", "false", ")", ";", "item", ".", "getTreeItems", "(", ")", ".", "forEach", "(", "this", "::", "collapseItems", ")", ";", "}" ]
Recursive function to collapse each tree item.
[ "Recursive", "function", "to", "collapse", "each", "tree", "item", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/tree/MaterialTree.java#L188-L193
3,286
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.nextStep
public void nextStep() { if (currentStepIndex >= getWidgetCount() - 1) { CompleteEvent.fire(MaterialStepper.this, currentStepIndex + 1); } else { Widget w = getWidget(currentStepIndex); if (w instanceof MaterialStep) { MaterialStep step = (MaterialStep) w; step.setActive(false); step.setSuccessText(step.getDescription()); // next step int nextStepIndex = getWidgetIndex(step) + 1; if (nextStepIndex >= 0) { for (int i = nextStepIndex; i < getWidgetCount(); i++) { w = getWidget(i); if (!(w instanceof MaterialStep)) { continue; } MaterialStep nextStep = (MaterialStep) w; if (nextStep.isEnabled() && nextStep.isVisible()) { nextStep.setActive(true); setCurrentStepIndex(i); NextEvent.fire(MaterialStepper.this); break; } } } } } }
java
public void nextStep() { if (currentStepIndex >= getWidgetCount() - 1) { CompleteEvent.fire(MaterialStepper.this, currentStepIndex + 1); } else { Widget w = getWidget(currentStepIndex); if (w instanceof MaterialStep) { MaterialStep step = (MaterialStep) w; step.setActive(false); step.setSuccessText(step.getDescription()); // next step int nextStepIndex = getWidgetIndex(step) + 1; if (nextStepIndex >= 0) { for (int i = nextStepIndex; i < getWidgetCount(); i++) { w = getWidget(i); if (!(w instanceof MaterialStep)) { continue; } MaterialStep nextStep = (MaterialStep) w; if (nextStep.isEnabled() && nextStep.isVisible()) { nextStep.setActive(true); setCurrentStepIndex(i); NextEvent.fire(MaterialStepper.this); break; } } } } } }
[ "public", "void", "nextStep", "(", ")", "{", "if", "(", "currentStepIndex", ">=", "getWidgetCount", "(", ")", "-", "1", ")", "{", "CompleteEvent", ".", "fire", "(", "MaterialStepper", ".", "this", ",", "currentStepIndex", "+", "1", ")", ";", "}", "else", "{", "Widget", "w", "=", "getWidget", "(", "currentStepIndex", ")", ";", "if", "(", "w", "instanceof", "MaterialStep", ")", "{", "MaterialStep", "step", "=", "(", "MaterialStep", ")", "w", ";", "step", ".", "setActive", "(", "false", ")", ";", "step", ".", "setSuccessText", "(", "step", ".", "getDescription", "(", ")", ")", ";", "// next step", "int", "nextStepIndex", "=", "getWidgetIndex", "(", "step", ")", "+", "1", ";", "if", "(", "nextStepIndex", ">=", "0", ")", "{", "for", "(", "int", "i", "=", "nextStepIndex", ";", "i", "<", "getWidgetCount", "(", ")", ";", "i", "++", ")", "{", "w", "=", "getWidget", "(", "i", ")", ";", "if", "(", "!", "(", "w", "instanceof", "MaterialStep", ")", ")", "{", "continue", ";", "}", "MaterialStep", "nextStep", "=", "(", "MaterialStep", ")", "w", ";", "if", "(", "nextStep", ".", "isEnabled", "(", ")", "&&", "nextStep", ".", "isVisible", "(", ")", ")", "{", "nextStep", ".", "setActive", "(", "true", ")", ";", "setCurrentStepIndex", "(", "i", ")", ";", "NextEvent", ".", "fire", "(", "MaterialStepper", ".", "this", ")", ";", "break", ";", "}", "}", "}", "}", "}", "}" ]
Go to next step, used by linear stepper.
[ "Go", "to", "next", "step", "used", "by", "linear", "stepper", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L163-L193
3,287
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.prevStep
public void prevStep() { if (currentStepIndex > 0) { Widget w = getWidget(currentStepIndex); if (w instanceof MaterialStep) { MaterialStep step = (MaterialStep) w; step.setActive(false); // prev step int prevStepIndex = getWidgetIndex(step) - 1; if (prevStepIndex >= 0) { for (int i = prevStepIndex; i >= 0; i--) { w = getWidget(i); if (!(w instanceof MaterialStep)) { continue; } MaterialStep prevStep = (MaterialStep) w; if (prevStep.isEnabled() && prevStep.isVisible()) { prevStep.setActive(true); setCurrentStepIndex(i); PreviousEvent.fire(MaterialStepper.this); break; } } } } } else { GWT.log("You have reached the minimum step."); } }
java
public void prevStep() { if (currentStepIndex > 0) { Widget w = getWidget(currentStepIndex); if (w instanceof MaterialStep) { MaterialStep step = (MaterialStep) w; step.setActive(false); // prev step int prevStepIndex = getWidgetIndex(step) - 1; if (prevStepIndex >= 0) { for (int i = prevStepIndex; i >= 0; i--) { w = getWidget(i); if (!(w instanceof MaterialStep)) { continue; } MaterialStep prevStep = (MaterialStep) w; if (prevStep.isEnabled() && prevStep.isVisible()) { prevStep.setActive(true); setCurrentStepIndex(i); PreviousEvent.fire(MaterialStepper.this); break; } } } } } else { GWT.log("You have reached the minimum step."); } }
[ "public", "void", "prevStep", "(", ")", "{", "if", "(", "currentStepIndex", ">", "0", ")", "{", "Widget", "w", "=", "getWidget", "(", "currentStepIndex", ")", ";", "if", "(", "w", "instanceof", "MaterialStep", ")", "{", "MaterialStep", "step", "=", "(", "MaterialStep", ")", "w", ";", "step", ".", "setActive", "(", "false", ")", ";", "// prev step", "int", "prevStepIndex", "=", "getWidgetIndex", "(", "step", ")", "-", "1", ";", "if", "(", "prevStepIndex", ">=", "0", ")", "{", "for", "(", "int", "i", "=", "prevStepIndex", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "w", "=", "getWidget", "(", "i", ")", ";", "if", "(", "!", "(", "w", "instanceof", "MaterialStep", ")", ")", "{", "continue", ";", "}", "MaterialStep", "prevStep", "=", "(", "MaterialStep", ")", "w", ";", "if", "(", "prevStep", ".", "isEnabled", "(", ")", "&&", "prevStep", ".", "isVisible", "(", ")", ")", "{", "prevStep", ".", "setActive", "(", "true", ")", ";", "setCurrentStepIndex", "(", "i", ")", ";", "PreviousEvent", ".", "fire", "(", "MaterialStepper", ".", "this", ")", ";", "break", ";", "}", "}", "}", "}", "}", "else", "{", "GWT", ".", "log", "(", "\"You have reached the minimum step.\"", ")", ";", "}", "}" ]
Go to previous step , used by linear stepper.
[ "Go", "to", "previous", "step", "used", "by", "linear", "stepper", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L198-L226
3,288
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.goToStep
public void goToStep(int step) { for (int i = 0; i < getWidgetCount(); i++) { Widget w = getWidget(i); if (w instanceof MaterialStep) { ((MaterialStep) w).setActive(false); } } Widget w = getWidget(step - 1); if (w instanceof MaterialStep) { ((MaterialStep) w).setActive(true); } setCurrentStepIndex(step - 1); }
java
public void goToStep(int step) { for (int i = 0; i < getWidgetCount(); i++) { Widget w = getWidget(i); if (w instanceof MaterialStep) { ((MaterialStep) w).setActive(false); } } Widget w = getWidget(step - 1); if (w instanceof MaterialStep) { ((MaterialStep) w).setActive(true); } setCurrentStepIndex(step - 1); }
[ "public", "void", "goToStep", "(", "int", "step", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getWidgetCount", "(", ")", ";", "i", "++", ")", "{", "Widget", "w", "=", "getWidget", "(", "i", ")", ";", "if", "(", "w", "instanceof", "MaterialStep", ")", "{", "(", "(", "MaterialStep", ")", "w", ")", ".", "setActive", "(", "false", ")", ";", "}", "}", "Widget", "w", "=", "getWidget", "(", "step", "-", "1", ")", ";", "if", "(", "w", "instanceof", "MaterialStep", ")", "{", "(", "(", "MaterialStep", ")", "w", ")", ".", "setActive", "(", "true", ")", ";", "}", "setCurrentStepIndex", "(", "step", "-", "1", ")", ";", "}" ]
Go to specific step manually by setting which step index you want to go.
[ "Go", "to", "specific", "step", "manually", "by", "setting", "which", "step", "index", "you", "want", "to", "go", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L231-L244
3,289
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.goToStepId
public void goToStepId(int id) { for (int i = 0; i < getWidgetCount(); i++) { Widget w = getWidget(i); if (w instanceof MaterialStep) { MaterialStep materialStep = (MaterialStep) w; boolean active = materialStep.getStep() == id; materialStep.setActive(active); if (active) { setCurrentStepIndex(i); } } } }
java
public void goToStepId(int id) { for (int i = 0; i < getWidgetCount(); i++) { Widget w = getWidget(i); if (w instanceof MaterialStep) { MaterialStep materialStep = (MaterialStep) w; boolean active = materialStep.getStep() == id; materialStep.setActive(active); if (active) { setCurrentStepIndex(i); } } } }
[ "public", "void", "goToStepId", "(", "int", "id", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "getWidgetCount", "(", ")", ";", "i", "++", ")", "{", "Widget", "w", "=", "getWidget", "(", "i", ")", ";", "if", "(", "w", "instanceof", "MaterialStep", ")", "{", "MaterialStep", "materialStep", "=", "(", "MaterialStep", ")", "w", ";", "boolean", "active", "=", "materialStep", ".", "getStep", "(", ")", "==", "id", ";", "materialStep", ".", "setActive", "(", "active", ")", ";", "if", "(", "active", ")", "{", "setCurrentStepIndex", "(", "i", ")", ";", "}", "}", "}", "}" ]
Go to the step with the specified step id. @see MaterialStep#getStep()
[ "Go", "to", "the", "step", "with", "the", "specified", "step", "id", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L268-L280
3,290
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.getCurrentStep
public MaterialStep getCurrentStep() { if (currentStepIndex > getWidgetCount() - 1 || currentStepIndex < 0) { return null; } Widget w = getWidget(currentStepIndex); if (w instanceof MaterialStep) { return (MaterialStep) w; } return null; }
java
public MaterialStep getCurrentStep() { if (currentStepIndex > getWidgetCount() - 1 || currentStepIndex < 0) { return null; } Widget w = getWidget(currentStepIndex); if (w instanceof MaterialStep) { return (MaterialStep) w; } return null; }
[ "public", "MaterialStep", "getCurrentStep", "(", ")", "{", "if", "(", "currentStepIndex", ">", "getWidgetCount", "(", ")", "-", "1", "||", "currentStepIndex", "<", "0", ")", "{", "return", "null", ";", "}", "Widget", "w", "=", "getWidget", "(", "currentStepIndex", ")", ";", "if", "(", "w", "instanceof", "MaterialStep", ")", "{", "return", "(", "MaterialStep", ")", "w", ";", "}", "return", "null", ";", "}" ]
Gets the current step component.
[ "Gets", "the", "current", "step", "component", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L325-L334
3,291
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.showFeedback
public void showFeedback(String feedbackText) { feedbackSpan.setText(feedbackText); new MaterialAnimation().transition(Transition.FADEINUP).duration(400).animate(feedbackSpan); MaterialLoader.loading(true, getCurrentStep().getDivBody()); add(divFeedback); }
java
public void showFeedback(String feedbackText) { feedbackSpan.setText(feedbackText); new MaterialAnimation().transition(Transition.FADEINUP).duration(400).animate(feedbackSpan); MaterialLoader.loading(true, getCurrentStep().getDivBody()); add(divFeedback); }
[ "public", "void", "showFeedback", "(", "String", "feedbackText", ")", "{", "feedbackSpan", ".", "setText", "(", "feedbackText", ")", ";", "new", "MaterialAnimation", "(", ")", ".", "transition", "(", "Transition", ".", "FADEINUP", ")", ".", "duration", "(", "400", ")", ".", "animate", "(", "feedbackSpan", ")", ";", "MaterialLoader", ".", "loading", "(", "true", ",", "getCurrentStep", "(", ")", ".", "getDivBody", "(", ")", ")", ";", "add", "(", "divFeedback", ")", ";", "}" ]
Show feedback message and circular loader on body container
[ "Show", "feedback", "message", "and", "circular", "loader", "on", "body", "container" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L413-L418
3,292
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java
MaterialStepper.onSelection
@Override public void onSelection(SelectionEvent<MaterialStep> event) { if (stepSkippingAllowed) { if (event.getSelectedItem().getState() == State.SUCCESS) { goToStep(event.getSelectedItem()); } } }
java
@Override public void onSelection(SelectionEvent<MaterialStep> event) { if (stepSkippingAllowed) { if (event.getSelectedItem().getState() == State.SUCCESS) { goToStep(event.getSelectedItem()); } } }
[ "@", "Override", "public", "void", "onSelection", "(", "SelectionEvent", "<", "MaterialStep", ">", "event", ")", "{", "if", "(", "stepSkippingAllowed", ")", "{", "if", "(", "event", ".", "getSelectedItem", "(", ")", ".", "getState", "(", ")", "==", "State", ".", "SUCCESS", ")", "{", "goToStep", "(", "event", ".", "getSelectedItem", "(", ")", ")", ";", "}", "}", "}" ]
Called when a step title is clicked.
[ "Called", "when", "a", "step", "title", "is", "clicked", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/stepper/MaterialStepper.java#L450-L457
3,293
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java
MaterialCutOut.open
public void open() { setCutOutStyle(); if (targetElement == null) { throw new IllegalStateException("The target element should be set before calling open()."); } targetElement.scrollIntoView(); if (computedBackgroundColor == null) { setupComputedBackgroundColor(); } //temporarily disables scrolling by setting the overflow of the page to hidden Style docStyle = Document.get().getDocumentElement().getStyle(); viewportOverflow = docStyle.getOverflow(); docStyle.setProperty("overflow", "hidden"); if (backgroundSize == null) { backgroundSize = body().width() + 300 + "px"; } setupTransition(); if (animated) { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px 0rem " + computedBackgroundColor); //the animation will take place after the boxshadow is set by the deferred command Scheduler.get().scheduleDeferred(() -> { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); }); } else { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); } if (circle) { focusElement.getStyle().setProperty("WebkitBorderRadius", "50%"); focusElement.getStyle().setProperty("borderRadius", "50%"); // Temporary fixed for the IOS Issue on recalculation of the border radius focusElement.getStyle().setProperty("webkitBorderTopLeftRadius", "49.9%"); focusElement.getStyle().setProperty("borderTopLeftRadius", "49.9%"); } else { focusElement.getStyle().clearProperty("WebkitBorderRadius"); focusElement.getStyle().clearProperty("borderRadius"); focusElement.getStyle().clearProperty("webkitBorderTopLeftRadius"); focusElement.getStyle().clearProperty("borderTopLeftRadius"); } setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle); setupWindowHandlers(); getElement().getStyle().clearDisplay(); // verify if the component is added to the document (via UiBinder for // instance) if (getParent() == null) { autoAddedToDocument = true; RootPanel.get().add(this); } OpenEvent.fire(this, this); }
java
public void open() { setCutOutStyle(); if (targetElement == null) { throw new IllegalStateException("The target element should be set before calling open()."); } targetElement.scrollIntoView(); if (computedBackgroundColor == null) { setupComputedBackgroundColor(); } //temporarily disables scrolling by setting the overflow of the page to hidden Style docStyle = Document.get().getDocumentElement().getStyle(); viewportOverflow = docStyle.getOverflow(); docStyle.setProperty("overflow", "hidden"); if (backgroundSize == null) { backgroundSize = body().width() + 300 + "px"; } setupTransition(); if (animated) { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px 0rem " + computedBackgroundColor); //the animation will take place after the boxshadow is set by the deferred command Scheduler.get().scheduleDeferred(() -> { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); }); } else { focusElement.getStyle().setProperty("boxShadow", "0px 0px 0px " + backgroundSize + " " + computedBackgroundColor); } if (circle) { focusElement.getStyle().setProperty("WebkitBorderRadius", "50%"); focusElement.getStyle().setProperty("borderRadius", "50%"); // Temporary fixed for the IOS Issue on recalculation of the border radius focusElement.getStyle().setProperty("webkitBorderTopLeftRadius", "49.9%"); focusElement.getStyle().setProperty("borderTopLeftRadius", "49.9%"); } else { focusElement.getStyle().clearProperty("WebkitBorderRadius"); focusElement.getStyle().clearProperty("borderRadius"); focusElement.getStyle().clearProperty("webkitBorderTopLeftRadius"); focusElement.getStyle().clearProperty("borderTopLeftRadius"); } setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle); setupWindowHandlers(); getElement().getStyle().clearDisplay(); // verify if the component is added to the document (via UiBinder for // instance) if (getParent() == null) { autoAddedToDocument = true; RootPanel.get().add(this); } OpenEvent.fire(this, this); }
[ "public", "void", "open", "(", ")", "{", "setCutOutStyle", "(", ")", ";", "if", "(", "targetElement", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"The target element should be set before calling open().\"", ")", ";", "}", "targetElement", ".", "scrollIntoView", "(", ")", ";", "if", "(", "computedBackgroundColor", "==", "null", ")", "{", "setupComputedBackgroundColor", "(", ")", ";", "}", "//temporarily disables scrolling by setting the overflow of the page to hidden", "Style", "docStyle", "=", "Document", ".", "get", "(", ")", ".", "getDocumentElement", "(", ")", ".", "getStyle", "(", ")", ";", "viewportOverflow", "=", "docStyle", ".", "getOverflow", "(", ")", ";", "docStyle", ".", "setProperty", "(", "\"overflow\"", ",", "\"hidden\"", ")", ";", "if", "(", "backgroundSize", "==", "null", ")", "{", "backgroundSize", "=", "body", "(", ")", ".", "width", "(", ")", "+", "300", "+", "\"px\"", ";", "}", "setupTransition", "(", ")", ";", "if", "(", "animated", ")", "{", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"boxShadow\"", ",", "\"0px 0px 0px 0rem \"", "+", "computedBackgroundColor", ")", ";", "//the animation will take place after the boxshadow is set by the deferred command", "Scheduler", ".", "get", "(", ")", ".", "scheduleDeferred", "(", "(", ")", "->", "{", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"boxShadow\"", ",", "\"0px 0px 0px \"", "+", "backgroundSize", "+", "\" \"", "+", "computedBackgroundColor", ")", ";", "}", ")", ";", "}", "else", "{", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"boxShadow\"", ",", "\"0px 0px 0px \"", "+", "backgroundSize", "+", "\" \"", "+", "computedBackgroundColor", ")", ";", "}", "if", "(", "circle", ")", "{", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"WebkitBorderRadius\"", ",", "\"50%\"", ")", ";", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"borderRadius\"", ",", "\"50%\"", ")", ";", "// Temporary fixed for the IOS Issue on recalculation of the border radius", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"webkitBorderTopLeftRadius\"", ",", "\"49.9%\"", ")", ";", "focusElement", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"borderTopLeftRadius\"", ",", "\"49.9%\"", ")", ";", "}", "else", "{", "focusElement", ".", "getStyle", "(", ")", ".", "clearProperty", "(", "\"WebkitBorderRadius\"", ")", ";", "focusElement", ".", "getStyle", "(", ")", ".", "clearProperty", "(", "\"borderRadius\"", ")", ";", "focusElement", ".", "getStyle", "(", ")", ".", "clearProperty", "(", "\"webkitBorderTopLeftRadius\"", ")", ";", "focusElement", ".", "getStyle", "(", ")", ".", "clearProperty", "(", "\"borderTopLeftRadius\"", ")", ";", "}", "setupCutOutPosition", "(", "focusElement", ",", "targetElement", ",", "cutOutPadding", ",", "circle", ")", ";", "setupWindowHandlers", "(", ")", ";", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "clearDisplay", "(", ")", ";", "// verify if the component is added to the document (via UiBinder for", "// instance)", "if", "(", "getParent", "(", ")", "==", "null", ")", "{", "autoAddedToDocument", "=", "true", ";", "RootPanel", ".", "get", "(", ")", ".", "add", "(", "this", ")", ";", "}", "OpenEvent", ".", "fire", "(", "this", ",", "this", ")", ";", "}" ]
Opens the dialog cut out taking all the screen. The target element should be set before calling this method. @throws IllegalStateException if the target element is <code>null</code> @see #setTarget(Widget)
[ "Opens", "the", "dialog", "cut", "out", "taking", "all", "the", "screen", ".", "The", "target", "element", "should", "be", "set", "before", "calling", "this", "method", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java#L130-L187
3,294
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java
MaterialCutOut.close
public void close(boolean autoClosed) { //restore the old overflow of the page Document.get().getDocumentElement().getStyle().setProperty("overflow", viewportOverflow); getElement().getStyle().setDisplay(Display.NONE); getHandlerRegistry().clearHandlers(); // if the component added himself to the document, it must remove // himself too if (autoAddedToDocument) { this.removeFromParent(); autoAddedToDocument = false; } CloseEvent.fire(this, this, autoClosed); }
java
public void close(boolean autoClosed) { //restore the old overflow of the page Document.get().getDocumentElement().getStyle().setProperty("overflow", viewportOverflow); getElement().getStyle().setDisplay(Display.NONE); getHandlerRegistry().clearHandlers(); // if the component added himself to the document, it must remove // himself too if (autoAddedToDocument) { this.removeFromParent(); autoAddedToDocument = false; } CloseEvent.fire(this, this, autoClosed); }
[ "public", "void", "close", "(", "boolean", "autoClosed", ")", "{", "//restore the old overflow of the page", "Document", ".", "get", "(", ")", ".", "getDocumentElement", "(", ")", ".", "getStyle", "(", ")", ".", "setProperty", "(", "\"overflow\"", ",", "viewportOverflow", ")", ";", "getElement", "(", ")", ".", "getStyle", "(", ")", ".", "setDisplay", "(", "Display", ".", "NONE", ")", ";", "getHandlerRegistry", "(", ")", ".", "clearHandlers", "(", ")", ";", "// if the component added himself to the document, it must remove", "// himself too", "if", "(", "autoAddedToDocument", ")", "{", "this", ".", "removeFromParent", "(", ")", ";", "autoAddedToDocument", "=", "false", ";", "}", "CloseEvent", ".", "fire", "(", "this", ",", "this", ",", "autoClosed", ")", ";", "}" ]
Closes the cut out. @param autoClosed Notifies with the dialog was auto closed or closed by user action
[ "Closes", "the", "cut", "out", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java#L218-L233
3,295
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java
MaterialCutOut.setupWindowHandlers
protected void setupWindowHandlers() { registerHandler(Window.addResizeHandler(event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle))); registerHandler(Window.addWindowScrollHandler(event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle))); }
java
protected void setupWindowHandlers() { registerHandler(Window.addResizeHandler(event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle))); registerHandler(Window.addWindowScrollHandler(event -> setupCutOutPosition(focusElement, targetElement, cutOutPadding, circle))); }
[ "protected", "void", "setupWindowHandlers", "(", ")", "{", "registerHandler", "(", "Window", ".", "addResizeHandler", "(", "event", "->", "setupCutOutPosition", "(", "focusElement", ",", "targetElement", ",", "cutOutPadding", ",", "circle", ")", ")", ")", ";", "registerHandler", "(", "Window", ".", "addWindowScrollHandler", "(", "event", "->", "setupCutOutPosition", "(", "focusElement", ",", "targetElement", ",", "cutOutPadding", ",", "circle", ")", ")", ")", ";", "}" ]
Configures a resize handler and a scroll handler on the window to properly adjust the Cut Out.
[ "Configures", "a", "resize", "handler", "and", "a", "scroll", "handler", "on", "the", "window", "to", "properly", "adjust", "the", "Cut", "Out", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java#L407-L411
3,296
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java
MaterialCutOut.setupComputedBackgroundColor
protected void setupComputedBackgroundColor() { // temp is just a widget created to evaluate the computed background // color MaterialWidget temp = new MaterialWidget(Document.get().createDivElement()); temp.setBackgroundColor(backgroundColor); // setting a style to make it invisible for the user Style style = temp.getElement().getStyle(); style.setPosition(Position.FIXED); style.setWidth(1, Unit.PX); style.setHeight(1, Unit.PX); style.setLeft(-10, Unit.PX); style.setTop(-10, Unit.PX); style.setZIndex(-10000); // adding it to the body (on Chrome the component must be added to the // DOM before getting computed values). String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor); // convert rgb to rgba, considering the opacity field if (opacity < 1 && computed.startsWith("rgb(")) { computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")"); } computedBackgroundColor = computed; }
java
protected void setupComputedBackgroundColor() { // temp is just a widget created to evaluate the computed background // color MaterialWidget temp = new MaterialWidget(Document.get().createDivElement()); temp.setBackgroundColor(backgroundColor); // setting a style to make it invisible for the user Style style = temp.getElement().getStyle(); style.setPosition(Position.FIXED); style.setWidth(1, Unit.PX); style.setHeight(1, Unit.PX); style.setLeft(-10, Unit.PX); style.setTop(-10, Unit.PX); style.setZIndex(-10000); // adding it to the body (on Chrome the component must be added to the // DOM before getting computed values). String computed = ColorHelper.setupComputedBackgroundColor(backgroundColor); // convert rgb to rgba, considering the opacity field if (opacity < 1 && computed.startsWith("rgb(")) { computed = computed.replace("rgb(", "rgba(").replace(")", ", " + opacity + ")"); } computedBackgroundColor = computed; }
[ "protected", "void", "setupComputedBackgroundColor", "(", ")", "{", "// temp is just a widget created to evaluate the computed background", "// color", "MaterialWidget", "temp", "=", "new", "MaterialWidget", "(", "Document", ".", "get", "(", ")", ".", "createDivElement", "(", ")", ")", ";", "temp", ".", "setBackgroundColor", "(", "backgroundColor", ")", ";", "// setting a style to make it invisible for the user", "Style", "style", "=", "temp", ".", "getElement", "(", ")", ".", "getStyle", "(", ")", ";", "style", ".", "setPosition", "(", "Position", ".", "FIXED", ")", ";", "style", ".", "setWidth", "(", "1", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setHeight", "(", "1", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setLeft", "(", "-", "10", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setTop", "(", "-", "10", ",", "Unit", ".", "PX", ")", ";", "style", ".", "setZIndex", "(", "-", "10000", ")", ";", "// adding it to the body (on Chrome the component must be added to the", "// DOM before getting computed values).", "String", "computed", "=", "ColorHelper", ".", "setupComputedBackgroundColor", "(", "backgroundColor", ")", ";", "// convert rgb to rgba, considering the opacity field", "if", "(", "opacity", "<", "1", "&&", "computed", ".", "startsWith", "(", "\"rgb(\"", ")", ")", "{", "computed", "=", "computed", ".", "replace", "(", "\"rgb(\"", ",", "\"rgba(\"", ")", ".", "replace", "(", "\")\"", ",", "\", \"", "+", "opacity", "+", "\")\"", ")", ";", "}", "computedBackgroundColor", "=", "computed", ";", "}" ]
Gets the computed background color, based on the backgroundColor CSS class.
[ "Gets", "the", "computed", "background", "color", "based", "on", "the", "backgroundColor", "CSS", "class", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/cutout/MaterialCutOut.java#L427-L452
3,297
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/incubator/client/language/LanguageSelectorItem.java
LanguageSelectorItem.setLanguage
public void setLanguage(Language language) { this.language = language; this.label.setText(language.getName()); this.image.setUrl(language.getImage()); }
java
public void setLanguage(Language language) { this.language = language; this.label.setText(language.getName()); this.image.setUrl(language.getImage()); }
[ "public", "void", "setLanguage", "(", "Language", "language", ")", "{", "this", ".", "language", "=", "language", ";", "this", ".", "label", ".", "setText", "(", "language", ".", "getName", "(", ")", ")", ";", "this", ".", "image", ".", "setUrl", "(", "language", ".", "getImage", "(", ")", ")", ";", "}" ]
Update the ui for the name and image components.
[ "Update", "the", "ui", "for", "the", "name", "and", "image", "components", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/incubator/client/language/LanguageSelectorItem.java#L90-L94
3,298
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java
MaterialFileUploader.convertUploadFile
protected UploadFile convertUploadFile(File file) { Date lastModifiedDate = new Date(); // Avoid parsing error on last modified date if (file.lastModifiedDate != null && !file.lastModifiedDate.isEmpty()) { lastModifiedDate = new Date(file.lastModifiedDate); } return new UploadFile(file.name, lastModifiedDate, Double.parseDouble(file.size), file.type); }
java
protected UploadFile convertUploadFile(File file) { Date lastModifiedDate = new Date(); // Avoid parsing error on last modified date if (file.lastModifiedDate != null && !file.lastModifiedDate.isEmpty()) { lastModifiedDate = new Date(file.lastModifiedDate); } return new UploadFile(file.name, lastModifiedDate, Double.parseDouble(file.size), file.type); }
[ "protected", "UploadFile", "convertUploadFile", "(", "File", "file", ")", "{", "Date", "lastModifiedDate", "=", "new", "Date", "(", ")", ";", "// Avoid parsing error on last modified date", "if", "(", "file", ".", "lastModifiedDate", "!=", "null", "&&", "!", "file", ".", "lastModifiedDate", ".", "isEmpty", "(", ")", ")", "{", "lastModifiedDate", "=", "new", "Date", "(", "file", ".", "lastModifiedDate", ")", ";", "}", "return", "new", "UploadFile", "(", "file", ".", "name", ",", "lastModifiedDate", ",", "Double", ".", "parseDouble", "(", "file", ".", "size", ")", ",", "file", ".", "type", ")", ";", "}" ]
Converts a Native File Object to Upload File object
[ "Converts", "a", "Native", "File", "Object", "to", "Upload", "File", "object" ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/fileuploader/MaterialFileUploader.java#L368-L375
3,299
GwtMaterialDesign/gwt-material-addins
src/main/java/gwt/material/design/addins/client/splitpanel/MaterialSplitPanel.java
MaterialSplitPanel.getThickness
public double getThickness() { return options.thickness != null ? Double.parseDouble(options.thickness.replace("px", "")) : null; }
java
public double getThickness() { return options.thickness != null ? Double.parseDouble(options.thickness.replace("px", "")) : null; }
[ "public", "double", "getThickness", "(", ")", "{", "return", "options", ".", "thickness", "!=", "null", "?", "Double", ".", "parseDouble", "(", "options", ".", "thickness", ".", "replace", "(", "\"px\"", ",", "\"\"", ")", ")", ":", "null", ";", "}" ]
Get the bar's thickness in px.
[ "Get", "the", "bar", "s", "thickness", "in", "px", "." ]
11aec9d92918225f70f936285d0ae94f2178c36e
https://github.com/GwtMaterialDesign/gwt-material-addins/blob/11aec9d92918225f70f936285d0ae94f2178c36e/src/main/java/gwt/material/design/addins/client/splitpanel/MaterialSplitPanel.java#L158-L160