Package com.esri.gpt.framework.jsf

Examples of com.esri.gpt.framework.jsf.MessageBroker


                                              Section section,
                                              Parameter parameter,
                                              String onchange) {
 
  // initialize the component
  MessageBroker msgBroker = context.extractMessageBroker();
  HtmlSelectOneMenu component = new HtmlSelectOneMenu();
  component.setId(getFacesId());
  component.setDisabled(!getEditable());
  component.setOnchange(getOnChange());
  component.setOnclick(getOnClick());
  setComponentValue(context,component,parameter);
  onchange = Val.chkStr(onchange);
  if (onchange.length() > 0) {
    component.setOnchange(onchange);
  }
 
  // add each code as a SelectItem
  ArrayList<SelectItem> codeItems = new ArrayList<SelectItem>();
  Codes codes = parameter.getContent().getCodes();
  for (Code code: codes.values()) {
    String sResKey = code.getResourceKey();
    String sLabel = code.getKey();
    if (sResKey.length() > 0) {
      sLabel = msgBroker.retrieveMessage(sResKey);
    }
    codeItems.add(new SelectItem(code.getKey(),sLabel));
  }
  UISelectItems uiItems = new UISelectItems();
  uiItems.setValue(codeItems);
View Full Code Here


  try{
    dirContext.modifyAttributes(objectDN,operation,attributes);
  }catch(javax.naming.directory.InvalidAttributeValueException iave){
    LogUtil.getLogger().severe(iave.getMessage());
    FacesContextBroker contextBroker = new FacesContextBroker();
    MessageBroker msgBroker = contextBroker.extractMessageBroker();
    String errMsg = "javax.naming.directory.InvalidAttributeValueException";
    if(msgBroker != null){
      errMsg = msgBroker.getMessage("javax.naming.directory.InvalidAttributeValueException").getSummary();
    }
    throw new LdapException(errMsg);
  }
}
View Full Code Here

