Skip to content

Commit

Permalink
Merge pull request #5 from Jose-Badeau/feature/attila/simplify_tabs
Browse files Browse the repository at this point in the history
Feature/attila/simplify tabs
  • Loading branch information
abartha authored Oct 27, 2016
2 parents 8c40037 + 625df15 commit 170a5ba
Show file tree
Hide file tree
Showing 20 changed files with 165 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature Table
In order to "verify that the grammar is correct"

Scenario "Assertion Handling"
Given I am on the Simple screen
Given I am on the screen Simple

when I from the Submit button I click
then the Name textfield not equals ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Feature MultiComponent
In order to "verify the language works as expected"

Scenario "Test Use Of Multiple"
Given I am on the MultiComponent screen
Given I am on the screen MultiComponent
when I from the EMail textfield I type "[email protected]"
and I from the Name textfield I type "John Doe"
and I from the PhoneNumber textfield I type "+ 41 225587"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature MultiComponentWithOwnWidgets
In order to "verify the language works as expected"

Scenario "Test Use Of Multiple"
Given I am on the MultiComponentWithOwnWidgets screen
Given I am on the screen MultiComponentWithOwnWidgets
when I from the EMail textfield I type "[email protected]"
and I from the Name textfield I type "John Doe"
and I from the PhoneNumber textfield I type "+ 41 225587"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature MultiWidgetGroups
In order to "verify the language works as expected"

Scenario "Test Use Of Multiple"
Given I am on the MultiWidgetGroups screen
Given I am on the screen MultiWidgetGroups
when I from the Login textfield I type "Login Credentials"
and I from the Password textfield I type "MySecretPassword"
and I from the PasswordForgotten button I click
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Feature ScreenSwitch
In order to "Verify the grammar"

Scenario "Hit all elements on the screen"
Given I am on the WidgetGroupInWidgetGroup screen
Given I am on the screen WidgetGroupInWidgetGroup
when I from the Yes button I click
then I am on the MultiComponent screen
then I am on the screen MultiComponent
when I from the EMail textfield I type "DSFDSF"
then I am on the Simple screen
then I am on the screen Simple
when I from the Name textfield I type "BAFD"
then I am on the WidgetGroupInWidgetGroup screen
when I from the Clear button I click
then I am on the screen WidgetGroupInWidgetGroup
when I from the Clear button I click
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Feature Simple
In order to "Verify the grammar"

Scenario "Hit all elements on the screen"
Given I am on the Simple screen
Given I am on the screen Simple
when I from the Name textfield I type "asdasd"
and I from the Title combo I select indices 1
and I from the Title combo I select names "Mueller", "Meier", "Schmidt"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ I want to "Make sure that the grammar works with component screens"
In order to "Ensure that the language is ok"

Scenario "Reference Elements inside a component"
Given I am on the SimpleComponent screen
Given I am on the screen SimpleComponent
when I from the Name textfield I type "BlaBlub"
when I from the Title combo I select indices 1
when I from the Title combo I select names "Meier", "Mueller"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ Feature TabbedPane
In order to "ensure that the language is ok"


Scenario "Select a tab in a tabbed pane"
Given I am on the TabbedPaneComp :: SimpleTab2 screen
Scenario "Select a tab in a tabbed pane"
Given I am on the tab TabbedPaneComp :: SimpleTab2
when I from the TabbedPaneSimple tabbedpane I select the Tab1 tab
and I from the SaveAll button I click
then the TabbedPaneSimple tabbedpane selected tab is Tab1 tab

Scenario "Select a tab in a tabbed pane 2"
Given I am on the org.simpleB.TabbedPaneComp :: SimpleTab1 screen
Given I am on the tab org.simpleB.TabbedPaneComp :: SimpleTab1
when I from the org.simpleB.TabbedPaneComp.SaveAll button I click
then I am on the parts.simple.SimpleTab1 screen
then I am on the tab TabbedPaneComp :: parts.simple.SimpleTab1

