private void limpaCampos() {
   ligaCampos();
   nome.setValue("");
   email.setValue("");
   telefone.setValue("");
   cargo.setValue("");
   login.setValue("");
   senha1.setValue("");
   senha2.setValue("");
   admin.setValue(false);
   desligaCampos();
 }
예제 #2
0
  public SearchView(final AddressBookApplication app) {
    this.app = app;
    addStyleName("view");

    setCaption("Search contacts");
    setSizeFull();

    /* Use a FormLayout as main layout for this Panel */
    FormLayout formLayout = new FormLayout();
    setContent(formLayout);

    /* Create UI components */
    tf = new TextField("Search term");
    fieldToSearch = new NativeSelect("Field to search");
    saveSearch = new CheckBox("Save search");
    searchName = new TextField("Search name");
    Button search = new Button("Search");

    /* Initialize fieldToSearch */
    for (int i = 0; i < PersonContainer.NATURAL_COL_ORDER.length; i++) {
      fieldToSearch.addItem(PersonContainer.NATURAL_COL_ORDER[i]);
      fieldToSearch.setItemCaption(
          PersonContainer.NATURAL_COL_ORDER[i], PersonContainer.COL_HEADERS_ENGLISH[i]);
    }

    fieldToSearch.setValue("lastName");
    fieldToSearch.setNullSelectionAllowed(false);

    /* Initialize save checkbox */
    saveSearch.setValue(true);
    saveSearch.setImmediate(true);
    saveSearch.addListener(
        new ClickListener() {
          public void buttonClick(ClickEvent event) {
            searchName.setVisible(event.getButton().booleanValue());
          }
        });

    search.addListener(
        new Button.ClickListener() {
          public void buttonClick(ClickEvent event) {
            performSearch();
          }
        });

    /* Add all the created components to the form */
    addComponent(tf);
    addComponent(fieldToSearch);
    addComponent(saveSearch);
    addComponent(searchName);
    addComponent(search);
  }
예제 #3
0
  @Override
  protected void initFromConfig() {

    myWebLoginMessage.setValue(MyTunesRss.CONFIG.getWebLoginMessage());
    myWebWelcomeMessage.setValue(MyTunesRss.CONFIG.getWebWelcomeMessage());
    myServerBrowserActive.setValue(MyTunesRss.CONFIG.isServerBrowserActive());
    myOpenIdActive.setValue(MyTunesRss.CONFIG.isOpenIdActive());
    myProxyHost.setValue(MyTunesRss.CONFIG.getProxyHost());
    myProxyPort.setValue(MyTunesRss.CONFIG.getProxyPort(), 1, 65535, "");
    myMailHost.setValue(MyTunesRss.CONFIG.getMailHost());
    myMailPort.setValue(MyTunesRss.CONFIG.getMailPort(), 1, 65535, "");
    mySmtpProtocol.setValue(MyTunesRss.CONFIG.getSmtpProtocol());
    myMailLogin.setValue(MyTunesRss.CONFIG.getMailLogin());
    myMailPassword.setValue(MyTunesRss.CONFIG.getMailPassword());
    myMailSender.setValue(MyTunesRss.CONFIG.getMailSender());
    myHeadless.setValue(MyTunesRss.CONFIG.isHeadless());
    myGraphicsMagickEnabled.setValue(MyTunesRss.CONFIG.isGmEnabled());
    myGraphicsMagickBinary.setValue(
        MyTunesRss.CONFIG.getGmExecutable() != null
            ? MyTunesRss.CONFIG.getGmExecutable().getAbsolutePath()
            : "");
  }
예제 #4
0
  private Component toggleEnabled() {
    CheckBox enabledToggle = new CheckBox();
    enabledToggle.setImmediate(true);
    enabledToggle.setValue(true);
    enabledToggle.setCaption("Enabled");
    enabledToggle.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(ValueChangeEvent event) {
            setEnabled((Boolean) event.getProperty().getValue());
          }
        });

    return enabledToggle;
  }
