org.kie.uberfire.apps.client.home.AppsHomePresenter Maven / Gradle / Ivy
package org.kie.uberfire.apps.client.home;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import com.google.gwt.user.client.Window;
import org.jboss.errai.common.client.api.Caller;
import org.jboss.errai.common.client.api.ErrorCallback;
import org.jboss.errai.common.client.api.RemoteCallback;
import org.kie.uberfire.apps.api.AppsPersistenceAPI;
import org.kie.uberfire.apps.api.Directory;
import org.kie.uberfire.apps.api.DirectoryBreadCrumb;
import org.uberfire.client.annotations.WorkbenchPartTitle;
import org.uberfire.client.annotations.WorkbenchPartView;
import org.uberfire.client.annotations.WorkbenchScreen;
import org.uberfire.client.mvp.PlaceManager;
import org.uberfire.client.mvp.UberView;
import org.uberfire.lifecycle.OnOpen;
import org.uberfire.mvp.ParameterizedCommand;
@ApplicationScoped
@WorkbenchScreen(identifier = "AppsHomePresenter")
public class AppsHomePresenter {
public interface View extends UberView {
void setupBreadCrumbs( List breadcrumbs,
ParameterizedCommand breadCrumbAction );
void setupAddDir( ParameterizedCommand clickCommand );
void setupChildsDirectories( List childsDirectories,
ParameterizedCommand clickCommand, ParameterizedCommand deleteCommand );
void clear();
void setupChildComponents( List childComponents,
ParameterizedCommand stringParameterizedCommand );
}
@Inject
private View view;
@Inject
private PlaceManager placeManager;
@Inject
private Caller appService;
private Directory currentDirectory;
private Directory root;
@PostConstruct
public void init() {
}
@OnOpen
public void loadContent() {
view.clear();
appService.call( new RemoteCallback() {
public void callback( Directory root_ ) {
root = root_;
currentDirectory = root_;
setupView();
}
}, new ErrorCallback