Skip to content

Commit

Permalink
BZ-1017886: Added project name and description to pom.
Browse files Browse the repository at this point in the history
Improvements to project settings panel.
(cherry-picked from cb388fc)
  • Loading branch information
jrenaat committed Oct 22, 2013
1 parent cae2d5f commit 9f91bc5
Show file tree
Hide file tree
Showing 11 changed files with 242 additions and 57 deletions.
Expand Up @@ -122,7 +122,7 @@ public void setPresenter(Presenter presenter) {
@Override
public void showGAVPanel() {
deckPanel.showWidget(GAV_PANEL_INDEX);
setGAVDropboxTitle(ProjectEditorResources.CONSTANTS.GroupArtifactVersion());
setGAVDropboxTitle(ProjectEditorResources.CONSTANTS.ProjectGeneralSettings());
}

@Override
Expand All @@ -131,8 +131,8 @@ public void showGAVMetadataPanel() {
setGAVDropboxTitle(ProjectEditorResources.CONSTANTS.Metadata());
}

@UiHandler(value = "gavButton")
public void onGAVButtonClick(ClickEvent clickEvent) {
@UiHandler(value = "generalSettingsButton")
public void onGeneralSettingsButtonClick(ClickEvent clickEvent) {
presenter.onGAVPanelSelected();
}

Expand Down
Expand Up @@ -26,14 +26,14 @@

<bootstrap:FluidContainer width="90%">
<bootstrap:FluidRow addStyleNames="well">
<bootstrap:DropdownButton text="Project Settings: Group arfifact version" ui:field="dropDownButton">
<bootstrap:DropdownButton text="{i18n.ProjectSettings}" ui:field="dropDownButton">

<bootstrap:NavList>
<bootstrap:NavHeader>
<ui:text from="{i18n.ProjectSettings}"/>
</bootstrap:NavHeader>
<bootstrap:NavLink ui:field="gavButton">
<ui:text from="{i18n.GroupArtifactVersion}"/>
<bootstrap:NavLink ui:field="generalSettingsButton">
<ui:text from="{i18n.ProjectGeneralSettings}"/>
</bootstrap:NavLink>
<bootstrap:NavLink ui:field="dependenciesButton">
<ui:text from="{i18n.Dependencies}"/>
Expand Down
@@ -1,6 +1,8 @@
package org.kie.workbench.common.screens.projecteditor.client.forms;

import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.google.gwt.dom.client.Style;
import org.kie.workbench.common.screens.projecteditor.client.resources.ProjectEditorResources;
import org.kie.workbench.common.screens.projecteditor.client.resources.i18n.ProjectEditorConstants;

Expand All @@ -27,6 +29,15 @@ interface Binder
@UiField
TextBox groupIdTextBox;

@UiField
Icon gavHelpIcon;

@UiField
Icon gavHelpIcon2;

@UiField
Icon gavHelpIcon3;

@UiField
TextBox artifactIdTextBox;

Expand All @@ -37,6 +48,13 @@ interface Binder

public GAVEditorViewImpl() {
initWidget(uiBinder.createAndBindUi(this));

gavHelpIcon.getElement().getStyle().setPaddingLeft( 10, Style.Unit.PX );
gavHelpIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);
gavHelpIcon2.getElement().getStyle().setPaddingLeft( 10, Style.Unit.PX );
gavHelpIcon2.getElement().getStyle().setCursor(Style.Cursor.POINTER);
gavHelpIcon3.getElement().getStyle().setPaddingLeft( 10, Style.Unit.PX );
gavHelpIcon3.getElement().getStyle().setCursor(Style.Cursor.POINTER);
}

@Override
Expand Down
Expand Up @@ -17,40 +17,72 @@
-->
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
xmlns:gwt='urn:import:com.google.gwt.user.client.ui'
xmlns:bootstrap='urn:import:com.github.gwtbootstrap.client.ui'>

<ui:with field="i18n"
type="org.kie.workbench.common.screens.projecteditor.client.resources.i18n.ProjectEditorConstants"/>
<ui:with field="resources"
type="org.kie.workbench.common.screens.projecteditor.client.resources.ProjectEditorResources"/>

<bootstrap:Form type="HORIZONTAL">
<bootstrap:Fieldset>
<bootstrap:ControlLabel for="groupIdTextBox">
<ui:text from="{i18n.GroupID}"/>
</bootstrap:ControlLabel>
<bootstrap:Controls>
<bootstrap:TextBox bootstrap:id="groupIdTextBox" ui:field="groupIdTextBox"/>
</bootstrap:Controls>
</bootstrap:Fieldset>
<gwt:HTMLPanel>
<bootstrap:Form type="INLINE">
<bootstrap:FluidRow>
<bootstrap:Column size="2">
<bootstrap:ControlLabel for="groupIdTextBox" >
<ui:text from="{i18n.GroupID}"/>
</bootstrap:ControlLabel>
</bootstrap:Column>
<bootstrap:Column size="4">
<bootstrap:Controls>
<bootstrap:TextBox ui:field="groupIdTextBox"/>
</bootstrap:Controls>
</bootstrap:Column>
<bootstrap:Column size="6">
<bootstrap:HelpInline text="{i18n.GroupIdExample}"></bootstrap:HelpInline>
<bootstrap:Popover placement="LEFT" trigger="HOVER" heading="{i18n.MoreInfo}" text="{i18n.GroupIdMoreInfo}">
<bootstrap:Icon ui:field="gavHelpIcon" type="QUESTION_SIGN"></bootstrap:Icon>
</bootstrap:Popover>
</bootstrap:Column>
</bootstrap:FluidRow>

<bootstrap:Fieldset>
<bootstrap:ControlLabel for="artifactIdTextBox">
<ui:text from="{i18n.ArtifactID}"/>
</bootstrap:ControlLabel>
<bootstrap:Controls>
<bootstrap:TextBox bootstrap:id="artifactIdTextBox" ui:field="artifactIdTextBox"/>
</bootstrap:Controls>
</bootstrap:Fieldset>
<bootstrap:FluidRow>
<bootstrap:Column size="2">
<bootstrap:ControlLabel for="artifactIdTextBox">
<ui:text from="{i18n.ArtifactID}"/>
</bootstrap:ControlLabel>
</bootstrap:Column>
<bootstrap:Column size="4">
<bootstrap:Controls>
<bootstrap:TextBox ui:field="artifactIdTextBox"/>
</bootstrap:Controls>
</bootstrap:Column>
<bootstrap:Column size="6">
<bootstrap:HelpInline text="{i18n.ArtifactIDExample}"></bootstrap:HelpInline>
<bootstrap:Popover placement="LEFT" trigger="HOVER" heading="{i18n.MoreInfo}" text="{i18n.ArtifactIDMoreInfo}">
<bootstrap:Icon ui:field="gavHelpIcon2" type="QUESTION_SIGN"></bootstrap:Icon>
</bootstrap:Popover>
</bootstrap:Column>
</bootstrap:FluidRow>

<bootstrap:Fieldset>
<bootstrap:ControlLabel for="versionIdTextBox">
<ui:text from="{i18n.VersionID}"/>
</bootstrap:ControlLabel>
<bootstrap:Controls>
<bootstrap:TextBox bootstrap:id="versionIdTextBox" ui:field="versionIdTextBox"/>
</bootstrap:Controls>
</bootstrap:Fieldset>

</bootstrap:Form>
<bootstrap:FluidRow>
<bootstrap:Column size="2">
<bootstrap:ControlLabel for="versionIdTextBox">
<ui:text from="{i18n.VersionID}"/>
</bootstrap:ControlLabel>
</bootstrap:Column>
<bootstrap:Column size="4">
<bootstrap:Controls>
<bootstrap:TextBox ui:field="versionIdTextBox"/>
</bootstrap:Controls>
</bootstrap:Column>
<bootstrap:Column size="6">
<bootstrap:HelpInline text="{i18n.VersionIDExample}"></bootstrap:HelpInline>
<bootstrap:Popover placement="LEFT" trigger="HOVER" heading="{i18n.MoreInfo}" text="{i18n.VersionIDMoreInfo}">
<bootstrap:Icon ui:field="gavHelpIcon3" type="QUESTION_SIGN"></bootstrap:Icon>
</bootstrap:Popover>
</bootstrap:Column>
</bootstrap:FluidRow>
</bootstrap:Form>
</gwt:HTMLPanel>
</ui:UiBinder>
Expand Up @@ -25,15 +25,16 @@
import org.kie.workbench.common.screens.projecteditor.client.resources.i18n.ProjectEditorConstants;

public class POMEditorPanel
implements IsWidget {
implements POMEditorPanelView.Presenter,
IsWidget {

private final POMEditorPanelView view;
private POM model;

@Inject
public POMEditorPanel(final POMEditorPanelView view) {
this.view = view;

view.setPresenter( this );
}

public void setPOM(POM model, boolean isReadOnly) {
Expand All @@ -43,6 +44,8 @@ public void setPOM(POM model, boolean isReadOnly) {

this.model = model;

view.setName(model.getName());
view.setDescription(model.getDescription());
view.setGAV(model.getGav());
view.addArtifactIdChangeHandler(new ArtifactIdChangeHandler() {
@Override
Expand All @@ -61,6 +64,16 @@ private void setTitle(final String titleText) {
}
}

@Override
public void onNameChange( String name ) {
this.model.setName( name );
}

@Override
public void onDescriptionChange( String description ) {
this.model.setDescription( description );
}

@Override
public Widget asWidget() {
return view.asWidget();
Expand Down
Expand Up @@ -16,22 +16,33 @@

package org.kie.workbench.common.screens.projecteditor.client.forms;

import java.util.List;

import com.google.gwt.user.client.ui.IsWidget;
import org.guvnor.common.services.project.model.Dependency;
import org.guvnor.common.services.project.model.GAV;
import org.kie.workbench.common.widgets.client.widget.HasBusyIndicator;

public interface POMEditorPanelView extends HasBusyIndicator,
IsWidget {

interface Presenter {

void onNameChange(String name);

void onDescriptionChange(String description);

}

void setPresenter(Presenter presenter);

String getTitleWidget();

void setTitleText( String titleText );

void showSaveSuccessful( String fileName );

void setName( String projectName );

void setDescription( String projectDescription );

void setGAV( GAV gav );

void addArtifactIdChangeHandler( ArtifactIdChangeHandler changeHandler );
Expand Down
Expand Up @@ -16,23 +16,26 @@

package org.kie.workbench.common.screens.projecteditor.client.forms;

import java.util.List;
import javax.enterprise.event.Event;
import javax.inject.Inject;

import com.github.gwtbootstrap.client.ui.TextArea;
import com.github.gwtbootstrap.client.ui.TextBox;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.ResizeComposite;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Widget;
import org.guvnor.common.services.project.model.GAV;
import org.kie.workbench.common.screens.projecteditor.client.resources.ProjectEditorResources;
import org.kie.workbench.common.screens.projecteditor.client.resources.i18n.ProjectEditorConstants;
import org.uberfire.client.common.BusyPopup;
import org.uberfire.workbench.events.NotificationEvent;

public class POMEditorPanelViewImpl
extends ResizeComposite
// extends ResizeComposite
extends Composite
implements POMEditorPanelView {

private String tabTitleLabel = ProjectEditorResources.CONSTANTS.ProjectModel();
Expand All @@ -47,9 +50,17 @@ interface GroupArtifactVersionEditorPanelViewImplBinder

private final Event<NotificationEvent> notificationEvent;

@UiField
TextBox pomNameTextBox;

@UiField
TextArea pomDescriptionTextArea;

@UiField(provided = true)
GAVEditor gavEditor;

private Presenter presenter;

@Inject
public POMEditorPanelViewImpl( Event<NotificationEvent> notificationEvent,
GAVEditor gavEditor,
Expand All @@ -59,6 +70,11 @@ public POMEditorPanelViewImpl( Event<NotificationEvent> notificationEvent,
this.notificationEvent = notificationEvent;
}

@Override
public void setPresenter(Presenter presenter) {
this.presenter = presenter;
}

@Override
public void showSaveSuccessful( String fileName ) {
notificationEvent.fire( new NotificationEvent( ProjectEditorResources.CONSTANTS.SaveSuccessful( fileName ) ) );
Expand All @@ -69,6 +85,16 @@ public String getTitleWidget() {
return tabTitleLabel;
}

@Override
public void setName( String projectName ) {
pomNameTextBox.setText( projectName );
}

@Override
public void setDescription( String projectDescription ) {
pomDescriptionTextArea.setText( projectDescription );
}

@Override
public void setGAV( GAV gav ) {
gavEditor.setGAV( gav );
Expand All @@ -89,13 +115,6 @@ public void setTitleText( String titleText ) {
tabTitleLabel = titleText;
}

@Override
public void onResize() {
setPixelSize( getParent().getOffsetWidth(),
getParent().getOffsetHeight() );
super.onResize();
}

@Override
public void showBusyIndicator( final String message ) {
BusyPopup.showMessage( message );
Expand All @@ -106,4 +125,13 @@ public void hideBusyIndicator() {
BusyPopup.close();
}

@UiHandler("pomNameTextBox")
public void onNameChange(ValueChangeEvent<String> event) {
presenter.onNameChange(pomNameTextBox.getText());
}

@UiHandler("pomDescriptionTextArea")
public void onDescriptionChange(ValueChangeEvent<String> event) {
presenter.onDescriptionChange(pomDescriptionTextArea.getText());
}
}

0 comments on commit 9f91bc5

Please sign in to comment.