20 package net.sf.gridarta.model.collectable;
22 import java.io.BufferedWriter;
24 import java.io.FileOutputStream;
25 import java.io.IOException;
26 import java.io.OutputStreamWriter;
27 import java.io.Writer;
33 import net.
sf.japi.swing.action.ActionBuilder;
34 import net.
sf.japi.swing.action.ActionBuilderFactory;
35 import net.
sf.japi.swing.misc.Progress;
36 import org.jetbrains.annotations.NotNull;
50 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
80 public void collect(@NotNull
final Progress progress, @NotNull
final File collectedDirectory)
throws IOException {
91 private void collectAnimations(@NotNull
final Progress progress, @NotNull
final File collectedDirectory)
throws IOException {
93 try (Writer animations =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(
new File(collectedDirectory,
"animations")),
IOUtils.
MAP_ENCODING))) {
96 animations.append(
"anim ").append(anim.getAnimName()).append(
'\n').append(anim.getAnimList()).append(
"mina\n");
97 if (counter++ % 128 == 0) {
98 progress.setValue(counter);
102 progress.setValue(animationObjects.
size());
111 private void collectAnimTree(@NotNull
final Progress progress, @NotNull
final File collectedDirectory)
throws IOException {
113 try (Writer animtree =
new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(
new File(collectedDirectory, animTreeFile)),
IOUtils.
MAP_ENCODING))) {
116 animtree.append(anim.getPath()).append(
'\n');
117 if (counter++ % 128 == 0) {
118 progress.setValue(counter);
122 progress.setValue(animationObjects.
size());
final AnimationObjects animationObjects
The AnimationObjects being collected.
The data package contains classes for handling data that is organized in a tree.
void collectAnimTree(@NotNull final Progress progress, @NotNull final File collectedDirectory)
Collects the animation data into the file "animations".
static final String MAP_ENCODING
Encoding to use for maps and other data.
int size()
Get the number of objects.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
void collectAnimations(@NotNull final Progress progress, @NotNull final File collectedDirectory)
Collects the animation data into the file "animations".
A Collectable has information that can be collected.
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Base package of all Gridarta classes.
Utility-class for Gridarta's I/O.
AnimationObjects is a container for AnimationObjects.
static final ActionBuilder ACTION_BUILDER
The ActionBuilder instance.
void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory)
Collects information.the progress to report progress to the destination directory to collect data to ...
final String animTreeFile
The collected animation tree file.
An AnimationObject reflects the animation ("@code anim\n @endcode " ...
Utility class for ActionBuilder related functions.
a Collectable that creates the "animations" file.
AnimationObjectsCollectable(@NotNull final AnimationObjects animationObjects, @NotNull final String animTreeFile)
Creates a new instance.