Skip to content

Commit

Permalink
SWITCHYARD-1152 update as7 console to 1.4.0.Final
Browse files Browse the repository at this point in the history
  • Loading branch information
rcernich committed Dec 13, 2012
1 parent 0a7550a commit 449331f
Show file tree
Hide file tree
Showing 13 changed files with 218 additions and 177 deletions.
6 changes: 6 additions & 0 deletions app/pom.xml
Expand Up @@ -49,6 +49,12 @@
<classifier>module</classifier> <classifier>module</classifier>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>console-spi</artifactId>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
Expand Down
Expand Up @@ -19,7 +19,6 @@


<module rename-to="app"> <module rename-to="app">


<inherits name="org.jboss.as.console.App" />
<inherits name="org.switchyard.console.SwitchYard" /> <inherits name="org.switchyard.console.SwitchYard" />


<set-configuration-property name="gin.ginjector" <set-configuration-property name="gin.ginjector"
Expand Down
Expand Up @@ -18,7 +18,7 @@
*/ */
package org.switchyard.console.application.client; package org.switchyard.console.application.client;


import org.jboss.as.console.client.core.gin.CoreUI; import org.jboss.as.console.client.core.gin.Composite;
import org.switchyard.console.client.gin.SwitchYardGinjector; import org.switchyard.console.client.gin.SwitchYardGinjector;


/** /**
Expand All @@ -29,6 +29,6 @@
* *
* @author Rob Cernich * @author Rob Cernich
*/ */
public interface AggregatedConsoleGinjector extends CoreUI, SwitchYardGinjector { public interface AggregatedConsoleGinjector extends Composite, SwitchYardGinjector {


} }
Expand Up @@ -18,7 +18,7 @@
*/ */
package org.switchyard.console.application.client; package org.switchyard.console.application.client;


import org.jboss.as.console.client.core.gin.CoreUI; import org.jboss.as.console.client.core.gin.Composite;
import org.jboss.as.console.client.core.gin.GinjectorSingleton; import org.jboss.as.console.client.core.gin.GinjectorSingleton;


