made link-targets within a page work (eg. #Grundlagen_1
authorwneuper
Wed, 14 May 2008 12:22:45 +0200
changeset 3908c30ead91986a
parent 3907 824ef5e94beb
child 3909 4d115ebfa840
made link-targets within a page work (eg. #Grundlagen_1
in thy_isac_Biegelinie.html#Grundlagen_1)
src/java/isac/browserdialog/BrowserDialog.java
src/java/isac/browserdialog/ExampleDialog.java
src/java/isac/browserdialog/MethodDialog.java
src/java/isac/browserdialog/ProblemDialog.java
src/java/isac/browserdialog/TheoryDialog.java
src/java/manifest.mf
     1.1 --- a/src/java/isac/browserdialog/BrowserDialog.java	Mon Mar 24 17:42:29 2008 +0100
     1.2 +++ b/src/java/isac/browserdialog/BrowserDialog.java	Wed May 14 12:22:45 2008 +0200
     1.3 @@ -276,6 +276,7 @@
     1.4          String link = ""; // ...../proto2/www/kbase/thy/thy_xxx.html
     1.5          String[] path_array; // ..[proto2,www,kbase,thy,thy_xxx.html
     1.6          String filename = ""; // .......................^^^^^^^
     1.7 +        String target = ""; // ......................................targetInPage
     1.8          String command = ""; // .....................................COMMAND_EXEC_EXAMPLE
     1.9          String argument = ""; // ........................................thy_xxx.xml
    1.10          String type = ""; // taken from here............^^^ (mustbe same^^^)
    1.11 @@ -283,7 +284,10 @@
    1.12  
    1.13          link_array = to_interpret.split("#");
    1.14          link = link_array[0];
    1.15 -        if (link_array.length >= 2) {
    1.16 +        if (link_array.length == 2) {
    1.17 +            target = link_array[1];
    1.18 +        } // TODO.WN080422 push through filename_#target_
    1.19 +        if (link_array.length > 2) {
    1.20              command = link_array[1];
    1.21              argument = link_array[2];
    1.22              if (command.equals("COMMAND_EXEC_EXAMPLE")) {
    1.23 @@ -357,7 +361,7 @@
    1.24          link_context.setKEStoreKey(new KEStoreKey(filename));
    1.25  
    1.26          link_target.sendContextToBrowser(link_context);
    1.27 -        link_target.sendLinkToMiniBrowser(link_context, context_type);
    1.28 +        link_target.sendLinkToMiniBrowser(link_context, context_type, target);
    1.29          link_target.sendGetFocusToBrowser();
    1.30  
    1.31      }
    1.32 @@ -403,7 +407,7 @@
    1.33              context.setKEStoreKey(current_context_.getKEStoreKey());
    1.34          }
    1.35          sendContextToBrowser(context);
    1.36 -        sendLinkToMiniBrowser(context, context_type_);
    1.37 +        sendLinkToMiniBrowser(context, context_type_, "");
    1.38      }
    1.39  
    1.40      protected Vector<String> loadContent(String session, String type,
    1.41 @@ -603,8 +607,13 @@
    1.42       * 
    1.43       * @param context
    1.44       *            the context containing the link
    1.45 +     * @param type =
    1.46 +     *            "exp" | "met" | "pbl" | "thy"
    1.47 +     * @param target =
    1.48 +     *            occasional target like filename#targetInPage
    1.49       */
    1.50 -    protected void sendLinkToMiniBrowser(Context context, ContextType type) {
    1.51 +    protected void sendLinkToMiniBrowser(Context context, ContextType type,
    1.52 +            String target) {
    1.53          KEStoreKey ks_key = context.getKEStoreKey();
    1.54          if (ks_key == null)
    1.55              return;
    1.56 @@ -615,9 +624,15 @@
    1.57              link = ks_key.toString().replaceFirst(".xml", ".html");
    1.58          else
    1.59              link = ks_key.toString() + ".html";
    1.60 +        String link_to_send = "";
    1.61 +        if (target.equals("")) {
    1.62 +            link_to_send = ObjectManagerPaths.WEB_PATH + type.toString() + "/"
    1.63 +                    + link;
    1.64 +        } else {
    1.65 +            link_to_send = ObjectManagerPaths.WEB_PATH + type.toString() + "/"
    1.66 +                    + link + "#" + target;
    1.67  
    1.68 -        String link_to_send = ObjectManagerPaths.WEB_PATH + type.toString()
    1.69 -                + "/" + link;
    1.70 +        }
    1.71          sendLinkToMiniBrowser(link_to_send);
    1.72      }
    1.73  
    1.74 @@ -654,7 +669,7 @@
    1.75              UserActionOnMathContext uaomc = (UserActionOnMathContext) action;
    1.76              Context context = uaomc.getMathContext();
    1.77              if (!context_on_)
    1.78 -                sendLinkToMiniBrowser(context, context_type_);
    1.79 +                sendLinkToMiniBrowser(context, context_type_, "");
    1.80              else {
    1.81                  sendCheckedContextToBrowser(context);
    1.82              }
    1.83 @@ -718,7 +733,7 @@
    1.84                  new_context = context_provider.initContext(context_type_);
    1.85              sendContextToBrowser(new_context);
    1.86              if (!(new_context instanceof ContextUnknown))
    1.87 -                sendLinkToMiniBrowser(new_context, context_type_);
    1.88 +                sendLinkToMiniBrowser(new_context, context_type_, "");
    1.89          } catch (RemoteException e) {
    1.90              e.printStackTrace();
    1.91          }
    1.92 @@ -839,7 +854,7 @@
    1.93              new_context.setKEStoreKey(context.getKEStoreKey());
    1.94          }
    1.95          sendContextToBrowser(new_context);
    1.96 -        sendLinkToMiniBrowser(context, context_type_);
    1.97 +        sendLinkToMiniBrowser(context, context_type_, "");
    1.98  
    1.99          // test implementation:
   1.100          /*
   1.101 @@ -859,7 +874,7 @@
   1.102          // in derived classes if necessary
   1.103      }
   1.104  
   1.105 -    public ICompod getCompod(){
   1.106 +    public ICompod getCompod() {
   1.107          return compod_;
   1.108      }
   1.109  }
     2.1 --- a/src/java/isac/browserdialog/ExampleDialog.java	Mon Mar 24 17:42:29 2008 +0100
     2.2 +++ b/src/java/isac/browserdialog/ExampleDialog.java	Wed May 14 12:22:45 2008 +0200
     2.3 @@ -167,7 +167,7 @@
     2.4       */
     2.5      public void sendCheckedContextToBrowser(Context context) {
     2.6          sendContextToBrowser(context);
     2.7 -        sendLinkToMiniBrowser(context, context_type_);
     2.8 +        sendLinkToMiniBrowser(context, context_type_, "");
     2.9      }
    2.10  
    2.11      /**
     3.1 --- a/src/java/isac/browserdialog/MethodDialog.java	Mon Mar 24 17:42:29 2008 +0100
     3.2 +++ b/src/java/isac/browserdialog/MethodDialog.java	Wed May 14 12:22:45 2008 +0200
     3.3 @@ -109,7 +109,7 @@
     3.4              new_context.setHierarchyKey(current_context_.getHierarchyKey());
     3.5              new_context.setKEStoreKey(current_context_.getKEStoreKey());
     3.6              sendContextToBrowser(new_context);
     3.7 -            sendLinkToMiniBrowser(new_context, context_type_);
     3.8 +            sendLinkToMiniBrowser(new_context, context_type_, "");
     3.9              return true;
    3.10          }
    3.11          case UI_BROWSER_TO_WORKSHEET: {
     4.1 --- a/src/java/isac/browserdialog/ProblemDialog.java	Mon Mar 24 17:42:29 2008 +0100
     4.2 +++ b/src/java/isac/browserdialog/ProblemDialog.java	Wed May 14 12:22:45 2008 +0200
     4.3 @@ -117,7 +117,7 @@
     4.4              new_context.setHierarchyKey(current_context_.getHierarchyKey());
     4.5              new_context.setKEStoreKey(current_context_.getKEStoreKey());
     4.6              sendContextToBrowser(new_context);
     4.7 -            sendLinkToMiniBrowser(new_context, context_type_);
     4.8 +            sendLinkToMiniBrowser(new_context, context_type_, "");
     4.9              return true;
    4.10          }
    4.11          case UI_PROBLEMBROWSER_REFINE: {
    4.12 @@ -314,7 +314,7 @@
    4.13                  return;
    4.14              refined_context = context_provider.refineContext(current_context_);
    4.15              sendContextToBrowser(refined_context);
    4.16 -            sendLinkToMiniBrowser(refined_context, context_type_);
    4.17 +            sendLinkToMiniBrowser(refined_context, context_type_, "");
    4.18          } catch (RemoteException e) {
    4.19              e.printStackTrace();
    4.20          }
     5.1 --- a/src/java/isac/browserdialog/TheoryDialog.java	Mon Mar 24 17:42:29 2008 +0100
     5.2 +++ b/src/java/isac/browserdialog/TheoryDialog.java	Wed May 14 12:22:45 2008 +0200
     5.3 @@ -110,7 +110,7 @@
     5.4              new_context.setHierarchyKey(current_context_.getHierarchyKey());
     5.5              new_context.setKEStoreKey(current_context_.getKEStoreKey());
     5.6              sendContextToBrowser(new_context);
     5.7 -            sendLinkToMiniBrowser(new_context, context_type_);
     5.8 +            sendLinkToMiniBrowser(new_context, context_type_, "");
     5.9              return true;
    5.10          }
    5.11          case UI_BROWSER_TO_WORKSHEET: {
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/src/java/manifest.mf	Wed May 14 12:22:45 2008 +0200
     6.3 @@ -0,0 +1,5 @@
     6.4 +Manifest-Version: 1.0
     6.5 +Created-By: 1.5.0_06 (Sun Microsystems Inc.)
     6.6 +Main-Class: isac.gui.WindowApplication
     6.7 +Class-Path: log4j-1.2.8.jar
     6.8 +