[jboss-svn-commits] JBL Code SVN: r35500 - in labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor: client/ruleeditor and 2 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Wed Oct 13 09:20:11 EDT 2010
Author: Rikkola
Date: 2010-10-13 09:20:11 -0400 (Wed, 13 Oct 2010)
New Revision: 35500
Added:
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CommentWidget.java
Modified:
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/DiscussionWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/MetaDataWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleDocumentWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QueryWidget.java
labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.css
Log:
Some CSS changes for the DisclosurePanel.
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/decisiontable/GuidedDecisionTableWidget.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -140,7 +140,6 @@
DisclosurePanel disclosurePanel = new DisclosurePanel( constants.DecisionTable() );
disclosurePanel.setAnimationEnabled(true);
- disclosurePanel.addStyleName("my-DisclosurePanel");
disclosurePanel.setWidth("100%");
disclosurePanel.setTitle( constants.DecisionTable() );
Added: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CommentWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CommentWidget.java (rev 0)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/CommentWidget.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.drools.guvnor.client.ruleeditor;
+
+import org.drools.guvnor.client.common.DirtyableComposite;
+import org.drools.guvnor.client.messages.Constants;
+import org.drools.guvnor.client.rpc.MetaData;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.logical.shared.OpenEvent;
+import com.google.gwt.event.logical.shared.OpenHandler;
+import com.google.gwt.user.client.ui.DisclosurePanel;
+import com.google.gwt.user.client.ui.TextArea;
+
+/**
+ *
+ * @author rikkola
+ *
+ */
+public class CommentWidget extends DirtyableComposite {
+
+ private Constants constants = ((Constants) GWT.create( Constants.class ));
+
+ private final TextArea text;
+ private final DisclosurePanel disclosurePanel;
+
+ public CommentWidget(final MetaData data) {
+ text = getTextArea();
+ disclosurePanel = getDisclosurePanel();
+
+ disclosurePanel.setContent( text );
+
+ disclosurePanel.addOpenHandler( new OpenHandler<DisclosurePanel>() {
+ public void onOpen(OpenEvent<DisclosurePanel> event) {
+ loadData( data );
+ }
+ } );
+
+ if ( isDescriptionUnSet( data ) ) {
+ disclosurePanel.setOpen( true );
+ }
+
+ initWidget( disclosurePanel );
+
+ }
+
+ private DisclosurePanel getDisclosurePanel() {
+ DisclosurePanel disclosurePanel = new DisclosurePanel( constants.Description() );
+ disclosurePanel.setAnimationEnabled( true );
+ disclosurePanel.setWidth( "100%" );
+ return disclosurePanel;
+ }
+
+ private TextArea getTextArea() {
+ TextArea text = new TextArea();
+ text.setWidth( "90%" );
+ text.setVisibleLines( 5 );
+ text.setStyleName( "rule-viewer-Documentation" ); //NON-NLS
+ text.setTitle( constants.RuleDocHint() );
+ return text;
+ }
+
+ private boolean isDescriptionUnSet(MetaData data) {
+ return data.description == null || data.description.equals( "" ) || data.description.equals( "<documentation>" );
+ }
+
+ private void loadData(final MetaData data) {
+ text.setText( data.description );
+ text.addChangeHandler( new ChangeHandler() {
+
+ public void onChange(ChangeEvent event) {
+ data.description = text.getText();
+ makeDirty();
+ }
+ } );
+ if ( data.description == null || "".equals( data.description ) ) {
+ text.setText( constants.documentationDefault() );
+ }
+ }
+}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/DiscussionWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/DiscussionWidget.java 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/DiscussionWidget.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -59,88 +59,82 @@
*/
public class DiscussionWidget extends Composite {
- private static Constants constants = ((Constants) GWT.create(Constants.class));
+ private static Constants constants = ((Constants) GWT.create( Constants.class ));
- private VerticalPanel commentList = new VerticalPanel();
- private VerticalPanel newCommentLayout = new VerticalPanel();
- private RuleAsset asset;
+ private VerticalPanel commentList = new VerticalPanel();
+ private VerticalPanel newCommentLayout = new VerticalPanel();
+ private RuleAsset asset;
private ServerPushNotification pushNotify;
- private int lastCount = 0;
+ private int lastCount = 0;
@Override
protected void onUnload() {
- super.onUnload(); //To change body of overridden methods use File | Settings | File Templates.
- PushClient.instance().unsubscribe(pushNotify);
+ super.onUnload(); //To change body of overridden methods use File | Settings | File Templates.
+ PushClient.instance().unsubscribe( pushNotify );
}
public DiscussionWidget(final RuleAsset asset) {
this.asset = asset;
- DisclosurePanel discussionPanel = new DisclosurePanel(
- constants.Discussion() + ":" );
- discussionPanel.setAnimationEnabled(true);
- discussionPanel.addStyleName("my-DisclosurePanel");
- discussionPanel.setWidth("100%");
- //discussionPanel.setOpen(true);
-
-/* final Panel discussionPanel = new Panel();
- discussionPanel.setCollapsible( true );
- discussionPanel.setTitle(constants.Discussion() + ":" );
- discussionPanel.setBodyBorder(false);*/
+ DisclosurePanel discussionPanel = new DisclosurePanel( constants.Discussion() );
+ discussionPanel.setAnimationEnabled( true );
+ discussionPanel.setWidth( "100%" );
- commentList.setWidth("100%");
+ commentList.setWidth( "100%" );
VerticalPanel discussionLayout = new VerticalPanel();
- discussionLayout.setWidth("90%");
- discussionLayout.add(commentList);
-
- newCommentLayout.setWidth("100%");
+ discussionLayout.setWidth( "90%" );
+ discussionLayout.add( commentList );
+
+ newCommentLayout.setWidth( "100%" );
refreshDiscussion();
- discussionLayout.add(newCommentLayout);
+ discussionLayout.add( newCommentLayout );
showNewCommentButton();
- discussionPanel.setContent(discussionLayout);
-
+ discussionPanel.setContent( discussionLayout );
+
pushNotify = new ServerPushNotification() {
public void messageReceived(PushResponse response) {
- if ("discussion".equals(response.messageType) &&
- asset.uuid.equals(response.message)) {
- System.err.println("Refreshing discussion...");
+ if ( "discussion".equals( response.messageType ) && asset.uuid.equals( response.message ) ) {
+ System.err.println( "Refreshing discussion..." );
refreshDiscussion();
}
}
};
- PushClient.instance().subscribe(pushNotify);
+ PushClient.instance().subscribe( pushNotify );
- initWidget(discussionPanel);
+ initWidget( discussionPanel );
}
/** Hit up the server */
public void refreshDiscussion() {
- RepositoryServiceFactory.getService().loadDiscussionForAsset(asset.uuid, new GenericCallback<List<DiscussionRecord>>() {
- public void onSuccess(List<DiscussionRecord> result) {
- updateCommentList(result);
- }
- });
+ RepositoryServiceFactory.getService().loadDiscussionForAsset( asset.uuid,
+ new GenericCallback<List<DiscussionRecord>>() {
+ public void onSuccess(List<DiscussionRecord> result) {
+ updateCommentList( result );
+ }
+ } );
}
private void updateCommentList(List<DiscussionRecord> ls) {
- if (ls.size() == lastCount) return; //don't want to over do it boys...
+ if ( ls.size() == lastCount ) return; //don't want to over do it boys...
commentList.clear();
- for(DiscussionRecord dr: ls) {
- appendComment(dr);
+ for ( DiscussionRecord dr : ls ) {
+ appendComment( dr );
}
lastCount = ls.size();
}
private Widget appendComment(DiscussionRecord r) {
- SmallLabel hrd = new SmallLabel(Format.format(constants.smallCommentBy0On1Small(), r.author, new Date(r.timestamp).toString()));
- hrd.addStyleName("discussion-header");
- commentList.add(hrd);
- Label lbl = new Label(r.note);
- lbl.setStyleName("x-form-field");
- commentList.add(lbl);
- commentList.add(new HTML("<br/>"));
+ SmallLabel hrd = new SmallLabel( Format.format( constants.smallCommentBy0On1Small(),
+ r.author,
+ new Date( r.timestamp ).toString() ) );
+ hrd.addStyleName( "discussion-header" );
+ commentList.add( hrd );
+ Label lbl = new Label( r.note );
+ lbl.setStyleName( "x-form-field" );
+ commentList.add( lbl );
+ commentList.add( new HTML( "<br/>" ) );
return hrd;
}
@@ -149,76 +143,80 @@
HorizontalPanel hp = new HorizontalPanel();
- Button createNewComment = new Button(constants.AddADiscussionComment());
- hp.add(createNewComment);
+ Button createNewComment = new Button( constants.AddADiscussionComment() );
+ hp.add( createNewComment );
- if (ExplorerLayoutManager.shouldShow(Capabilities.SHOW_ADMIN)) {
- Button adminClearAll = new Button(constants.EraseAllComments());
- hp.add(adminClearAll);
- adminClearAll.addClickHandler(new ClickHandler() {
+ if ( ExplorerLayoutManager.shouldShow( Capabilities.SHOW_ADMIN ) ) {
+ Button adminClearAll = new Button( constants.EraseAllComments() );
+ hp.add( adminClearAll );
+ adminClearAll.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent sender) {
- if (Window.confirm(constants.EraseAllCommentsWarning())) {
- RepositoryServiceFactory.getService().clearAllDiscussionsForAsset(asset.uuid, new GenericCallback() {
- public void onSuccess(Object result) {
- updateCommentList(new ArrayList<DiscussionRecord>());
- }
- });
+ if ( Window.confirm( constants.EraseAllCommentsWarning() ) ) {
+ RepositoryServiceFactory.getService().clearAllDiscussionsForAsset( asset.uuid,
+ new GenericCallback() {
+ public void onSuccess(Object result) {
+ updateCommentList( new ArrayList<DiscussionRecord>() );
+ }
+ } );
}
}
- });
+ } );
}
- String feedURL = GWT.getModuleBaseURL() + "feed/discussion?package=" + asset.metaData.packageName+
- "&assetName=" + URL.encode(asset.metaData.name) + "&viewUrl=" + BrowseTree.getSelfURL();
- hp.add(new HTML("<a href='" + feedURL + "' target='_blank'><img src='images/feed.png'/></a>"));
+ String feedURL = GWT.getModuleBaseURL() + "feed/discussion?package=" + asset.metaData.packageName + "&assetName=" + URL.encode( asset.metaData.name ) + "&viewUrl=" + BrowseTree.getSelfURL();
+ hp.add( new HTML( "<a href='" + feedURL + "' target='_blank'><img src='images/feed.png'/></a>" ) );
- newCommentLayout.add(hp);
-
- newCommentLayout.setCellHorizontalAlignment(hp, HasHorizontalAlignment.ALIGN_RIGHT);
- createNewComment.addClickHandler(new ClickHandler() {
+ newCommentLayout.add( hp );
+
+ newCommentLayout.setCellHorizontalAlignment( hp,
+ HasHorizontalAlignment.ALIGN_RIGHT );
+ createNewComment.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent sender) {
showAddNewComment();
}
- });
+ } );
}
private void showAddNewComment() {
newCommentLayout.clear();
final TextArea comment = new TextArea();
- comment.setWidth("100%");
- newCommentLayout.add(comment);
+ comment.setWidth( "100%" );
+ newCommentLayout.add( comment );
- Button ok = new Button(constants.OK());
- Button cancel = new Button(constants.Cancel());
+ Button ok = new Button( constants.OK() );
+ Button cancel = new Button( constants.Cancel() );
- ok.addClickHandler(new ClickHandler() {
+ ok.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent sender) {
- sendNewComment(comment.getText());
+ sendNewComment( comment.getText() );
}
- });
+ } );
- cancel.addClickHandler(new ClickHandler() {
+ cancel.addClickHandler( new ClickHandler() {
public void onClick(ClickEvent sender) {
showNewCommentButton();
}
- });
+ } );
HorizontalPanel hp = new HorizontalPanel();
- hp.add(ok); hp.add(cancel);
+ hp.add( ok );
+ hp.add( cancel );
- newCommentLayout.add(hp);
-
- comment.setFocus(true);
+ newCommentLayout.add( hp );
+
+ comment.setFocus( true );
}
private void sendNewComment(String text) {
newCommentLayout.clear();
- newCommentLayout.add(new Image("images/spinner.gif"));
- RepositoryServiceFactory.getService().addToDiscussionForAsset(asset.uuid, text, new GenericCallback<List<DiscussionRecord>>() {
- public void onSuccess(List<DiscussionRecord> result) {
- showNewCommentButton();
- updateCommentList(result);
- }
- });
+ newCommentLayout.add( new Image( "images/spinner.gif" ) );
+ RepositoryServiceFactory.getService().addToDiscussionForAsset( asset.uuid,
+ text,
+ new GenericCallback<List<DiscussionRecord>>() {
+ public void onSuccess(List<DiscussionRecord> result) {
+ showNewCommentButton();
+ updateCommentList( result );
+ }
+ } );
}
}
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/MetaDataWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/MetaDataWidget.java 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/MetaDataWidget.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -273,7 +273,6 @@
DisclosurePanel advancedDisclosure = new DisclosurePanel(
currentSectionName);
advancedDisclosure.setAnimationEnabled(true);
- advancedDisclosure.addStyleName("my-DisclosurePanel");
advancedDisclosure.setWidth("100%");
advancedDisclosure.setOpen(collapsed);
advancedDisclosure.setContent(this.currentSection);
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleDocumentWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleDocumentWidget.java 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleDocumentWidget.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -1,20 +1,3 @@
-/**
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.drools.guvnor.client.ruleeditor;
/*
* Copyright 2005 JBoss Inc
*
@@ -31,16 +14,15 @@
* limitations under the License.
*/
+package org.drools.guvnor.client.ruleeditor;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.ui.*;
-import com.google.gwt.user.client.DeferredCommand;
-import com.google.gwt.user.client.Command;
import org.drools.guvnor.client.common.DirtyableComposite;
-import org.drools.guvnor.client.messages.Constants;
-import org.drools.guvnor.client.rpc.MetaData;
import org.drools.guvnor.client.rpc.RuleAsset;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.DeferredCommand;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
/**
* This holds the editor and viewer for rule documentation.
* It will update the model when the text is changed.
@@ -49,55 +31,21 @@
*/
public class RuleDocumentWidget extends DirtyableComposite {
- private TextArea text;
- private Constants constants = ((Constants) GWT.create(Constants.class));
+ final VerticalPanel layout = new VerticalPanel();
public RuleDocumentWidget(final RuleAsset asset) {
- MetaData data = asset.metaData;
- text = new TextArea();
- text.setWidth( "90%" );
- text.setVisibleLines( 5 );
- text.setStyleName( "rule-viewer-Documentation" ); //NON-NLS
- text.setTitle(constants.RuleDocHint());
- DisclosurePanel p = new DisclosurePanel(
- constants.Description() + ":" );
- p.setAnimationEnabled(true);
- p.addStyleName("my-DisclosurePanel");
- p.setWidth("100%");
+ layout.add( new CommentWidget( asset.metaData ) );
- if (data.description == null || data.description.equals("") || data.description.equals("<documentation>")) {
- p.setOpen(true);
- }
- p.setContent(text);
-
- final VerticalPanel vp = new VerticalPanel();
-
- vp.add(p);
-
- DeferredCommand.addCommand(new Command() {
+ DeferredCommand.addCommand( new Command() {
public void execute() {
- vp.add(new DiscussionWidget(asset));
+ layout.add( new DiscussionWidget( asset ) );
}
- });
+ } );
- vp.setWidth("100%");
+ layout.setWidth( "100%" );
- loadData(data);
-
- initWidget(vp);
- }
-
- private void loadData(final MetaData data) {
- text.setText(data.description);
- text.addChangeListener( new ChangeListener() {
- public void onChange(Widget w) {
- data.description = text.getText();
- makeDirty();
- }
- });
- if (data.description == null || "".equals(data.description )) {
- text.setText(constants.documentationDefault());
- }
+ initWidget( layout );
}
+
}
\ No newline at end of file
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/ruleeditor/RuleFlowWrapper.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -118,7 +118,6 @@
constants.Parameters());
parameterPanel.setAnimationEnabled(true);
parameterPanel.ensureDebugId("cwDisclosurePanel");
- parameterPanel.addStyleName("my-DisclosurePanel");
parameterPanel.setWidth("100%");
parameterPanel.setOpen(false);
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QueryWidget.java
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QueryWidget.java 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/client/rulelist/QueryWidget.java 2010-10-13 13:20:11 UTC (rev 35500)
@@ -72,11 +72,12 @@
DisclosurePanel advancedDisclosure = new DisclosurePanel(
constants.AttributeSearch());
advancedDisclosure.setAnimationEnabled(true);
- advancedDisclosure.addStyleName("my-DisclosurePanel");
advancedDisclosure.setWidth("100%");
advancedDisclosure.setOpen(true);
final Map<String, MetaDataQuery> atts = new HashMap<String, MetaDataQuery>() {
+ private static final long serialVersionUID = 510l;
+
{
put( constants.CreatedBy(),
new MetaDataQuery( "drools:creator" ) ); //NON-NLS
Modified: labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.css
===================================================================
--- labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.css 2010-10-13 07:47:25 UTC (rev 35499)
+++ labs/jbossrules/trunk/drools-guvnor/src/main/java/org/drools/guvnor/public/Guvnor.css 2010-10-13 13:20:11 UTC (rev 35500)
@@ -30,29 +30,20 @@
border: 0;
}
-.my-DisclosurePanel {
+.gwt-DisclosurePanel .header {
+ border: 1px solid #BCBCBC;
+ background: #E3E3E3;
+ padding-bottom:2px;
-}
-
-.my-DisclosurePanel-open {
-
-}
-
-.my-DisclosurePanel-closed {
-
-}
-
-.my-DisclosurePanel .header,.my-DisclosurePanel .header a,.my-DisclosurePanel .header td
- {
- height: 30px;
- background: white;
+ width:100%;
+ height: 20px;
text-decoration: none; /* Remove underline from header */
color: white;
cursor: pointer;
cursor: hand;
}
-.my-DisclosurePanel .content {
+.gwt-DisclosurePanel .content {
border-left: 3px solid #e3e3e3;
padding: 4px 0px 4px 8px;
margin-left: 16px;
More information about the jboss-svn-commits
mailing list