예제 #5
0
 @Override
 protected void initFromConfig() {
   myTranscoderTable.removeAllItems();
   for (TranscoderConfig transcoderConfig : myTranscoderConfigs) {
     addTranscoderConfigTableItem(transcoderConfig);
   }
   myTranscodingCacheMaxGiB.setValue(MyTunesRss.CONFIG.getTranscodingCacheMaxGiB(), 1, 1024, "1");
   myHttpLiveStreamCacheMaxGiB.setValue(
       MyTunesRss.CONFIG.getHttpLiveStreamCacheMaxGiB(), 1, 1024, "5");
   myVlcEnabled.setValue(MyTunesRss.CONFIG.isVlcEnabled());
   myVlcBinary.setValue(
       MyTunesRss.CONFIG.getVlcExecutable() != null
           ? MyTunesRss.CONFIG.getVlcExecutable().getAbsolutePath()
           : "");
   setTablePageLengths();
 }
예제 #6
0
  protected Object addTaskRow(
      Object previousTaskItemId,
      String taskName,
      String taskAssignee,
      String taskGroups,
      String taskDescription,
      Boolean startWithPrevious) {

    Object newItemId = null;
    if (previousTaskItemId == null) { // add at the end of list
      newItemId = addItem();
    } else {
      newItemId = addItemAfter(previousTaskItemId);
    }
    Item newItem = getItem(newItemId);

    // name
    newItem.getItemProperty(ID_NAME).setValue(taskName == null ? "my task" : taskName);

    // assignee
    newItem.getItemProperty(ID_ASSIGNEE).setValue(taskAssignee == null ? "" : taskAssignee);

    // groups
    newItem.getItemProperty(ID_GROUPS).setValue(taskGroups == null ? "" : taskGroups);

    // description
    TextField descriptionTextField = new TextField();
    descriptionTextField.setColumns(16);
    descriptionTextField.setRows(1);
    if (taskDescription != null) {
      descriptionTextField.setValue(taskDescription);
    }
    newItem.getItemProperty(ID_DESCRIPTION).setValue(descriptionTextField);

    // concurrency
    CheckBox startWithPreviousCheckBox =
        new CheckBox(i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_START_WITH_PREVIOUS));
    startWithPreviousCheckBox.setValue(startWithPrevious == null ? false : startWithPrevious);
    newItem.getItemProperty(ID_START_WITH_PREVIOUS).setValue(startWithPreviousCheckBox);

    // actions
    newItem.getItemProperty(ID_ACTIONS).setValue(generateActionButtons(newItemId));

    return newItemId;
  }
