This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Controls { | |
type CloseableResource = { def close() } | |
/** | |
* Equivalent of C# using keyword. Automatically closes any resource which has a close method. | |
* Capable of returning a value | |
* @param T resource which has a close() method | |
* @param M result | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class TableColumnDefinitionSupport { | |
public interface ITableColumDefinition { | |
String getTitle(); | |
} | |
private TableColumnDefinitionSupport() {} | |
public final static > getDefinition( Class cls, int index ) { | |
return cls.getEnumConstants()[index]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ComponentClassScanner extends ClassPathScanningCandidateComponentProvider { | |
public ComponentClassScanner() { | |
super(false); | |
} | |
@SuppressWarnings("unchecked") | |
public final Collection getComponentClasses(String basePackage) { | |
basePackage = basePackage == null ? "" : basePackage; | |
List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PreferencePageClassScanner extends ComponentClassScanner { | |
public PreferencePageClassScanner() { | |
super(); | |
addIncludeFilter( new AssignableTypeFilter(JComponent.class)); | |
addIncludeFilter( new AnnotationTypeFilter(PreferencePage.class)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class TableEnumColumnSupport { | |
public interface ITableColumDefinition { | |
String getTitle(); | |
} | |
private TableEnumColumnSupport() {} | |
/** | |
* Finds column definition by index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
boolean validationResult = ...// your business logic here | |
TaskDialog dlg = TaskDialog.getInstance(this); //find the task dialog panel belongs to | |
dlg.fireValidationFinished( validationResult ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TaskDialogs.warn( "Are you sure you want to quit?@@10", "Please do not quit yet!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int choice = TaskDialogs.choice( | |
"What do you want to do with your game in\nprogress?", | |
"", | |
1, | |
new CommandLink("Exit and save my game", "Save your game in progress, then exit. " + | |
"This will\noverwrite any previosely saved games."), | |
new CommandLink("Exit and don't save", "Exit without saving your game. " + | |
"This is counted\nas a loss in your statistics." ), | |
new CommandLink("Don't exit", "Return to your game progress" )); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TaskDialog dlg = new TaskDialog("Security Warning"); | |
dlg.setInstruction( "The publisher cannot be verified.\nDo you want to run this software?" ); | |
dlg.setText( "Name: C:\\Program Files\\eclipse\\eclipse.exe\n" + | |
"Publisher: <b>Unknown Publisher</b>\n" + | |
"Type: Application\n"); | |
dlg.setIcon( TaskDialog.StandardIcon.WARNING ); | |
dlg.getFooter().setCheckBoxText("Always ask before opening this file"); | |
dlg.setCommands( StandardCommand.OK.derive("Run"), StandardCommand.CANCEL ); | |
if ( dlg.show().equals(StandardCommand.OK)) { | |
//do something |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TaskDialog dlg = new TaskDialog("Copying..."); | |
dlg.setInstruction("Copying file"); | |
dlg.setText( "Location: From 'Others' to 'Others'\n" + | |
"File Name: <b>Photo.jpg</b>" ); | |
dlg.setIcon( TaskDialog.StandardIcon.INFO ); | |
JProgressBar pb = new JProgressBar(); | |
pb.setValue(30); | |
dlg.setFixedComponent( pb ); | |
dlg.show(); |
OlderNewer