import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
Expand All @@ -32,10 +32,10 @@
*/ */
public class AggregatedConsoleSingleton implements GinjectorSingleton { public class AggregatedConsoleSingleton implements GinjectorSingleton {


private static final CoreUI INSTANCE = GWT.create(AggregatedConsoleGinjector.class); private static final Composite INSTANCE = GWT.create(AggregatedConsoleGinjector.class);


@Override @Override
public CoreUI getCoreUI() { public Composite getCoreUI() {
return INSTANCE; return INSTANCE;
} }


Expand Down
6 changes: 5 additions & 1 deletion as7-core/pom.xml
Expand Up @@ -36,6 +36,10 @@
<asConsoleIncludesDirectory>${project.build.directory}/dependency/as-console</asConsoleIncludesDirectory> <asConsoleIncludesDirectory>${project.build.directory}/dependency/as-console</asConsoleIncludesDirectory>
</properties> </properties>
<dependencies> <dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>console-spi</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.jboss.ballroom</groupId> <groupId>org.jboss.ballroom</groupId>
<artifactId>widgets</artifactId> <artifactId>widgets</artifactId>
Expand Down Expand Up @@ -101,7 +105,7 @@
<version>${version.jbossas.console}</version> <version>${version.jbossas.console}</version>
<classifier>sources</classifier> <classifier>sources</classifier>
<type>jar</type> <type>jar</type>
<excludes>org/jboss/as/console/client/Console.java,org/jboss/as/console/client/shared/SubsystemMetaData.java,org/jboss/as/console/client/domain/runtime/DomainRuntimeNavigation.java,org/jboss/as/console/client/standalone/runtime/StandaloneRuntimeNavigation.java,org/jboss/dmr/client/DataInput.java,org/jboss/dmr/client/IEEE754.java,org/jboss/as/console/client/shared/runtime/plain/PlainColumnView.java,META-INF/*.SF,META-INF/*.RSA,META-INF/*.DSA</excludes> <excludes>org/jboss/as/console/client/Console.java,org/jboss/as/console/client/shared/SubsystemMetaData.java,org/jboss/as/console/client/domain/runtime/DomainRuntimeNavigation.java,org/jboss/as/console/client/standalone/runtime/StandaloneRuntimeNavigation.java,org/jboss/dmr/client/DataInput.java,org/jboss/dmr/client/IEEE754.java,org/jboss/as/console/client/shared/runtime/plain/PlainColumnView.java,META-INF/*.SF,META-INF/*.RSA,META-INF/*.DSA,apt/**</excludes>
<outputDirectory>${asConsoleIncludesDirectory}/java</outputDirectory> <outputDirectory>${asConsoleIncludesDirectory}/java</outputDirectory>
</artifactItem> </artifactItem>
</artifactItems> </artifactItems>
Expand Down
116 changes: 59 additions & 57 deletions as7-core/src/main/java/org/jboss/as/console/client/Console.java
Expand Up @@ -24,14 +24,16 @@
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.Command; import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.user.client.ui.RootLayoutPanel;
import com.google.gwt.user.client.ui.Widget; import com.google.gwt.user.client.ui.Widget;
import com.gwtplatform.mvp.client.DelayedBindRegistry; import com.gwtplatform.mvp.client.DelayedBindRegistry;
import com.gwtplatform.mvp.client.proxy.PlaceManager;
import org.jboss.as.console.client.core.BootstrapContext;
import org.jboss.as.console.client.core.LoadingPanel; import org.jboss.as.console.client.core.LoadingPanel;
import org.jboss.as.console.client.core.UIConstants; import org.jboss.as.console.client.core.UIConstants;
import org.jboss.as.console.client.core.UIDebugConstants; import org.jboss.as.console.client.core.UIDebugConstants;
Expand All @@ -41,13 +43,16 @@
import org.jboss.as.console.client.core.bootstrap.EagerLoadProfiles; import org.jboss.as.console.client.core.bootstrap.EagerLoadProfiles;
import org.jboss.as.console.client.core.bootstrap.ExecutionMode; import org.jboss.as.console.client.core.bootstrap.ExecutionMode;
import org.jboss.as.console.client.core.bootstrap.LoadMainApp; import org.jboss.as.console.client.core.bootstrap.LoadMainApp;
import org.jboss.as.console.client.core.bootstrap.RegisterSubsystems;
import org.jboss.as.console.client.core.bootstrap.RemoveLoadingPanel; import org.jboss.as.console.client.core.bootstrap.RemoveLoadingPanel;
import org.jboss.as.console.client.core.gin.CoreUI; import org.jboss.as.console.client.core.gin.Composite;
import org.jboss.as.console.client.core.gin.GinjectorSingleton; import org.jboss.as.console.client.core.gin.GinjectorSingleton;
import org.jboss.as.console.client.core.message.Message; import org.jboss.as.console.client.core.message.Message;
import org.jboss.as.console.client.core.message.MessageCenter;
import org.jboss.as.console.client.plugins.SubsystemRegistry;
import org.jboss.as.console.client.shared.help.HelpSystem;


import java.util.EnumSet; import java.util.EnumSet;

/** /**
* Main application entry point. * Main application entry point.
* Executes a two phased init process: * Executes a two phased init process:
Expand All @@ -60,15 +65,11 @@
*/ */
public class Console implements EntryPoint { public class Console implements EntryPoint {


/** The MODULES. */ public final static Composite MODULES = GWT.<GinjectorSingleton>create(GinjectorSingleton.class).getCoreUI();
public final static CoreUI MODULES = GWT.<GinjectorSingleton>create(GinjectorSingleton.class).getCoreUI();
/** The CONSTANTS. */
public final static UIConstants CONSTANTS = GWT.create(UIConstants.class); public final static UIConstants CONSTANTS = GWT.create(UIConstants.class);
/** The MESSAGES. */
public final static UIDebugConstants DEBUG_CONSTANTS = GWT.create(UIDebugConstants.class); public final static UIDebugConstants DEBUG_CONSTANTS = GWT.create(UIDebugConstants.class);
public final static UIMessages MESSAGES = GWT.create(UIMessages.class); public final static UIMessages MESSAGES = GWT.create(UIMessages.class);


@Override
public void onModuleLoad() { public void onModuleLoad() {
// Defer all application initialisation code to onModuleLoad2() so that the // Defer all application initialisation code to onModuleLoad2() so that the
// UncaughtExceptionHandler can catch any unexpected exceptions. // UncaughtExceptionHandler can catch any unexpected exceptions.
Expand All @@ -82,10 +83,11 @@ public void execute() {
}); });
} }


/**
*/
public void onModuleLoad2() { public void onModuleLoad2() {


// load console css bundle
ConsoleResources.INSTANCE.css().ensureInjected();

// display the loading panel // display the loading panel
final Widget loadingPanel = new LoadingPanel().asWidget(); final Widget loadingPanel = new LoadingPanel().asWidget();
RootLayoutPanel.get().add(loadingPanel); RootLayoutPanel.get().add(loadingPanel);
Expand All @@ -99,11 +101,12 @@ public void onSuccess() {
DelayedBindRegistry.bind(MODULES); DelayedBindRegistry.bind(MODULES);


// ordered bootstrap // ordered bootstrap
BootstrapProcess bootstrap = new BootstrapProcess(); final BootstrapProcess bootstrap = new BootstrapProcess();


bootstrap.addHook(new ExecutionMode(MODULES.getBootstrapContext(), MODULES.getDispatchAsync())); bootstrap.addHook(new ExecutionMode(MODULES.getBootstrapContext(), MODULES.getDispatchAsync()));
bootstrap.addHook(new RegisterSubsystems(MODULES.getSubsystemRegistry()));
bootstrap.addHook(new ChoseProcessor(MODULES.getBootstrapContext())); bootstrap.addHook(new ChoseProcessor(MODULES.getBootstrapContext()));
bootstrap.addHook(new EagerLoadProfiles()); bootstrap.addHook(new EagerLoadProfiles(MODULES.getProfileStore(), MODULES.getCurrentSelectedProfile()));
bootstrap.addHook(new RemoveLoadingPanel(loadingPanel)); bootstrap.addHook(new RemoveLoadingPanel(loadingPanel));
bootstrap.addHook(new LoadMainApp(MODULES.getBootstrapContext(), MODULES.getPlaceManager(), MODULES.getTokenFormatter())); bootstrap.addHook(new LoadMainApp(MODULES.getBootstrapContext(), MODULES.getPlaceManager(), MODULES.getTokenFormatter()));


Expand All @@ -123,7 +126,11 @@ public void onSuccess(Boolean wasSuccessfull) {
// currently we only deal with authentication errors // currently we only deal with authentication errors
RootLayoutPanel.get().remove(loadingPanel); RootLayoutPanel.get().remove(loadingPanel);


HTMLPanel explanation = new HTMLPanel("<center><div style='padding-top:150px;'>The web console could not be loaded. Please refresh this page to start over.</div></center>"); String cause = "";
if(MODULES.getBootstrapContext().getLastError()!=null)
cause = MODULES.getBootstrapContext().getLastError().getMessage();

HTMLPanel explanation = new HTMLPanel("<center><div style='padding-top:150px;'><h2>The web console could not be loaded.</h2>"+cause+"</div></center>");
RootLayoutPanel.get().add(explanation); RootLayoutPanel.get().add(explanation);
} }


Expand All @@ -134,82 +141,53 @@ public void onSuccess(Boolean wasSuccessfull) {
}); });
} }