예제 #7
0
  private Panel designMainPanel() {
    // positioning indices
    final int leftStart = 450, topStart = 10, space = 100;
    // create the panel that will hold all components

    Panel pnlURIsProperties = new Panel("URI Display");

    pnlURIsProperties.setWidth("100%");
    pnlURIsProperties.setHeight("100%");

    // Create absolute layout specifying its properties
    final AbsoluteLayout layout = new AbsoluteLayout();
    layout.setWidth("100%");
    layout.setHeight("100%");
    layout.setSizeFull();

    // Create components Objects and specify their properties

    Button btnCorrect = new Button("Correct");
    Button btnIncorrect = new Button("Incorrect");
    Button btnUnsure = new Button("Unsure");
    Button btnGetProperties = new Button("Get properties");

    final NativeSelect cmbSourceEndpoint = new NativeSelect("Source Endpoint");
    final NativeSelect cmbDestinationEndpoint = new NativeSelect("Destination Endpoint");
    final ListSelect lstSuggestedProperties = new ListSelect("Lookup Properties");
    // to load properties of loaded resources automatically
    final CheckBox chkAutomaticPropertiesLoad =
        new CheckBox("Automatic Properties loading (next time)");
    chkAutomaticPropertiesLoad.setValue(false);

    cmbSourceEndpoint.setNullSelectionAllowed(false);
    cmbDestinationEndpoint.setNullSelectionAllowed(false);

    lstSuggestedProperties.setRows(4);
    lstSuggestedProperties.setNullSelectionAllowed(false);

    source = new Label("Source URI");
    destination = new Label("Destination URI");

    final Table tblSourcePropertiesMapping = new Table("Source Properties");
    final Table tblDestinationPropertiesMapping = new Table("Destination Properties");
    tblSourcePropertiesParam = tblSourcePropertiesMapping;
    tblDestinationPropertiesParam = tblDestinationPropertiesMapping;

    tblSourcePropertiesMapping.setWidth("50%");
    tblDestinationPropertiesMapping.setWidth("100%");
    tblSourcePropertiesMapping.setSelectable(true);
    tblDestinationPropertiesMapping.setSelectable(true);
    /* Define the names and data types of columns.
     * The "default value" parameter is meaningless here. */
    tblSourcePropertiesMapping.addContainerProperty("Property", String.class, null);
    tblSourcePropertiesMapping.addContainerProperty("Value", String.class, null);

    tblDestinationPropertiesMapping.addContainerProperty("Property", String.class, null);
    tblDestinationPropertiesMapping.addContainerProperty("Value", String.class, null);
    tblDestinationPropertiesMapping.setMultiSelect(true);
    /// get data for comboboxes
    SQLContainer cmbContainer = connectToDB("root", "mofo", "Endpoints");
    // fill endpoints
    cmbSourceEndpoint.setContainerDataSource(cmbContainer);
    cmbDestinationEndpoint.setContainerDataSource(cmbContainer);

    cmbSourceEndpoint.setValue(cmbSourceEndpoint.getItemIds().iterator().next());
    cmbDestinationEndpoint.setValue(cmbDestinationEndpoint.getItemIds().iterator().next());

    SQLContainer lstContainer = getSuggestedProperties("root", "mofo");
    int lstSize = lstContainer.size();
    int i = 0;
    for (Object cityItemId : lstContainer.getItemIds()) {
      lstSuggestedProperties.addItem(i);
      String g = lstContainer.getItem(cityItemId).getItemProperty("property").getValue().toString();
      lstSuggestedProperties.setItemCaption(i, g);
      i++;
    }
    lstSuggestedProperties.setValue(lstSuggestedProperties.getItemIds().iterator().next());

    btnCorrect.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              long lEllapsedTime = lEndTime - lStartTime;
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Correct");
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "time")
                  .setValue(String.valueOf(lEllapsedTime));

              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");
                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }

            ///////////////////////////////////

          }
        });
    btnIncorrect.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              long lEllapsedTime = lEndTime - lStartTime;
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "decision")
                  .setValue("Incorrect");
              tblSourceDestinationparam
                  .getContainerProperty(rowId, "time")
                  .setValue(String.valueOf(lEllapsedTime));
              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");

                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR Not Properties queried");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }
            ///////////////////////////////////

          }
        });
    btnUnsure.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            try {
              Object rowId = tblSourceDestinationparam.getValue();
              Item myitem = tblSourceDestinationparam.getItem(tblSourceDestinationparam.getValue());
              lEndTime = System.currentTimeMillis();
              float lEllapsedTime = lEndTime - lStartTime;
              String elapsedTime = String.valueOf(lEllapsedTime);
              tblSourceDestinationparam.setEditable(true);
              tblSourceDestinationparam.getContainerProperty(rowId, "decision").setValue("Unsure");
              tblSourceDestinationparam.getContainerProperty(rowId, "time").setValue(elapsedTime);
              tblSourceDestinationparam.setEditable(false);
              SQLContainer c = (SQLContainer) tblSourceDestinationparam.getContainerDataSource();
              try {
                c.commit();
              } catch (UnsupportedOperationException | SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }

              // int selectedId=Integer.parseInt(tblSourceDestination.getValue().toString());
              int maxindex = tblSourceDestination.size();
              SQLContainer s = (SQLContainer) tblSourceDestination.getContainerDataSource();
              // Item x=s.getItem(tblSourceDestination.getValue());
              if (!(tblSourceDestination.getValue().equals(tblSourceDestination.lastItemId()))) {
                int index = s.indexOfId(tblSourceDestination.getValue());
                index++;
                tblSourceDestination.setValue(s.getIdByIndex(index));
                try {
                  Object rowId2 = tblSourceDestination.getValue();
                  Property sourceProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "sourceURI");
                  Property destinationProperty =
                      tblSourceDestination.getContainerProperty(rowId2, "destinationURI");

                  source.setValue(sourceProperty.toString());
                  destination.setValue(destinationProperty.toString());
                  tblSourcePropertiesParam.removeAllItems();
                  tblDestinationPropertiesParam.removeAllItems();

                  Notification loadURI = new Notification("");
                  loadURI.show("Links' URIs are successfully loaded ");
                  if (chkAutomaticPropertiesLoad.getValue()) // the automatic buton i schecked
                  {
                    // load the properties automatically
                    String sourceEndpoint = "", destinationEndpoint = "";
                    sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
                    destinationEndpoint =
                        cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
                    try {
                      String sparqlQuery = source.getValue();
                      getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
                      sparqlQuery = destination.getValue();
                      getURIProperties(
                          sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
                    } catch (Exception e) {
                      Notification.show("ERROR Not Properties queried");
                    }
                    lStartTime = System.currentTimeMillis();
                    // start time for next one
                  }
                } catch (Exception e) {
                  Notification error = new Notification("Error");
                  error.show("You did not select an item in the links table");
                }
              }
            } catch (Exception e) {
              Notification.show(e.getMessage());
            }
          }
        });
    btnGetProperties.addClickListener(
        new Button.ClickListener() {
          @Override
          public void buttonClick(ClickEvent event) {
            String sourceEndpoint = "", destinationEndpoint = "";
            sourceEndpoint = cmbSourceEndpoint.getItemCaption(cmbSourceEndpoint.getValue());
            destinationEndpoint =
                cmbDestinationEndpoint.getItemCaption(cmbDestinationEndpoint.getValue());
            lStartTime = System.currentTimeMillis();

            try {
              String sparqlQuery = source.getValue();
              getURIProperties(sparqlQuery, sourceEndpoint, tblSourcePropertiesMapping);
              sparqlQuery = destination.getValue();
              getURIProperties(sparqlQuery, destinationEndpoint, tblDestinationPropertiesMapping);
            } catch (Exception e) {
              Notification.show(
                  "ERROR while sparqling the endpoint for resources' properties (Are they selected/loaded ?)");
            }
            // cachingForTriples(tblSourceDestination, sourceEndpoint);
          }
        });

    lstSuggestedProperties.addValueChangeListener(
        new ValueChangeListener() {
          @Override
          public void valueChange(final ValueChangeEvent event) {
            final String valueString = String.valueOf(event.getProperty().getValue());
            // Notification.show(valueString);
            List<Object> Ids = new ArrayList<Object>();
            Object first = null;
            for (Iterator i = tblSourcePropertiesMapping.getItemIds().iterator(); i.hasNext(); ) {
              // Get the current item identifier, which is an integer.
              first = i.next();
              int iid = (Integer) first;
              String other =
                  tblSourcePropertiesMapping.getItem(iid).getItemProperty("Property").toString();
              // Notification.show(other);
              if (other.equals(valueString)) // if(other.equals(property))
              {
                Ids.add(iid);
                break;
              }
            }
            tblSourcePropertiesMapping.setImmediate(true);
            tblSourcePropertiesMapping.setValue(Ids);
            tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first);
          }
        });

    tblSourcePropertiesMapping.addItemClickListener(
        new ItemClickEvent.ItemClickListener() {

          @Override
          public void itemClick(ItemClickEvent event) {
            String property =
                tblSourcePropertiesMapping
                    .getContainerProperty(event.getItemId(), event.getPropertyId())
                    .toString();
            List<String> res = getRelatedProperties(property);

            if (res == null) {
              Notification.show("No related Properties");
              return;
            }
            boolean Found = false;
            List<Object> Ids = new ArrayList<Object>();
            Object first = null;
            int x = 0;
            for (String relatedProperty : res) {
              for (Iterator i = tblDestinationPropertiesMapping.getItemIds().iterator();
                  i.hasNext(); ) {
                // Get the current item identifier, which is an integer.
                Object theId = i.next();
                int iid = (Integer) theId;
                String other =
                    tblDestinationPropertiesMapping
                        .getItem(iid)
                        .getItemProperty(event.getPropertyId())
                        .toString();

                if (other.equals(relatedProperty)) // if(other.equals(property))
                {
                  Ids.add(iid);
                  if (x == 0) {
                    first = theId;
                    x = 1;
                  }
                  Found = true;
                }
              }
            }
            if (!Found)
              Notification.show(
                  "Related property is not Found in destination table try manual search");
            else {
              Notification.show("Found in destination table");
              tblDestinationPropertiesMapping.setValue(Ids);
              tblDestinationPropertiesMapping.setCurrentPageFirstItemId(first);
            }
          }
        });
    // add component to the layout specifying its position on the layout

    layout.addComponent(btnCorrect, "left: " + leftStart + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnIncorrect, "left: " + (leftStart + space) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnUnsure, "left: " + (leftStart + 2 * space) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        btnGetProperties,
        "left: " + (leftStart + 3 * space + 50) + "px; top: " + (topStart + 450) + "px;");
    layout.addComponent(
        chkAutomaticPropertiesLoad,
        "left: " + (leftStart + 3 * space + 250) + "px; top: " + (topStart + 450) + "px;");

    /*layout.addComponent(sourceURI,"left: "+(leftStart-space/2)+"px; top: "+(topStart+space/2)+"px;");
    layout.addComponent(destinationURI,"left: "+(leftStart+2*space)+"px; top: "+(topStart+space/2)+"px;");*/

    layout.addComponent(source, "left: 30px; top: " + (topStart + space / 2) + "px;");
    layout.addComponent(
        destination,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space / 2) + "px;");

    layout.addComponent(cmbSourceEndpoint, "left: 50px; top: " + (topStart + 20) + "px;");
    layout.addComponent(
        cmbDestinationEndpoint,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + 20) + "px;");
    layout.addComponent(
        lstSuggestedProperties,
        "left: " + (leftStart + 100) + "px; top: " + (topStart + 20) + "px;");

    layout.addComponent(
        tblSourcePropertiesMapping, "left: 10px; top: " + (topStart + space) + "px;");
    layout.addComponent(
        tblDestinationPropertiesMapping,
        "left: " + (leftStart + 3 * space + 200) + "px; top: " + (topStart + space) + "px;");

    pnlURIsProperties.setContent(layout);

    return pnlURIsProperties;
  }
