/machinelearning/5.0.x/drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/swimlane/SwimlaneDialog.java

https://github.com/etirelli/droolsjbpm-contributed-experiments · Java · 66 lines · 37 code · 9 blank · 20 comment · 1 complexity · 36b5379c2680af847296d1a20f434699 MD5 · raw file

  1. package org.drools.eclipse.flow.ruleflow.view.property.swimlane;
  2. /*
  3. * Copyright 2005 JBoss Inc
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
  18. import org.drools.process.core.context.swimlane.Swimlane;
  19. import org.eclipse.swt.SWT;
  20. import org.eclipse.swt.layout.GridData;
  21. import org.eclipse.swt.layout.GridLayout;
  22. import org.eclipse.swt.widgets.Composite;
  23. import org.eclipse.swt.widgets.Control;
  24. import org.eclipse.swt.widgets.Label;
  25. import org.eclipse.swt.widgets.Shell;
  26. import org.eclipse.swt.widgets.Text;
  27. /**
  28. * Dialog for editing swimlanes.
  29. *
  30. * @author <a href="mailto:kris_verlaenen@hotmail.com">Kris Verlaenen</a>
  31. */
  32. public class SwimlaneDialog extends EditBeanDialog<Swimlane> {
  33. private Text nameText;
  34. public SwimlaneDialog(Shell parentShell) {
  35. super(parentShell, "Edit Swimlane");
  36. }
  37. protected Control createDialogArea(Composite parent) {
  38. final Composite composite = (Composite) super.createDialogArea(parent);
  39. GridLayout gridLayout = new GridLayout();
  40. gridLayout.numColumns = 2;
  41. composite.setLayout(gridLayout);
  42. Label nameLabel = new Label(composite, SWT.NONE);
  43. nameLabel.setText("Name: ");
  44. nameText = new Text(composite, SWT.NONE);
  45. GridData gridData = new GridData();
  46. gridData.grabExcessHorizontalSpace = true;
  47. gridData.horizontalAlignment = GridData.FILL;
  48. nameText.setLayoutData(gridData);
  49. String name = ((Swimlane) getValue()).getName();
  50. nameText.setText(name == null ? "" : name);
  51. return composite;
  52. }
  53. protected Swimlane updateValue(Swimlane value) {
  54. value.setName(nameText.getText());
  55. return value;
  56. }
  57. }