/**
* @param message the message
*/
public static void info(String message) { public static void info(String message) {
MODULES.getMessageCenter().notify( getMessageCenter().notify(
new Message(message, Message.Severity.Info) new Message(message, Message.Severity.Info)
); );
} }


/**
* @param message the message
*/
public static void error(String message) { public static void error(String message) {
MODULES.getMessageCenter().notify( getMessageCenter().notify(
new Message(message, Message.Severity.Error) new Message(message, Message.Severity.Error)
); );
} }


/**
* @param message the message
* @param detail details
*/
public static void error(String message, String detail) { public static void error(String message, String detail) {
MODULES.getMessageCenter().notify( getMessageCenter().notify(
new Message(message, detail, Message.Severity.Error) new Message(message, detail, Message.Severity.Error)
); );
} }


/**
* @param message the message
*/
public static void warning(String message) { public static void warning(String message) {
MODULES.getMessageCenter().notify( getMessageCenter().notify(
new Message(message, Message.Severity.Warning) new Message(message, Message.Severity.Warning)
); );
} }


/**
* @param message the message
* @param sticky is it sticky
*/
public static void warning(String message, boolean sticky) { public static void warning(String message, boolean sticky) {
Message msg = sticky ? Message msg = sticky ?
new Message(message, Message.Severity.Warning, EnumSet.of(Message.Option.Sticky)) : new Message(message, Message.Severity.Warning, EnumSet.of(Message.Option.Sticky)) :
new Message(message, Message.Severity.Warning); new Message(message, Message.Severity.Warning);


MODULES.getMessageCenter().notify(msg); getMessageCenter().notify(msg);
} }