예제 #8
0
  private void initUI() {
    addStyleName(Reindeer.WINDOW_LIGHT);
    setModal(true);
    setHeight("90%");
    setWidth("60%");
    center();

    HorizontalLayout bottom = new HorizontalLayout();
    bottom.setStyleName(ExplorerLayout.THEME);
    bottom.setSizeFull();
    // bottom.setMargin(true);
    bottom.setSpacing(true);
    bottom.addStyleName(Runo.LAYOUT_DARKER);
    this.setContent(bottom);

    scheduleEventFieldGroup = new FieldGroup();
    scheduleEventFieldGroup.setBuffered(true);
    if (currentBeanItem != null) {
      scheduleEventFieldGroup.setItemDataSource(currentBeanItem);
    }

    line = new GridLayout(4, 20);
    line.addStyleName("v-gridlayout");
    line.setWidth("100%");
    line.setSpacing(true);
    line.setMargin(true);

    final Label lbTitle = CommonFieldHandler.createLable("计划名称:");
    line.addComponent(lbTitle);
    line.setComponentAlignment(lbTitle, Alignment.MIDDLE_RIGHT);
    final TextField txtTitle = new TextField();
    txtTitle.setWidth("80%");
    scheduleEventFieldGroup.bind(txtTitle, "name");
    line.addComponent(txtTitle, 1, 0, 3, 0);
    line.setComponentAlignment(txtTitle, Alignment.MIDDLE_LEFT);

    Label label2 = CommonFieldHandler.createLable("开始时间:");
    line.addComponent(label2, 0, 1, 0, 1);
    line.setComponentAlignment(label2, Alignment.MIDDLE_RIGHT);
    // 创建一个时间后台变化的listener
    BlurListener startTimeListener = createTimeReCountListener();
    DateField startDateField = CommonFieldHandler.createDateField("", false);
    scheduleEventFieldGroup.bind(startDateField, "startDate");
    startDateField.addBlurListener(startTimeListener);
    line.addComponent(startDateField, 1, 1, 1, 1);
    line.setComponentAlignment(startDateField, Alignment.MIDDLE_LEFT);

    Label label3 = CommonFieldHandler.createLable("估算时间:");
    line.addComponent(label3, 2, 1, 2, 1);
    line.setComponentAlignment(label3, Alignment.MIDDLE_RIGHT);
    HorizontalLayout hlay = new HorizontalLayout();
    final TextField estimateField = new TextField();
    estimateField.setValue("1");
    estimateField.setWidth("60px");
    estimateField.setNullSettingAllowed(false);
    BlurListener timeReCountListener = createTimeReCountListener();
    estimateField.addBlurListener(timeReCountListener);
    scheduleEventFieldGroup.bind(estimateField, "estimate");
    hlay.addComponent(estimateField);
    Map<Object, String> data = new HashMap();
    data.put(0, "天");
    data.put(1, "时");
    data.put(2, "分");
    // WW_TODO 估算时间单位
    ComboBox unit_cb = createComboBox(data, "55px");
    scheduleEventFieldGroup.bind(unit_cb, "estimateUnit");
    hlay.addComponent(unit_cb);
    line.addComponent(hlay, 3, 1, 3, 1);
    line.setComponentAlignment(hlay, Alignment.MIDDLE_LEFT);

    Label label4 = CommonFieldHandler.createLable("到期时间:");
    line.addComponent(label4, 0, 2, 0, 2);
    line.setComponentAlignment(label4, Alignment.MIDDLE_RIGHT);
    completionDateField = CommonFieldHandler.createDateField("", false);
    line.addComponent(completionDateField, 1, 2, 1, 2);
    line.setComponentAlignment(completionDateField, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(completionDateField, "completionDate");
    //		line.setExpandRatio(completionDateField, 1.0f);

    Label label6 = CommonFieldHandler.createLable("消耗时间:");
    line.addComponent(label6, 2, 2, 2, 2);
    line.setComponentAlignment(label6, Alignment.MIDDLE_RIGHT);
    TextField gs1 = new TextField();
    gs1.setValue("20%");
    gs1.setInputPrompt("50%");
    scheduleEventFieldGroup.bind(gs1, "useup");
    line.addComponent(gs1, 3, 2, 3, 2);
    line.setComponentAlignment(gs1, Alignment.MIDDLE_LEFT);

    Label label5 = CommonFieldHandler.createLable("优先级:");
    //		label.setWidth("80px");
    line.addComponent(label5, 0, 3, 0, 3);
    line.setComponentAlignment(label5, Alignment.MIDDLE_RIGHT);
    Map<Object, String> dtp = new HashMap();
    dtp.put(0, "底");
    dtp.put(1, "中");
    dtp.put(2, "高");
    ComboBox selectPriority = createComboBox(dtp, "100px");
    //		NativeSelect select = new NativeSelect();
    //		select.addItem("无");
    //		select.addItem("0(最低)");
    //		String itemId = "1(中)";
    //		select.addItem(itemId);
    //		select.addItem("2(高)");
    selectPriority.setNullSelectionAllowed(false);
    selectPriority.select(2);
    scheduleEventFieldGroup.bind(selectPriority, "priority");
    line.addComponent(selectPriority, 1, 3, 1, 3);
    line.setComponentAlignment(selectPriority, Alignment.MIDDLE_LEFT);

    Label label1 = CommonFieldHandler.createLable("完成百分比:");
    line.addComponent(label1, 2, 3, 2, 3);
    line.setComponentAlignment(label1, Alignment.MIDDLE_RIGHT);
    TextField tf = new TextField();
    tf.setInputPrompt("50%");
    line.addComponent(tf, 3, 3, 3, 3);
    line.setComponentAlignment(tf, Alignment.MIDDLE_LEFT);

    Label label7 = CommonFieldHandler.createLable("关联日程:");
    line.addComponent(label7, 0, 4, 0, 4);
    line.setComponentAlignment(label7, Alignment.MIDDLE_RIGHT);
    CheckBox relatedCalendar_cb = new CheckBox();
    relatedCalendar_cb.setValue(false);
    line.addComponent(relatedCalendar_cb, 1, 4, 1, 4);
    line.setComponentAlignment(relatedCalendar_cb, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(relatedCalendar_cb, "relatedCalendar");

    Label lbStatus = CommonFieldHandler.createLable("计划状态:");
    lbStatus.setWidth("20px");
    line.addComponent(lbStatus, 2, 4, 2, 4);
    line.setComponentAlignment(lbStatus, Alignment.MIDDLE_RIGHT);
    Map<Object, String> sta = new HashMap();
    sta.put(0, "新建");
    sta.put(1, "完成");
    sta.put(2, "关闭");
    sta.put(3, "取消");
    ComboBox sectStatus = createComboBox(sta, "100px");
    sectStatus.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(sectStatus, "status");
    line.addComponent(sectStatus, 3, 4, 3, 4);
    line.setComponentAlignment(sectStatus, Alignment.MIDDLE_LEFT);

    Label label8 = CommonFieldHandler.createLable("关联外部任务:");
    label8.setWidth("20px");
    line.addComponent(label8, 0, 5, 0, 5);
    line.setComponentAlignment(label8, Alignment.MIDDLE_RIGHT);
    CheckBox cb = new CheckBox();
    cb.setValue(true);
    line.addComponent(cb, 1, 5, 1, 5);
    line.setComponentAlignment(cb, Alignment.MIDDLE_LEFT);
    scheduleEventFieldGroup.bind(cb, "relatedTask");

    Label label9 = CommonFieldHandler.createLable("外部任务类型:");
    label9.setWidth("20px");
    line.addComponent(label9, 2, 5, 2, 5);
    line.setComponentAlignment(label9, Alignment.MIDDLE_RIGHT);
    Map<Object, String> oat = new HashMap();
    oat.put(0, "外包任务");
    oat.put(1, "外包任务-类型2");
    ComboBox select2 = createComboBox(oat, "150px");
    //		NativeSelect select2 = new NativeSelect();
    //		select2.addItem("外包任务");
    //		select2.addItem("外包任务-类型2");
    select2.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(select2, "type");
    line.addComponent(select2, 3, 5, 3, 5);
    line.setComponentAlignment(select2, Alignment.MIDDLE_LEFT);
    // select2.select("Timed");

    Label lbOwnGrp = CommonFieldHandler.createLable("计划分配团队:");
    lbOwnGrp.setWidth("20px");
    line.addComponent(lbOwnGrp, 0, 6, 0, 6);
    line.setComponentAlignment(lbOwnGrp, Alignment.MIDDLE_RIGHT);

    //		NativeSelect sectOwnGrp = new NativeSelect();
    Map<Object, String> groupsMap =
        teamService.queryTeamOfUser(LoginHandler.getLoggedInUser().getId());
    groupsMap.put("", "请选择");
    ComboBox sectOwnGrp = createComboBox(groupsMap, "150px");
    //		for (String p : groupsMap.keySet()) {
    //			String title = groupsMap.get(p);
    //			sectOwnGrp.addItem(p);
    //			sectOwnGrp.setItemCaption(p, title);
    //		}
    sectOwnGrp.setNullSelectionAllowed(false);
    ValueChangeListener valueChangeListener = createValueChangeListener();
    sectOwnGrp.addValueChangeListener(valueChangeListener);
    sectOwnGrp.setImmediate(true);
    scheduleEventFieldGroup.bind(sectOwnGrp, "assignedTeam");
    line.addComponent(sectOwnGrp, 1, 6, 1, 6);
    line.setComponentAlignment(sectOwnGrp, Alignment.MIDDLE_LEFT);

    final Label lbOwner = CommonFieldHandler.createLable("计划分配用户:");
    lbOwner.setWidth("20px");
    line.addComponent(lbOwner, 2, 6, 2, 6);
    line.setComponentAlignment(lbOwner, Alignment.MIDDLE_RIGHT);
    //		sectOwner = new NativeSelect();
    //		sectOwner.addItem("请选择");
    sectOwner.setNullSelectionAllowed(false);
    scheduleEventFieldGroup.bind(sectOwner, "assignedUser");
    line.addComponent(sectOwner, 3, 6, 3, 6);
    line.setComponentAlignment(sectOwner, Alignment.MIDDLE_LEFT);

    final Label lbDesc = CommonFieldHandler.createLable("计划描述:");
    lbDesc.setWidth("15px");
    line.addComponent(lbDesc, 0, 7, 0, 7);
    line.setComponentAlignment(lbDesc, Alignment.MIDDLE_RIGHT);
    final TextArea taDesc = CommonFieldHandler.createTextArea("");
    taDesc.setWidth("85%");
    taDesc.setHeight("290px");
    scheduleEventFieldGroup.bind(taDesc, "description");
    line.addComponent(taDesc, 1, 7, 3, 13);
    line.setComponentAlignment(taDesc, Alignment.MIDDLE_LEFT);

    //		CKEditorConfig config = new CKEditorConfig();

    final Button updateSave = new Button("保存");
    updateSave.addClickListener(
        new ClickListener() {
          @SuppressWarnings("unchecked")
          public void buttonClick(ClickEvent event) {
            // WW_TODO 修改保存到数据库
            Todo fieldGroupTodo = saveFieldGroupToDB();
            fireEvent(
                new SubmitEvent(
                    updateSave,
                    SubmitEvent.SUBMITTED,
                    scheduleEventFieldGroup.getItemDataSource()));

            // close popup window
            close();
            /*
             * Todo fieldGroupTodo = saveFieldGroupToDB(); //reflash current
             * Item copyBeanValueToContainer(hContainer,(BeanItem<Todo>)(
             * scheduleEventFieldGroup.getItemDataSource())); //刷新日历
             * main.refreshCalendarView(); Notification.show("保存成功",
             * Notification.Type.HUMANIZED_MESSAGE); //如果有外部流程,启动外部流程 if
             * (fieldGroupTodo.getRelatedTask()) { ViewToolManager
             * .showPopupWindow(new ActivityStartPopupWindow( "1111")); }
             */
            if (fieldGroupTodo.getRelatedTask()) {
              ViewToolManager.showPopupWindow(new ActivityStartPopupWindow("1111"));
            }
          }
        });
    line.addComponent(updateSave, 3, 14, 3, 14);
    line.setComponentAlignment(updateSave, Alignment.MIDDLE_RIGHT);
    //		line.setExpandRatio(updateSave, 1.0f);

    bottom.addComponent(line);
  }
예제 #9
0
 private void updateCheckBox(CheckBox checkBox, Object rowId, boolean enabled) {
   checkBox.setValue(enabled);
   Collection<Field<?>> columns = getFieldsForItemId(rowId);
   columns.remove(checkBox);
   enableFields(columns, checkBox.getValue());
 }
 public void setValue(final DistributionSetIdName distSet) {
   dsTable.setVisible(distSet != null);
   checkBox.setValue(distSet != null);
   dsTable.setValue(distSet);
   dsTable.setCurrentPageFirstItemId(distSet);
 }
 @Override
 protected void initFromConfig() {
   myAdminEmail.setValue(MyTunesRss.CONFIG.getAdminEmail());
   myNotifyOnDatabaseUpdate.setValue(MyTunesRss.CONFIG.isNotifyOnDatabaseUpdate());
   myNotifyOnEmailChange.setValue(MyTunesRss.CONFIG.isNotifyOnEmailChange());
   myNotifyOnInternalError.setValue(MyTunesRss.CONFIG.isNotifyOnInternalError());
   myNotifyOnLoginFailure.setValue(MyTunesRss.CONFIG.isNotifyOnLoginFailure());
   myNotifyOnMissingFile.setValue(MyTunesRss.CONFIG.isNotifyOnMissingFile());
   myNotifyOnPasswordChange.setValue(MyTunesRss.CONFIG.isNotifyOnPasswordChange());
   myNotifyOnQuotaExceeded.setValue(MyTunesRss.CONFIG.isNotifyOnQuotaExceeded());
   myNotifyOnTranscodingFailure.setValue(MyTunesRss.CONFIG.isNotifyOnTranscodingFailure());
   myNotifyOnWebUpload.setValue(MyTunesRss.CONFIG.isNotifyOnWebUpload());
   myNotifyOnOutdatedItunesXml.setValue(MyTunesRss.CONFIG.isNotifyOnOutdatedItunesXml());
   myNotifyOnSkippedDatabaseUpdate.setValue(MyTunesRss.CONFIG.isNotifyOnSkippedDatabaseUpdate());
 }