Navigation Menu

Skip to content

Commit

Permalink
BZ-1129694: validations and refactoring in forms
Browse files Browse the repository at this point in the history
  • Loading branch information
salaboy committed Dec 5, 2014
1 parent 586385b commit c1b7416
Show file tree
Hide file tree
Showing 8 changed files with 150 additions and 123 deletions.
Expand Up @@ -81,10 +81,12 @@
</bootstrap:DataGrid>
<bootstrap:Button ui:field="newParametersButton"></bootstrap:Button>
</bootstrap:Fieldset>
<bootstrap:ModalFooter>
<bootstrap:Button type="PRIMARY" ui:field="createButton"></bootstrap:Button>
</bootstrap:ModalFooter>


</bootstrap:Well>
<bootstrap:ModalFooter>
<bootstrap:Button type="PRIMARY" ui:field="createButton"></bootstrap:Button>
</bootstrap:ModalFooter>
</gwt:HTMLPanel>

</ui:UiBinder>
Expand Up @@ -64,8 +64,6 @@ public interface RequestListView extends ListView<RequestSummary, RequestListPre
@Inject
private RequestListView view;

private Menus menus;

@Inject
private Caller<ExecutorServiceEntryPoint> executorServices;
@Inject
Expand All @@ -76,7 +74,6 @@ public interface RequestListView extends ListView<RequestSummary, RequestListPre

public RequestListPresenter() {
onRangeChanged();
makeMenuBar();
}

private void onRangeChanged(){
Expand Down Expand Up @@ -198,41 +195,4 @@ public void callback(Void nothing) {
}).requeueRequest(requestId);
}

@WorkbenchMenu
public Menus getMenus() {
return menus;
}

private void makeMenuBar() {
menus = MenuFactory
.newTopLevelMenu(constants.Settings())
.respondsWith(new Command() {
@Override
public void execute() {
placeManager.goTo( new DefaultPlaceRequest( "Job Service Settings" ) );

}
})
.endMenu()
.newTopLevelMenu(constants.New_Job())
.respondsWith(new Command() {
@Override
public void execute() {
placeManager.goTo( new DefaultPlaceRequest( "Quick New Job" ) );

}
})
.endMenu()
.newTopLevelMenu(constants.Refresh())
.respondsWith(new Command() {
public void execute() {
refreshRequests(null);
// clearSearchEvent.fire(new ClearSearchEvent());
// view.setCurrentFilter("");
// view.displayNotification(constants.Process_Instances_Refreshed());
}
})
.endMenu().build();

}
}
Expand Up @@ -47,6 +47,7 @@
import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.NavLink;
import com.github.gwtbootstrap.client.ui.SimplePager;
import com.github.gwtbootstrap.client.ui.SplitDropdownButton;
import com.github.gwtbootstrap.client.ui.constants.IconType;
import com.github.gwtbootstrap.client.ui.resources.ButtonSize;
import com.google.gwt.cell.client.ActionCell;
Expand Down Expand Up @@ -125,7 +126,7 @@ public void init(final RequestListPresenter presenter ) {
super.init(presenter, new GridGlobalPreferences("RequestListGrid", initColumns, bannedColumns));

initFiltersBar();

this.initActionsDropDown();
listGrid.setEmptyTableCaption(constants.No_Jobs_Found());
initSelectionModel();
initNoActionColumnManager();
Expand Down Expand Up @@ -374,6 +375,31 @@ public DefaultSelectionEventManager.SelectAction translateSelectionEvent(CellPre

}

private void initActionsDropDown() {
SplitDropdownButton actions = new SplitDropdownButton();
actions.setText(constants.Actions());
NavLink newJobNavLink = new NavLink(constants.New_Job());
newJobNavLink.setIcon(IconType.PLUS_SIGN);
newJobNavLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
placeManager.goTo( new DefaultPlaceRequest( "Quick New Job" ) );
}
});

NavLink settingsNavLink = new NavLink(constants.Settings());
settingsNavLink.setIcon(IconType.COG);
settingsNavLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
placeManager.goTo( new DefaultPlaceRequest( "Job Service Settings" ) );
}
});

actions.add(newJobNavLink);
actions.add(settingsNavLink);
listGrid.getLeftToolbar().add(actions);
}

private void initChecksColumn() {
// Checkbox column. This table will uses a checkbox column for selection.
Expand Down
Expand Up @@ -16,13 +16,16 @@

package org.jbpm.console.ng.es.client.editors.servicesettings;

import com.github.gwtbootstrap.client.ui.Button;
import com.google.gwt.core.shared.GWT;
import javax.annotation.PostConstruct;
import javax.enterprise.context.Dependent;
import javax.inject.Inject;

import com.google.gwt.user.client.ui.Focusable;
import org.jboss.errai.common.client.api.Caller;
import org.jboss.errai.common.client.api.RemoteCallback;
import org.jbpm.console.ng.es.client.i18n.Constants;
import org.jbpm.console.ng.es.service.ExecutorServiceEntryPoint;
import org.uberfire.client.annotations.WorkbenchPartTitle;
import org.uberfire.client.annotations.WorkbenchPartView;
Expand Down Expand Up @@ -50,6 +53,8 @@ public interface JobServiceSettingsView extends UberView<JobServiceSettingsPrese
void setStartedLabel( Boolean started );

void alert( String message );

Button getStartStopButton();
}

@Inject
Expand All @@ -59,6 +64,8 @@ public interface JobServiceSettingsView extends UberView<JobServiceSettingsPrese
@Inject
private Caller<ExecutorServiceEntryPoint> executorServices;
private PlaceRequest place;

private Constants constants = GWT.create( Constants.class );

public JobServiceSettingsPresenter() {
}
Expand Down Expand Up @@ -91,24 +98,32 @@ public void callback( Integer threadPoolSize ) {
@Override
public void callback( Boolean started ) {
view.setStartedLabel( started );
if(started){
view.getStartStopButton().setText(constants.Stop());
}else{
view.getStartStopButton().setText(constants.Start());
}
}
} ).isActive();
}

public void initService( final Integer numberOfExecutors,
String frequency ) {
try {
Integer interval = fromFrequencyToInterval( frequency );
Integer frequency ) {


executorServices.call( new RemoteCallback<Boolean>() {
@Override
public void callback( Boolean serviceStatus ) {
view.displayNotification( serviceStatus ? "Service started" : "Service stopped" );
if(serviceStatus){
view.getStartStopButton().setText(constants.Stop());
}else{
view.getStartStopButton().setText(constants.Start());
}
placeManager.closePlace( place );
}
} ).startStopService( interval, numberOfExecutors );
} catch ( NumberFormatException e ) {
view.alert( "Invalid frequency expression: " + frequency );
}
} ).startStopService( frequency, numberOfExecutors );

}

@OnOpen
Expand All @@ -121,7 +136,7 @@ public void onStartup( final PlaceRequest place ) {
this.place = place;
}

private String fromIntervalToFrequency( Integer interval ) {
public String fromIntervalToFrequency( Integer interval ) {
int seconds = interval % 60;
int minutes = ( interval / 60 ) % 60;
int hours = ( interval / 3600 ) % 24;
Expand All @@ -142,7 +157,7 @@ private String fromIntervalToFrequency( Integer interval ) {
return frequencyText.toString();
}

private Integer fromFrequencyToInterval( String frequency ) throws NumberFormatException {
public Integer fromFrequencyToInterval( String frequency ) throws NumberFormatException {
String[] sections = frequency.split( " " );
int interval = 0;
for ( String section : sections ) {
Expand Down

This file was deleted.

0 comments on commit c1b7416

Please sign in to comment.