when I from the TabbedPaneSimple tabbedpane I select the Tab1 tab
then the TabbedPaneSimple tabbedpane selected tab is Tab1 tab
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ Feature TabbedPaneInWidgetGroup


Scenario "Select a tab in a tabbed pane that is inside a widget group"
Given I am on the TabbedPaneInWidgetGroupComp ::FirstTab screen
Given I am on the tab TabbedPaneInWidgetGroupComp::FirstTab
when I from the TabbedPane3 tabbedpane I select the Second_Tab tab
and I from the Toggle button I click
then I am on the SecondTab screen
then I am on the tab TabbedPaneInWidgetGroupComp::SecondTab
then the TabbedPane3 tabbedpane selected tab is Second_Tab tab


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature Table
In order to "verify that the grammar is correct"

Scenario "Click Table Handling"
Given I am on the Simple screen
Given I am on the screen Simple

when I from the Adress table I click cell where row equals "Test",
and column matches "some name",
Expand All @@ -18,7 +18,7 @@ Feature Table
and row index equals 1

Scenario "Select Table Handling"
Given I am on the Simple screen
Given I am on the screen Simple

when I from the Adress table I select cell where row equals "Test",
and column matches "some name",
Expand All @@ -27,7 +27,7 @@ Feature Table
and row index equals 1

Scenario "Type Table Handling"
Given I am on the Simple screen
Given I am on the screen Simple

when I from the Adress table I type "Foo" in the cell where row equals "Test",
and column matches "some name",
Expand All @@ -36,7 +36,7 @@ Feature Table
and row index equals 1

Scenario "DoubleClick Table Handling"
Given I am on the Simple screen
Given I am on the screen Simple

when I from the Adress table I double click cell where row equals "Test",
and column matches "some name",
Expand All @@ -45,7 +45,7 @@ Feature Table
and row index equals 1

Scenario "Check Table Handling"
Given I am on the Simple screen
Given I am on the screen Simple

when I from the Adress table I check cell where row equals "Test",
and column matches "some name",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ I want to "Make sure that the grammar works with component screens that are used
In order to "Ensure that the language is ok"

Scenario "ReUse components from asset folder"
Given I am on the UseSimpleComponent screen
Given I am on the screen UseSimpleComponent
when I from the Name textfield I type "sda"
and I from the Submit button I click
and I from the Title combo I select indices 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature WidgetGroupInWidgetGroup
In order to "Verify the grammar"

Scenario "Hit all elements on the screen"
Given I am on the WidgetGroupInWidgetGroup screen
Given I am on the screen WidgetGroupInWidgetGroup
when I from the Yes button I click
and I from the No button I click
and I from the Clear button I click
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,16 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {
givenIamOnTheAccess.group.createKeywordProposal(context, acceptor)
}

override complete_OnScreen(EObject model, RuleCall ruleCall, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
acceptor.accept(createCompletionProposal("screen ", "screen", null, context))
}

override complete_OnTab(EObject model, RuleCall ruleCall, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
acceptor.accept(createCompletionProposal("tab ", "tab", null, context))
}

