@Override
  public void initContextData(Session session, Context uiSharedContext) {
    selectedMethod = uiSharedContext.getSessionManagementMethod();
    if (log.isDebugEnabled())
      log.debug(
          "Initializing configuration panel for session management method: "
              + selectedMethod
              + " for context "
              + uiSharedContext.getName());

    // If something was already configured, find the type and set the UI accordingly
    if (selectedMethod != null) {
      // If the proper type is already selected, just rebind the data
      if (shownMethodType != null && shownMethodType.isTypeForMethod(selectedMethod)) {
        if (shownMethodType.hasOptionsPanel()) shownConfigPanel.bindMethod(selectedMethod);
        return;
      }

      // Select what needs to be selected
      for (SessionManagementMethodType type : extension.getSessionManagementMethodTypes())
        if (type.isTypeForMethod(selectedMethod)) {
          // Selecting the type here will also force the selection listener to run and
          // change the config panel accordingly
          getSessionManagementMethodsComboBox().setSelectedItem(type);
          break;
        }
    }
  }
Esempio n. 2
0
 public void renameContext(Context c) {
   for (AbstractParamPanel panel : contextPanels) {
     if (panel instanceof ContextGeneralPanel) {
       ContextGeneralPanel ctxPanel = (ContextGeneralPanel) panel;
       if (ctxPanel.getContextIndex() == c.getIndex()) {
         getSessionDialog().renamePanel(ctxPanel, c.getName());
         break;
       }
     }
   }
 }
 @Override
 public boolean isButtonEnabledForSiteNode(SiteNode sn) {
   if (context == null) {
     // New context
     return true;
   }
   if (context.isIncluded(sn) || context.isExcluded(sn)) {
     // Either explicitly included or excluded, so would have to change that regex in a non
     // trivial way to include!
     return false;
   }
   return true;
 }
  protected void performAction(String name, String url) {
    Session session = Model.getSingleton().getSession();

    if (context == null) {
      context = session.getNewContext(name);
    }

    // Manually create the UI shared contexts so any modifications are done
    // on an UI shared Context, so changes can be undone by pressing Cancel
    SessionDialog sessionDialog = View.getSingleton().getSessionDialog();
    sessionDialog.recreateUISharedContexts(session);
    Context uiSharedContext = sessionDialog.getUISharedContext(context.getIndex());

    uiSharedContext.addIncludeInContextRegex(url);

    // Show the session dialog without recreating UI Shared contexts
    View.getSingleton()
        .showSessionDialog(session, ContextIncludePanel.getPanelName(context.getIndex()), false);
  }
Esempio n. 5
0
  public void addContext(Context c) {
    ContextGeneralPanel contextGenPanel = new ContextGeneralPanel(c.getName(), c.getIndex());
    getSessionDialog()
        .addParamPanel(
            new String[] {Constant.messages.getString("context.list")}, contextGenPanel, false);
    this.contextPanels.add(contextGenPanel);

    ContextIncludePanel contextIncPanel = new ContextIncludePanel(c);
    getSessionDialog()
        .addParamPanel(
            new String[] {Constant.messages.getString("context.list"), contextGenPanel.getName()},
            contextIncPanel,
            false);
    this.contextPanels.add(contextIncPanel);

    ContextExcludePanel contextExcPanel = new ContextExcludePanel(c);
    getSessionDialog()
        .addParamPanel(
            new String[] {Constant.messages.getString("context.list"), contextGenPanel.getName()},
            contextExcPanel,
            false);
    this.contextPanels.add(contextExcPanel);

    ContextTechnologyPanel contextTechPanel = new ContextTechnologyPanel(c);
    getSessionDialog()
        .addParamPanel(
            new String[] {Constant.messages.getString("context.list"), contextGenPanel.getName()},
            contextTechPanel,
            false);
    this.contextPanels.add(contextTechPanel);

    for (ContextPanelFactory cpf : this.contextPanelFactories) {
      AbstractParamPanel panel = cpf.getContextPanel(c);
      getSessionDialog()
          .addParamPanel(
              new String[] {Constant.messages.getString("context.list"), contextGenPanel.getName()},
              panel,
              false);
      this.contextPanels.add(panel);
    }
  }
 /**
  * Instantiates a new context session management panel.
  *
  * @param extension the extension
  * @param context the context
  */
 public ContextSessionManagementPanel(ExtensionSessionManagement extension, Context context) {
   super(context.getIndex());
   this.extension = extension;
   initialize();
 }
 @Override
 public void saveTemporaryContextData(Context uiSharedContext) {
   if (shownConfigPanel != null) shownConfigPanel.saveMethod();
   uiSharedContext.setSessionManagementMethod(selectedMethod);
 }
 public PopupMenuItemIncludeInContext(Context context) {
   super(context.getName(), true);
   this.context = context;
 }