Skip to content

Commit

Permalink
Merge pull request #5442 from pentaho/wcag
Browse files Browse the repository at this point in the history
Merging wcag into master
  • Loading branch information
phalguni-a authored Nov 9, 2023
2 parents 5880095 + 4875b4a commit f402f63
Show file tree
Hide file tree
Showing 15 changed files with 345 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,7 @@ public void onMantleSettingsLoaded( MantleSettingsLoadedEvent event ) {

RootPanel.get( "pucMenuBar" ).add( MantleXul.getInstance().getMenubar() );
RootPanel.get( "pucBurgerToolbar" ).add( MantleXul.getInstance().getBurgerToolbarWrapper() );
RootPanel.get( "pucTabsMenuBar" ).add( MantleXul.getInstance().getTabsMenuBarWrapper() );
RootPanel.get( "pucPerspectives" ).add( PerspectiveManager.getInstance() );
RootPanel.get( "pucToolBar" ).add( MantleXul.getInstance().getToolbar() );
RootPanel.get( "pucUserDropDown" ).add( getUserDropDown() );
Expand All @@ -360,6 +361,7 @@ public void onMantleSettingsLoaded( MantleSettingsLoadedEvent event ) {
contentDeck.add( new Label() );
contentDeck.showWidget( 0 );
contentDeck.add( SolutionBrowserPanel.getInstance() );

if ( showOnlyPerspective && !StringUtils.isEmpty( startupPerspective ) ) {
SolutionBrowserPanel.getInstance().setVisible( false );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,16 @@ public ChangePasswordByUserDialog( MantleController controller ) {
cancelBtn.setStylePrimaryName( "pentaho-button" );
cancelBtn.addClickHandler( new CancelListener() );

setResponsive( true );
setWidthCategory( WidthCategory.EXTRASMALL );

this.controller = controller;
}

@Override
protected DialogBox createManagedDialog() {
DialogBox dialog = super.createManagedDialog();
dialog.setStyleDependentName( "change-password", true );
dialog.setResponsive( true );
dialog.setWidthCategory( DialogBox.DialogWidthCategory.EXTRA_SMALL );

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,16 @@ public ChangePasswordDialog( UpdatePasswordController controller ) {
cancelBtn.setStylePrimaryName( "pentaho-button" );
cancelBtn.addClickHandler( new CancelListener() );

setResponsive( true );
setWidthCategory( WidthCategory.EXTRASMALL );

this.controller = controller;
}

@Override
protected DialogBox createManagedDialog() {
DialogBox dialog = super.createManagedDialog();
dialog.setStyleDependentName( "change-password", true );
dialog.setResponsive( true );
dialog.setWidthCategory( DialogBox.DialogWidthCategory.EXTRA_SMALL );

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,17 @@ public RoleDialog( UserRolesAdminPanelController controller ) {
cancelBtn.setStylePrimaryName( "pentaho-button" );
cancelBtn.addClickHandler( new CancelListener() );

setResponsive( true );
setWidthCategory( WidthCategory.EXTRASMALL );
setMinimumHeightCategory( MinimumHeightCategory.CONTENT );

this.controller = controller;
}

@Override
protected DialogBox createManagedDialog() {
DialogBox dialog = super.createManagedDialog();
dialog.setStyleDependentName( "new-role", true );
dialog.setResponsive( true );
dialog.setWidthCategory( DialogBox.DialogWidthCategory.EXTRA_SMALL );
dialog.setMinimumHeightCategory( DialogBox.DialogMinimumHeightCategory.CONTENT );

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,16 @@ public UserDialog( UserRolesAdminPanelController controller ) {
cancelBtn.setStylePrimaryName( "pentaho-button" );
cancelBtn.addClickHandler( new CancelListener() );

setResponsive( true );
setWidthCategory( WidthCategory.EXTRASMALL );

this.controller = controller;
}

@Override
protected DialogBox createManagedDialog() {
DialogBox dialog = super.createManagedDialog();
dialog.setStyleDependentName( "new-user", true );
dialog.setResponsive( true );
dialog.setWidthCategory( DialogBox.DialogWidthCategory.EXTRA_SMALL );

return dialog;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.google.gwt.core.client.JsArrayString;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Label;
import org.pentaho.mantle.client.ui.tabs.MantleTabPanel;

public class SaveCommand extends AbstractCommand {

Expand Down Expand Up @@ -442,9 +443,11 @@ private native void doSaveAsNativeWrapper( String elementId, String filename, St
// used via JSNI
private void doTabRename() {
if ( tabName != null ) { // Save-As does not modify the name of the tab.
PentahoTab tab = SolutionBrowserPanel.getInstance().getContentTabPanel().getSelectedTab();
MantleTabPanel tabPanel = SolutionBrowserPanel.getInstance().getContentTabPanel();
PentahoTab tab = tabPanel.getSelectedTab();
tab.setLabelText( tabName );
tab.setLabelTooltip( tabName );
tabPanel.renameMenuTab( tab );
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,13 @@
import org.pentaho.gwt.widgets.client.dialogs.IDialogCallback;
import org.pentaho.gwt.widgets.client.dialogs.PromptDialogBox;
import org.pentaho.gwt.widgets.client.tabs.PentahoTab;
import org.pentaho.gwt.widgets.client.tabs.PentahoTabPanel;
import org.pentaho.gwt.widgets.client.utils.FrameUtils;
import org.pentaho.gwt.widgets.client.utils.string.StringUtils;
import org.pentaho.mantle.client.messages.Messages;
import org.pentaho.mantle.client.solutionbrowser.MantlePopupPanel;
import org.pentaho.mantle.client.solutionbrowser.tabs.IFrameTabPanel;
import org.pentaho.mantle.client.ui.PerspectiveManager;

public class MantleTab extends org.pentaho.gwt.widgets.client.tabs.PentahoTab {

Expand Down Expand Up @@ -234,19 +236,23 @@ public void hidePopUpMenu() {
popupMenu.hide();
}

public void onRightClick( Event event ) {
FrameUtils.setEmbedVisibility( ( (IFrameTabPanel) getTabPanel().getSelectedTab().getContent() ).getFrame(), false );
int left;
int top;
if ( event.getTypeInt() == Event.ONKEYDOWN ) {
PentahoTab tab = getTabPanel().getTab( getTabPanel().getSelectedTabIndex() );
left = tab.getAbsoluteLeft() + ( tab.getOffsetWidth() / 2 );
top = tab.getAbsoluteTop() + tab.getOffsetHeight();
} else {
left = Window.getScrollLeft() + DOM.eventGetClientX( event );
top = Window.getScrollTop() + DOM.eventGetClientY( event );
/**
* Select this tab. If the "Opened" perspective is not show, show it.
*/
protected void selectTabMenuItem() {
PerspectiveManager perspectiveManager = PerspectiveManager.getInstance();
if ( !perspectiveManager.getActivePerspective().equals( PerspectiveManager.OPENED_PERSPECTIVE ) ) {
perspectiveManager.setPerspective( PerspectiveManager.OPENED_PERSPECTIVE );
}
popupMenu.setPopupPosition( adjustLeftIfNecessary( left ), top );
fireTabSelected();
( (MantleTabPanel) this.getTabPanel() ).updateTabMenuText( this );
}

protected MenuBar getContextMenuBar(){
return getContextMenuBar( false );
}

protected MenuBar getContextMenuBar( boolean addSelectItem ){
MenuBar menuBar = new MenuBar( true ) {
public void onBrowserEvent( Event event ) {
int type = event.getTypeInt();
Expand All @@ -263,20 +269,26 @@ public void onBrowserEvent( Event event ) {
};
menuBar.setAutoOpen( true );
menuBar.setFocusOnHoverEnabled( true );

if ( addSelectItem ) {
MenuItem selectTabMenuItem = new MenuItem( Messages.getString( "select" ), () -> selectTabMenuItem() );
menuBar.addItem( selectTabMenuItem );
}

if ( getContent() instanceof IFrameTabPanel ) {
MenuItem backMenuItem =
new MenuItem( Messages.getString( "back" ), new TabCommand( TABCOMMANDTYPE.BACK, popupMenu ) ); //$NON-NLS-1$
new MenuItem( Messages.getString( "back" ), new TabCommand( TABCOMMANDTYPE.BACK, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( backMenuItem );
backMenuItem.getElement().setId( "back" ); //$NON-NLS-1$
menuBar.addSeparator();
MenuItem reloadTabMenuItem =
new MenuItem( Messages.getString( "reloadTab" ), new TabCommand( TABCOMMANDTYPE.RELOAD, popupMenu ) ); //$NON-NLS-1$
new MenuItem( Messages.getString( "reloadTab" ), new TabCommand( TABCOMMANDTYPE.RELOAD, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( reloadTabMenuItem );
reloadTabMenuItem.getElement().setId( "reloadTab" ); //$NON-NLS-1$
}
if ( getTabPanel().getTabCount() > 1 ) {
MenuItem reloadAllTabsMenuItem =
new MenuItem( Messages.getString( "reloadAllTabs" ), new TabCommand( TABCOMMANDTYPE.RELOAD_ALL, popupMenu ) ); //$NON-NLS-1$
new MenuItem( Messages.getString( "reloadAllTabs" ), new TabCommand( TABCOMMANDTYPE.RELOAD_ALL, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( reloadAllTabsMenuItem );
reloadAllTabsMenuItem.getElement().setId( "reloadAllTabs" ); //$NON-NLS-1$
} else {
Expand All @@ -288,26 +300,26 @@ public void onBrowserEvent( Event event ) {
menuBar.addSeparator();
if ( getContent() instanceof IFrameTabPanel ) {
MenuItem openTabInNewWindowMenuItem =
new MenuItem(
Messages.getString( "openTabInNewWindow" ), new TabCommand( TABCOMMANDTYPE.NEW_WINDOW, popupMenu ) ); //$NON-NLS-1$
new MenuItem(
Messages.getString( "openTabInNewWindow" ), new TabCommand( TABCOMMANDTYPE.NEW_WINDOW, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( openTabInNewWindowMenuItem );
openTabInNewWindowMenuItem.getElement().setId( "openTabInNewWindow" ); //$NON-NLS-1$
MenuItem createDeepLinkMenuItem =
new MenuItem(
Messages.getString( "createDeepLink" ), new TabCommand( TABCOMMANDTYPE.CREATE_DEEP_LINK, popupMenu ) ); //$NON-NLS-1$
new MenuItem(
Messages.getString( "createDeepLink" ), new TabCommand( TABCOMMANDTYPE.CREATE_DEEP_LINK, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( createDeepLinkMenuItem );
createDeepLinkMenuItem.getElement().setId( "deepLink" ); //$NON-NLS-1$
menuBar.addSeparator();
}
menuBar
.addItem( new MenuItem( Messages.getString( "closeTab" ), new TabCommand( TABCOMMANDTYPE.CLOSE, popupMenu ) ) ); //$NON-NLS-1$
.addItem( new MenuItem( Messages.getString( "closeTab" ), new TabCommand( TABCOMMANDTYPE.CLOSE, popupMenu ) ) ); //$NON-NLS-1$
if ( getTabPanel().getTabCount() > 1 ) {
MenuItem closeOtherTabsMenuItem =
new MenuItem( Messages.getString( "closeOtherTabs" ), new TabCommand( TABCOMMANDTYPE.CLOSE_OTHERS, popupMenu ) ); //$NON-NLS-1$
new MenuItem( Messages.getString( "closeOtherTabs" ), new TabCommand( TABCOMMANDTYPE.CLOSE_OTHERS, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( closeOtherTabsMenuItem );
closeOtherTabsMenuItem.getElement().setId( "closeOtherTabs" ); //$NON-NLS-1$
MenuItem closeAllTabsMenuItem =
new MenuItem( Messages.getString( "closeAllTabs" ), new TabCommand( TABCOMMANDTYPE.CLOSE_ALL, popupMenu ) ); //$NON-NLS-1$
new MenuItem( Messages.getString( "closeAllTabs" ), new TabCommand( TABCOMMANDTYPE.CLOSE_ALL, popupMenu ) ); //$NON-NLS-1$
menuBar.addItem( closeAllTabsMenuItem );
closeAllTabsMenuItem.getElement().setId( "closeAllTabs" ); //$NON-NLS-1$
} else {
Expand All @@ -320,6 +332,23 @@ public void onBrowserEvent( Event event ) {
closeOtherTabsMenuItem.getElement().setId( "closeOtherTabs" ); //$NON-NLS-1$
closeAllTabsMenuItem.getElement().setId( "closeAllTabs" ); //$NON-NLS-1$
}
return menuBar;
}

public void onRightClick( Event event ) {
FrameUtils.setEmbedVisibility( ( (IFrameTabPanel) getTabPanel().getSelectedTab().getContent() ).getFrame(), false );
int left;
int top;
if ( event.getTypeInt() == Event.ONKEYDOWN ) {
PentahoTab tab = getTabPanel().getTab( getTabPanel().getSelectedTabIndex() );
left = tab.getAbsoluteLeft() + ( tab.getOffsetWidth() / 2 );
top = tab.getAbsoluteTop() + tab.getOffsetHeight();
} else {
left = Window.getScrollLeft() + DOM.eventGetClientX( event );
top = Window.getScrollTop() + DOM.eventGetClientY( event );
}
popupMenu.setPopupPosition( adjustLeftIfNecessary( left ), top );
MenuBar menuBar = getContextMenuBar();
popupMenu.setWidget( menuBar );

if ( isIEBrowser() ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.pentaho.mantle.client.ui.tabs;

import com.google.gwt.core.client.Scheduler;
import com.google.gwt.user.client.ui.MenuBar;

public class MantleTabMenuItem extends com.google.gwt.user.client.ui.MenuItem {
private MantleTab mantleTab;

public MantleTabMenuItem( MantleTab tab ) {
super( tab.getLabelText(), (Scheduler.ScheduledCommand) null );
mantleTab = tab;
refreshContextMenu();
}

public void refreshContextMenu() {
MenuBar contextMenuBar = mantleTab.getContextMenuBar( true );
contextMenuBar.addStyleName( "tabsMenuContextSubMenu" );
setSubMenu( contextMenuBar );
}
}
Loading

0 comments on commit f402f63

Please sign in to comment.