override complete_AndI(EObject model, RuleCall ruleCall, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
andIAccess.group.createKeywordProposal(context, acceptor)
Expand Down Expand Up @@ -340,7 +350,7 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {

override completeBTabItemWrapper_TabItem(EObject model, Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
createTypeProposal(model, assignment, context, acceptor)
createTabItemProposal(model, assignment, context, acceptor)
}

override completeBWidgetWrapper_Widget(EObject model, Assignment assignment, ContentAssistContext context,
Expand All @@ -359,8 +369,7 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {
createTypeProposal(model, assignment, context, acceptor)
}

override completeBToScreenSwitch_ComponentPartScreen(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
//super.completeBToScreenSwitch_ComponentPartScreen(model, assignment, context, acceptor)
override completeBToScreenSwitch_ComponentScreen(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
createTypeProposal(model, assignment, context, acceptor)
}

Expand Down Expand Up @@ -395,9 +404,11 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {
// Definition of variables for getting the initial scope and Qualified Name
val widgetTypeERef = GrammarUtil.getReference(assignment.getTerminal() as CrossReference)

val List<QualifiedName> prefixQNames =
if ("tabbedPane".equals(widgetTypeERef.name) || "tabItem".equals(widgetTypeERef.name)) {
if (EcoreUtil2.getContainerOfType(model, BScenario).BToScreenSwitch.determineScreen.isComponentPart) {
val List<QualifiedName> prefixQNames =
if ("componentScreen".equals(widgetTypeERef.name)) {
emptyList // null
} else if ("tabbedPane".equals(widgetTypeERef.name) || "tabItem".equals(widgetTypeERef.name)) {
if (EcoreUtil2.getContainerOfType(model, BScenario).BToScreenSwitch.screen.isComponentPart) {
newArrayList( // attila: making a list
EcoreUtil2.getContainerOfType(model, BScenario).BToScreenSwitch.screen?.fullyQualifiedName
)
Expand All @@ -419,21 +430,19 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {

for (IEObjectDescription description : scopeAllElements) {
val qname = description.qualifiedName
val String typeName = if ('item'.equals(description.EClass.name.toLowerCase)) {
'tab'
} else if (description.isComponent) { // attila
val String typeName = if (description.isComponent && "componentScreen".equals(widgetTypeERef.name)) {
'::'
} else {
description.EClass.name.toLowerCase
}

if (!(!prefixQNames.nullOrEmpty && !qname.qNameInPrefixNames(prefixQNames) && !typeName.equals("screen") && !typeName.equals("tab"))) {
if (!(!prefixQNames.nullOrEmpty && !qname.qNameInPrefixNames(prefixQNames) && !typeName.equals("screen"))) {

val simpleName = qualifiedNameConverter.toString(qname.skipFirst(qname.segmentCount - 1))
val parentQName = qualifiedNameConverter.toString(qname.skipLast(1))
var proposalName = simpleName
var proposalString = simpleName + (if (typeName.equals("::")) typeName else if (typeName.equals("screen")) " " else " " + typeName + " ")

val proposal = (createCompletionProposal(proposalName + " " + typeName, simpleName + " " + typeName + " - " + parentQName,
val proposal = (createCompletionProposal(proposalString, proposalString + " - " + parentQName,
null, context) as ConfigurableCompletionProposal)
proposal.setAdditionalData(ImportReplacementTextApplier::ADDITIONAL_DATA_QNAME, qname)
proposal.setAdditionalProposalInfo(typeName)
Expand All @@ -443,6 +452,20 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {
}
}

def createTabItemProposal(EObject model, Assignment assignment, ContentAssistContext context,
ICompletionProposalAcceptor acceptor) {
val widgetTypeERef = GrammarUtil.getReference(assignment.getTerminal() as CrossReference)
val IScope scope = model.getScope(widgetTypeERef, context)
val scopeAllElements = scope.allElements

for (IEObjectDescription description : scopeAllElements) {
val proposalName = description.qualifiedName
val proposal = (createCompletionProposal(proposalName + " tab", proposalName + " tab",
null, context) as ConfigurableCompletionProposal)
acceptor.accept(proposal)
}
}

def isGivenIAmOnThe(ContentAssistContext context){
var parent = context.lastCompleteNode?.parent?.grammarElement
switch(parent){
Expand Down Expand Up @@ -499,8 +522,8 @@ class FeatureProposalProvider extends AbstractFeatureProposalProvider {
def getScreenBeforeOffset(EObject model, ContentAssistContext context) {
var Screen screen = null
for (BToScreenSwitch screenSwitch : model.getContainerOfType(BScenario).getAllContentsOfType(BToScreenSwitch)) {
if (screenSwitch.determineScreen != null && context.offset > NodeModelUtils.getNode(screenSwitch).offset) {
screen = screenSwitch.determineScreen
if (screenSwitch.screen != null && context.offset > NodeModelUtils.getNode(screenSwitch).offset) {
screen = screenSwitch.screen
}
}
return screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class ImportReplacementTextApplier extends ReplacementTextApplier {
val replacementString = if (useQualifiedName) {
getActualReplacementString(proposal)
} else {
proposal.replacementString
val proposalRepString = proposal.replacementString
if (proposalRepString.endsWith("::")) proposalRepString else proposalRepString
}
proposal.setCursorPosition(replacementString.length());
document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(), replacementString);
Expand All @@ -87,7 +88,9 @@ class ImportReplacementTextApplier extends ReplacementTextApplier {
override getActualReplacementString(ConfigurableCompletionProposal proposal) {
val qname = (proposal.getAdditionalData(ADDITIONAL_DATA_QNAME) as QualifiedName)
val simpleName = qualifiedNameConverter.toString(qname)
val actualString = simpleName + " " + proposal.additionalProposalInfo + " "
// proposal additional info: type name or ::
val proposalInfo = proposal.additionalProposalInfo
val actualString = simpleName + (if ("::".equals(proposalInfo)) proposalInfo else " " + proposalInfo + " ")
return actualString
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ BScreenContext:

BToScreenSwitch:
{BToScreenSwitch}
screen=[uid::Screen|QualifiedName] ('::' componentPartScreen=[uid::Screen|QualifiedName])? 'screen'
//screen=[uid::Screen|QualifiedName] ('::' componentPartScreen=[uid::Screen|QualifiedName])? 'screen'
(OnTab componentScreen=[uid::Screen|QualifiedName] '::' | OnScreen) screen=[uid::Screen|QualifiedName]
;

BCodeStatement:
Expand Down Expand Up @@ -325,6 +326,14 @@ GivenIamOnThe:
'Given' 'I' 'am' 'on' 'the'
;

OnScreen:
'screen'
;

OnTab:
'tab'
;

AndI:
'and' 'I'
;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,31 @@ class FeatureScopeProvider extends AbstractDeclarativeScopeProvider {
return scope
}

def IScope scope_BToScreenSwitch_screen(BToScreenSwitch ctx, EReference ref) {
val scope = delegateGetScope(ctx, ref)
return scope
}

def IScope scope_BToScreenSwitch_componentPartScreen(EObject ctx, EReference ref) {
val originalScope = delegateGetScope(ctx, ref)
//if the referenced screen/widget is a "Part" of another component(e.g. tab screen as part of tabbedpane)
//then the function isComponentPart returns true

val screenSwitch = ctx as BToScreenSwitch
val component = screenSwitch.screen

def IScope scope_BToScreenSwitch_componentScreen(BToScreenSwitch ctx, EReference ref) {
val originalScope = delegateGetScope(ctx, ref)
val scope = new FilteringScope(originalScope,[
isComponentPart && isComponentPartOf(component)
isComponent
])
debugScope(scope)
return scope
//debugScope(scope)
return scope
}

def IScope scope_BToScreenSwitch_screen(BToScreenSwitch ctx, EReference ref) {
val componentScreen = ctx.componentScreen
val originalScope = delegateGetScope(ctx, ref)
val scope = if (componentScreen != null) {
// component part (tab) of a component screen
new FilteringScope(originalScope,[
isComponentPart && isComponentPartOf(componentScreen)
])
} else {
// not a component part (tab)
new FilteringScope(originalScope,[
!isComponentPart
])
}
//debugScope(scope)
return scope
}

def EObject getEObject(IEObjectDescription description, EObject ctx) {
Expand Down
Loading

0 comments on commit 170a5ba

Please sign in to comment.