public UIComponent makeInputComponent(UiContext context,
                                      Section section,
                                      Parameter parameter) {
 
  // make the component
  MessageBroker msgBroker = context.extractMessageBroker();
  HtmlPanelGroup panel = new HtmlPanelGroup();
 
  // make the map tools
  HtmlPanelGroup toolbar = new HtmlPanelGroup();
  toolbar.setId("mapToolbar");
  toolbar.setStyleClass("mapToolbar");
  panel.getChildren().add(toolbar);
 
  HtmlGraphicImage btn;
  String sMsg;
 
  btn = new HtmlGraphicImage();
  sMsg = msgBroker.retrieveMessage("catalog.general.map.zoomToWorld");
  btn.setId("mapButton-zoomToWorld");
  btn.setAlt(sMsg);
  btn.setTitle(sMsg);
  btn.setUrl("/catalog/images/btn-zoomToWorld-off.gif");
  toolbar.getChildren().add(btn);
 
  btn = new HtmlGraphicImage();
  sMsg = msgBroker.retrieveMessage("catalog.general.map.zoomToInputEnvelope");
  btn.setId("mapButton-zoomToInputEnvelope");
  btn.setAlt(sMsg);
  btn.setTitle(sMsg);
  btn.setUrl("/catalog/images/btn-zoomToInputEnvelope-off.gif");
  toolbar.getChildren().add(btn);
   
  btn = new HtmlGraphicImage();
  sMsg = msgBroker.retrieveMessage("catalog.general.map.drawInputEnvelope");
  btn.setId("mapTool-drawInputEnvelope");
  btn.setAlt(sMsg);
  btn.setTitle(sMsg);
  btn.setStyleClass("firstTool");
  btn.setUrl("/catalog/images/btn-drawInputEnvelope-off.gif");
  toolbar.getChildren().add(btn);
 
  btn = new HtmlGraphicImage();
  sMsg = msgBroker.retrieveMessage("catalog.general.map.deactivate");
  btn.setId("mapTool-deactivate");
  btn.setAlt(sMsg);
  btn.setTitle(sMsg);
  btn.setUrl("/catalog/images/btn-deactivate-off.gif");
  toolbar.getChildren().add(btn);
 
  HtmlInputText text = new HtmlInputText();
  text.setId("mapInput-locate");
  text.setStyleClass("locatorInput");
  text.setMaxlength(1024);
  text.setOnkeypress("return mdeMap.onLocatorKeyPress(event);");
  toolbar.getChildren().add(text);
 
  btn = new HtmlGraphicImage();
  sMsg = msgBroker.retrieveMessage("catalog.general.map.locate");
  btn.setId("mapButton-locate");
  btn.setAlt(sMsg);
  btn.setTitle(sMsg);
  btn.setUrl("/catalog/images/btn-locate-off.gif");
  toolbar.getChildren().add(btn);
View Full Code Here

public UIComponent makeOutputComponent(UiContext context,
                                       Section section,
                                       Parameter parameter) {
 
  // make the component
  MessageBroker msgBroker = context.extractMessageBroker();
  HtmlPanelGroup panel = new HtmlPanelGroup();
 
  // make the map tools
  HtmlPanelGroup toolbar = new HtmlPanelGroup();
  toolbar.setId("mapToolbar");
  toolbar.setStyleClass("mapToolbar");
  panel.getChildren().add(toolbar);
 
  HtmlGraphicImage btn;
  String sMsg;
   
  btn = new HtmlGraphicImage();
  sMsg = msgBroker.retrieveMessage("catalog.general.map.zoomToInputEnvelope");
  btn.setId("mapButton-zoomToInputEnvelope");
  btn.setAlt(sMsg);
  btn.setTitle(sMsg);
  btn.setUrl("/catalog/images/btn-zoomToInputEnvelope-off.gif");
  toolbar.getChildren().add(btn);
View Full Code Here

* @return the resultant UI component
*/
protected UIComponent applyHint(UiContext context,
                                UIComponent inputComponent) {
  if ((inputComponent != null) && (getHintResourceKey().length() > 0)) {
    MessageBroker msgBroker = context.extractMessageBroker();
    String sHint = msgBroker.retrieveMessage(getHintResourceKey());
   
    if (this.getHintMode().equalsIgnoreCase("tip")) {
   
      // use reflection to set the tip (i.e. the HTML "title" attribute)
      if ((sHint != null) && (sHint.length() > 0)) {
View Full Code Here

* @return the UI input component
*/
public UIComponent makeOutputComponent(UiContext context,
                                       Section section,
                                       Parameter parameter) {
  MessageBroker msgBroker = context.extractMessageBroker();
  String sValue = parameter.getContent().makeDisplayValue(msgBroker,parameter);
  if (sValue.length() > 0) {
    HtmlOutputText component = new HtmlOutputText();
    component.setId(getFacesId());
    component.setValue(sValue);
View Full Code Here

  boolean bIsExclusive = getObligation().equalsIgnoreCase(Section.OBLIGATION_EXCLUSIVE);
  boolean bIsOptional = getObligation().equalsIgnoreCase(Section.OBLIGATION_OPTIONAL);
  HtmlPanelGroup panel = new HtmlPanelGroup();
  panel.setStyleClass("section");
  MessageBroker msgBroker = context.extractMessageBroker();
 
  // return if there is nothing to display
  if ((bIsExclusive || bIsOptional) && !getOpen()) {
    return false;
  }
 
  // determine the caption
  String sCaption = "";
  if (getLabel() != null) {
    sCaption = msgBroker.retrieveMessage(getLabel().getResourceKey());
  }
  if (sCaption.length() == 0) {
    sCaption = getKey();
  }
 
  // make the header
  StringBuffer sbOnclick = new StringBuffer();
  sbOnclick.append("mddOnSectionClicked('").append(sSectionId).append("')");
 
  HtmlPanelGrid headerTable = new HtmlPanelGrid();
  headerTable.setColumns(3);
  headerTable.setStyleClass("sectionHeader");
  headerTable.setSummary(msgBroker.retrieveMessage("catalog.general.designOnly"));
  headerTable.setOnclick(sbOnclick.toString());
 
  HtmlSelectBooleanCheckbox checkBox = new HtmlSelectBooleanCheckbox();
  checkBox.setId(sCheckboxId);
  checkBox.setSelected(getOpen());
  checkBox.setStyle("display:none;");
  headerTable.getChildren().add(checkBox);
 
  HtmlGraphicImage img = new HtmlGraphicImage();
  img.setId(sImgId);
  setGraphicUrl(img);
  headerTable.getChildren().add(img);
 
  HtmlOutputText caption = new HtmlOutputText();
  caption.setValue(sCaption);
  caption.setStyleClass("sectionCaption");
  headerTable.getChildren().add(caption);
  if (getLabel() != null) {
    panel.getChildren().add(headerTable);
  } else {
    panel.setStyleClass("");
  }
 
  // make the section body
  boolean bContainerOnly = (getLabel() == null);
  String sBodyClass = "sectionBody";
  if (bContainerOnly) sBodyClass= "";
  HtmlPanelGrid sectionBody = new HtmlPanelGrid();
  sectionBody.setId(sBodyId);
  sectionBody.setStyleClass(sBodyClass);
  setBodyDisplay(sectionBody);
  panel.getChildren().add(sectionBody);
 
  // make the table to hold section parameters, add all parameters
  HtmlPanelGrid parametersTable = new HtmlPanelGrid();
  parametersTable.setId(sParamsId);
  parametersTable.setColumns(2);
  parametersTable.setStyleClass("parameters");
  parametersTable.setSummary(msgBroker.retrieveMessage("catalog.general.designOnly"));
  boolean hasMap = false;
  for (Parameter parameter: getParameters().values()) {
    HtmlOutputText cmpLabel = null;
    UIComponent cmpValue = null;
   
    // check for a binary thumbnail
    if (parameter.getMeaningType().equalsIgnoreCase(Meaning.MEANINGTYPE_THUMBNAIL_URL)) {
      if (schema.getMeaning().getThumbnailUrl().length() == 0) {
        String uuid = Val.chkStr(context.extractHttpServletRequest().getParameter("uuid"));
        if ((uuid.length() > 0) && (schema.getMeaning().getThumbnailBinary().length() > 0)) {
          try {
            String thumbUrl = "/thumbnail?uuid="+URLEncoder.encode(uuid,"UTF-8");
            parameter.getContent().getSingleValue().setValue(thumbUrl);
          } catch (UnsupportedEncodingException e) {}
        }
      }
    }
   
    boolean bDisplay = parameter.getVisible() && parameter.getVisibleOnDetails() &&
                       !parameter.getContent().isValueEmpty() &&
                       (parameter.getInput() != null);
    if ((parameter.getInput() instanceof InputMap)) {
      cmpValue = parameter.getInput().makeOutputComponent(context,this,parameter);
      if (cmpValue != null) {
        parametersTable.getChildren().add(cmpValue);
        hasMap = true;
      }
    } else if (bDisplay) {
      cmpValue = parameter.getInput().makeOutputComponent(context,this,parameter);
      if (cmpValue != null) {
        cmpLabel = new HtmlOutputText();
        cmpLabel.setValue(msgBroker.retrieveMessage(parameter.getLabel().getResourceKey()));
        parametersTable.getChildren().add(cmpLabel);
        parametersTable.getChildren().add(cmpValue);
      }
    }
  }
View Full Code Here

  boolean bIsExclusive = getObligation().equalsIgnoreCase(Section.OBLIGATION_EXCLUSIVE);
  boolean bIsOptional = getObligation().equalsIgnoreCase(Section.OBLIGATION_OPTIONAL);
 
  HtmlPanelGroup panel = new HtmlPanelGroup();
  panel.setStyleClass("section");
  MessageBroker msgBroker = context.extractMessageBroker();
 
  // determine the caption
  String sCaption = "";
  if (getLabel() != null) {
    sCaption = msgBroker.retrieveMessage(getLabel().getResourceKey());
  }
  if (sCaption.length() == 0) {
    sCaption = getKey();
  }
 
  StringBuffer sbOnclick = new StringBuffer();
  sbOnclick.append("mdeOnSectionClicked(");
  sbOnclick.append("this,").append(bIsOptional).append(",").append(bIsExclusive);
  sbOnclick.append(",'").append(sSectionId).append("')");
 
  // add the caption
  if (bIsExclusive) {
   
    Sections exclusive = getExclusiveSiblings(schema);
    boolean bIsFirstExclusive = (exclusive.size() > 0) &&
                                (this == exclusive.values().iterator().next());
    if (bIsFirstExclusive) {
      HtmlSelectOneRadio radio = new HtmlSelectOneRadio();
      radio.setId(sRadioId);
      radio.setStyleClass("optionalSectionHeader");
      radio.setOnclick(sbOnclick.toString());
      ArrayList<SelectItem> radioItems = new ArrayList<SelectItem>();
      UISelectItems uiItems = new UISelectItems();
      uiItems.setValue(radioItems);
      radio.getChildren().add(uiItems);
      panel.getChildren().add(radio);
      int nIdx = 0;
      for (Section sibling: exclusive.values()) {
        String sItemLabel = "";
        String sItemId = sibling.getFacesId();
        if (sibling.getLabel() != null) {
          sItemLabel = msgBroker.retrieveMessage(sibling.getLabel().getResourceKey());
        }
        if (sItemLabel.length() == 0) {
          sItemLabel = sibling.getKey();
        }
        radioItems.add(new SelectItem(sItemId,sItemLabel));
        if (sibling.getOpen()) {
          radio.setValue(sItemId);
        }
        nIdx++;
      }
    }
   
  } else if (bIsOptional) { 
   
    HtmlPanelGroup captionPanel = new HtmlPanelGroup();
    captionPanel.setStyleClass("optionalSectionHeader");
   
    HtmlPanelGrid headerTable = new HtmlPanelGrid();
    headerTable.setColumns(2);
    headerTable.setStyleClass("optionalSectionHeader");
    headerTable.setSummary(msgBroker.retrieveMessage("catalog.general.designOnly"));
   
    HtmlSelectBooleanCheckbox checkBox = new HtmlSelectBooleanCheckbox();
    checkBox.setId(sCheckboxId);
    checkBox.setSelected(getOpen());
    checkBox.setOnclick(sbOnclick.toString());
    headerTable.getChildren().add(checkBox);
   
    HtmlOutputLabel caption = new HtmlOutputLabel();
    // even label has to have unique id (for GlassFish)
    caption.setId(sCheckboxId+"label");
    caption.setFor(sCheckboxId);
    caption.setValue(sCaption);
    caption.setStyleClass("sectionCaption");
    headerTable.getChildren().add(caption);
    panel.getChildren().add(headerTable);   
   
  } else {
   
    HtmlPanelGrid headerTable = new HtmlPanelGrid();
    headerTable.setColumns(3);
    headerTable.setStyleClass("mandatorySectionHeader");
    headerTable.setSummary(msgBroker.retrieveMessage("catalog.general.designOnly"));
    headerTable.setOnclick(sbOnclick.toString());
   
    HtmlSelectBooleanCheckbox checkBox = new HtmlSelectBooleanCheckbox();
    checkBox.setId(sCheckboxId);
    checkBox.setSelected(getOpen());
    //checkBox.setOnclick(sbOnclick.toString());
    checkBox.setStyle("display:none;");
    headerTable.getChildren().add(checkBox);
   
    HtmlGraphicImage img = new HtmlGraphicImage();
    img.setId(sImgId);
    setGraphicUrl(img);
    headerTable.getChildren().add(img);
   
    HtmlOutputText caption = new HtmlOutputText();
    caption.setValue(sCaption);
    caption.setStyleClass("sectionCaption");
   
    headerTable.getChildren().add(caption);
    if (getLabel() != null) {
      panel.getChildren().add(headerTable);
    } else {
      panel.setStyleClass("");
    }
    
  }
 
  // make the section body
  boolean bContainerOnly = (getLabel() == null);
  String sBodyClass = "sectionBody";
  if (bContainerOnly) sBodyClass= "";
  HtmlPanelGrid sectionBody = new HtmlPanelGrid();
  sectionBody.setId(sBodyId);
  sectionBody.setStyleClass(sBodyClass);
  setBodyDisplay(sectionBody);
  panel.getChildren().add(sectionBody);
 
 
  // make the table to hold section parameters, add all parameters
  HtmlPanelGrid parametersTable = new HtmlPanelGrid();
  parametersTable.setId(sParamsId);
  parametersTable.setColumns(2);
  parametersTable.setStyleClass("parameters");
  parametersTable.setColumnClasses("parameterLabel,parameterInput");
  parametersTable.setSummary(msgBroker.retrieveMessage("catalog.general.designOnly"));
  for (Parameter parameter: getParameters().values()) {
    if (parameter.getVisible()) {
      UIComponent cmpLabel = null;
      if (parameter.getLabel() != null) {
        cmpLabel = parameter.getLabel().makeEditorLabel(context,this,parameter);
View Full Code Here

*
* @return the jscript foreign sites
*/
public String getJscriptForeignSites() {
 
  MessageBroker broker = new MessageBroker();
  broker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
  StringBuffer json = new StringBuffer("[");
  com.esri.gpt.catalog.search.SearchConfig sConfig =
    com.esri.gpt.catalog.search.SearchConfig.getConfiguredInstance();
  java.util.Map<String, java.util.Map<String, String>>
  sfRepos = sConfig.getSearchFactoryRepos();
  java.util.Iterator<String> iter = sfRepos.keySet().iterator();
  boolean firstIter = false;
  while(iter != null && iter.hasNext()) {
    String key = iter.next();
    if(key == null) {
      continue;
    }
    java.util.Map<String, String> attribs = sfRepos.get(key);
    if(attribs == null) {
      continue;
    }
    String label = attribs.get("RESOURCEKEY");
    if(label == null || "".equals(label)) {
      label = attribs.get("LABELRESOURCEKEY");
      if(label == null || "".equals(label)) {
        continue;
      }
    }
    if(iter.hasNext() && firstIter) {
      json.append(",");
    }
    firstIter = true;
    json.append("{");
    label = broker.retrieveMessage(label);
    json.append("uuid: '" +
        com.esri.gpt.framework.util.Val.escapeSingleQuotes(key) + "',");
    json.append("name: '" +
        com.esri.gpt.framework.util.Val.escapeSingleQuotes(label) + "'");
    json.append("}");
View Full Code Here

    serviceInfo.setResourceUrl(url);
   
    // generate the name, e.g. Parent Service Name (WMS)
    String resourceKey = "catalog.ags.namegeneration."+Val.chkStr(this.getOgcType()).toLowerCase();
    try {
      MessageBroker msgBroker = new MessageBroker();
      msgBroker.setBundleBaseName(MessageBroker.DEFAULT_BUNDLE_BASE_NAME);
      String name = msgBroker.retrieveMessage(resourceKey,new String[]{serviceInfo.getName()});
      if (!name.startsWith("???")) {
        serviceInfo.setName(name);
      }
    } catch (Exception e) {
      String msg = "Error auto-generating OGC service name for resource key: "+resourceKey;
View Full Code Here

TOP

Related Classes of com.esri.gpt.framework.jsf.MessageBroker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.