/**
* @param message the message
* @param detail details
* @param sticky is it sticky
*/
public static void warning(String message, String detail, boolean sticky) { public static void warning(String message, String detail, boolean sticky) {
Message msg = sticky ? Message msg = sticky ?
new Message(message, detail, Message.Severity.Warning, EnumSet.of(Message.Option.Sticky)) : new Message(message, detail, Message.Severity.Warning, EnumSet.of(Message.Option.Sticky)) :
new Message(message, detail, Message.Severity.Warning); new Message(message, detail, Message.Severity.Warning);




MODULES.getMessageCenter().notify(msg); getMessageCenter().notify(msg);
} }


/**
* @param message the message
* @param detail details
*/
public static void warning(String message, String detail) { public static void warning(String message, String detail) {
MODULES.getMessageCenter().notify( getMessageCenter().notify(
new Message(message, detail, Message.Severity.Warning) new Message(message, detail, Message.Severity.Warning)
); );
} }


/**
* @param cmd the command
*/
public static void schedule(final Command cmd) public static void schedule(final Command cmd)
{ {
Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
Expand All @@ -220,14 +198,38 @@ public void execute() {
}); });
} }


/** public static EventBus getEventBus() {
* @return true if vis api is loaded. return MODULES.getEventBus();
*/ }

public static MessageCenter getMessageCenter() {
return MODULES.getMessageCenter();
}

public static PlaceManager getPlaceManager() {
return MODULES.getPlaceManager();
}

public static BootstrapContext getBootstrapContext()
{
return MODULES.getBootstrapContext();
}

public static HelpSystem getHelpSystem() {
return MODULES.getHelpSystem();
}


@Deprecated
public static native boolean visAPILoaded() /*-{ public static native boolean visAPILoaded() /*-{
if ($wnd['google'] && $wnd.google['load']) { if ($wnd['google'] && $wnd.google['load']) {
return true; return true;
} }
return false; return false;
}-*/; }-*/;



public static SubsystemRegistry getSubsystemRegistry() {
return MODULES.getSubsystemRegistry();
}
} }
Expand Up @@ -30,10 +30,10 @@
*/ */
public class CoreUISingleton implements GinjectorSingleton { public class CoreUISingleton implements GinjectorSingleton {


private static final CoreUI INSTANCE = GWT.create(CoreUI.class); private static final Composite INSTANCE = GWT.create(Composite.class);


@Override @Override
public CoreUI getCoreUI() { public Composite getCoreUI() {
return INSTANCE; return INSTANCE;
} }


Expand Down
Expand Up @@ -47,5 +47,5 @@ public interface GinjectorSingleton {
/** /**
* @return the CoreUI Ginjector. * @return the CoreUI Ginjector.
*/ */
CoreUI getCoreUI(); Composite getCoreUI();
} }

0 comments on commit 449331f

Please sign in to comment.